A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/ef1c3687b35295993258127ad7a5b0fd323fba8b below:

package-json-from-dist@1.0.1 · npm/cli@ef1c368 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+27

-7

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+27

-7

lines changed Original file line number Diff line number Diff line change

@@ -5,6 +5,8 @@ const node_fs_1 = require("node:fs");

5 5

const node_path_1 = require("node:path");

6 6

const node_url_1 = require("node:url");

7 7

const NM = `${node_path_1.sep}node_modules${node_path_1.sep}`;

8 +

const STORE = `.store${node_path_1.sep}`;

9 +

const PKG = `${node_path_1.sep}package${node_path_1.sep}`;

8 10

const DIST = `${node_path_1.sep}dist${node_path_1.sep}`;

9 11

/**

10 12

* Find the package.json file, either from a TypeScript file somewhere not

@@ -59,8 +61,16 @@ const findPackageJson = (from, pathFromSrc = '../package.json') => {

59 61

// inside of node_modules. find the dist directly under package name.

60 62

const nm = __dirname.substring(0, nms + NM.length);

61 63

const pkgDir = __dirname.substring(nms + NM.length);

64 +

// affordance for yarn berry, which puts package contents in

65 +

// '.../node_modules/.store/${id}-${hash}/package/...'

66 +

if (pkgDir.startsWith(STORE)) {

67 +

const pkg = pkgDir.indexOf(PKG, STORE.length);

68 +

if (pkg) {

69 +

return (0, node_path_1.resolve)(nm, pkgDir.substring(0, pkg + PKG.length), 'package.json');

70 +

}

71 +

}

62 72

const pkgName = pkgDir.startsWith('@') ?

63 -

pkgDir.split(node_path_1.sep).slice(0, 2).join(node_path_1.sep)

73 +

pkgDir.split(node_path_1.sep, 2).join(node_path_1.sep)

64 74

: String(pkgDir.split(node_path_1.sep)[0]);

65 75

return (0, node_path_1.resolve)(nm, pkgName, 'package.json');

66 76

}

Original file line number Diff line number Diff line change

@@ -2,6 +2,8 @@ import { readFileSync } from 'node:fs';

2 2

import { dirname, resolve, sep } from 'node:path';

3 3

import { fileURLToPath } from 'node:url';

4 4

const NM = `${sep}node_modules${sep}`;

5 +

const STORE = `.store${sep}`;

6 +

const PKG = `${sep}package${sep}`;

5 7

const DIST = `${sep}dist${sep}`;

6 8

/**

7 9

* Find the package.json file, either from a TypeScript file somewhere not

@@ -56,8 +58,16 @@ export const findPackageJson = (from, pathFromSrc = '../package.json') => {

56 58

// inside of node_modules. find the dist directly under package name.

57 59

const nm = __dirname.substring(0, nms + NM.length);

58 60

const pkgDir = __dirname.substring(nms + NM.length);

61 +

// affordance for yarn berry, which puts package contents in

62 +

// '.../node_modules/.store/${id}-${hash}/package/...'

63 +

if (pkgDir.startsWith(STORE)) {

64 +

const pkg = pkgDir.indexOf(PKG, STORE.length);

65 +

if (pkg) {

66 +

return resolve(nm, pkgDir.substring(0, pkg + PKG.length), 'package.json');

67 +

}

68 +

}

59 69

const pkgName = pkgDir.startsWith('@') ?

60 -

pkgDir.split(sep).slice(0, 2).join(sep)

70 +

pkgDir.split(sep, 2).join(sep)

61 71

: String(pkgDir.split(sep)[0]);

62 72

return resolve(nm, pkgName, 'package.json');

63 73

}

Original file line number Diff line number Diff line change

@@ -1,6 +1,6 @@

1 1

{

2 2

"name": "package-json-from-dist",

3 -

"version": "1.0.0",

3 +

"version": "1.0.1",

4 4

"description": "Load the local package.json from either src or dist folder",

5 5

"main": "./dist/commonjs/index.js",

6 6

"exports": {

@@ -28,7 +28,7 @@

28 28

"presnap": "npm run prepare",

29 29

"test": "tap",

30 30

"snap": "tap",

31 -

"format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache",

31 +

"format": "prettier --write . --log-level warn",

32 32

"typedoc": "typedoc"

33 33

},

34 34

"author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)",

Original file line number Diff line number Diff line change

@@ -12880,9 +12880,9 @@

12880 12880

}

12881 12881

},

12882 12882

"node_modules/package-json-from-dist": {

12883 -

"version": "1.0.0",

12884 -

"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz",

12885 -

"integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==",

12883 +

"version": "1.0.1",

12884 +

"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",

12885 +

"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",

12886 12886

"inBundle": true,

12887 12887

"license": "BlueOak-1.0.0"

12888 12888

},

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4