@vltpkg/run 1.0.10 → 1.1.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/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { Manifest } from '@vltpkg/types';
4
4
  export * from './node-gyp.ts';
5
5
  /**
6
6
  * The user agent string set as `npm_config_user_agent` in lifecycle script
7
- * environments. Follows the conventional format used by package managers.
7
+ * environments. Matches the `user-agent` header sent with registry requests.
8
8
  */
9
9
  export declare const npmConfigUserAgent: string;
10
10
  /** options shared by run() and exec() */
@@ -53,7 +53,7 @@ export type RunOptions = SharedOptions & {
53
53
  /**
54
54
  * Pass in a manifest to avoid having to read it at all
55
55
  */
56
- manifest?: Pick<Manifest, 'scripts' | 'gypfile'>;
56
+ manifest?: Pick<Manifest, 'scripts' | 'gypfile' | 'hasInstallScript'>;
57
57
  /**
58
58
  * if the script is not defined in package.json#scripts, just ignore it and
59
59
  * treat as success. Otherwise, treat as an error. Default false.
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { error } from '@vltpkg/error-cause';
2
+ import { userAgent } from '@vltpkg/user-agent';
2
3
  import { PackageJson } from '@vltpkg/package-json';
3
4
  import { promiseSpawn } from '@vltpkg/promise-spawn';
4
5
  import { foregroundChild } from 'foreground-child';
@@ -11,9 +12,9 @@ import { getNodeGypShimDir, hasNodeGypReference, hasNodeGypBinding, } from "./no
11
12
  export * from "./node-gyp.js";
12
13
  /**
13
14
  * The user agent string set as `npm_config_user_agent` in lifecycle script
14
- * environments. Follows the conventional format used by package managers.
15
+ * environments. Matches the `user-agent` header sent with registry requests.
15
16
  */
16
- export const npmConfigUserAgent = `vlt/${process.version.slice(1)} node/${process.version} ${process.platform} ${process.arch}`;
17
+ export const npmConfigUserAgent = userAgent;
17
18
  /** map of which node_modules/.bin folders exist */
18
19
  const dotBins = new Map();
19
20
  /** Check if a directory exists, and cache result */
@@ -102,10 +103,13 @@ const runImpl = async (options, execImpl, empty) => {
102
103
  // npm adds a `"install": "node-gyp rebuild"` if a binding.gyp
103
104
  // is present at the time of publish, EVEN IF it's not included
104
105
  // in the package. So, we need to read the actual package.json
105
- // in those cases.
106
- const untrustworthy = !!(manifest?.gypfile &&
107
- arg0 === 'install' &&
108
- manifest.scripts?.install === 'node-gyp rebuild');
106
+ // in those cases. Likewise an abbreviated registry manifest only
107
+ // says `hasInstallScript`, and the scripts live on disk.
108
+ const untrustworthy = !!manifest &&
109
+ ((manifest.gypfile === true &&
110
+ arg0 === 'install' &&
111
+ manifest.scripts?.install === 'node-gyp rebuild') ||
112
+ (manifest.hasInstallScript === true && !manifest.scripts));
109
113
  const pj = (untrustworthy ? undefined : manifest) ??
110
114
  packageJson.read(options.cwd);
111
115
  const { scripts } = pj;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/run",
3
3
  "description": "Run package.json scripts and execute commands",
4
- "version": "1.0.10",
4
+ "version": "1.1.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -13,11 +13,12 @@
13
13
  "url": "http://vlt.sh"
14
14
  },
15
15
  "dependencies": {
16
- "@vltpkg/error-cause": "1.0.10",
17
- "@vltpkg/package-json": "1.0.10",
18
- "@vltpkg/promise-spawn": "1.0.10",
19
- "@vltpkg/types": "1.0.10",
20
- "@vltpkg/xdg": "1.0.10",
16
+ "@vltpkg/error-cause": "1.1.1",
17
+ "@vltpkg/package-json": "1.1.1",
18
+ "@vltpkg/promise-spawn": "1.1.1",
19
+ "@vltpkg/types": "1.1.1",
20
+ "@vltpkg/user-agent": "1.1.1",
21
+ "@vltpkg/xdg": "1.1.1",
21
22
  "foreground-child": "^3.3.1",
22
23
  "walk-up-path": "^4.0.0"
23
24
  },