I'm new to Ember.js and I'm use to just typing in rails project33. But, when I want to start a new Ember project I'm going:
mkdir project43 && cd project43
npm install -g generator-ember
yo ember
This brings up all the boilerplate code in my folder which is fine, but is there not a more simple way to jumping into creating a new application? And does Ember REALLY need all this boiler code? It seems...excessive.
You are starting a new project and you are using Yeoman so what you are doing is specific to the tool that you are using. So with Yeoman you have to make a directory then cd into it and run yo ember. Having to do npm install -g generator-ember (which you do once to install node package globally) is to install the generators for ember that Yeoman needs for you to run commands like yo ember from the command line for use with Yeoman with Ember.
Now if you were to use a tool called ember-cli http://iamstef.net/ember-cli/ creating a new project would be a little different you have two options. One is just running ember new <appname> from the command line that will create a new folder with whatever name you used for the 'appname'. The second way with ember-cli is similar to Yeoman where you would make a new directory, cd into that directory and run ember initfrom the command line.
Both Yeoman and ember-cli install files and setup a folder structure for you. I believe these files and folders are what you are calling boilerplate. When you look into your rails project you will see alot of boilerplate if you will but its there for a reason. All of this boilerplate is helping you and assisting you in not having to setup things like a build solution, installing dependencies, testing solutions, css compilation etc. Ember-cli and Yeoman are built differently under the hood and implement different things but essentially set out to solve the same thing, tooling for building client-side apps.
If you just making a quick app you can do something similar to http://emberjs.com/guides/getting-started/ however once you app starts to grow having a clear separation of files and a application structure will be of benefit.
Hope this helps, hope you have fun learning ember.
Related
Potential similar question here.
I'd like to build a simple in-browser app that can run without an internet connection.
To develop a Python project, this isn't even a question. You just pip install whatever in your favorite virtual env and run offline all day. Your dependency list is also managed for you locally.
While building a toy project with npm, I can't figure out how to do the above. Parcel seems like a good tool to build, bundle, minify, etc. But in the end, all dependencies still point to a CDN. I understand this is default behavior, but there seems no way to easily pull all dependencies local and run offline.
Not a web dev so if I'm asking the wrong question, that sort of insight is appreciated also.
Edit: I've already built all the functionality I need. I can run successfully from file:// or a simple http server. What I'm trying to do in consolidate all the dependencies locally so as to not depend on a CDN at runtime. It'd be better to not go to each CDN/GitHub repo, manually download JS/CSS dependencies, and then manually link to them from my code. That's the point of using a bundler or similar. Is Electron or another framework really the best way to do this? For my use that feels like a lot of overhead.
You can use npm to install and maintain your dependencies. Lets say you are create your project from start. You will need to do the following steps. Assuming you have npm installed.
mkdir my-project //create project directory
cd my-project // cd into project direcotry
npm init // init npm project inside the directory.
After this you can install javascript packages using npm i package-name
I'm trying to build an application that have to run on Windows(PC), Android and iOS.
For this, I will use Electron (for Windows) and React Native (for mobile plateforms). Both will be built with React and Redux. This way, I will be able to implement the logic in Redux reducers and middlewares and use them in both projects.
From now, I have done a POC for the Electron app using webpack. The reducers are currently directly in the app code. I want to extract the Redux relative code in a seperate package to allow me using it in a the React Native project.
I can make an npm package for my Redux module containing the reducers and the middlwares but this way, when I will compile my application, webpack will not compile my seperate package, it will use the precompiled version.
So What I want is to be able to make a separate package but still compile it at application compile time (because it is still in developpement and the dev is very closely related to main application dev).
Do I have to do it only with npm or with webpack as well ?
I'm pretty new to the Javascript dev stack.
I think you have different ways to handle that problem.
You can use NPM package. But in code of package, you will store not only original source code, but compiled code too. I mean before publish that package, you'll need to compile it in normal ES5 code.
I think you can use submodule system provided by Git. You should have separate repository with common code of your reducers. And in each project (Electron, RN, etc.), you will have a directory with git submodule. Webpack should compile code in that directory normally without any problems.
UPD:
About submodules you can read nice article here: https://git-scm.com/book/en/v2/Git-Tools-Submodules#Starting-with-Submodules
In few words, in project it will looks like:
cd yourProjectFolder
git submodule add https://github.com/TalAter/awesome-service-workers submoduleDirectoryName
It will clone repository to your project, and create .gitmodules file. Code from submodule will not exists in current project repository. In remote repository it will contain only link to submodule, but on your machine, you will have full code and you will be able to compile it.
I'm having some issues deploying my first Aurelia app using the 'gulp' process outlined in the Aurelia documentation here. I started developing it using the Aurelia provided ES 2016 Kit. After installing aurelia-bundler and gulp through npm and creating the bundle.js file, gulp states that no gulpfile was found when running the 'gulp bundle' command.
I tried renaming bundle.js to gulpfile.js. It then threw errors about unable to find an injectionConfigPath (which is talked about further down under Bundling a JSPM v0.17 App).
Do I need to follow the 0.17 process and instead name bundle.js => gulpfile.js against the documentation? Or do I have something setup wrong?
The bundling documentation assumes you are working from the skeleton as your base. Specifically skeleton-esnext or skeleton-typescript. If you download the latest release of the skeletons you can use one of those two skeletons as the starting point for your app, or you can try using one of the webpack skeletons (and thus learning Webpack).
You should be able to transition quite quickly, just delete the src folder in the skeleton you're going to use, and replace it with the src folder from your app. You'll also need to copy any dependencies, whether npm or (more likely) jspm from your existing app to the skeleton. You can then run npm install and jspm install then gulp bundle.
The kit you download on the Getting Started page is positioned to serve simply as a tool to help you work your way through the Getting Started guide without having to futz around with the crazy, mixed-up world that is Modern JavaScript tooling. It doesn't provide the full suite of tooling that our skeletons offer, or that our CLI will (very soon).
Quick edit: Downloading the skeletons and working from them is mentioned in "A Production Setup."
I'm new to node.js and just went through basic tutorials and now ready to set my project with Express.js installed as well.
I'm just wondering what happens if I change my project name to something else now that I've got the framework in place. Can I simply just rename the project directory or do I need some npm package to refactor it properly?
With Ruby on Rails, there is a gem for this purpose and wonder if it's the same for node.js project.
Can I simply just rename the project directory?
Yes.
Express is just a library.
Express-generator (which proviedes "express" command line) is a tool (not actually a framework) to easily build a basic project layout with express, jade and a few other common packages.
Out of the box you can run it by executing ./bin/www (or node bin/www).
Until now, project name doesn't care so far except for if you put it in some template, database register, etc...
Sure you will use some version control system (vcs) like git or subversion and, if you don't want to publish it as npm module, you doesn't need nothing more.
But, even if you doesn't plan to publish it at npm, it is a wonderful tool to manage your project packaging.
If you did it, (by executing "npm init"), then you can take advantadge of some facilities like:
Launch your project with 'npm start'.
Install modules with 'npm --save module_name'.
DON'T track node_modules directory in your vcs.
Get fresh node_modules directory for your current node version with 'npm install'
etc...
All this magic is thanks to a file named 'package.json'.
This file was generated when you did (if you did it) 'npm init' and contains a package name and a version number.
If you doesn't plan to publish your package it also doesn't care so much. But it is a bit more polite to update it accordingly if you rename your project.
I'm having an Ionic project which I need to keep in github. When you start an Ionic project it auto generates a lot of library files. Do I need to keep all those library files while pushing the project to the github repo ? Is there something similar to maven available for Ionic projects which I can make use of ?
In JavaScript projects, we tend to use npm or bower. npm is the main one used these days (certainly has the largest ecosystem) and is also the one I mainly use, but bower certainly has quite a few front-end orientated modules that you can use.
npm comes packaged with NodeJS automatically; bower will require NodeJS to function as well, but is installed separately.