Frontfy-cli aims to generate a new Frontfy project already configured and with the possibility of creating pages, components and directives.
Prerequisites: Node.js (>=8.x), npm version 3+ and Git.
$ npm i -g frontfy-cli
frontfy <command>
Commands currently available:
The init command is used to create a new, clean and configured Frontfy project.
$ frontfy init
The init method contains some questions after calling:
Question | Description |
---|---|
How would you like to name the project? | This command has a prefix front. and a suffix .com.br. So if the input is "example" the result for this question is front.example.com.br |
What technology do you want to use? | The choices are NodeJS or PHP |
Question | Description |
---|---|
Do you like to create a repository? | The choices are Bitbucket, Github or None. |
Enter with your Client ID/Key: | To authorize the repository creation at Bitbucket we need your OAuth Client ID/Key. See more in the section Configuration - OAuth authentication. |
Enter with your Client Secret: | To authorize the repository creation at Bitbucket we need your OAuth Client Secret. See more in the section Configuration - OAuth authentication. |
Who is the owner of the project? (Only in Bitbucket) | Project owner on Bitbucket. Default is owinteractive the owner of Frontfy. |
Question | Description |
---|---|
Do you like to run the project? | (Y/n) |
The generate command is used to generate a new component, directive or page. This commands only works in the NodeJS project for now.
$ frontfy generate
or
$ frontfy generate <type> <name>
The first example will have some questions, such as what you want to generate and the name of the item being generated. The second example is a syntax sugar for the first. You will already pass the type (component, directive or page) and the name of the item directly.
Run the command below:
$ frontfy generate component Message
When generating a component the same is created inside src/assets/js/components.
Run the command below:
$ frontfy generate directive date-convert
When generating a directive it is created in src/assets/js/directives.
Run the command below:
$ frontfy generate page about
When generating a new page it is created in src/views/site. The page is created using the EJS template. A new route to this page is created and added to the express router. So if you generate a page called "about", you'll already be able to access it in your browser. Example: http://localhost:3301/about.
To authorize the Bitbucket we need your OAuth Client Key and Client Secret. Follow the steps below:
- Go to Bitbucket (https://bitbucket.org);
- Click on your profile picture;
- Click on Bitbucket settings;
- Click on OAuth;
- Click on Add consumer;
- Fill the fields:
- Name: frontfy
- Callback URL: http://localhost:3301/oauth-callback
- Permissions: check repositories options write and admin
- Click on Save to get your key and secret.
To authorize the Github we need your OAuth Client ID and Client Secret. Follow the steps below:
- Go to Github (https://github.com);
- Click on your profile picture;
- Click on Settings;
- Click on Developer Settings;
- Click on Register a new aplication;
- Fill the fields:
- Application name: frontfy
- Homepage URL: http://localhost:3301
- Authorization callback URL: http://localhost:3301/oauth-callback
- Click on Register application to get your key and secret.
See the documentation in Frontfy repository.