mkdir my-project && cd my-project
npm init
npm install @magnolia/cli @magnolia/jumpstart --save
- this will make dependencies scripts (those declared in the bin section) available to the client module (see bin part at https://docs.npmjs.com/files/package.json)
- edit
package.json
and add a scripts section, e.g.
"scripts": {
"setup-magnolia": "setup-magnolia",
"add-page": "add-page",
"add-component": "add-component"
}
- run
npm run setup-magnolia
- will download Magnolia, prepare it for light development and start it up
- create pages and stuff, e.g
npm run add-page home
- if dependencies are installed globally e.g.
npm install @magnolia/cli -g
then one can run commands like shell scripts e.g.add-page home
without thenpm run
bit - there may be drawbacks to this approach having to do with update dependencies and possibly overwriting of existing global commands
Pro:
- apparently this is considered best NPM practice when having command line tool modules, i.e. client module uses the scripts they provide by declaring them in its own package.json http://blog.npmjs.org/post/118810260230/building-a-simple-command-line-tool-with-npm
Contra:
- one needs to setup
package.json
manually and adds the needed bits, unless we can automate this with somepostinstall
script magic
This is the approach used lately by Tomas and which seems the simplest and most promising Video
mkdir my-project && cd my-project
npm install @magnolia/cli
cd cli && npm install
- this will prepare the cli module, for instance replace
package.json
- edit
package.json
if necessary - run
npm start
- this will download tomcat bundle and prepare it for light dev
- run commands to create pages and other stuff
Pro:
- works and it's pretty much done, polishing apart. It also includes the download Magnolia part which would basically make jumpstart module redunant
Contra:
- need to run
npm install
twice, once to install the cli module proper, then from the cli folder itself to complete the installation - does not look like the "recommended" way to use npm modules providing commands