From 680f704cc8ffc76614f7e57a048e9b4b4c5df0fb Mon Sep 17 00:00:00 2001 From: Jeroen de Bruijn Date: Wed, 25 Oct 2023 22:13:07 +0200 Subject: [PATCH] fix: add `create-project` binary to be able to execute the CLI --- README.md | 10 ++++++++-- package.json | 3 +++ src/content/package.test.ts | 3 +++ src/content/package.ts | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 276dd9b..8570d37 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Interactively create a project. [![npm version](https://img.shields.io/npm/v/@vidavidorra/create-project?logo=npm&style=flat-square)](https://www.npmjs.com/package/@vidavidorra/create-project) [![npm downloads](https://img.shields.io/npm/dm/@vidavidorra/create-project?logo=npm&style=flat-square)](https://www.npmjs.com/package/@vidavidorra/create-project) -[![Node.js version support](https://img.shields.io/node/v/@vidavidorracreate-project?logo=node.js&style=flat-square)](https://nodejs.org/en/about/releases/) +[![Node.js version support](https://img.shields.io/node/v/@vidavidorra/create-project?logo=node.js&style=flat-square)](https://nodejs.org/en/about/releases/) [![Renovate enabled](https://img.shields.io/badge/Renovate-enabled-brightgreen?logo=renovatebot&logoColor&style=flat-square)](https://renovatebot.com) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079?style=flat-square)](https://github.com/semantic-release/semantic-release) [![Code coverage](https://img.shields.io/codecov/c/github/vidavidorra/create-project?logo=codecov&style=flat-square)](https://codecov.io/gh/vidavidorra/create-project) @@ -32,7 +32,13 @@ npm install --global @vidavidorra/create-project Start the interactive CLI to create a project. ```shell -@vidavidorra/create-project +create-project +``` + +Or run the interactive CLI directly via `npx`. + +```shell +npx @vidavidorra/create-project ``` ## Contributing diff --git a/package.json b/package.json index fe4e940..bd5cd58 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,9 @@ "author": "Jeroen de Bruijn", "type": "module", "exports": "./dist/index.js", + "bin": { + "create-project": "./dist/cli.js" + }, "files": [ "./dist/**/!(*.test).{js,d.ts,cjs}", "./.github/", diff --git a/src/content/package.test.ts b/src/content/package.test.ts index bbf4f2c..091f3a4 100644 --- a/src/content/package.test.ts +++ b/src/content/package.test.ts @@ -21,6 +21,9 @@ test(sets, 'name', options.package, '"package" option'); test(sets, 'version', '0.1.0', '"0.1.0"'); test(sets, 'description', options.description, '"description" option'); test(sets, 'author', options.author, '"author" option'); +test('does not include "bin"', (t) => { + t.is(packageJson().bin, undefined); +}); test('does not include "dependencies"', (t) => { t.is(packageJson().dependencies, undefined); }); diff --git a/src/content/package.ts b/src/content/package.ts index b66c3a8..637d76b 100644 --- a/src/content/package.ts +++ b/src/content/package.ts @@ -25,6 +25,7 @@ const schema = z author: z.string().min(1), type: z.literal('module'), exports: z.string().min(1).optional(), + bin: z.record(z.unknown()).optional(), files: z .tuple([z.literal('./dist/**/!(*.test).{js,d.ts,cjs}')]) .rest(z.string().min(1)) @@ -83,6 +84,7 @@ class Package extends File { ...this._package.devDependencies, ...this._package.dependencies, }; + delete this._package.bin; delete this._package.dependencies; if (this._options.public) { delete this._package.private;