skaffolder-cli
TypeScript icon, indicating that this package has built-in type declarations

2.0.16 • Public • Published

npm download total npm version GitHub Workflow Status Build Status

sk-cli animation

Skaffolder-cli

The Skaffolder CLI is a powerful command-line interface (CLI) tool to access and manage a Skaffolder project. You can easily generate, export and add models, APIs and pages to your project.

Table of Contents


Installation

npm install -g skaffolder-cli

Getting started

To create your first Skaffolder project just run sk new, then:

  1. Give a name to your project.
  2. Pick your frontend.
  3. Pick your backend.

And your project is ready!

$ sk new
✔ Insert the name of your project … MyAwesomeProject
Project name:           MyAwesomeProject
✔ Select your frontend language › React Native
✔ Select your backend language › Go
...
✔   Project created offline!

That's it! Now to get the source code simply run sk generate and you are all set.


Commands

Every sk commands takes five global options:

-h, --help                       Display help
-V, --version                    Display version
--no-color                       Disable colors
--quiet                          Quiet mode - only displays warn and error messages
-v, --verbose                    Verbose mode - will also output debug messages

User Commands

Commands to manage your Skaffolder account.

login

Login to your Skaffolder account, a browser window will open to Skaffolder login page. Be sure to be logged in when using project commands with the --online option and when exporting your project.

Still don't have a Skaffolder account? Get yours here, it's free!.

Example:

$ sk login
...
The Skaffolder login will open in your default browser...
 
✔  Login successful with user: admin@example.com
...

logout

Logout from your Skaffolder account.

Example:

$ sk logout
✔ Logout successfully

Project Commands

Used for manage and edit your Skaffolder project. Every project command takes one option:

-o, --online                    Work online on the Skaffolder project, requires sk login

When using the --online option the cli works with project saved on our servers instead of reading your project from the openapi.yaml file. Before using this option, make sure that your project has been exported to Skaffolder.

Create Project

new [project name]

Create a new local Skaffolder project.

Additional options:

-i, --import <file>                Convert an OpenAPI 3.0 file in a Skaffolder project
-f, --frontend <templateName>      Template frontend language
-b, --backend <templateName>       Template backend language
-o, --online                       Create the project locally and exports it to your Skaffolder web interface account

Example:

$ sk new "MyProject" --frontend "React" --backend "NodeJS"
Project name:           MyProject
Frontend template:      React
Backend template:       NodeJS
 
File created: openapi.yaml
...
✔   Project created offline!
 
You can edit the project from the web interface running 'sk export'
You can edit the project from the VSCode extension https://github.com/skaffolder/skaffolder-vscode-extension
You can edit the project from the openapi.yaml file
You can edit the project from the command line:
        Add a model running 'sk add model'
        Add a page running 'sk add page'
        Add an API running 'sk add api'
 
Generate your code running 'sk generate'

open [id project] [id generator]

Open an already existent Skaffolder project. Requires sk login.

$ sk open
✔ Select your project › My_Project
✔ Select your generator › Generator Angular 6 + NodeJS - Sequelize
✔  Generator files imported in ./.skaffolder/template
You can edit your project structure at https://app.skaffolder.com/#!/projects/<project-id>/models or running 'sk web open'

If a Skaffolder project is already present in the folder, the program will ask you if you want to overwrite it.

generate

Generate the source code of your project from the openapi.yaml file.

Additional options:

-o, --online                       Generate the source code of your project from your Skaffolder account datas, it ignores the openapi.yaml

Example:

$ sk generate
File created: client/.dockerignore
File created: client/Dockerfile
File created: client/README.md
...
✔  Generation complete!

Manage Project

add page [page name]

Create a new page in the Skaffolder project.

Additional options:

-o, --online                       Add the page in the Skaffolder account

Example:

$ sk add page MyNewPage
Page name: MyNewPage
File modified: client/src/app/app-routing.module.ts
File created: client/src/app/pages/my-new-page/my-new-page-routing.module.ts
File created: client/src/app/pages/my-new-page/my-new-page.component.css
File created: client/src/app/pages/my-new-page/my-new-page.component.html
File created: client/src/app/pages/my-new-page/my-new-page.component.ts
File created: client/src/app/pages/my-new-page/my-new-page.module.ts
File modified: openapi.yaml
✔  Generation complete!

add model [model name]

Create a new model in the Skaffolder project. After the model will be created the program will ask you if you want to generate CRUD interface for the newly created model.

Additional options:

-o, --online                       Add the model in the Skaffolder account

Example:

$ sk add model "MyNewModel"
Model name: MyNewModel
✔ Do you want to add an attribute to MyNewModel model? … No / Yes
✔ Insert the name of the attribute … MyNewModel_Attribute
✔ Select type of MyNewModel_Attribute attribute › String
✔ Do you want to add another attribute to MyNewModel model? … No / Yes
File created: client/src/api/generated/MyNewModelApiGenerated.js
File created: client/src/api/MyNewModelApi.js
...
✔  Generation complete!
You can edit your Model at https://app.skaffolder.com/#!/projects/undefined/models/undefined
✔ Do you want to generate CRUD interface for 'MyNewModel' model? … No / Yes
File modified: client/src/api/generated/MyNewModelApiGenerated.js
File modified: client/src/components/Navbar.js
...
✔  Generation complete!

add api

Create a new api. You can choose to create a CRUD or a custom API.

Additional options:

-o, --online                       Add the page in the Skaffolder account

Example creating a CRUD delete API:

$ sk add api
✔ Select the model on which you want to create the API › MyNewModel
✔ Select type of your API › delete
You can edit your API at https://app.skaffolder.com/#!/projects/undefined/apis/undefined
File modified: client/src/api/generated/MyNewModelApiGenerated.js
File modified: client/src/redux/actionTypes.js
...
✔  Generation complete!

Example creating a custom API:

$ sk add api
✔ Select the model on which you want to create the API › MyNewModel
✔ Select type of your API › Custom API
✔ Insert the name of your API … myNewCustomApi
API name: myNewCustomApi
✔ Insert the URL of your API. Example: /{id}/action … /{id}/customApi
API name: /{id}/customApi
✔ Select the method of your API › POST
File modified: client/src/api/generated/MyNewModelApiGenerated.js
File modified: client/src/redux/actionTypes.js
...
✔  Generation complete!

Generator Commands

generator init

Initializes a new generator in the .skaffolder/template folder. This command will overwrite your existing local generator.

Example:

$ sk generator init
✔ Select your frontend language › React
✔ Select your backend language › Go
✔  Generator files imported in ./.skaffolder/template
 
Now you can generate your code running 'sk generate'

generator pull

Pulls the remote generator on Skaffolder in the local generator of your project. Any changes to your remote generator on Skaffolder will no be reflected into your local generator.

Example:

$ sk generator pull
✔  Generator files imported in ./.skaffolder/template
You can edit your project structure at http://localhost:3001/#!/projects/<project-id>/models or running 'sk web open'

generator push

Pushes the local generator of your project to the remote generator on Skaffolder. In this way any changes to your generator will be saved.

Pro tip: You can edit your generator directly on Skaffolder: Move to the generators tab, click on Edit Generator and then, on the bottom, click Customize generator template.

generator create

Copy the content of your project folder inside the .skaffolder/template folder. This may be useful when creating new generators.

$ sk generator create
✔ Do you want to overwrite ./.skaffolder/template folder? … No / Yes
✔  Generator files imported in ./.skaffolder/template
Now you can customize template files an generate code with 'sk generate'

generator publish

Share your local generator with Skaffolder community. If you want to learn more on how to become a contributor, click here.

$ sk generator publish --verbose
✔ Do you want to share ./.skaffolder/template folder with the Skaffolder community? … No / Yes
✔  Generator files shared
The Skaffolder team will check this generator and it will be published if quality standards are ok.
We will contact you at your account email

Utility Commands

Useful commands to import/export project and get your configurations.

web open

Open your project on Skaffolder web interface. The project must be exported before calling this command.

set endpoint [endpoint]

Set Skaffolder endpoint for on-premise.

get endpoint

Get Skaffolder endpoint for on-premise.

get user

Get the currently logged Skaffolder user.

Example:

$ sk get user
User: admin@example.com

get project url

Get your project url. The project must be exported before calling this command.

Example:

$ sk get project url
To manage data models, APIs and pages of your project, visit this URL:
https://app.skaffolder.com/#!/projects/<project-id>/models

list frontend

List all available frontend templates.

list backend

List all available backend templates.

import db [schema.xml]

Import your db schema in Skaffolder from a SchemaSpy XML file, here you can find an example. In order to successfully import your database, you need to call this commands from a project already exported on Skaffolder.

Example:

sk import db schema.xml
✔   Db import completed!
You can edit your project structure at https://app.skaffolder.com/#!/projects/<project-id>/models or running 'sk web open'

export

Export your local project to Skaffolder. Requires sk login.

Example:

$ sk export
 
File modified: openapi.yaml
Create project
[CREATE]: 'MyProject' project
[CREATE]: 'MyProject_db' database
...
[CREATE]: 'Home' page
[UPDATE]: 'MyProject' project pages and dbs

help [command]

Display help for a specific command.


Skaffolder documentation

Additional Skaffolder documentation can be found here.

Template location

In your folder workspace, Skaffolder creates a .skaffolder folder. This folder is used by Skaffolder-cli to store the generator's files. Each template file (.hbs extension) follows Handlebar's syntax and is used by Skaffolder when generating the project's source code.


Contributing

Skaffolder-cli is an open-source project. Feel free to propose enhancements suggestions, report bugs and to submit pull requests.

Package Sidebar

Install

npm i skaffolder-cli

Weekly Downloads

29

Version

2.0.16

License

GPLv3

Unpacked Size

378 kB

Total Files

49

Last publish

Collaborators

  • skaffolder