diff --git a/.changeset/tiny-garlics-argue.md b/.changeset/tiny-garlics-argue.md new file mode 100644 index 000000000..4a11690db --- /dev/null +++ b/.changeset/tiny-garlics-argue.md @@ -0,0 +1,14 @@ +--- +'preact-cli': major +'create-preact-cli': major +--- + +Extracts project creation functionality from `preact-cli` into `create-preact-cli` + +Setting up new `preact-cli` projects with `npx` is slow, as all dependencies of `preact-cli` would need to be installed, even though only a handful are used for project initialization. On the other hand, suggesting global installs is less than attractive due to NPM's poor default install location (requires `sudo`) and this can get out of sync over time. + +By extracting project initialization into its own package, we can provide much, much faster project setup times. + +To setup a new project, users will use `npm init preact-cli ...` or `yarn create preact-cli ...`. + +Additionally, the `--yarn` flag has been removed in favour of using the yarn initializer (`yarn create`). diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5bd7679e..c1099dafb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 strategy: matrix: - node-version: [12.x, 14.x] + node-version: [14.x, 16.x] steps: - uses: actions/checkout@v2 with: diff --git a/README.md b/README.md index a33f96eef..457b89e21 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,15 @@ ### Usage ```sh -$ npx preact-cli create +$ npm init preact-cli + +$ yarn create preact-cli ``` Example: ```sh -$ npx preact-cli create default my-project +$ npm init preact-cli default my-project ``` The above command pulls the template from [preactjs-templates/default], prompts for some information, and generates the project at `./my-project/`. @@ -65,7 +67,7 @@ The above command pulls the template from [preactjs-templates/default], prompts The purpose of official preact project templates are to provide opinionated development tooling setups so that users can get started with actual app code as fast as possible. However, these templates are un-opinionated in terms of how you structure your app code and what libraries you use in addition to preact.js. -All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `npx preact-cli create ` to use that template. +All official project templates are repos in the [preactjs-templates organization]. When a new template is added to the organization, you will be able to run `npm init preact-cli ` to use that template. Current available templates include: @@ -81,27 +83,32 @@ Current available templates include: - [widget-typescript] - Widget template implemented in TypeScript -> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`npx preact-cli create / ` +> 💁 Tip: Any Github repo with a `'template'` folder can be used as a custom template:
`npm init preact-cli / ` ### CLI Options +#### preact list + +Lists all the official preactjs-cli repositories + +```sh +$ [npm init / yarn create] preact-cli list +``` + #### preact create Create a project to quick start development. ``` -$ npx preact-cli create +$ [npm init / yarn create] preact-cli --name The application name. --cwd A directory to use instead of $PWD. --force Force option to create the directory for the new app [boolean] [default: false] - --yarn Installs dependencies with yarn. [boolean] [default: false] --git Initialize version control using git. [boolean] [default: false] --install Installs dependencies. [boolean] [default: true] ``` -Note: If you don't specify enough data to the `npx preact-cli create` command, it will prompt the required questions. - #### preact build Create a production build @@ -109,7 +116,7 @@ Create a production build You can disable `default: true` flags by prefixing them with `--no-