Skip to content

Commit cde2cba

Browse files
feat(learn/typescript): polish, wordsmith, and add caveat (#7479)
1 parent d2661f5 commit cde2cba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

apps/site/pages/en/learn/typescript/publishing-a-ts-package.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Some important things to note:
2626

2727
- Use [dependabot](https://docs.github.com/en/code-security/dependabot) to keep your dependencies current, including those in github actions. It's a very easy set-and-forget configuration.
2828

29-
- `.nvmrc` comes from [NVM](https://github.com/nvm-sh/nvm), a multi-version manager for node. It allows you to specify the version of node the project should generally use.
29+
- `.nvmrc` comes from [`nvm`](https://github.com/nvm-sh/nvm), a multi-version manager for node. It allows you to specify the version of node the project should generally use.
3030

3131
A directory overview of a repository would look something like:
3232

@@ -136,7 +136,7 @@ const bar: number = 1 + foo;
136136

137137
TypeScript has warned that the above code will not behave as intended, just like a unit test warns that code does not behave as intended. They are complementary and verify different things—you should have both.
138138

139-
Your editor (ex VS Code) likely has built-in support for TypeScript, displaying errors as you work. If not, and/or you missed those, CI will have your back.
139+
Your editor (eg VS Code) likely has built-in support for TypeScript, displaying errors as you work. If not, and/or you missed those, CI will have your back.
140140

141141
The following [GitHub Action](https://github.com/features/actions) sets up a CI task to automatically check (and require) types pass inspection for a PR into the `main` branch.
142142

@@ -265,14 +265,14 @@ Type declarations (`.d.ts` and friends) provide type information as a sidecar fi
265265

266266
Since these are generated based on source code, they can be built as part of your publication process and do not need to be checked into your repository.
267267

268-
Take the following example, where the type declarations are generated just before publishing to the NPM registry.
268+
Take the following example, where the type declarations are generated just before publishing to the npm registry.
269269

270270
```yaml displayName=".github/workflows/publish.yml"
271271
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
272272

273273
# This is mostly boilerplate.
274274

275-
name: Publish to NPM
275+
name: Publish to npm
276276
on:
277277
push:
278278
tags:
@@ -292,7 +292,7 @@ jobs:
292292
registry-url: 'https://registry.npmjs.org'
293293
- run: npm ci
294294

295-
# - name: Publish to NPM
295+
# - name: Publish to npm
296296
# run: … npm publish …
297297
```
298298

@@ -329,4 +329,4 @@ Generating type declarations is deterministic: you'll get the same output from t
329329

330330
[`npm publish`](https://docs.npmjs.com/cli/commands/npm-publish) grabs everything applicable and available at the moment the command is run; so generating type declarations immediately before means those are available and will get picked up.
331331

332-
By default, `npm publish` grabs (almost) everything (see [Files included in package](https://docs.npmjs.com/cli/commands/npm-publish#files-included-in-package)). In order to keep your published package minimal (see the "Heaviest Objects in the Universe" meme about `node_modules`), you want to exclude certain files (like tests and test fixtures) from from packaging. Add these to the opt-out list specified in [`.npmignore`](https://docs.npmjs.com/cli/using-npm/developers#keeping-files-out-of-your-package); ensure the `!*.d.ts` exception is listed, or the generated type declartions will not be published! Alternatively, you can use [package.json "files"](https://docs.npmjs.com/cli/configuring-npm/package-json#files) to create an opt-in list.
332+
By default, `npm publish` grabs (almost) everything (see [Files included in package](https://docs.npmjs.com/cli/commands/npm-publish#files-included-in-package)). In order to keep your published package minimal (see the "Heaviest Objects in the Universe" meme about `node_modules`), you want to exclude certain files (like tests and test fixtures) from from packaging. Add these to the opt-out list specified in [`.npmignore`](https://docs.npmjs.com/cli/using-npm/developers#keeping-files-out-of-your-package); ensure the `!*.d.ts` exception is listed, or the generated type declartions will not be published! Alternatively, you can use [package.json "files"](https://docs.npmjs.com/cli/configuring-npm/package-json#files) to create an opt-in (if a mistake is made accidentally omitting a file, your package may be broken for downstream users, so this is a less safe option).

0 commit comments

Comments
 (0)