Skip to content

Commit

Permalink
Format all mdx content with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Oct 23, 2023
1 parent e94015c commit c62df53
Show file tree
Hide file tree
Showing 169 changed files with 1,400 additions and 2,836 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
parserOptions: {
sourceType: 'module',
},
globals: getGlobals(['Index', 'Note', 'Prompt', 'PromptReply', 'Screenshot', 'Link', 'YouTube']),
globals: getGlobals(['Index', 'Note', 'Prompt', 'Screenshot', 'Link', 'YouTube']),
settings: {
'import/resolver': 'webpack',
},
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:
run: npm run lint --ignore-scripts -w cli
- name: Post Lint
run: npm run postlint --ignore-scripts -w cli
- name: Check Format
run: npm run format:check --ignore-scripts --if-present -w cli

test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:
run: npm run lint --ignore-scripts
- name: Post Lint
run: npm run postlint --ignore-scripts
- name: Check Format
run: npm run format:check --ignore-scripts --if-present

test:
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
**/template-oss/*.json
**/template-oss/*.yml
/content/
/.github/
/package-lock.json
/SECURITY.md
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ const config = require('@github/prettier-config')
module.exports = {
...config,
proseWrap: 'never',
embeddedLanguageFormatting: 'off',
overrides: [
{
files: ['content/**/*.mdx'],
printWidth: 99999,
},
],
}
12 changes: 11 additions & 1 deletion cli/lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ const gh = require('./gh')
const prettier = require('@prettier/sync')
const rawRedirects = require('./redirects')

const prettierFormat = str =>
prettier.format(str, {
parser: 'markdown',
proseWrap: 'never',
})

const getPathParts = path => {
const abs = isAbsolute(path)
const paths = path.replace(/\.mdx?$/, '').split(sep)
Expand Down Expand Up @@ -101,7 +107,8 @@ const transform = (data, {release, path, frontmatter, format = s => s}) => {

// first format with prettier, this helps so other replacements don't have to
// worry about newlines vs spaces
body = prettier.format(body, {parser: 'markdown', proseWrap: 'never'})
body = prettierFormat(body)

// then do replacements for all cli makdown files
body = body
// some legacy versions of the docs did not get this replaced
Expand All @@ -121,6 +128,9 @@ const transform = (data, {release, path, frontmatter, format = s => s}) => {
// then do any transformer specific replacements
body = format(body)

// prettier again now that we've altered the contents
body = prettierFormat(body)

return `---\n${yaml.stringify(attributes).trim()}\n---\n\n${body}`
}

Expand Down
40 changes: 19 additions & 21 deletions content/about-npm/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,29 @@ npm is the world's largest software registry. Open source developers from every

npm consists of three distinct components:

* the website
* the Command Line Interface (CLI)
* the registry
- the website
- the Command Line Interface (CLI)
- the registry

Use the [*website*](https://npmjs.com) to discover packages, set up profiles, and manage other aspects of your npm experience. For example, you can set up [organizations](https://www.npmjs.com/features) to manage access to public or private packages.
Use the [_website_](https://npmjs.com) to discover packages, set up profiles, and manage other aspects of your npm experience. For example, you can set up [organizations](https://www.npmjs.com/features) to manage access to public or private packages.

The [*CLI*](https://docs.npmjs.com/cli/npm) runs from a terminal, and is how most developers interact with npm.

The [*registry*](https://docs.npmjs.com/misc/registry) is a large public database of JavaScript software and the meta-information surrounding it.
The [_CLI_](https://docs.npmjs.com/cli/npm) runs from a terminal, and is how most developers interact with npm.

The [_registry_](https://docs.npmjs.com/misc/registry) is a large public database of JavaScript software and the meta-information surrounding it.

## Use npm to . . .

* Adapt packages of code for your apps, or incorporate packages as they are.
* Download standalone tools you can use right away.
* Run packages without downloading using [npx](https://docs.npmjs.com/cli/commands/npx).
* Share code with any npm user, anywhere.
* Restrict code to specific developers.
* Create organizations to coordinate package maintenance, coding, and developers.
* Form virtual teams by using organizations.
* Manage multiple versions of code and code dependencies.
* Update applications easily when underlying code is updated.
* Discover multiple ways to solve the same puzzle.
* Find other developers who are working on similar problems and projects.
- Adapt packages of code for your apps, or incorporate packages as they are.
- Download standalone tools you can use right away.
- Run packages without downloading using [npx](https://docs.npmjs.com/cli/commands/npx).
- Share code with any npm user, anywhere.
- Restrict code to specific developers.
- Create organizations to coordinate package maintenance, coding, and developers.
- Form virtual teams by using organizations.
- Manage multiple versions of code and code dependencies.
- Update applications easily when underlying code is updated.
- Discover multiple ways to solve the same puzzle.
- Find other developers who are working on similar problems and projects.

## Getting started

Expand All @@ -41,9 +40,9 @@ After you set up an npm account, the next step is to use the command line interf

## Sharing packages and collaborating with others

If you choose to share your packages publicly, there is no cost. To use and share private packages, you need to upgrade your account. To share with others, create organizations, called **[npm organizations][orgs-docs]**, and invite others to work with you, privately (for a fee) or publicly (for free).
If you choose to share your packages publicly, there is no cost. To use and share private packages, you need to upgrade your account. To share with others, create organizations, called **[npm organizations][orgs-docs]**, and invite others to work with you, privately (for a fee) or publicly (for free).

You can also use a private npm package registry like [GitHub Packages](https://github.com/features/packages) or the open source [Verdaccio](https://verdaccio.org) project. This lets you develop packages internally that are not shared publicly.
You can also use a private npm package registry like [GitHub Packages](https://github.com/features/packages) or the open source [Verdaccio](https://verdaccio.org) project. This lets you develop packages internally that are not shared publicly.

## Learn more

Expand All @@ -55,7 +54,6 @@ For mentoring, tutorials, and learning, visit [node school](https://nodeschool.i

While relevant CLI commands are covered throughout this user documentation, the CLI includes command line help, its own [documentation section, and instant help (man pages)][cli-docs].


[orgs-docs]: /organizations
[install-npm]: /downloading-and-installing-node-js-and-npm
[cli-docs]: /cli-documentation
4 changes: 0 additions & 4 deletions content/cli/v7/commands/npm-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ Management of teams and team memberships is done with the `npm team` command.
### Configuration
#### `registry`
- Default: "https://registry.npmjs.org/"
- Type: URL
The base URL of the npm registry.
#### `otp`
- Default: null
Expand All @@ -94,8 +92,6 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
### See Also
- [`libnpmaccess`](https://npm.im/libnpmaccess)
Expand Down
4 changes: 0 additions & 4 deletions content/cli/v7/commands/npm-adduser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ You may use this command multiple times with the same user account to authorize

### Configuration


#### `registry`

- Default: "https://registry.npmjs.org/"
- Type: URL

The base URL of the npm registry.


#### `scope`

- Default: the scope of the current project, if any, or ""
Expand Down Expand Up @@ -81,8 +79,6 @@ This will also cause `npm init` to create a scoped package.
npm init --scope=@foo --yes
```



### See Also

- [npm registry](/cli/v7/using-npm/registry)
Expand Down
10 changes: 0 additions & 10 deletions content/cli/v7/commands/npm-audit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,13 @@ $ npm audit --audit-level=moderate

### Configuration


#### `audit-level`

- Default: null
- Type: null, "info", "low", "moderate", "high", "critical", or "none"

The minimum level of vulnerability for `npm audit` to exit with a non-zero exit code.


#### `dry-run`

- Default: false
Expand All @@ -164,7 +162,6 @@ Indicates that you don't want npm to make any changes and that it should only re

Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.


#### `force`

- Default: false
Expand All @@ -185,7 +182,6 @@ Removes various protections against unfortunate side effects, common mistakes, u

If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!


#### `json`

- Default: false
Expand All @@ -197,7 +193,6 @@ Whether or not to output JSON data, rather than the normal output.

Not supported by all npm commands.


#### `package-lock-only`

- Default: false
Expand All @@ -209,7 +204,6 @@ For `update` this means only the `package-lock.json` will be updated, instead of

For `list` this means the output will be based on the tree described by the `package-lock.json`, rather than the contents of `node_modules`.


#### `omit`

- Default: 'dev' if the `NODE_ENV` environment variable is set to 'production', otherwise empty.
Expand All @@ -223,7 +217,6 @@ If a package type appears in both the `--include` and `--omit` lists, then it wi

If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment variable will be set to `'production'` for all lifecycle scripts.


#### `workspace`

- Default:
Expand All @@ -241,7 +234,6 @@ When set for the `npm init` command, this may be set to the folder of a workspac

This value is not exported to the environment for child processes.


#### `workspaces`

- Default: false
Expand All @@ -251,8 +243,6 @@ Enable running a command in the context of **all** the configured workspaces.

This value is not exported to the environment for child processes.



### See Also

- [npm install](/cli/v7/commands/npm-install)
Expand Down
3 changes: 0 additions & 3 deletions content/cli/v7/commands/npm-bin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Print the folder where npm will install executables.

### Configuration


#### `global`

- Default: false
Expand All @@ -45,8 +44,6 @@ Operates in "global" mode, so that packages are installed into the `prefix` fold
- bin files are linked to `{prefix}/bin`
- man pages are linked to `{prefix}/share/man`



### See Also

- [npm prefix](/cli/v7/commands/npm-prefix)
Expand Down
4 changes: 0 additions & 4 deletions content/cli/v7/commands/npm-bugs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ This command tries to guess at the likely location of a package's bug tracker UR
### Configuration
#### `browser`
- Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
Expand All @@ -45,16 +44,13 @@ Set to `false` to suppress browser behavior and instead print urls to terminal.
Set to `true` to use default system URL opener.
#### `registry`
- Default: "https://registry.npmjs.org/"
- Type: URL
The base URL of the npm registry.
### See Also
- [npm docs](/cli/v7/commands/npm-docs)
Expand Down
3 changes: 0 additions & 3 deletions content/cli/v7/commands/npm-cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,13 @@ To run an offline verification of existing cache contents, use `npm cache verify

### Configuration


#### `cache`

- Default: Windows: `%LocalAppData%\npm-cache`, Posix: `~/.npm`
- Type: Path

The location of npm's cache directory. See [`npm cache`](/cli/v7/commands/npm-cache)



### See Also

- [npm folders](/cli/v7/configuring-npm/folders)
Expand Down
5 changes: 0 additions & 5 deletions content/cli/v7/commands/npm-ci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ cache:

### Configuration


#### `audit`

- Default: true
- Type: Boolean

When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for [`npm audit`](/cli/v7/commands/npm-audit) for details on what is submitted.


#### `ignore-scripts`

- Default: false
Expand All @@ -92,16 +90,13 @@ If true, npm does not run scripts specified in package.json files.

Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts.


#### `script-shell`

- Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
- Type: null or String

The shell to use for scripts run with the `npm exec`, `npm run` and `npm init <pkg>` commands.



### See Also

- [npm install](/cli/v7/commands/npm-install)
Expand Down
Loading

0 comments on commit c62df53

Please sign in to comment.