···14141515## Getting started
16161717-### Creating a new repository
1818-1919-#### GitHub UI
2020-2121-You can create a new repository based on this template by clicking the "Use this template" button in the top-right corner of this page.
2222-2323-#### Terminal
2424-2525-You can run the following command below with the [GitHub CLI](https://cli.github.com/). Some notes:
2626-2727-- Replace placeholder with name of your extension in upper CamelCase
2828-- Configure your repository's visibility with `--public`, `--private`, or `--internal`
2929-3030-```shell
3131-gh repo create {{package}} --public --clone --template neoncitylights/typescript
3232-```
3333-3434-### Cookiecutter stuff
3535-3636-Using your favorite text editor or IDE, find-and-replace the following placeholders:
3737-3838-- `@author/package`: Replace this with the name of your package. This can be scoped under a user/organization (e.g `@samantha/my-really-cool-package`). **Note**: This placeholder is different than the others to avoid warnings from the NPM client.
3939-- `{{author}}`: Replace this with your GitHub/npm username, or the name of your organization.
4040-- `{{package}}`: Replace this with the name of your library.
4141-- `{{desc}}`: Replace this with a short description of your library.
4242-4343-## Publishing a package
4444-4545-if you haven't authenticated with the NPM CLI already, you'll need to do that first by running [`npm adduser`](https://docs.npmjs.com/cli/v9/commands/npm-adduser) in the terminal.
4646-4747-- To publish a non-scoped package (e.g `my-cool-package`), run `npm publish`
4848-- To publish a [scoped package](https://docs.npmjs.com/cli/v9/using-npm/scope) (e.g `@namespace/my-cool-package`), pass the `--access` flag, which must be either `public` or `private`. For example:
1717+### Create a new repository
49181919+Choose a method:
2020+- **GitHub UI**: Press the "Use this template" button in the top-right corner of this page.
2121+- **GitHub CLI**: Install [GitHub CLI](https://cli.github.com). Then run one of the following:
5022 ```shell
5151- npm publish --access public
2323+ gh repo create --template neoncitylights/typescript --public --clone {{package}} # clone as public
2424+ gh repo create --template neoncitylights/typescript --private --clone {{package}} # clone as private
5225 ```
53265454-> [!NOTE]
5555-> To publish a private package on NPM, you must have [npm Pro](https://www.npmjs.com/products/pro).
2727+### Replace placeholders
56285757-### GitHub Actions
2929+Using your text editor or IDE, find-and-replace the following placeholders:
58305959-For your CI environment (when using GitHub Actions), you'll need to set the `NPM_TOKEN` environment variable to the value of your NPM token. You can find this by running `npm token list` in the terminal, and create a token by running `npm token create`.
3131+- `@author/package`: Replace this with the author's name (e.g a user or organization) and package's name.
3232+ - **Note**: This placeholder is different than the others to avoid warnings from the NPM client.
3333+- `{{author}}`: Replace this with the author's name (e.g real name, GitHub username, or organization).
3434+- `{{package}}`: Replace this with the name of the package.
3535+- `{{desc}}`: Replace this with a short description of the package.
60366161-To add your token to your repository:
3737+## Publishing a package
3838+```shell
3939+# Enter the root directory of the package you want to publish
4040+cd packages/pkg1
62416363-1. Go to Settings > Security (Secrets and Variables) > Actions
6464-2. Press "New repository secret" button
6565-3. Enter `NPM_TOKEN` as the name of the secret
6666-4. Copy and paste the token value
6767-5. Press "Add secret" button
4242+# if package is scoped, e.g "hello-world"
4343+npm publish
4444+4545+# if package is non-scoped, e.g "@user123/hello-world",
4646+# can also be published privately via `--access private` (requires npm pro plan)
4747+npm publish --access public
4848+```
68496950## Configure
70517152### NPM scripts
72537373-NPM has core commands that can be overriden by package authors. I've tried to make this as zero-config as possible, so its likely you won't need to change them any further. These commands are:
7474-7575-- [`prepare`](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts)
7676-- [`prepublishOnly`](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts)
7777-7878-These are the most relevant commands that you'll likely use:
7979-8054| Command | Description |
8155| ------- | ----------- |
8256| `npm run build` | Build the library for distributing |
8357| `npm run docs` | Generate documentation |
8458| `npm run docs-watch` | Generate documentation in watch mode|
8559| `npm run clean` | Remove all generated files |
8686-| `npm run reinstall` | Cleans and reinstalls dependencies |
8787-| `npm run lint` | Check for linting errors |
8888-| `npm run lint-fix` | Fix linting errors |
8960| `npm run test` | Run unit tests |
9061| `npm run test-ci` | Run unit tests in CI mode |
9162| `npm run test-ui` | Run unit tests in UI/browser mode |
9263| `npm run test-watch` | Run unit tests in watch mode |
6464+| `npm run lint` | Check for ESLint/publint errors |
6565+| `npm run lint-fix` | Fix ESLint errors (publint errors must be fixed manually) |
6666+| `npm run eslint` | Check for ESLint errors |
6767+| `npm run eslint-fix` | Fix ESLint errors |
6868+| `npm run publint` | Check for NPM packaging errors |
93699470### Developer tools
95719672| Tool | File | Documentation |
9773| ---- | ---- | ------------- |
9874| NPM package | [`package.json`](package.json) | [docs](https://docs.npmjs.com/cli/v10/configuring-npm/package-json), [website](https://docs.npmjs.com/) |
9999-| TypeDoc (documentation generator) | [`package.json`](package.json) (`typedocOptions`) | [docs](https://typedoc.org/options/configuration/), [website](https://typedoc.org/) |
100100-| TypeScript | [`packages/tsconfig.json`](packages/tsconfig.json) | [docs](https://www.typescriptlang.org/tsconfig), [website](https://www.typescriptlang.org/) |
7575+| TypeScript | [`tsconfig.json`](./tsconfig.json), [`packages/*/tsconfig.json`](packages/pkg1/tsconfig.json) | [docs](https://www.typescriptlang.org/tsconfig), [website](https://www.typescriptlang.org/) |
7676+| TypeDoc (documentation generator) | [`tsconfig.json`](tsconfig.json) (`typedocOptions`) | [docs](https://typedoc.org/options/configuration/), [website](https://typedoc.org/) |
10177| ESLint (code formatter + linter) | [`eslint.config.js`](./eslint.config.js) | [docs](https://eslint.org/docs/latest/use/configure/), [website](https://eslint.org/) |
10278| Vite (bundler) | [`vite.config.ts`](packages/pkg1/vite.config.ts) | [docs](https://vitejs.dev/config/), [website](https://vitejs.dev/) |
103103-| Vitest (testing framework) | [`vite.config.ts`](packages/pkg1/vite.config.ts) (`test`) | [docs](https://vitest.dev/config/), [website](https://vitest.dev/) |
7979+| Vitest (testing framework) | [`packages/*/vite.config.ts`](packages/pkg1/vite.config.ts) (`test`) | [docs](https://vitest.dev/config/), [website](https://vitest.dev/) |
10480| Vitest workspace | [`vitest.workspace.ts`](./vitest.workspace.ts) | [docs](https://vitest.dev/guide/workspace.html#workspace) |
10581| Dependabot | [`.github/dependabot.yml`](./.github/dependabot.yml) | [docs](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file), [website](https://github.com/dependabot) |
10682