generator-autonym v0.2.1
generator-autonym
Generates an app using the Autonym framework.
Installation
First, install Yeoman and generator-autonym using npm (we assume you have pre-installed node.js).
npm install -g yo generator-autonymUsage
New project
Create a new directory for your project and change into it. Then run the generator command.
mkdir my-new-project && cd $_
yo autonymYou will be prompted to enter a name for your project. The name must be a valid name for package.json. You will also be asked which port to listen on and to select your preferred indentation style.
The following files will be generated.
.
├── lib/
│ └── app.js
│ └── handle-error.js
│ └── models/
│ │ └── .gitkeep
│ └── policies/
│ │ └── .gitkeep
│ └── schemas/
│ └── .gitkeep
├── .babelrc
├── package.jsonModels and schemas
You can generate a new model and corresponding schema in an existing Autonym project.
yo autonym:modelYou will be prompted to enter the name of your new model in PascalCase (e.g. Person or DogLover). You will also be asked to select a store implementation (or none to implement the CRUD methods yourself). You may be asked for connection details the first time using a store.
The following files will be generated.
.
├── lib/
│ └── models/
│ │ └── <model-name>.model.js
│ └── schemas/
│ └── <model-name>.schema.json
├── test/
│ └── models/
│ │ └── <model-name>.model.spec.jsIf you select a store that is not already installed, it will be installed and added to package.json. It may also add an environment variable to your scripts in package.json and you will be prompted to overwrite.
Policies
You can generate a new policy in an existing Autonym project.
yo autonym:policyYou will be prompted to enter the name of your new policy in camelCase (e.g. isLoggedIn).
The following files will be generated.
.
├── lib/
│ └── policies/
│ └── <policy-name>.policy.js
├── test/
│ └── policies/
│ └── <policy-name>.policy.test.js