Potential Supported Commands

Here we’re going to list the possible commands you can run with frontity.

create

This command would be similar to the gatsby new my-site command or the create-react-app my-app one and would allow you to create a new app or package for the frontity framework.

If we use some kind of npm initializers the create command could turn into two different packages named create-frontity-app and create-frontity-package respectively.

When running this command, the console would prompt users for the project name, site URL and other settings related.

dev

This one would start the app or package in a local web server in development mode. This mode should let developers preview changes in real time, it should accept parameters like the server port, if it is in AMP mode, etc.

Examples of the syntax used by other frameworks:

  • gatsby develop
  • npm start (for create-react-app)
  • next (for next.js).

build

With this command, you could generate the production-ready version of your app, depending on what type of integration you want to use.

Examples of the syntax used by other frameworks:

  • gatsby build
  • npm run build (for create-react-app)
  • next build (for next.js).

serve

This would serve the app built with the previous command.

Examples of the syntax used by other frameworks:

  • gatsby serve
  • next start

export

This one lets you generate a static HTML version of your site as the same way Gatsby or Next.js do.
The Next framework uses the next export command.

publish

This command let developers publish packages for frontity to NPM. It could check that frontity-specific keywords are set correctly, for example.

dashboard

This one would open the frontity dashboard, a tool where developers would find everything they need to develop with frontity: documentation, guides, forum, dev tools, one-click package installation, etc.

Thanks @David!

We can also use frontity create-app or frontity create-package.

Perfect, we should do a list of parameters as well.

I love the idea!

This is my proposal:

npx frontity create

This command creates a new app. It asks the user for:

  • App name (for package.json)
  • Minimum packages (starter theme, extensions…)
  • Minimum settings (like the WP url…)

The goal is that after running this command the user can start the app and it works.

It populates the package.json scripts with:

{
  "scripts": {
    "dev": "frontity dev",
    "build": "frontity build",
    "serve": "frontity serve"
  }
}

:x: Not needed for the alpha

npm run dev

Starts the app in dev mode with HMR and so on.

In the future, it’ll also start the Frontity Admin.

:white_check_mark: Needed for the alpha.

npm run build

It triggers the build of both server and client bundles in production mode.

The server bundle is ready for serverless: exports a (req, res) => {} function.

:question: Not needed for the alpha but good to have

npm run serve

It takes the server bundle and serves it as a Node app. It also serves the client bundle files.

:question: Not needed for the alpha but good to have


Other command lines not needed for the alpha or v1.0

  • npx frontity new-package
  • npx frontity publish
  • npx frontity export
  • npx frontity dashboard/admin (this may not even exist at all)