cli icon indicating copy to clipboard operation
cli copied to clipboard

Npx command to setup default config

Open grizlizli opened this issue 1 year ago • 4 comments
trafficstars

User story

As a developer, I would like to setup the CLI as easy as possible.

Running the command such as npx code-pushup init should create code-pushup.config.[ ts | js | mjs ] file. init command should have arguments for file extension, default ts.

Acceptance criteria

Running the above mentioned command should generate the config file in the project.

Add package create-cli:

  • [x] create create-cli package to enable the npx init @code-pushup/cli command. The init command translates to npm exec @code-pushup/create-cli.
    #779
  • [x] create init script that is able to reuse the nx-plugin logic

Extend nx-plugin

  • [ ] extend the ext to accept a ext options to specify the file extension.
  • [ ] auto detect typescript and take ts if given. otherwise take mjs as extension.

Implementation details

Generate a config file in the root of the project.

grizlizli avatar Jul 10 '24 14:07 grizlizli

@BioPhoton Please finalize the issue for refinement

vmasek avatar Jul 11 '24 12:07 vmasek

As this has quite a decent overlap with the nx generators we could do the following:

  1. npm init @code-pushup/cli -> npm exec @code-pushup/create-cli
  2. create a publishable package create-cli
  3. inside use nx g @code-pushup/nx-plugin:configuration
    1. I have to figure out how to execute the generator without a nx.json prelent.

@matejchalk WDYT?

BioPhoton avatar Jul 23 '24 18:07 BioPhoton

As this has quite a decent overlap with the nx generators we could do the following:

  1. npm init @code-pushup/cli -> npm exec @code-pushup/create-cli
  2. create a publishable package create-cli
  3. inside use nx g @code-pushup/nx-plugin:configuration 2.1. I have to figure out how to execute the generator without a nx.json prelsent.

Yes! Having a create- package would give us compatibility with non-Nx codebases, since this package initializer format is supported by NPM, PNPM and Yarn 1.

matejchalk avatar Jul 24 '24 10:07 matejchalk

Updated issue and started work.

BioPhoton avatar Aug 02 '24 22:08 BioPhoton