Create frontity project in current folder

Related to this → Frontity CLI - Create command

Description

There’s no clear option to create a Frontity project in the CURRENT folder

If you do npx frontity create it asks for the project name but it creates a folder
I think that the expected behavior of frontity create is:

  • npx frontity create → aks for the projectName and creates the project in the currrent folder
  • npx frontity create . → aks for the projectName and creates the project in the currrent folder
  • npx frontity create my-project-name → creates a folder named my-project-name and then creates inside the frontity project

@juanma to add more context, could you please also add to your description your thoughts about the current way to do this with --use-cwd and why you think it needs to be changed?

I think the current way to create a frontity project in the current folder: npx frontity create whatever-frontity-project --use-cwd, is not intuitive enough.

I think the expected behaviour is the one I described above, as is the behaviour that very related CLI like create-react-app or gatsby have (and I’m pretty sure that most of them but we could do some research about that)

Also, this --use-cwd flag is not explained when you do npx frontity --help

⬢  bootstrap-theme-v1  master ⦾ npx frontity --help
Usage: frontity <command> [options]

Frontity CLI

Options:
  -V, --version                    output the version number
  -h, --help                       output usage information

Commands:
  create [options] [name]          Creates a new Frontity project.
  create-package [options] [name]  Creates a new Frontity package in a project.
  dev [options]                    Starts a server in development mode.
  build [options]                  Builds the project for production.
  serve [options]                  Starts a server in production mode.
  subscribe [email]                Subscribe to Frontity newsletter.
  info                             Get environment information for debugging and issue reporting.

Thanks for the additional information @juanma :slight_smile:

The options of the commands only appear when you indicate the command before the --help:

% npx frontity create --help

Usage: create [options] [name]

Creates a new Frontity project.

Options:
  -h, --theme <theme>  The theme to use
  -t, --typescript     Adds support for TypeScript
  -c, --use-cwd        Generates the project in the current directory.
  -n, --no-prompt      Skips prompting the user for options
  -h, --help           output usage information 

I think that is correct, right?

1 Like

Yes, it looks fine @luisherranz But I think it would be better if all these options (for each command) are also displayed in the general help.

From a developer point of view I would expect:

  • npx frontity create --help → only displays help for this frontity command because I need info for this specific command that I already know it exists
  • npx frontity --help → should give a general overview of what can be done from frontity’s cli (because I dont know any commands or options)

is this possible? Would there there be too many options to be displayed when npx frontity --help ?

Also… is this documented somewhere? This frontity commands and options should also be in the official documentation

I don’t know :slight_smile:

We are using commander in case you want to check if such option exists.

I can’t find it in the docs. I don’t think there are more places with documentation than the docs. Are there? (cc: @SantosGuillamot)

EDIT: From a quick look at the old documentation roadmap spreadsheet I see that all the CLI commands were in the roadmap, so I guess they are not documented yet apart from the CLI --help command.

1 Like