ncu-config-nick2bad4u 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ncurc.json +50 -0
- package/.ncurc.workspaces.json +51 -0
- package/LICENSE +22 -0
- package/README.md +83 -0
- package/dist/ncu-config.d.ts +22 -0
- package/dist/ncu-config.d.ts.map +1 -0
- package/dist/ncu-config.js +35 -0
- package/dist/ncu-config.js.map +1 -0
- package/package.json +160 -0
- package/src/ncu-config.ts +71 -0
package/.ncurc.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cache": true,
|
|
3
|
+
"cacheClear": false,
|
|
4
|
+
"cacheExpiration": 60,
|
|
5
|
+
"color": true,
|
|
6
|
+
"concurrency": 8,
|
|
7
|
+
"cooldown": "1m",
|
|
8
|
+
"deep": false,
|
|
9
|
+
"dep": [
|
|
10
|
+
"prod",
|
|
11
|
+
"dev",
|
|
12
|
+
"optional",
|
|
13
|
+
"packageManager"
|
|
14
|
+
],
|
|
15
|
+
"deprecated": true,
|
|
16
|
+
"doctor": false,
|
|
17
|
+
"doctorInstall": "npm install --force",
|
|
18
|
+
"doctorTest": "npm run test",
|
|
19
|
+
"enginesNode": false,
|
|
20
|
+
"errorLevel": 1,
|
|
21
|
+
"format": [
|
|
22
|
+
"group",
|
|
23
|
+
"dep",
|
|
24
|
+
"ownerChanged",
|
|
25
|
+
"time",
|
|
26
|
+
"homepage"
|
|
27
|
+
],
|
|
28
|
+
"global": false,
|
|
29
|
+
"install": "never",
|
|
30
|
+
"interactive": true,
|
|
31
|
+
"jsonAll": false,
|
|
32
|
+
"jsonDeps": false,
|
|
33
|
+
"jsonUpgraded": false,
|
|
34
|
+
"loglevel": "warn",
|
|
35
|
+
"mergeConfig": true,
|
|
36
|
+
"minimal": false,
|
|
37
|
+
"packageManager": "npm",
|
|
38
|
+
"peer": false,
|
|
39
|
+
"pre": false,
|
|
40
|
+
"registry": "https://registry.npmjs.org/",
|
|
41
|
+
"registryType": "npm",
|
|
42
|
+
"removeRange": false,
|
|
43
|
+
"retry": 3,
|
|
44
|
+
"silent": false,
|
|
45
|
+
"target": "latest",
|
|
46
|
+
"timeout": 0,
|
|
47
|
+
"upgrade": true,
|
|
48
|
+
"verbose": false,
|
|
49
|
+
"workspaces": false
|
|
50
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cache": true,
|
|
3
|
+
"cacheClear": false,
|
|
4
|
+
"cacheExpiration": 60,
|
|
5
|
+
"color": true,
|
|
6
|
+
"concurrency": 8,
|
|
7
|
+
"cooldown": "1m",
|
|
8
|
+
"deep": false,
|
|
9
|
+
"dep": [
|
|
10
|
+
"prod",
|
|
11
|
+
"dev",
|
|
12
|
+
"optional",
|
|
13
|
+
"packageManager"
|
|
14
|
+
],
|
|
15
|
+
"deprecated": true,
|
|
16
|
+
"doctor": false,
|
|
17
|
+
"doctorInstall": "npm install --force",
|
|
18
|
+
"doctorTest": "npm run test",
|
|
19
|
+
"enginesNode": false,
|
|
20
|
+
"errorLevel": 1,
|
|
21
|
+
"format": [
|
|
22
|
+
"group",
|
|
23
|
+
"dep",
|
|
24
|
+
"ownerChanged",
|
|
25
|
+
"time",
|
|
26
|
+
"homepage"
|
|
27
|
+
],
|
|
28
|
+
"global": false,
|
|
29
|
+
"install": "never",
|
|
30
|
+
"interactive": true,
|
|
31
|
+
"jsonAll": false,
|
|
32
|
+
"jsonDeps": false,
|
|
33
|
+
"jsonUpgraded": false,
|
|
34
|
+
"loglevel": "warn",
|
|
35
|
+
"mergeConfig": true,
|
|
36
|
+
"minimal": false,
|
|
37
|
+
"packageManager": "npm",
|
|
38
|
+
"peer": false,
|
|
39
|
+
"pre": false,
|
|
40
|
+
"registry": "https://registry.npmjs.org/",
|
|
41
|
+
"registryType": "npm",
|
|
42
|
+
"removeRange": false,
|
|
43
|
+
"retry": 3,
|
|
44
|
+
"root": true,
|
|
45
|
+
"silent": false,
|
|
46
|
+
"target": "latest",
|
|
47
|
+
"timeout": 0,
|
|
48
|
+
"upgrade": true,
|
|
49
|
+
"verbose": false,
|
|
50
|
+
"workspaces": true
|
|
51
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nick2bad4u
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# ncu-config-nick2bad4u
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/blob/main/LICENSE) [](https://www.npmjs.com/package/ncu-config-nick2bad4u) [](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/releases) [](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/stargazers) [](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/forks) [](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/issues) [](https://codecov.io/gh/Nick2bad4u/ncu-config-nick2bad4u) [](https://github.com/Nick2bad4u/ncu-config-nick2bad4u/actions)
|
|
4
|
+
|
|
5
|
+
Shared [npm-check-updates](https://github.com/raineorshine/npm-check-updates) configurations for Nick2bad4u npm repositories.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev npm-check-updates ncu-config-nick2bad4u
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Non-workspace repositories
|
|
14
|
+
|
|
15
|
+
Point NCU at the standard config from a package script:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"scripts": {
|
|
20
|
+
"update-deps": "ncu --configFileName .ncurc.json --configFilePath node_modules/ncu-config-nick2bad4u"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## npm workspaces
|
|
26
|
+
|
|
27
|
+
Use the workspace preset when the root `package.json` declares npm workspaces:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"scripts": {
|
|
32
|
+
"update-deps": "ncu --configFileName .ncurc.workspaces.json --configFilePath node_modules/ncu-config-nick2bad4u"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The workspace preset checks the root package and every declared workspace. Both presets enable NCU's interactive upgrade flow, so `npm run update-deps` prompts for selections and updates matching manifests. Command-line options take precedence when a one-off run needs different behavior.
|
|
38
|
+
|
|
39
|
+
## Programmatic access
|
|
40
|
+
|
|
41
|
+
The package exports stable file names, absolute paths, and a validated loader:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import {
|
|
45
|
+
loadNcuConfig,
|
|
46
|
+
ncuConfigPath,
|
|
47
|
+
ncuWorkspacesConfigPath,
|
|
48
|
+
} from "ncu-config-nick2bad4u";
|
|
49
|
+
|
|
50
|
+
const standardConfig = await loadNcuConfig();
|
|
51
|
+
const workspaceConfig = await loadNcuConfig("workspaces");
|
|
52
|
+
|
|
53
|
+
console.log(ncuConfigPath, ncuWorkspacesConfigPath);
|
|
54
|
+
console.log(standardConfig.workspaces, workspaceConfig.workspaces);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The raw JSON files are also exported for JSON-module consumers:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import standardConfig from "ncu-config-nick2bad4u/.ncurc.json" with { type: "json" };
|
|
61
|
+
import workspaceConfig from "ncu-config-nick2bad4u/.ncurc.workspaces.json" with { type: "json" };
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Shared defaults
|
|
65
|
+
|
|
66
|
+
- Uses npm and the public npm registry with eight concurrent requests and three retries.
|
|
67
|
+
- Checks production, development, optional, and package-manager dependencies against the `latest` tag.
|
|
68
|
+
- Requires versions to be at least one minute old and caches registry results for 60 minutes.
|
|
69
|
+
- Groups interactive results by dependency type, version impact, ownership changes, publication time, and homepage.
|
|
70
|
+
- Excludes prereleases by default, preserves version ranges, and never installs dependencies automatically.
|
|
71
|
+
- Merges nested configs so workspace-specific policies can extend the shared root policy.
|
|
72
|
+
- Keeps the standard and workspace behaviors separate through `workspaces: false` and `workspaces: true`.
|
|
73
|
+
|
|
74
|
+
The config-location flags intentionally stay in the consuming command. NCU uses `configFileName` and `configFilePath` to find an rc file, so embedding either selector inside the file it already loaded is ineffective and non-portable.
|
|
75
|
+
|
|
76
|
+
## Verification
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run release:verify
|
|
80
|
+
npm pack --dry-run
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
See [the maintenance checklist](docs/UPDATE_CHECKLIST.md) when updating NCU or changing the published policy.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RcOptions } from "npm-check-updates";
|
|
2
|
+
/** Parsed options from one of the bundled NCU configuration files. */
|
|
3
|
+
export type NcuConfig = Readonly<RcOptions>;
|
|
4
|
+
/** Supported shared NCU preset variants. */
|
|
5
|
+
export type NcuConfigMode = "standard" | "workspaces";
|
|
6
|
+
/** File name of the standard single-package preset. */
|
|
7
|
+
export declare const ncuConfigFileName: ".ncurc.json";
|
|
8
|
+
/** File name of the npm-workspaces preset. */
|
|
9
|
+
export declare const ncuWorkspacesConfigFileName: ".ncurc.workspaces.json";
|
|
10
|
+
/** Absolute path to the bundled standard single-package preset. */
|
|
11
|
+
export declare const ncuConfigPath: string;
|
|
12
|
+
/** Absolute path to the bundled npm-workspaces preset. */
|
|
13
|
+
export declare const ncuWorkspacesConfigPath: string;
|
|
14
|
+
/** Load and validate one of the bundled NCU presets. */
|
|
15
|
+
export declare function loadNcuConfig(mode?: NcuConfigMode): Promise<NcuConfig>;
|
|
16
|
+
/**
|
|
17
|
+
* Validate a bundled NCU configuration object and its workspace mode.
|
|
18
|
+
*
|
|
19
|
+
* @throws TypeError When the input is not an object or selects the wrong mode.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseNcuConfig(config: unknown, mode: NcuConfigMode): NcuConfig;
|
|
22
|
+
//# sourceMappingURL=ncu-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ncu-config.d.ts","sourceRoot":"","sources":["../src/ncu-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,sEAAsE;AACtE,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,YAAY,CAAC;AAMtD,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,EAAG,aAAsB,CAAC;AAExD,8CAA8C;AAC9C,eAAO,MAAM,2BAA2B,EAAG,wBAAiC,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,aAAa,EAAE,MAE3B,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB,EAAE,MAErC,CAAC;AAKF,wDAAwD;AACxD,wBAAsB,aAAa,CAC/B,IAAI,GAAE,aAA0B,GACjC,OAAO,CAAC,SAAS,CAAC,CASpB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,aAAa,GACpB,SAAS,CAcX"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
/** File name of the standard single-package preset. */
|
|
4
|
+
export const ncuConfigFileName = ".ncurc.json";
|
|
5
|
+
/** File name of the npm-workspaces preset. */
|
|
6
|
+
export const ncuWorkspacesConfigFileName = ".ncurc.workspaces.json";
|
|
7
|
+
/** Absolute path to the bundled standard single-package preset. */
|
|
8
|
+
export const ncuConfigPath = fileURLToPath(new URL(`../${ncuConfigFileName}`, import.meta.url));
|
|
9
|
+
/** Absolute path to the bundled npm-workspaces preset. */
|
|
10
|
+
export const ncuWorkspacesConfigPath = fileURLToPath(new URL(`../${ncuWorkspacesConfigFileName}`, import.meta.url));
|
|
11
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
|
+
/** Load and validate one of the bundled NCU presets. */
|
|
13
|
+
export async function loadNcuConfig(mode = "standard") {
|
|
14
|
+
const configPath = mode === "workspaces" ? ncuWorkspacesConfigPath : ncuConfigPath;
|
|
15
|
+
const parsedConfig = JSON.parse(
|
|
16
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- selected from package-owned config path constants
|
|
17
|
+
await readFile(configPath, "utf8"));
|
|
18
|
+
return parseNcuConfig(parsedConfig, mode);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Validate a bundled NCU configuration object and its workspace mode.
|
|
22
|
+
*
|
|
23
|
+
* @throws TypeError When the input is not an object or selects the wrong mode.
|
|
24
|
+
*/
|
|
25
|
+
export function parseNcuConfig(config, mode) {
|
|
26
|
+
if (!isRecord(config)) {
|
|
27
|
+
throw new TypeError("Expected the NCU config to be an object.");
|
|
28
|
+
}
|
|
29
|
+
const isWorkspaceMode = mode === "workspaces";
|
|
30
|
+
if (config.workspaces !== isWorkspaceMode) {
|
|
31
|
+
throw new TypeError(`Expected the ${mode} NCU config to set "workspaces" to ${String(isWorkspaceMode)}.`);
|
|
32
|
+
}
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ncu-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ncu-config.js","sourceRoot":"","sources":["../src/ncu-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAYzC,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAsB,CAAC;AAExD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,2BAA2B,GAAG,wBAAiC,CAAC;AAE7E,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAW,aAAa,CAC9C,IAAI,GAAG,CAAC,MAAM,iBAAiB,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CACtD,CAAC;AAEF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAW,aAAa,CACxD,IAAI,GAAG,CAAC,MAAM,2BAA2B,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAChE,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA4B,EAAE,CAC1D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEzE,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,aAAa,CAC/B,OAAsB,UAAU;IAEhC,MAAM,UAAU,GACZ,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC;IACpE,MAAM,YAAY,GAAY,IAAI,CAAC,KAAK;IACpC,wHAAwH;IACxH,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CACrC,CAAC;IAEF,OAAO,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC1B,MAAe,EACf,IAAmB;IAEnB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,KAAK,YAAY,CAAC;IAE9C,IAAI,MAAM,CAAC,UAAU,KAAK,eAAe,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CACf,gBAAgB,IAAI,sCAAsC,MAAM,CAAC,eAAe,CAAC,GAAG,CACvF,CAAC;IACN,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://www.schemastore.org/package.json",
|
|
3
|
+
"name": "ncu-config-nick2bad4u",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Shared npm-check-updates configurations for Nick2bad4u npm repositories.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"npm",
|
|
9
|
+
"npm-check-updates",
|
|
10
|
+
"ncu",
|
|
11
|
+
"shared-config",
|
|
12
|
+
"workspaces"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/Nick2bad4u/ncu-config-nick2bad4u#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Nick2bad4u/ncu-config-nick2bad4u/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/Nick2bad4u/ncu-config-nick2bad4u.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> (https://github.com/Nick2bad4u)",
|
|
24
|
+
"contributors": [
|
|
25
|
+
"Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com> (https://github.com/Nick2bad4u)"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/ncu-config.d.ts",
|
|
32
|
+
"default": "./dist/ncu-config.js"
|
|
33
|
+
},
|
|
34
|
+
"./.ncurc.json": "./.ncurc.json",
|
|
35
|
+
"./.ncurc.workspaces.json": "./.ncurc.workspaces.json",
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"types": "./dist/ncu-config.d.ts",
|
|
39
|
+
"files": [
|
|
40
|
+
".ncurc.json",
|
|
41
|
+
".ncurc.workspaces.json",
|
|
42
|
+
"dist",
|
|
43
|
+
"src",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.build.json",
|
|
49
|
+
"build:runtime": "npm run build",
|
|
50
|
+
"build:watch": "npm run build -- --watch",
|
|
51
|
+
"changelog:generate": "git cliff --config node_modules/gitcliff-config-nick2bad4u/cliff.toml --github-repo Nick2bad4u/ncu-config-nick2bad4u --output CHANGELOG.md",
|
|
52
|
+
"changelog:preview": "git cliff --config node_modules/gitcliff-config-nick2bad4u/cliff.toml --github-repo Nick2bad4u/ncu-config-nick2bad4u --unreleased",
|
|
53
|
+
"changelog:release-notes": "git cliff --config node_modules/gitcliff-config-nick2bad4u/cliff.toml --github-repo Nick2bad4u/ncu-config-nick2bad4u --current",
|
|
54
|
+
"coverage": "vitest run --coverage",
|
|
55
|
+
"lint": "cross-env NODE_OPTIONS=--max_old_space_size=8192 eslint . --cache --cache-strategy content --cache-location .cache/.eslintcache",
|
|
56
|
+
"lint:actions": "actionlint -config-file actionlint.yml",
|
|
57
|
+
"lint:all": "npm run lint && npm run typecheck && npm run test && npm run lint:prettier && npm run lint:package && npm run lint:remark && npm run lint:yaml && npm run lint:config && npm run lint:gitleaks && npm run lint:secretlint",
|
|
58
|
+
"lint:all:fix": "npm run lint:fix && npm run lint:prettier:fix && npm run lint:package:fix && npm run lint:remark:fix && npm run lint:yaml:fix && npm run lint:style:fix && npm run typecheck && npm run test",
|
|
59
|
+
"lint:attw": "attw --pack . --profile esm-only",
|
|
60
|
+
"lint:config": "npm run lint:node-config && npm run lint:tsdoc && npm run lint:jscpd",
|
|
61
|
+
"lint:fix": "npm run lint -- --fix",
|
|
62
|
+
"lint:gitleaks": "gitleaks dir --config .gitleaks.toml .",
|
|
63
|
+
"lint:jscpd": "jscpd --config node_modules/jscpd-config-nick2bad4u/jscpd.json",
|
|
64
|
+
"lint:lychee": "lychee --config node_modules/lychee-config-nick2bad4u/lychee.toml .",
|
|
65
|
+
"lint:lychee:smoke": "lychee --config node_modules/lychee-config-nick2bad4u/lychee.toml --dump-inputs README.md",
|
|
66
|
+
"lint:node-config": "node -e \"JSON.parse(require('node:fs').readFileSync('node.config.json','utf8')); console.log('node.config.json ok')\"",
|
|
67
|
+
"lint:package": "npm run lint:package-sort && npm run lint:package-json && npm run lint:package-check",
|
|
68
|
+
"lint:package:fix": "sort-package-json package.json",
|
|
69
|
+
"lint:package-check": "npm run package:check && npm run lint:publint && npm run lint:attw",
|
|
70
|
+
"lint:package-json": "npmPkgJsonLint . --config .npmpackagejsonlintrc.json",
|
|
71
|
+
"lint:package-sort": "sort-package-json --check package.json",
|
|
72
|
+
"lint:prettier": "prettier . --log-level warn --cache --cache-location=.cache/.prettier-cache --cache-strategy=content --check",
|
|
73
|
+
"lint:prettier:fix": "prettier . --log-level warn --cache --cache-location=.cache/.prettier-cache --cache-strategy=content --write",
|
|
74
|
+
"lint:publint": "publint",
|
|
75
|
+
"lint:remark": "remark . --frail --ignore-path .remarkignore",
|
|
76
|
+
"lint:remark:fix": "remark . --ignore-path .remarkignore --output",
|
|
77
|
+
"lint:secretlint": "secretlint --secretlintrc .secretlintrc.cjs --secretlintignore .gitignore \"**/*\"",
|
|
78
|
+
"lint:style": "stylelint \"**/*.{css,scss}\" --allow-empty-input --config stylelint.config.mjs",
|
|
79
|
+
"lint:style:fix": "npm run lint:style -- --fix",
|
|
80
|
+
"lint:tsdoc": "node -e \"JSON.parse(require('node:fs').readFileSync('tsdoc.json','utf8')); console.log('tsdoc.json ok')\"",
|
|
81
|
+
"lint:yaml": "eslint --cache --cache-strategy content --cache-location .cache/.eslintcache \"**/*.{yml,yaml}\"",
|
|
82
|
+
"lint:yaml:fix": "npm run lint:yaml -- --fix",
|
|
83
|
+
"lint:yamllint": "yamllint -c .yamllint .",
|
|
84
|
+
"package:check": "npm pack --dry-run",
|
|
85
|
+
"release:check": "npm run release:verify",
|
|
86
|
+
"release:verify": "npm run sync:node-version-files:check && npm run build && npm run lint:all && npm run test:coverage && npm run lint:package-check",
|
|
87
|
+
"sync:node-version-files": "node scripts/sync-node-version-files.mjs",
|
|
88
|
+
"sync:node-version-files:check": "node scripts/sync-node-version-files.mjs --check",
|
|
89
|
+
"test": "vitest run",
|
|
90
|
+
"test:coverage": "npm run coverage",
|
|
91
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.eslint.json --noEmit && tsc -p tsconfig.js.json --noEmit && tsc -p tsconfig.vitest-typecheck.json --noEmit",
|
|
92
|
+
"typecheck:all": "npm run typecheck",
|
|
93
|
+
"types:update": "npx typesync",
|
|
94
|
+
"update-actions": "actions-up --yes --style sha",
|
|
95
|
+
"update-all": "npm run update-actions && npm run update-deps",
|
|
96
|
+
"update-deps": "ncu --configFileName .ncurc.json --configFilePath . && npm update --force && npm install --force && npm run sync:node-version-files",
|
|
97
|
+
"verify": "npm run release:verify"
|
|
98
|
+
},
|
|
99
|
+
"overrides": {
|
|
100
|
+
"tsup": {
|
|
101
|
+
"esbuild": "0.28.1"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"devDependencies": {
|
|
105
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
106
|
+
"@microsoft/tsdoc-config": "^0.18.1",
|
|
107
|
+
"@types/node": "^26.1.1",
|
|
108
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
109
|
+
"actions-up": "^1.16.0",
|
|
110
|
+
"cross-env": "^10.1.0",
|
|
111
|
+
"eslint": "^10.7.0",
|
|
112
|
+
"eslint-config-nick2bad4u": "^4.0.0",
|
|
113
|
+
"git-cliff": "^2.13.1",
|
|
114
|
+
"gitcliff-config-nick2bad4u": "^1.3.0",
|
|
115
|
+
"gitleaks-config-nick2bad4u": "^1.0.4",
|
|
116
|
+
"jscpd": "^5.0.12",
|
|
117
|
+
"jscpd-config-nick2bad4u": "^1.1.0",
|
|
118
|
+
"lychee-config-nick2bad4u": "^2.0.0",
|
|
119
|
+
"npm-check-updates": "^22.2.9",
|
|
120
|
+
"npm-package-json-lint": "^10.4.1",
|
|
121
|
+
"npm-package-json-lint-config-nick2bad4u": "^1.0.4",
|
|
122
|
+
"picocolors": "^1.1.1",
|
|
123
|
+
"prettier": "^3.9.5",
|
|
124
|
+
"prettier-config-nick2bad4u": "^1.1.1",
|
|
125
|
+
"publint": "^0.3.21",
|
|
126
|
+
"remark": "^15.0.1",
|
|
127
|
+
"remark-cli": "^12.0.1",
|
|
128
|
+
"remark-config-nick2bad4u": "^1.1.3",
|
|
129
|
+
"secretlint": "^13.0.2",
|
|
130
|
+
"secretlint-config-nick2bad4u": "^1.1.2",
|
|
131
|
+
"sort-package-json": "^4.0.0",
|
|
132
|
+
"stylelint": "^17.14.0",
|
|
133
|
+
"stylelint-config-nick2bad4u": "^1.0.20",
|
|
134
|
+
"tsdoc-config-nick2bad4u": "^1.0.6",
|
|
135
|
+
"typedoc": "^0.28.20",
|
|
136
|
+
"typedoc-config-nick2bad4u": "^2.0.3",
|
|
137
|
+
"typescript": "^6.0.3",
|
|
138
|
+
"vite": "^8.1.4",
|
|
139
|
+
"vitest": "^4.1.10",
|
|
140
|
+
"yamllint-config-nick2bad4u": "^1.1.1"
|
|
141
|
+
},
|
|
142
|
+
"peerDependencies": {
|
|
143
|
+
"npm-check-updates": "^22.2.9"
|
|
144
|
+
},
|
|
145
|
+
"packageManager": "npm@12.0.1",
|
|
146
|
+
"engines": {
|
|
147
|
+
"node": "^22.22.3 || ^24.16.0 || >=26.3.0"
|
|
148
|
+
},
|
|
149
|
+
"publishConfig": {
|
|
150
|
+
"access": "public",
|
|
151
|
+
"provenance": true,
|
|
152
|
+
"registry": "https://registry.npmjs.org/"
|
|
153
|
+
},
|
|
154
|
+
"allowScripts": {
|
|
155
|
+
"core-js@3.49.0": true,
|
|
156
|
+
"esbuild@0.27.7 || 0.28.1": true,
|
|
157
|
+
"fsevents@2.3.3": true,
|
|
158
|
+
"unrs-resolver@1.12.2": true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { RcOptions } from "npm-check-updates";
|
|
2
|
+
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
/** Parsed options from one of the bundled NCU configuration files. */
|
|
7
|
+
export type NcuConfig = Readonly<RcOptions>;
|
|
8
|
+
|
|
9
|
+
/** Supported shared NCU preset variants. */
|
|
10
|
+
export type NcuConfigMode = "standard" | "workspaces";
|
|
11
|
+
|
|
12
|
+
interface NcuConfigRecord {
|
|
13
|
+
readonly workspaces?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** File name of the standard single-package preset. */
|
|
17
|
+
export const ncuConfigFileName = ".ncurc.json" as const;
|
|
18
|
+
|
|
19
|
+
/** File name of the npm-workspaces preset. */
|
|
20
|
+
export const ncuWorkspacesConfigFileName = ".ncurc.workspaces.json" as const;
|
|
21
|
+
|
|
22
|
+
/** Absolute path to the bundled standard single-package preset. */
|
|
23
|
+
export const ncuConfigPath: string = fileURLToPath(
|
|
24
|
+
new URL(`../${ncuConfigFileName}`, import.meta.url)
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
/** Absolute path to the bundled npm-workspaces preset. */
|
|
28
|
+
export const ncuWorkspacesConfigPath: string = fileURLToPath(
|
|
29
|
+
new URL(`../${ncuWorkspacesConfigFileName}`, import.meta.url)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const isRecord = (value: unknown): value is NcuConfigRecord =>
|
|
33
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
|
+
|
|
35
|
+
/** Load and validate one of the bundled NCU presets. */
|
|
36
|
+
export async function loadNcuConfig(
|
|
37
|
+
mode: NcuConfigMode = "standard"
|
|
38
|
+
): Promise<NcuConfig> {
|
|
39
|
+
const configPath =
|
|
40
|
+
mode === "workspaces" ? ncuWorkspacesConfigPath : ncuConfigPath;
|
|
41
|
+
const parsedConfig: unknown = JSON.parse(
|
|
42
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- selected from package-owned config path constants
|
|
43
|
+
await readFile(configPath, "utf8")
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return parseNcuConfig(parsedConfig, mode);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Validate a bundled NCU configuration object and its workspace mode.
|
|
51
|
+
*
|
|
52
|
+
* @throws TypeError When the input is not an object or selects the wrong mode.
|
|
53
|
+
*/
|
|
54
|
+
export function parseNcuConfig(
|
|
55
|
+
config: unknown,
|
|
56
|
+
mode: NcuConfigMode
|
|
57
|
+
): NcuConfig {
|
|
58
|
+
if (!isRecord(config)) {
|
|
59
|
+
throw new TypeError("Expected the NCU config to be an object.");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const isWorkspaceMode = mode === "workspaces";
|
|
63
|
+
|
|
64
|
+
if (config.workspaces !== isWorkspaceMode) {
|
|
65
|
+
throw new TypeError(
|
|
66
|
+
`Expected the ${mode} NCU config to set "workspaces" to ${String(isWorkspaceMode)}.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return config;
|
|
71
|
+
}
|