How to import existing node.js module into Intellij IDEA? - node.js

I have an existing Node.js codebase, forked from GitHub. Now I want to import it to the Intellij IDEA 13 (ultimate version, which supports Node.js). When I simply try to import the project from the root folder of my existing code, IDEA doesn't add the 'lib' folder, where all the sources are. It should be simple, but I cannot figure it out. Any hints?

Well, I've figured out a workaround, but not sure if it's the best solution. One can just create a new project of type "Web", and point it to the directory containing the module's sources. Then IDEA understands the whole structure, and you can create run configurations with Node.js.
In order to get additional Node features, like Intellisense for standard Node APIs, you'll still want to configure the project to be a Node project:
Open the Preferences window
Click Languages & Frameworks → Node.js and NPM
In the section Coding Assistance you'll see if Node.js Core library is [not] enabled. If it is enabled, there's nothing more to do. If not click the Enable button
Leave For the whole project checked, and click Configure
The text should now change to Node.js Core library is enabled.

Another workaround:
If you have a version controlled Node app with no local changes, you could also create a new project of type "Node.js and NPM", point that to the directory. Then just use any standard settings.
After the project is created, you can just revert the files overwritten by IDEA (e.g. app.js and package.json), delete any new directories and files, and you will get the additional Node features in your project.

Intellij 15 Professional Edition:
Import a new project -> Select the base folder of the project -> choose import form existing source.
When Intellij is done it wont look correct so do the following:
1) Project Structure CMD + ;
2) Go to Modules
3) Add a new module and select Node/Npm (if you dont have it then add a new plugin)
4) Point the source of the project to the base folder and click apply.

Related

Template Flutter Project

I am using AndroidStudio whenever I create projects, I always have to add dependencies, create BaseClass,etc... Very boring process. So, how can I make a template Flutter Project in AndroidStudio
You can create a template for Dart files doing the following:
File -> New -> Edit File Templates... -> Dart File
Though I think that's not exactly what you want, the easiest way I know would be having a base project and just replacing the files with a copy of that when you create a new project.
EDIT: Just found this article, maybe it can be helpful: https://medium.com/flutter-community/flutter-changing-the-default-app-template-f3448386139f
If you want to create a flutter app template then, you can run flutter create command in
'./{your-flutter-install}/packages/flutter-tools/templates/app/' location.
Or if you want a full-fledged template with numerous modern and intuitive UI screens and functionalities, you can check out lots of flutter templates out there in the market.

Setting up a modular project in Android Studio

I'm coming from the Visual Studio world of solutions, where each solution can consist of multiple projects that can refer to each other.
What I want to do is create a modular Android project in Android Studio such that all my code doesn't live in one huge app project. However, it seems terribly difficult to do this, so much so that I am sure I am doing something wrong.
I created a blank project called MyProject. This creates a project with the name MyProject and a package com.sohum.myproject. There is a single app project contained within containing no source files.
I now want to add another module under the same namespace (e.g. com.sohum.myproject.library1). However, it seems when I try to add a new module via the menu, I can only do so into a com.sohum.library1 project. How do I get it to use the same package as the project?
My end goal is to have all my modules under the com.sohum.myproject package, referencing each other. For example:
com.sohum.myproject.application will be the entry point. It might depend on com.sohum.myproject.library1 and com.sohum.myproject.someotherlibrary. And I would like to see all of these modules when I open the MyProject file.
You can click File > New > New Module. Then choose Android Library and enter the details.
Reference: https://developer.android.com/studio/projects/android-library
Another way is to set up the project in a subpackage when creating it.
For example, create a project MyProject in a root directory. Call the application Application and rename the package to be com.sohum.myproject.app instead of just com.sohum.myproject. Now any new modules created will be added below the com.sohum.myproject package space.

Gradle - Intellij modules workspace

Is there a way to have different modules in Intellij depends on my current working environment?
E.g.
Workspace:
Module A - Android App
Module B - Android Lib
Module C - Acceptance Tests
Module D - Feature Tests
Module E - Android Test App for libs
Configuration 1 - working on app and lib
Module A
Module B
Configuration 2 - working on tester app
Module A
Module B
Module E
Configuration 3 - tests
all modules
I'm using gradle building tool and I store my modules in settings.gradle.
I would be appreciate to be able to manipulate the list of modules in settings.gradle file from the Intellij however it could be some better way for it.
The only way (that I know of) to do this to create new blank IntelliJ projects for each configuration and then import the modules in which you are interested into each project.
EDIT: A second way that might work for you is to use the favourites. Open up the favourites windows and add 3 new favourites lists, one for each set up. Then go to a module in the project view and select "add to favourites" and select the relevant list. Repeat this for each module and list.
Again it's not quite what you want but might be good enough.
After few days looking into different solutions I finally found the way how to achieve it.
There is an option in Gradle project tool than gives you the opportunity to exclude not required modules. Select Project Data To Import lets you do the magic in IntelliJ.

WebStorm node configure balloon

I am using WebStorm for a Node.js project, and I keep getting a warning balloon which is rather annoying, and I can't remove.
I have tried various things to remove, but have not been successful. What I have tried :
Files-> Settings-> Notifications -> I have disabled balloon notifications.
Files -> Settings -> Languages & Frameworks -> Node.js and NPM
The configuration of the node modules does not work here either.
Anyone know how to remove the balloon?
Just guessing, but it might be easier just to configure Node.js sources and add the libraries.
For Webstorm 9+:
Try selecting the 'Download from Internet' option instead Or determine what your source root directory should be (The default here is not correct for you).
Then, one or more of the following:
A. Right-Click in the editor panel > Use Javascript Library > Node.js
Globals
B. Repeat A, but select Node.js Core Modules

Which project file element specifies a WinRT class library project and not .NET?

I have a WPF class library that I want to port to be a WinRT class library. My plan is to copy the project, edit the project file so that it's a WinRT project instead of WPF, and see where I stand.
However, I cannot find which element in the project file makes it a WinRT project, and not .NET. Any ideas?
I've tried everything including diffing the project file with a WinRT class library project file, and slowly changing it over, but the WPF project never switches to WinRT in VS's eyes.
Sorry if this sounds nuts, I'm looking for the quickest way to find out how much work I need to do to port across.
Thanks
I'd take a different approach to that:
First I'd create a new Windows Store apps class library project.
Then I'd copy all the files from the existing WPF class library folder to the new Windows Store apps class library project folder (without overwriting any of existing files)
In the Solution Explorer window I'd enable Show All Files to see all the copied files and folders.
I'd multi select all the items in the treeview that belong to the project and click on Include In Project from the context menu.
At this point the only thing potentially still missing would be settings at the project level such as conditional compilation symbols and missing references which could easily be added by comparing both projects in Visual Studio or just trying to compile the new projects and seeing what goes wrong.

Resources