npm-pkgbuild 8.1.2 → 8.2.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
CHANGED
|
@@ -36,7 +36,8 @@ You can specify the package content in package.json.
|
|
|
36
36
|
"type": "npm-pack"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"type": "node-modules"
|
|
39
|
+
"type": "node-modules",
|
|
40
|
+
"withoutDevelpmentDependencies": true
|
|
40
41
|
}
|
|
41
42
|
]
|
|
42
43
|
},
|
|
@@ -65,6 +66,10 @@ content as provided by npm pack
|
|
|
65
66
|
|
|
66
67
|
content of all (production) dependencies
|
|
67
68
|
|
|
69
|
+
options:
|
|
70
|
+
- withoutDevelpmentDependencies when to stip away dev dependencies
|
|
71
|
+
|
|
72
|
+
|
|
68
73
|
# API
|
|
69
74
|
|
|
70
75
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
27
27
|
|
|
28
28
|
constructor(definitions, entryProperties) {
|
|
29
29
|
super();
|
|
30
|
-
Object.assign(this, definitions);
|
|
30
|
+
Object.assign(this, { withoutDevelpmentDependencies: true }, definitions);
|
|
31
31
|
this.entryProperties = entryProperties;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -36,36 +36,44 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async *[Symbol.asyncIterator]() {
|
|
39
|
-
|
|
39
|
+
let pkgSourceDir = this.dir;
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
await
|
|
43
|
-
);
|
|
44
|
-
delete json.devDependencies;
|
|
45
|
-
await writeFile(
|
|
46
|
-
join(tmp, "package.json"),
|
|
47
|
-
JSON.stringify(json),
|
|
48
|
-
utf8StreamOptions
|
|
49
|
-
);
|
|
41
|
+
if (this.withoutDevelpmentDependencies) {
|
|
42
|
+
pkgSourceDir = await mkdtemp(join(tmpdir(), "node-modules"));
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
const json = JSON.parse(
|
|
45
|
+
await readFile(join(this.dir, "package.json"), utf8StreamOptions)
|
|
46
|
+
);
|
|
47
|
+
delete json.devDependencies;
|
|
48
|
+
await writeFile(
|
|
49
|
+
join(pkgSourceDir, "package.json"),
|
|
50
|
+
JSON.stringify(json),
|
|
51
|
+
utf8StreamOptions
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// TODO find .npmrc
|
|
55
|
+
const npmrc = parse(
|
|
56
|
+
await readFile(join(homedir(), ".npmrc"), utf8StreamOptions)
|
|
57
|
+
);
|
|
58
|
+
const arb = new Arborist({ path: pkgSourceDir, ...npmrc });
|
|
59
|
+
await arb.buildIdealTree({
|
|
60
|
+
update: true,
|
|
61
|
+
prune: true,
|
|
62
|
+
saveType: "prod"
|
|
63
|
+
});
|
|
64
|
+
await arb.prune({ saveType: "prod" });
|
|
65
|
+
await arb.reify({ save: true });
|
|
66
|
+
}
|
|
61
67
|
|
|
62
68
|
for (const name of await globby("node_modules/**/*", {
|
|
63
|
-
cwd:
|
|
69
|
+
cwd: pkgSourceDir
|
|
64
70
|
})) {
|
|
65
71
|
if (!toBeSkipped.test(name)) {
|
|
66
72
|
if (name.endsWith("package.json")) {
|
|
67
73
|
const json = shrinkNPM(
|
|
68
|
-
JSON.parse(
|
|
74
|
+
JSON.parse(
|
|
75
|
+
await readFile(join(pkgSourceDir, name), utf8StreamOptions)
|
|
76
|
+
),
|
|
69
77
|
{}
|
|
70
78
|
);
|
|
71
79
|
|
|
@@ -77,7 +85,7 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
77
85
|
}
|
|
78
86
|
} else {
|
|
79
87
|
yield Object.assign(
|
|
80
|
-
new FileSystemEntry(name,
|
|
88
|
+
new FileSystemEntry(name, pkgSourceDir),
|
|
81
89
|
this.entryProperties
|
|
82
90
|
);
|
|
83
91
|
}
|