CLI tool for Angular
npm install @speedray/clitype: faq label.
bash
npm install -g @speedray/cli
`
Usage
`bash
sr help
`
$3
`bash
sr new PROJECT_NAME
cd PROJECT_NAME
sr deploy --watch
`
Navigate to http://localhost:8080/. The app will automatically reload if you change any of the source files.
You can configure the default HTTP host and port used by the development server with two command-line options :
`bash
sr deploy --host 127.0.0.1 --port 11311
`
$3
You can use the sr generate (or just sr g) command to generate Angular components:
`bash
sr generate component my-new-component
sr g component my-new-component # using the alias
components support relative path generation
if in the directory src/app/feature/ and you run
sr g component new-cmp
your component will be generated in src/app/feature/new-cmp
but if you were to run
sr g component ../newer-cmp
your component will be generated in src/app/newer-cmp
`
You can find all possible blueprints in the table below:
Scaffold | Usage
--- | ---
Component | ng g component my-new-component
Directive | ng g directive my-new-directive
Pipe | ng g pipe my-new-pipe
Service | ng g service my-new-service
Class | ng g class my-new-class
Guard | ng g guard my-new-guard
Interface | ng g interface my-new-interface
Enum | ng g enum my-new-enum
Module | ng g module my-module
$3
To update Speedray CLI to a new version, you must update both the global package and your project's local package.
Global package:
`bash
npm uninstall -g @speedray/cli
npm cache clean
npm install -g @speedray/cli@latest
`
Local project package:
`bash
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @speedray/cli@latest
npm install
`
You can find more details about changes between versions in CHANGELOG.md.
Development Hints for hacking on Speedray CLI
$3
`bash
git clone https://github.com/ddavis2xtivia/speedray-cli.git
cd speedray-cli
npm link
`
npm link is very similar to npm install -g except that instead of downloading the package
from the repo, the just cloned speedray-cli/ folder becomes the global package.
Any changes to the files in the speedary-cli/ folder will immediately affect the global @speedray/cli package,
allowing you to quickly test any changes you make to the cli project.
Now you can use @speedray/cli via the command line:
`bash
sr new foo
cd foo
npm link @speedray/cli
sr serve
`
npm link @speedray/cli is needed because by default the globally installed @speedray/cli just loads
the local @speedray/cli from the project which was fetched remotely from npm.
npm link @speedray/cli symlinks the global @speedray/cli package to the local @speedray/cli package.
Now the speedray-cli you cloned before is in three places:
The folder you cloned it into, npm's folder where it stores global packages and the Speedray CLI project you just created.
You can also use sr new foo --link-cli to automatically link the @speedray/cli` package.