@vltpkg/cli-sdk 1.6.0 → 1.6.1
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/dist/commands/init.js +5 -2
- package/dist/pack-tarball.d.ts +3 -1
- package/dist/pack-tarball.js +29 -19
- package/dist/telemetry.js +8 -1
- package/package.json +30 -30
package/dist/commands/init.js
CHANGED
|
@@ -76,7 +76,7 @@ export const command = async (conf) => {
|
|
|
76
76
|
// create the folder in case it's missing
|
|
77
77
|
mkdirSync(cwd, { recursive: true });
|
|
78
78
|
// run the initialization script and collect results
|
|
79
|
-
results.push(await init({ cwd }));
|
|
79
|
+
results.push(await init({ cwd, packageJson: conf.options.packageJson }));
|
|
80
80
|
// Check if this workspace path is covered by existing workspace patterns
|
|
81
81
|
const isMatched = Object.values(parsedWSConfig).some((group) => {
|
|
82
82
|
const { patterns, ignore } = splitNegatedPatterns(group);
|
|
@@ -136,7 +136,10 @@ export const command = async (conf) => {
|
|
|
136
136
|
await install({ ...conf.options, allowScripts });
|
|
137
137
|
return results;
|
|
138
138
|
}
|
|
139
|
-
const result = await init({
|
|
139
|
+
const result = await init({
|
|
140
|
+
cwd: process.cwd(),
|
|
141
|
+
packageJson: conf.options.packageJson,
|
|
142
|
+
});
|
|
140
143
|
// run install to set up node_modules and vlt-lock.json
|
|
141
144
|
await install({ ...conf.options, allowScripts });
|
|
142
145
|
return result;
|
package/dist/pack-tarball.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { NormalizedManifest } from '@vltpkg/types';
|
|
2
|
+
import type { Stats } from 'node:fs';
|
|
3
|
+
import type { ReadEntry } from 'tar';
|
|
2
4
|
import type { LoadedConfig } from './config/index.ts';
|
|
3
5
|
export type PackTarballResult = {
|
|
4
6
|
name: string;
|
|
@@ -27,7 +29,7 @@ export type PackTarballResult = {
|
|
|
27
29
|
* .npmrc, vlt.json, etc.) are excluded and always-included files (package.json,
|
|
28
30
|
* README, LICENSE, etc.) are included.
|
|
29
31
|
*/
|
|
30
|
-
export declare const buildPackFilter: (manifest: NormalizedManifest, packDir: string) => ((path: string) => boolean);
|
|
32
|
+
export declare const buildPackFilter: (manifest: NormalizedManifest, packDir: string) => ((path: string, entry: Stats | ReadEntry) => boolean);
|
|
31
33
|
/**
|
|
32
34
|
* Create a tarball from a package directory
|
|
33
35
|
* @param {NormalizedManifest} manifest - The manifest of the package to pack
|
package/dist/pack-tarball.js
CHANGED
|
@@ -3,7 +3,7 @@ import { minimatch } from 'minimatch';
|
|
|
3
3
|
import { error } from '@vltpkg/error-cause';
|
|
4
4
|
import * as ssri from 'ssri';
|
|
5
5
|
import assert from 'node:assert';
|
|
6
|
-
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
6
|
+
import { existsSync, readdirSync, readFileSync, statSync, } from 'node:fs';
|
|
7
7
|
import { Spec } from '@vltpkg/spec';
|
|
8
8
|
import { join } from 'node:path';
|
|
9
9
|
import { parse, stringify } from 'polite-json';
|
|
@@ -155,7 +155,24 @@ export const buildPackFilter = (manifest, packDir) => {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
// `files` entries are normalized like npm does: a leading `./` or `/`
|
|
159
|
+
// and trailing slashes are dropped, empty entries are skipped
|
|
160
|
+
const files = (manifestWithFiles.files ?? [])
|
|
161
|
+
.map(pattern => pattern.replace(/^\.?\//, '').replace(/\/+$/, ''))
|
|
162
|
+
.filter(Boolean);
|
|
163
|
+
// dirs that only partially match a `files` glob (e.g. `dist/nested` for
|
|
164
|
+
// `dist/**/*.js`) are descended, unless unreadable: npm's glob expansion
|
|
165
|
+
// skips those too
|
|
166
|
+
const isReadableDir = (dir) => {
|
|
167
|
+
try {
|
|
168
|
+
readdirSync(join(packDir, dir));
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
return (path, entry) => {
|
|
159
176
|
const normalizedPath = path.replace(/^\.\//, '');
|
|
160
177
|
if (path === '.' || normalizedPath === '') {
|
|
161
178
|
return true;
|
|
@@ -173,23 +190,16 @@ export const buildPackFilter = (manifest, packDir) => {
|
|
|
173
190
|
if (hasEmptyFilesField) {
|
|
174
191
|
return false;
|
|
175
192
|
}
|
|
176
|
-
if (hasFilesField
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
dot: true,
|
|
187
|
-
});
|
|
188
|
-
const isParentDir = pattern.includes('/') &&
|
|
189
|
-
pattern.startsWith(normalizedPath + '/');
|
|
190
|
-
const isChildOfPattern = minimatch(normalizedPath, pattern + '/**', { dot: true });
|
|
191
|
-
return directMatch || isParentDir || isChildOfPattern;
|
|
192
|
-
});
|
|
193
|
+
if (hasFilesField) {
|
|
194
|
+
const isDir = 'isDirectory' in entry && entry.isDirectory();
|
|
195
|
+
return (files.some(pattern => minimatch(normalizedPath, pattern, { dot: true }) ||
|
|
196
|
+
minimatch(normalizedPath, `${pattern}/**`, { dot: true })) ||
|
|
197
|
+
(isDir &&
|
|
198
|
+
files.some(pattern => minimatch(normalizedPath, pattern, {
|
|
199
|
+
dot: true,
|
|
200
|
+
partial: true,
|
|
201
|
+
})) &&
|
|
202
|
+
isReadableDir(normalizedPath)));
|
|
193
203
|
}
|
|
194
204
|
// Ignore-file mode: apply .npmignore or .gitignore deny patterns
|
|
195
205
|
if (ig?.ignores(normalizedPath)) {
|
package/dist/telemetry.js
CHANGED
|
@@ -73,9 +73,16 @@ const getClient = () => {
|
|
|
73
73
|
// call shutdown at the end so this is just a safety net.
|
|
74
74
|
flushAt: 20,
|
|
75
75
|
flushInterval: 10_000,
|
|
76
|
+
// one attempt, capped like flush(); failed sends resolve as 204
|
|
77
|
+
// so offline or erroring runs neither wait nor log
|
|
78
|
+
fetchRetryCount: 0,
|
|
79
|
+
requestTimeout: SHUTDOWN_TIMEOUT_MS,
|
|
80
|
+
fetch: async (url, init) => {
|
|
81
|
+
const res = await fetch(url, init).catch(() => undefined);
|
|
82
|
+
return res?.ok ? res : new Response(null, { status: 204 });
|
|
83
|
+
},
|
|
76
84
|
});
|
|
77
85
|
return _posthog;
|
|
78
|
-
/* c8 ignore next 4 */
|
|
79
86
|
}
|
|
80
87
|
catch {
|
|
81
88
|
_initFailed = true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/cli-sdk",
|
|
3
3
|
"description": "The source for the vlt CLI",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -14,35 +14,35 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
17
|
-
"@vltpkg/cmd-shim": "1.6.
|
|
18
|
-
"@vltpkg/config": "1.6.
|
|
19
|
-
"@vltpkg/dep-id": "1.6.
|
|
20
|
-
"@vltpkg/dot-prop": "1.6.
|
|
21
|
-
"@vltpkg/error-cause": "1.6.
|
|
22
|
-
"@vltpkg/git": "1.6.
|
|
23
|
-
"@vltpkg/graph": "1.6.
|
|
24
|
-
"@vltpkg/graph-run": "1.6.
|
|
25
|
-
"@vltpkg/init": "1.6.
|
|
26
|
-
"@vltpkg/output": "1.6.
|
|
27
|
-
"@vltpkg/package-info": "1.6.
|
|
28
|
-
"@vltpkg/package-json": "1.6.
|
|
29
|
-
"@vltpkg/pick-manifest": "1.6.
|
|
30
|
-
"@vltpkg/promise-spawn": "1.6.
|
|
31
|
-
"@vltpkg/query": "1.6.
|
|
32
|
-
"@vltpkg/registry-client": "1.6.
|
|
33
|
-
"@vltpkg/rollback-remove": "1.6.
|
|
34
|
-
"@vltpkg/run": "1.6.
|
|
35
|
-
"@vltpkg/security-archive": "1.6.
|
|
36
|
-
"@vltpkg/semver": "1.6.
|
|
37
|
-
"@vltpkg/spec": "1.6.
|
|
38
|
-
"@vltpkg/tar": "1.6.
|
|
39
|
-
"@vltpkg/types": "1.6.
|
|
40
|
-
"@vltpkg/url-open": "1.6.
|
|
41
|
-
"@vltpkg/vlt-json": "1.6.
|
|
42
|
-
"@vltpkg/vlx": "1.6.
|
|
43
|
-
"@vltpkg/which": "1.6.
|
|
44
|
-
"@vltpkg/workspaces": "1.6.
|
|
45
|
-
"@vltpkg/xdg": "1.6.
|
|
17
|
+
"@vltpkg/cmd-shim": "1.6.1",
|
|
18
|
+
"@vltpkg/config": "1.6.1",
|
|
19
|
+
"@vltpkg/dep-id": "1.6.1",
|
|
20
|
+
"@vltpkg/dot-prop": "1.6.1",
|
|
21
|
+
"@vltpkg/error-cause": "1.6.1",
|
|
22
|
+
"@vltpkg/git": "1.6.1",
|
|
23
|
+
"@vltpkg/graph": "1.6.1",
|
|
24
|
+
"@vltpkg/graph-run": "1.6.1",
|
|
25
|
+
"@vltpkg/init": "1.6.1",
|
|
26
|
+
"@vltpkg/output": "1.6.1",
|
|
27
|
+
"@vltpkg/package-info": "1.6.1",
|
|
28
|
+
"@vltpkg/package-json": "1.6.1",
|
|
29
|
+
"@vltpkg/pick-manifest": "1.6.1",
|
|
30
|
+
"@vltpkg/promise-spawn": "1.6.1",
|
|
31
|
+
"@vltpkg/query": "1.6.1",
|
|
32
|
+
"@vltpkg/registry-client": "1.6.1",
|
|
33
|
+
"@vltpkg/rollback-remove": "1.6.1",
|
|
34
|
+
"@vltpkg/run": "1.6.1",
|
|
35
|
+
"@vltpkg/security-archive": "1.6.1",
|
|
36
|
+
"@vltpkg/semver": "1.6.1",
|
|
37
|
+
"@vltpkg/spec": "1.6.1",
|
|
38
|
+
"@vltpkg/tar": "1.6.1",
|
|
39
|
+
"@vltpkg/types": "1.6.1",
|
|
40
|
+
"@vltpkg/url-open": "1.6.1",
|
|
41
|
+
"@vltpkg/vlt-json": "1.6.1",
|
|
42
|
+
"@vltpkg/vlx": "1.6.1",
|
|
43
|
+
"@vltpkg/which": "1.6.1",
|
|
44
|
+
"@vltpkg/workspaces": "1.6.1",
|
|
45
|
+
"@vltpkg/xdg": "1.6.1",
|
|
46
46
|
"ansi-to-pre": "^1.0.6",
|
|
47
47
|
"beautiful-mermaid": "^1.1.3",
|
|
48
48
|
"chalk": "^5.6.2",
|