Alfred
Alfred is a command line tool, a suite of helper commands for react developers
Installation
Install globally and use anywhere :
npm i alfredjs -g
or
Install locally to your project and use from npm scripts :
npm i alfredjs
Add an npm script in your package.json
"scripts":{"alfredjs":"alfredjs"}
Usage
Run globally installed alfredjs in project folder :
$ cd my-project
$ alfred
Configuration
You can configure alfred in 3 ways :
- Pass a configuration path
- Use a configuration file
.alfredrc
- Zero configuration with default config
Pass configuration
Run alfred with alfred --config <CONFIG_PATH>
to pass a configuration file path. You can use this if you don't want your alfred configuration in your version control.
Configuration file
Alfred will use .alfredrc
in the root folder, which command is executed in, by default. If there is no .alfredrc
file then alfred falls back to it's default configuration options. You can show default alfred configuration by running show:config
after running alfred.
You can also create a premade .alfredrc
by running init
command in alfred.
Default config
Default alfred config is : (beware this might not be up to date with source code lib/Utils.js
)
{
dirs: {
component: 'src/javascript/components',
reducer: 'src/javascript/reducers',
action: 'src/javascript/actions',
shared: 'src/javascript/shared',
view: 'src/javascript/views',
root: '.alfred',
}
}
Commands
Commands:
help [command...] Provides help for a given command.
exit Exits application.
new:component <name> [reduxEnabled] Creates a new component
new:components <names...> Creates multiple components at once without redux
new:view <name> [reduxEnabled] Creates a new view
new:action <actionCreatorName> <name> Creates a new action creator
create:routes Creates a simple react-router-dom entry in root folder
create:store Creates a redux store in root folder
show:config Shows current config options
init Creates an .alfredrc file with all the defaults
Environment Variables
$ALFRED_VERBOSE
: If environment variables is set, alfred stouts processes as they happen
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
TODO: Write history
Credits
TODO: Write credits
License