npmdata 0.10.3 → 0.12.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/README.md +133 -58
- package/dist/cli/actions/check.d.ts +6 -0
- package/dist/cli/actions/check.d.ts.map +1 -0
- package/dist/cli/actions/check.js +57 -0
- package/dist/cli/actions/check.js.map +1 -0
- package/dist/cli/actions/extract.d.ts +7 -0
- package/dist/cli/actions/extract.d.ts.map +1 -0
- package/dist/cli/actions/extract.js +84 -0
- package/dist/cli/actions/extract.js.map +1 -0
- package/dist/cli/actions/init.d.ts +6 -0
- package/dist/cli/actions/init.d.ts.map +1 -0
- package/dist/cli/actions/init.js +36 -0
- package/dist/cli/actions/init.js.map +1 -0
- package/dist/cli/actions/list.d.ts +7 -0
- package/dist/cli/actions/list.d.ts.map +1 -0
- package/dist/cli/actions/list.js +42 -0
- package/dist/cli/actions/list.js.map +1 -0
- package/dist/cli/actions/purge.d.ts +6 -0
- package/dist/cli/actions/purge.d.ts.map +1 -0
- package/dist/cli/actions/purge.js +47 -0
- package/dist/cli/actions/purge.js.map +1 -0
- package/dist/cli/argv.d.ts +35 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +125 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/cli.d.ts +9 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +69 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/runner.d.ts +9 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +106 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/usage.d.ts +6 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +126 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/fileset/check.d.ts +15 -0
- package/dist/fileset/check.d.ts.map +1 -0
- package/dist/fileset/check.js +68 -0
- package/dist/fileset/check.js.map +1 -0
- package/dist/fileset/constants.d.ts +13 -0
- package/dist/fileset/constants.d.ts.map +1 -0
- package/dist/fileset/constants.js +22 -0
- package/dist/fileset/constants.js.map +1 -0
- package/dist/fileset/diff.d.ts +16 -0
- package/dist/fileset/diff.d.ts.map +1 -0
- package/dist/fileset/diff.js +116 -0
- package/dist/fileset/diff.js.map +1 -0
- package/dist/fileset/execute.d.ts +29 -0
- package/dist/fileset/execute.d.ts.map +1 -0
- package/dist/fileset/execute.js +136 -0
- package/dist/fileset/execute.js.map +1 -0
- package/dist/fileset/gitignore.d.ts +16 -0
- package/dist/fileset/gitignore.d.ts.map +1 -0
- package/dist/fileset/gitignore.js +82 -0
- package/dist/fileset/gitignore.js.map +1 -0
- package/dist/fileset/index.d.ts +5 -0
- package/dist/fileset/index.d.ts.map +1 -0
- package/dist/fileset/index.js +21 -0
- package/dist/fileset/index.js.map +1 -0
- package/dist/fileset/list.d.ts +6 -0
- package/dist/fileset/list.d.ts.map +1 -0
- package/dist/fileset/list.js +11 -0
- package/dist/fileset/list.js.map +1 -0
- package/dist/fileset/markers.d.ts +22 -0
- package/dist/fileset/markers.d.ts.map +1 -0
- package/dist/fileset/markers.js +68 -0
- package/dist/fileset/markers.js.map +1 -0
- package/dist/fileset/package-files.d.ts +14 -0
- package/dist/fileset/package-files.d.ts.map +1 -0
- package/dist/fileset/package-files.js +81 -0
- package/dist/fileset/package-files.js.map +1 -0
- package/dist/fileset/purge.d.ts +12 -0
- package/dist/fileset/purge.d.ts.map +1 -0
- package/dist/fileset/purge.js +95 -0
- package/dist/fileset/purge.js.map +1 -0
- package/dist/fileset/test-utils.d.ts +12 -0
- package/dist/fileset/test-utils.d.ts.map +1 -0
- package/dist/fileset/test-utils.js +65 -0
- package/dist/fileset/test-utils.js.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/main.js +9 -16
- package/dist/main.js.map +1 -1
- package/dist/npmdata-0.0.1.tgz +0 -0
- package/dist/package/action-check.d.ts +20 -0
- package/dist/package/action-check.d.ts.map +1 -0
- package/dist/package/action-check.js +61 -0
- package/dist/package/action-check.js.map +1 -0
- package/dist/package/action-extract.d.ts +21 -0
- package/dist/package/action-extract.d.ts.map +1 -0
- package/dist/package/action-extract.js +186 -0
- package/dist/package/action-extract.js.map +1 -0
- package/dist/package/action-init.d.ts +13 -0
- package/dist/package/action-init.d.ts.map +1 -0
- package/dist/package/action-init.js +77 -0
- package/dist/package/action-init.js.map +1 -0
- package/dist/package/action-list.d.ts +14 -0
- package/dist/package/action-list.d.ts.map +1 -0
- package/dist/package/action-list.js +46 -0
- package/dist/package/action-list.js.map +1 -0
- package/dist/package/action-purge.d.ts +21 -0
- package/dist/package/action-purge.d.ts.map +1 -0
- package/dist/package/action-purge.js +60 -0
- package/dist/package/action-purge.js.map +1 -0
- package/dist/package/config-merge.d.ts +18 -0
- package/dist/package/config-merge.d.ts.map +1 -0
- package/dist/package/config-merge.js +48 -0
- package/dist/package/config-merge.js.map +1 -0
- package/dist/package/config.d.ts +13 -0
- package/dist/package/config.d.ts.map +1 -0
- package/dist/package/config.js +29 -0
- package/dist/package/config.js.map +1 -0
- package/dist/package/content-replacements.d.ts +21 -0
- package/dist/package/content-replacements.d.ts.map +1 -0
- package/dist/package/content-replacements.js +96 -0
- package/dist/package/content-replacements.js.map +1 -0
- package/dist/package/index.d.ts +10 -0
- package/dist/package/index.d.ts.map +1 -0
- package/dist/package/index.js +16 -0
- package/dist/package/index.js.map +1 -0
- package/dist/package/symlinks.d.ts +17 -0
- package/dist/package/symlinks.d.ts.map +1 -0
- package/dist/package/symlinks.js +125 -0
- package/dist/package/symlinks.js.map +1 -0
- package/dist/types.d.ts +184 -270
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -12
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +25 -55
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +82 -181
- package/dist/utils.js.map +1 -1
- package/package.json +5 -2
- package/dist/cli.d.ts +0 -6
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -514
- package/dist/cli.js.map +0 -1
- package/dist/consumer.d.ts +0 -74
- package/dist/consumer.d.ts.map +0 -1
- package/dist/consumer.js +0 -820
- package/dist/consumer.js.map +0 -1
- package/dist/publisher.d.ts +0 -38
- package/dist/publisher.d.ts.map +0 -1
- package/dist/publisher.js +0 -164
- package/dist/publisher.js.map +0 -1
- package/dist/runner.d.ts +0 -102
- package/dist/runner.d.ts.map +0 -1
- package/dist/runner.js +0 -748
- package/dist/runner.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,20 +27,22 @@ Create a dedicated npm package whose `package.json` declares an `npmdata` config
|
|
|
27
27
|
|
|
28
28
|
```json
|
|
29
29
|
{
|
|
30
|
-
"name": "my-org-
|
|
30
|
+
"name": "my-org-configs",
|
|
31
31
|
"version": "1.0.0",
|
|
32
|
-
"npmdata":
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
"npmdata": {
|
|
33
|
+
"sets": [
|
|
34
|
+
{
|
|
35
|
+
"package": "base-datasets@^3.0.0",
|
|
36
|
+
"selector": { "files": ["datasets/**"] },
|
|
37
|
+
"output": { "path": "./data/base" }
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"package": "org-configs@^1.2.0",
|
|
41
|
+
"selector": { "contentRegexes": ["env: production"] },
|
|
42
|
+
"output": { "path": "./configs" }
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
@@ -49,13 +51,71 @@ Run `pnpm dlx npmdata init` in that package and then `npm publish` to release it
|
|
|
49
51
|
**Consumer** — just install and run:
|
|
50
52
|
|
|
51
53
|
```sh
|
|
52
|
-
npx my-org-
|
|
54
|
+
npx my-org-configs extract --output ./local-data
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
No knowledge of the upstream packages or transformation rules is required.
|
|
56
58
|
|
|
57
59
|
**When to use:** When an intermediary team (a platform, infrastructure, or data team) wants to bundle, curate, and version a collection of data from multiple sources and hand it to consumers as a single, opinionated package. Consumers get a stable, self-describing interface; producers control all the complexity.
|
|
58
60
|
|
|
61
|
+
### Pattern 3 — Config file mode
|
|
62
|
+
|
|
63
|
+
Add an `npmdata` configuration directly to a project's own `package.json` (or a `.npmdatarc` file) and then run `npmdata extract` without `--packages`. The CLI automatically loads the configuration and runs every entry, reusing the same runner logic as data packages.
|
|
64
|
+
|
|
65
|
+
**Consumer** — declare the config inline in `package.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"name": "my-project",
|
|
70
|
+
"npmdata": {
|
|
71
|
+
"sets": [
|
|
72
|
+
{
|
|
73
|
+
"package": "base-datasets@^3.0.0",
|
|
74
|
+
"selector": { "files": ["datasets/**"] },
|
|
75
|
+
"output": { "path": "./data" }
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or write a standalone `.npmdatarc` (JSON object at the top level):
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"sets": [
|
|
87
|
+
{
|
|
88
|
+
"package": "base-datasets@^3.0.0",
|
|
89
|
+
"selector": { "files": ["datasets/**"] },
|
|
90
|
+
"output": { "path": "./data" }
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Then run any command without `--packages`:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
npx npmdata # same as 'npx npmdata extract'
|
|
100
|
+
npx npmdata extract # reads config, extracts all entries
|
|
101
|
+
npx npmdata check # checks all entries
|
|
102
|
+
npx npmdata purge # purges all entries
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Config is resolved using [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). Sources searched in order from the current directory:
|
|
106
|
+
|
|
107
|
+
| Source | Key / format |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `package.json` | `"npmdata"` key — object with `"sets"` array |
|
|
110
|
+
| `.npmdatarc` | JSON or YAML object with `"sets"` array |
|
|
111
|
+
| `.npmdatarc.json` | JSON object with `"sets"` array |
|
|
112
|
+
| `.npmdatarc.yaml` / `.npmdatarc.yml` | YAML object with `"sets"` array |
|
|
113
|
+
| `npmdata.config.js` | CommonJS module exporting object with `sets` array |
|
|
114
|
+
|
|
115
|
+
All runner flags (`--dry-run`, `--silent`, `--verbose`, `--no-gitignore`, `--unmanaged`, `--presets`, `--output`) work as usual.
|
|
116
|
+
|
|
117
|
+
**When to use:** When a consuming project wants to pin and automate a set of data extractions locally without publishing a separate data package. This is the lightest-weight approach — no extra package, no `init` step, just a config block and a single CLI call.
|
|
118
|
+
|
|
59
119
|
---
|
|
60
120
|
|
|
61
121
|
## Quick start
|
|
@@ -139,24 +199,26 @@ npx my-shared-assets extract --output ./data
|
|
|
139
199
|
npx my-shared-assets check --output ./data
|
|
140
200
|
```
|
|
141
201
|
|
|
142
|
-
When the data package defines multiple `npmdata` entries in its `package.json`, you can limit which entries are processed using the `--
|
|
202
|
+
When the data package defines multiple `npmdata` entries in its `package.json`, you can limit which entries are processed using the `--presets` option. Only entries whose `presets` list includes at least one of the requested presets will be extracted; entries with no presets are skipped when a preset filter is active.
|
|
143
203
|
|
|
144
204
|
```sh
|
|
145
205
|
# run only entries tagged with "prod"
|
|
146
|
-
npx my-shared-assets --
|
|
206
|
+
npx my-shared-assets --presets prod
|
|
147
207
|
|
|
148
208
|
# run entries tagged with either "prod" or "staging"
|
|
149
|
-
npx my-shared-assets --
|
|
209
|
+
npx my-shared-assets --presets prod,staging
|
|
150
210
|
```
|
|
151
211
|
|
|
152
|
-
To use
|
|
212
|
+
To use presets, add a `presets` array to each `npmdata` entry in the data package's `package.json`:
|
|
153
213
|
|
|
154
214
|
```json
|
|
155
215
|
{
|
|
156
|
-
"npmdata":
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
216
|
+
"npmdata": {
|
|
217
|
+
"sets": [
|
|
218
|
+
{ "package": "my-shared-assets", "output": { "path": "./data" }, "presets": ["prod"] },
|
|
219
|
+
{ "package": "my-dev-assets", "output": { "path": "./dev-data" }, "presets": ["dev", "staging"] }
|
|
220
|
+
]
|
|
221
|
+
}
|
|
160
222
|
}
|
|
161
223
|
```
|
|
162
224
|
|
|
@@ -168,8 +230,8 @@ When calling the bin script bundled in a data package, the following options are
|
|
|
168
230
|
|
|
169
231
|
| Option | Description |
|
|
170
232
|
|---|---|
|
|
171
|
-
| `--output, -o <dir>` | Base directory for resolving all `
|
|
172
|
-
| `--
|
|
233
|
+
| `--output, -o <dir>` | Base directory for resolving all `output.path` values (default: cwd). |
|
|
234
|
+
| `--presets <preset1,preset2>` | Limit to entries whose `presets` overlap with the given list (comma-separated). |
|
|
173
235
|
| `--no-gitignore` | Disable `.gitignore` management for every entry, overriding each entry's `gitignore` field. |
|
|
174
236
|
| `--unmanaged` | Run every entry in unmanaged mode, overriding each entry's `unmanaged` field. Files are written without a `.npmdata` marker, without `.gitignore` updates, and without being made read-only. |
|
|
175
237
|
| `--dry-run` | Simulate changes without writing or deleting any files. |
|
|
@@ -188,32 +250,32 @@ npx my-shared-assets --no-gitignore --unmanaged --dry-run
|
|
|
188
250
|
|
|
189
251
|
### npmdata entry options reference
|
|
190
252
|
|
|
191
|
-
Each entry in the `npmdata` array in `package.json` supports the following options:
|
|
253
|
+
Each entry in the `npmdata.sets` array in `package.json` supports the following options:
|
|
192
254
|
|
|
193
255
|
| Option | Type | Default | Description |
|
|
194
256
|
|---|---|---|---|
|
|
195
257
|
| `package` | `string` | required | Package spec to install and extract. Either a bare name (`my-pkg`) or with a semver constraint (`my-pkg@^1.2.3`). |
|
|
196
|
-
| `
|
|
197
|
-
| `files` | `string[]` | all files | Glob patterns to filter which files are extracted (e.g. `["data/**", "*.json"]`). |
|
|
198
|
-
| `contentRegexes` | `string[]` | none | Regex patterns (as strings) to filter files by content. Only files matching at least one pattern are extracted. |
|
|
199
|
-
| `force` | `boolean` | `false` | Allow overwriting existing unmanaged files or files owned by a different package. |
|
|
200
|
-
| `keepExisting` | `boolean` | `false` | Skip files that already exist but create them when absent. Cannot be combined with `force`. |
|
|
201
|
-
| `gitignore` | `boolean` | `true` | Create/update a `.gitignore` file alongside each `.npmdata` marker file. Set to `false` to disable. |
|
|
202
|
-
| `unmanaged` | `boolean` | `false` | Write files without a `.npmdata` marker, `.gitignore` update, or read-only flag. Existing files are skipped. |
|
|
203
|
-
| `dryRun` | `boolean` | `false` | Simulate extraction without writing anything to disk. |
|
|
258
|
+
| `output.path` | `string` | required | Directory where files will be extracted, relative to where the consumer runs the command. |
|
|
259
|
+
| `selector.files` | `string[]` | all files | Glob patterns to filter which files are extracted (e.g. `["data/**", "*.json"]`). |
|
|
260
|
+
| `selector.contentRegexes` | `string[]` | none | Regex patterns (as strings) to filter files by content. Only files matching at least one pattern are extracted. |
|
|
261
|
+
| `output.force` | `boolean` | `false` | Allow overwriting existing unmanaged files or files owned by a different package. |
|
|
262
|
+
| `output.keepExisting` | `boolean` | `false` | Skip files that already exist but create them when absent. Cannot be combined with `force`. |
|
|
263
|
+
| `output.gitignore` | `boolean` | `true` | Create/update a `.gitignore` file alongside each `.npmdata` marker file. Set to `false` to disable. |
|
|
264
|
+
| `output.unmanaged` | `boolean` | `false` | Write files without a `.npmdata` marker, `.gitignore` update, or read-only flag. Existing files are skipped. |
|
|
265
|
+
| `output.dryRun` | `boolean` | `false` | Simulate extraction without writing anything to disk. |
|
|
204
266
|
| `upgrade` | `boolean` | `false` | Force a fresh install of the package even when a satisfying version is already installed. |
|
|
205
267
|
| `silent` | `boolean` | `false` | Suppress per-file output, printing only the final result line. |
|
|
206
|
-
| `
|
|
207
|
-
| `symlinks` | `SymlinkConfig[]` | none | Post-extract symlink operations (see below). |
|
|
208
|
-
| `contentReplacements` | `ContentReplacementConfig[]` | none | Post-extract content-replacement operations (see below). |
|
|
268
|
+
| `presets` | `string[]` | none | Presets used to group and selectively run entries with `--presets`. |
|
|
269
|
+
| `output.symlinks` | `SymlinkConfig[]` | none | Post-extract symlink operations (see below). |
|
|
270
|
+
| `output.contentReplacements` | `ContentReplacementConfig[]` | none | Post-extract content-replacement operations (see below). |
|
|
209
271
|
|
|
210
272
|
#### SymlinkConfig
|
|
211
273
|
|
|
212
|
-
After extraction, for each config the runner resolves all files/directories inside `
|
|
274
|
+
After extraction, for each config the runner resolves all files/directories inside `output.path` that match `source` and creates a corresponding symlink inside `target`. Stale symlinks pointing into `output.path` but no longer matched are removed automatically.
|
|
213
275
|
|
|
214
276
|
| Field | Type | Description |
|
|
215
277
|
|---|---|---|
|
|
216
|
-
| `source` | `string` | Glob pattern relative to `
|
|
278
|
+
| `source` | `string` | Glob pattern relative to `output.path`. Every matching file or directory gets a symlink in `target`. Example: `"**\/skills\/**"` |
|
|
217
279
|
| `target` | `string` | Directory where symlinks are created, relative to the project root. Example: `".github/skills"` |
|
|
218
280
|
|
|
219
281
|
#### ContentReplacementConfig
|
|
@@ -233,17 +295,21 @@ Example with multiple options:
|
|
|
233
295
|
"npmdata": [
|
|
234
296
|
{
|
|
235
297
|
"package": "my-shared-assets@^2.0.0",
|
|
236
|
-
"
|
|
237
|
-
|
|
238
|
-
|
|
298
|
+
"selector": {
|
|
299
|
+
"files": ["docs/**", "configs/*.json"]
|
|
300
|
+
},
|
|
301
|
+
"output": {
|
|
302
|
+
"path": "./data",
|
|
303
|
+
"gitignore": true,
|
|
304
|
+
"symlinks": [
|
|
305
|
+
{ "source": "**\/skills\/**", "target": ".github/skills" }
|
|
306
|
+
],
|
|
307
|
+
"contentReplacements": [
|
|
308
|
+
{ "files": "docs/**\/*.md", "match": "<!-- version: .* -->", "replace": "<!-- version: 2.0.0 -->" }
|
|
309
|
+
]
|
|
310
|
+
},
|
|
239
311
|
"upgrade": true,
|
|
240
|
-
"
|
|
241
|
-
"symlinks": [
|
|
242
|
-
{ "source": "**\/skills\/**", "target": ".github/skills" }
|
|
243
|
-
],
|
|
244
|
-
"contentReplacements": [
|
|
245
|
-
{ "files": "docs/**\/*.md", "match": "<!-- version: .* -->", "replace": "<!-- version: 2.0.0 -->" }
|
|
246
|
-
]
|
|
312
|
+
"presets": ["prod"]
|
|
247
313
|
}
|
|
248
314
|
]
|
|
249
315
|
}
|
|
@@ -262,10 +328,10 @@ npx npmdata check --packages "my-shared-assets,another-pkg" --output ./data
|
|
|
262
328
|
The check command reports differences per package:
|
|
263
329
|
|
|
264
330
|
```
|
|
265
|
-
my-shared-assets
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
331
|
+
my-shared-assets@2.1.0: out of sync
|
|
332
|
+
- missing: data/new-file.json
|
|
333
|
+
~ modified: data/configs/app.config.json
|
|
334
|
+
+ extra: data/old-file.json
|
|
269
335
|
```
|
|
270
336
|
|
|
271
337
|
### 4. List managed files
|
|
@@ -318,7 +384,7 @@ Commands:
|
|
|
318
384
|
|
|
319
385
|
Global options:
|
|
320
386
|
--help, -h Show help
|
|
321
|
-
--version
|
|
387
|
+
--version Show version
|
|
322
388
|
|
|
323
389
|
Init options:
|
|
324
390
|
--files <patterns> Comma-separated glob patterns of files to publish (required)
|
|
@@ -335,11 +401,16 @@ Init options:
|
|
|
335
401
|
and without being made read-only. Existing files are skipped.
|
|
336
402
|
|
|
337
403
|
Extract options:
|
|
338
|
-
--packages <specs> Comma-separated package specs
|
|
404
|
+
--packages <specs> Comma-separated package specs.
|
|
405
|
+
When omitted, npmdata searches for a configuration file
|
|
406
|
+
(package.json "npmdata" key, .npmdatarc, etc.) and runs all
|
|
407
|
+
entries defined there.
|
|
339
408
|
Each spec is "name" or "name@version", e.g.
|
|
340
409
|
"my-pkg@^1.0.0,other-pkg@2.x"
|
|
341
410
|
--output, -o <dir> Output directory (default: current directory)
|
|
342
411
|
--force Overwrite existing unmanaged files or files owned by a different package
|
|
412
|
+
--keep-existing Skip files that already exist; create them when absent. Cannot be
|
|
413
|
+
combined with --force
|
|
343
414
|
--no-gitignore Skip creating/updating .gitignore (gitignore is enabled by default)
|
|
344
415
|
--unmanaged Write files without a .npmdata marker, .gitignore update, or read-only
|
|
345
416
|
flag. Existing files are skipped. Files can be freely edited afterwards
|
|
@@ -348,13 +419,17 @@ Extract options:
|
|
|
348
419
|
--content-regex <regex> Regex to filter files by content
|
|
349
420
|
--dry-run Preview changes without writing any files
|
|
350
421
|
--upgrade Reinstall the package even if already present
|
|
422
|
+
--silent Print only the final result line, suppressing per-file output
|
|
423
|
+
--verbose, -v Print detailed progress information for each step
|
|
351
424
|
|
|
352
425
|
Check options:
|
|
353
|
-
--packages <specs> Same format as extract
|
|
426
|
+
--packages <specs> Same format as extract.
|
|
427
|
+
When omitted, reads from a configuration file (see Pattern 3).
|
|
354
428
|
--output, -o <dir> Output directory to check (default: current directory)
|
|
355
429
|
|
|
356
430
|
Purge options:
|
|
357
|
-
--packages <specs> Comma-separated package names whose managed files should be removed
|
|
431
|
+
--packages <specs> Comma-separated package names whose managed files should be removed.
|
|
432
|
+
When omitted, reads from a configuration file (see Pattern 3).
|
|
358
433
|
--output, -o <dir> Output directory to purge from (default: current directory)
|
|
359
434
|
--dry-run Simulate purge without removing any files
|
|
360
435
|
--silent Suppress per-file output
|
|
@@ -461,8 +536,8 @@ await purge({
|
|
|
461
536
|
});
|
|
462
537
|
|
|
463
538
|
// list all files managed by npmdata in an output directory
|
|
464
|
-
const managed =
|
|
465
|
-
// managed is
|
|
539
|
+
const managed = list('./data');
|
|
540
|
+
// managed is Array<{ packageName: string; packageVersion: string; files: string[] }>
|
|
466
541
|
|
|
467
542
|
// initialize a publisher package
|
|
468
543
|
await initPublisher(['docs', 'data'], { workingDir: './my-package' });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCheck = runCheck;
|
|
4
|
+
const argv_1 = require("../argv");
|
|
5
|
+
const usage_1 = require("../usage");
|
|
6
|
+
const action_check_1 = require("../../package/action-check");
|
|
7
|
+
/**
|
|
8
|
+
* `check` CLI action handler.
|
|
9
|
+
*/
|
|
10
|
+
async function runCheck(config, argv, cwd) {
|
|
11
|
+
if (argv.includes('--help')) {
|
|
12
|
+
(0, usage_1.printUsage)('check');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let parsed;
|
|
16
|
+
try {
|
|
17
|
+
parsed = (0, argv_1.parseArgv)(argv);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error(`Error: ${error.message}`);
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!config || config.sets.length === 0) {
|
|
25
|
+
console.error('Error: No config found and no --packages specified.');
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const overridden = (0, argv_1.applyArgvOverrides)(config.sets, parsed);
|
|
30
|
+
try {
|
|
31
|
+
const summary = await (0, action_check_1.actionCheck)({
|
|
32
|
+
entries: overridden,
|
|
33
|
+
config,
|
|
34
|
+
cwd,
|
|
35
|
+
verbose: parsed.verbose,
|
|
36
|
+
skipUnmanaged: parsed.unmanaged,
|
|
37
|
+
});
|
|
38
|
+
const hasDrift = summary.missing.length > 0 || summary.modified.length > 0 || summary.extra.length > 0;
|
|
39
|
+
if (hasDrift) {
|
|
40
|
+
for (const f of summary.missing)
|
|
41
|
+
console.log(`missing: ${f}`);
|
|
42
|
+
for (const f of summary.modified)
|
|
43
|
+
console.log(`modified: ${f}`);
|
|
44
|
+
for (const f of summary.extra)
|
|
45
|
+
console.log(`extra: ${f}`);
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.log('All managed files are in sync.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error(`Error: ${error.message}`);
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/cli/actions/check.ts"],"names":[],"mappings":";;AASA,4BAmDC;AA1DD,kCAAwD;AACxD,oCAAsC;AACtC,6DAAyD;AAEzD;;GAEG;AACI,KAAK,UAAU,QAAQ,CAC5B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,OAAO,CAAC,CAAC;QACpB,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,O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,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NpmdataConfig } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* `extract` CLI action handler.
|
|
4
|
+
* Parses argv, merges with config, calls actionExtract, prints summary.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runExtract(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/extract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAuEf"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runExtract = runExtract;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
const node_child_process_1 = require("node:child_process");
|
|
6
|
+
const argv_1 = require("../argv");
|
|
7
|
+
const usage_1 = require("../usage");
|
|
8
|
+
const action_extract_1 = require("../../package/action-extract");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
/**
|
|
11
|
+
* `extract` CLI action handler.
|
|
12
|
+
* Parses argv, merges with config, calls actionExtract, prints summary.
|
|
13
|
+
*/
|
|
14
|
+
async function runExtract(config, argv, cwd) {
|
|
15
|
+
if (argv.includes('--help')) {
|
|
16
|
+
(0, usage_1.printUsage)('extract');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let parsed;
|
|
20
|
+
try {
|
|
21
|
+
parsed = (0, argv_1.parseArgv)(argv);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error(`Error: ${error.message}`);
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Build entries: --packages overrides config sets
|
|
29
|
+
let entries = (0, argv_1.buildEntriesFromArgv)(parsed);
|
|
30
|
+
if (!entries) {
|
|
31
|
+
if (!config || config.sets.length === 0) {
|
|
32
|
+
console.error('Error: No packages specified. Use --packages or a config file with sets.');
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Config-sourced entries need CLI flag overrides applied
|
|
37
|
+
entries = (0, argv_1.applyArgvOverrides)(config.sets, parsed);
|
|
38
|
+
}
|
|
39
|
+
// Apply preset filter
|
|
40
|
+
const presets = parsed.presets ?? [];
|
|
41
|
+
const filtered = (0, utils_1.filterEntriesByPresets)(entries, presets);
|
|
42
|
+
if (filtered.length === 0) {
|
|
43
|
+
console.log('No entries matched the specified presets.');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const result = await (0, action_extract_1.actionExtract)({
|
|
48
|
+
entries: filtered,
|
|
49
|
+
config,
|
|
50
|
+
cwd,
|
|
51
|
+
verbose: parsed.verbose,
|
|
52
|
+
onProgress: (event) => {
|
|
53
|
+
if (filtered[0]?.silent)
|
|
54
|
+
return;
|
|
55
|
+
if (event.type === 'file-added')
|
|
56
|
+
console.log(` + ${event.file}`);
|
|
57
|
+
else if (event.type === 'file-modified')
|
|
58
|
+
console.log(` ~ ${event.file}`);
|
|
59
|
+
else if (event.type === 'file-deleted')
|
|
60
|
+
console.log(` - ${event.file}`);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
// Run postExtractScript if configured and not dry-run
|
|
64
|
+
const isDryRun = filtered.some((e) => e.output.dryRun);
|
|
65
|
+
if (!isDryRun && config?.postExtractScript) {
|
|
66
|
+
const scriptCmd = `${config.postExtractScript} ${argv.join(' ')}`.trim();
|
|
67
|
+
try {
|
|
68
|
+
(0, node_child_process_1.execSync)(scriptCmd, { cwd, stdio: 'inherit', encoding: 'utf8' });
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const e = error;
|
|
72
|
+
process.exitCode = e.status ?? 1;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
console.log(`Extract complete: ${result.added} added, ${result.modified} modified, ` +
|
|
77
|
+
`${result.deleted} deleted, ${result.skipped} skipped.`);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error(`Error: ${error.message}`);
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../../../src/cli/actions/extract.ts"],"names":[],"mappings":";;AAaA,gCA2EC;AAxFD,+BAA+B;AAC/B,2DAA8C;AAG9C,kCAA8E;AAC9E,oCAAsC;AACtC,iEAA6D;AAC7D,uCAAqD;AAErD;;;GAGG;AACI,KAAK,UAAU,UAAU,CAC9B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,SAAS,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,kDAAkD;IAClD,IAAI,OAAO,GAAG,IAAA,2BAAoB,EAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,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B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CAsBf"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runInit = runInit;
|
|
7
|
+
/* eslint-disable no-console */
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const argv_1 = require("../argv");
|
|
10
|
+
const usage_1 = require("../usage");
|
|
11
|
+
const action_init_1 = require("../../package/action-init");
|
|
12
|
+
/**
|
|
13
|
+
* `init` CLI action handler.
|
|
14
|
+
*/
|
|
15
|
+
async function runInit(config, argv, cwd) {
|
|
16
|
+
if (argv.includes('--help')) {
|
|
17
|
+
(0, usage_1.printUsage)('init');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const parsed = (0, argv_1.parseArgv)(argv);
|
|
21
|
+
const outputDir = parsed.output ? node_path_1.default.resolve(cwd, parsed.output) : cwd;
|
|
22
|
+
const { verbose, files, packages } = parsed;
|
|
23
|
+
const initConfig = {
|
|
24
|
+
files,
|
|
25
|
+
packages: packages?.map((p) => (p.version ? `${p.name}@${p.version}` : p.name)),
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
await (0, action_init_1.actionInit)(outputDir, verbose, initConfig);
|
|
29
|
+
console.log('Init complete. Scaffolded package.json and bin/npmdata.js.');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error(`Error: ${error.message}`);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli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|
1
|
+
import { NpmdataConfig } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* `list` CLI action handler.
|
|
4
|
+
* Note: list always ignores --presets.
|
|
5
|
+
*/
|
|
6
|
+
export declare function runList(config: NpmdataConfig | null, argv: string[], cwd: string): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/actions/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,MAAM,EAAE,aAAa,GAAG,IAAI,EAC5B,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runList = runList;
|
|
4
|
+
const argv_1 = require("../argv");
|
|
5
|
+
const usage_1 = require("../usage");
|
|
6
|
+
const action_list_1 = require("../../package/action-list");
|
|
7
|
+
/**
|
|
8
|
+
* `list` CLI action handler.
|
|
9
|
+
* Note: list always ignores --presets.
|
|
10
|
+
*/
|
|
11
|
+
async function runList(config, argv, cwd) {
|
|
12
|
+
if (argv.includes('--help')) {
|
|
13
|
+
(0, usage_1.printUsage)('list');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const parsed = (0, argv_1.parseArgv)(argv);
|
|
17
|
+
const entries = config?.sets ?? [];
|
|
18
|
+
try {
|
|
19
|
+
const files = await (0, action_list_1.actionList)({
|
|
20
|
+
entries,
|
|
21
|
+
config,
|
|
22
|
+
cwd,
|
|
23
|
+
output: parsed.output,
|
|
24
|
+
verbose: parsed.verbose,
|
|
25
|
+
});
|
|
26
|
+
if (files.length === 0) {
|
|
27
|
+
if (parsed.verbose)
|
|
28
|
+
console.log('No managed files found.');
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
for (const f of files) {
|
|
32
|
+
console.log(`${f.path} ${f.packageName}@${f.packageVersion}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// list always exits 0
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(`Error: ${error.message}`);
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/actions/list.ts"],"names":[],"mappings":";;AAUA,0BAmCC;AA3CD,kCAAoC;AACpC,oCAAsC;AACtC,2DAAuD;AAEvD;;;GAGG;AACI,KAAK,UAAU,OAAO,CAC3B,MAA4B,EAC5B,IAAc,EACd,GAAW;IAEX,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;QACnB,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IAE/B,MAAM,OAAO,GAAG,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;IAEnC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,IAAA,wBAAU,EAAC;YAC7B,OAAO;YACP,MAAM;YACN,GAAG;YACH,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;QAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,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