pkgprn 0.2.1 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkgprn",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",
6
6
  "bin": "./index.js",
@@ -14,6 +14,13 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "description": "Prune package.json before publish",
17
+ "keywords": [
18
+ "npm",
19
+ "package",
20
+ "cleanup",
21
+ "pack",
22
+ "prepack"
23
+ ],
17
24
  "homepage": "https://github.com/kshutkin/package-prune#readme",
18
25
  "bugs": {
19
26
  "url": "https://github.com/kshutkin/package-prune/issues"
@@ -0,0 +1,35 @@
1
+ declare module 'pkgprn' {
2
+ /**
3
+ * Prunes a package.json object according to the given options.
4
+ * */
5
+ export function prunePkg(pkg: PackageJson, options: PruneOptions, logger: Logger): Promise<void>;
6
+ export type Logger = import("@niceties/logger").Logger;
7
+ export type PackageJson = {
8
+ scripts?: {
9
+ [x: string]: string;
10
+ } | undefined;
11
+ devDependencies?: {
12
+ [x: string]: string;
13
+ } | undefined;
14
+ packageManager?: string | undefined;
15
+ main?: string | undefined;
16
+ bin?: string | {
17
+ [x: string]: string;
18
+ } | undefined;
19
+ files?: string[] | undefined;
20
+ directories?: Record<string, unknown> | undefined;
21
+ exports?: Record<string, unknown> | undefined;
22
+ typesVersions?: Record<string, unknown> | undefined;
23
+ };
24
+ export type PruneOptions = {
25
+ profile: string;
26
+ flatten: string | boolean;
27
+ removeSourcemaps: boolean;
28
+ optimizeFiles: boolean;
29
+ cleanupFiles: boolean;
30
+ };
31
+
32
+ export {};
33
+ }
34
+
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.d.ts",
4
+ "names": [
5
+ "prunePkg",
6
+ "Logger"
7
+ ],
8
+ "sources": [
9
+ "../prune.js"
10
+ ],
11
+ "sourcesContent": [
12
+ null
13
+ ],
14
+ "mappings": ";;;;iBAmEsBA,QAAQA;aA/BUC,MAAMA",
15
+ "ignoreList": []
16
+ }
@@ -1,8 +0,0 @@
1
- # Changesets
2
-
3
- Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
- with multi-package repos, or single-package repos to help you version and publish your code. You can
5
- find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
-
7
- We have a quick list of common questions to get you started engaging with this project in
8
- [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
3
- "changelog": "@changesets/cli/changelog",
4
- "commit": false,
5
- "fixed": [],
6
- "linked": [],
7
- "access": "public",
8
- "baseBranch": "main",
9
- "updateInternalDependencies": "patch",
10
- "ignore": []
11
- }
@@ -1,28 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - main
5
- - '[0-9]+.[0-9]+.x'
6
- - '[0-9]+.x.x'
7
- - '[0-9]+.x'
8
- - next
9
- - next-major
10
- - alpha
11
- - beta
12
- pull_request:
13
- branches:
14
- - main
15
- - '[0-9]+.[0-9]+.x'
16
- - '[0-9]+.x.x'
17
- - '[0-9]+.x'
18
- - next
19
- - next-major
20
- - alpha
21
- - beta
22
-
23
- jobs:
24
- pipeline:
25
- uses: kshutkin/pipeline/.github/workflows/main.yml@main
26
- secrets: inherit
27
- with:
28
- has-dist: false
package/CHANGELOG.md DELETED
@@ -1,24 +0,0 @@
1
- # pkgprn
2
-
3
- ## 0.2.1
4
-
5
- ### Patch Changes
6
-
7
- - 5182c31: added types
8
-
9
- ## 0.2.0
10
-
11
- ### Minor Changes
12
-
13
- - c234bfb: improved cleanup
14
- - 1ad1966: support multiple paths for flatten
15
-
16
- ### Patch Changes
17
-
18
- - 34d968a: better walkDir
19
-
20
- ## 0.1.0
21
-
22
- ### Minor Changes
23
-
24
- - 7ba2122: initial release
package/biome.json DELETED
@@ -1,62 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/2.3.2/schema.json",
3
- "linter": {
4
- "enabled": true,
5
- "rules": {
6
- "recommended": true
7
- }
8
- },
9
- "assist": {
10
- "actions": {
11
- "source": {
12
- "organizeImports": {
13
- "level": "on",
14
- "options": {
15
- "groups": [
16
- ":NODE:",
17
- ":BLANK_LINE:",
18
- { "type": false, "source": [":PACKAGE:", "!@slimlib/**", "!@niceties/**"] },
19
- ":BLANK_LINE:",
20
- { "type": false, "source": ["@slimlib/**", "@niceties/**"] },
21
- ":BLANK_LINE:",
22
- { "type": false, "source": ":PATH:" }
23
- ]
24
- }
25
- }
26
- }
27
- }
28
- },
29
- "formatter": {
30
- "enabled": true,
31
- "formatWithErrors": false,
32
- "indentStyle": "space",
33
- "indentWidth": 4,
34
- "lineEnding": "lf",
35
- "lineWidth": 140
36
- },
37
- "javascript": {
38
- "formatter": {
39
- "quoteStyle": "single",
40
- "jsxQuoteStyle": "single",
41
- "quoteProperties": "asNeeded",
42
- "trailingCommas": "es5",
43
- "semicolons": "always",
44
- "arrowParentheses": "asNeeded",
45
- "bracketSpacing": true,
46
- "bracketSameLine": false,
47
- "attributePosition": "auto"
48
- }
49
- },
50
- "json": {
51
- "formatter": {
52
- "enabled": true,
53
- "indentWidth": 4,
54
- "lineWidth": 140
55
- }
56
- },
57
- "vcs": {
58
- "enabled": true,
59
- "clientKind": "git",
60
- "useIgnoreFile": true
61
- }
62
- }
package/ci.env DELETED
@@ -1 +0,0 @@
1
- CI=true
@@ -1,4 +0,0 @@
1
- overrides:
2
- yargs: ^18.0.0
3
- onlyBuiltDependencies:
4
- - "@biomejs/biome"
package/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:recommended"
5
- ]
6
- }
package/tests/test.js DELETED
@@ -1,205 +0,0 @@
1
- import cd from 'node:child_process';
2
- import { promisify, parseArgs } from 'node:util';
3
- import assert from 'node:assert';
4
- import test, { after, describe } from 'node:test';
5
- import fs from 'node:fs/promises';
6
- import process from 'node:process';
7
- import { filesToString, stringToFiles } from 'cli-test-helper';
8
- import tests from './tests.json' with { type: 'json' };
9
-
10
- const exec = promisify(cd.exec);
11
-
12
- const dir = './tests/tmp';
13
-
14
- /**
15
- * @typedef {Object} TestCase
16
- * @property {number} id
17
- * @property {string} name
18
- * @property {string} input
19
- * @property {string} output
20
- * @property {string} stdout
21
- * @property {string} stderr
22
- * @property {string} [args]
23
- * @property {number} [exitCode]
24
- */
25
-
26
- /**
27
- * @typedef {Record<string, TestCase[]>} TestSuites
28
- */
29
-
30
- /**
31
- * @typedef {Object} ExecResult
32
- * @property {number} [code]
33
- * @property {string} [stdout]
34
- * @property {string} [stderr]
35
- */
36
-
37
- /**
38
- * @typedef {Object} ExecError
39
- * @property {number} code
40
- * @property {string} [stdout]
41
- * @property {string} [stderr]
42
- */
43
-
44
- const args = parseArgs({
45
- options: {
46
- update: {
47
- type: 'boolean',
48
- short: 'u',
49
- default: false,
50
- },
51
- capture: {
52
- type: 'string',
53
- short: 'c',
54
- },
55
- export: {
56
- type: 'string',
57
- short: 'e',
58
- },
59
- result: {
60
- type: 'string',
61
- short: 'r',
62
- },
63
- },
64
- }).values;
65
-
66
- /** @type {TestCase[]} */
67
- const allTestCases = Object.entries(/** @type {TestSuites} */ (tests)).flatMap(
68
- (entry) => entry[1].map((testCase) => /** @type {TestCase} */ (testCase))
69
- );
70
-
71
- if ('capture' in args) {
72
- const capture =
73
- Number(args.capture) ||
74
- allTestCases.reduce((max, testCase) => Math.max(max, testCase.id), 0) +
75
- 1;
76
- let testCase = allTestCases.find((testCase) => testCase.id === capture);
77
- if (!testCase) {
78
- /** @type {TestCase} */
79
- testCase = {
80
- id: capture,
81
- name: '',
82
- input: '',
83
- output: '',
84
- stdout: '',
85
- stderr: '',
86
- };
87
- const testsObj = /** @type {Record<string, TestCase[]>} */ (tests);
88
- if (!testsObj.capture) {
89
- testsObj.capture = [];
90
- }
91
- testsObj.capture.push(testCase);
92
- }
93
- testCase.input = await captureFiles();
94
- await writeTestCases();
95
- process.exit(0);
96
- }
97
-
98
- if ('export' in args) {
99
- const exportN = Number(args.export);
100
- const testCase = allTestCases.find((testCase) => testCase.id === exportN);
101
- if (!testCase) {
102
- console.error(`Test case not found: ${JSON.stringify(exportN)}`);
103
- process.exit(1);
104
- }
105
- await exportFiles(testCase);
106
- process.exit(0);
107
- }
108
-
109
- if ('result' in args) {
110
- const exportN = Number(args.result);
111
- const testCase = allTestCases.find((testCase) => testCase.id === exportN);
112
- if (!testCase) {
113
- console.error(`Test case not found: ${JSON.stringify(exportN)}`);
114
- process.exit(1);
115
- }
116
- await exportFiles(testCase, true);
117
- process.exit(0);
118
- }
119
-
120
- for (const [suiteName, suiteTestCases] of Object.entries(tests)) {
121
- describe(suiteName, () => {
122
- for (const testCase of suiteTestCases) {
123
- const tc = /** @type {TestCase} */ (testCase);
124
- test(tc.name, async () => {
125
- await exportFiles(tc);
126
- /** @type {ExecResult | ExecError} */
127
- let result;
128
- try {
129
- result = await exec(
130
- `cd ${dir}; node ../../index.js ${tc.args || ''}`
131
- );
132
- } catch (e) {
133
- result = /** @type {ExecError} */ (e);
134
- }
135
-
136
- const actualOutput = await captureFiles();
137
-
138
- if (args.update) {
139
- tc.output = actualOutput;
140
- tc.exitCode = result?.code || 0;
141
- tc.stdout = replaceTime(result?.stdout || '');
142
- tc.stderr = result?.stderr || '';
143
- assert.ok(true);
144
- } else {
145
- assert.strictEqual(actualOutput, tc.output);
146
- assert.strictEqual(result?.code || 0, tc.exitCode || 0);
147
- assert.strictEqual(
148
- replaceTime(result?.stdout || ''),
149
- tc.stdout
150
- );
151
- assert.strictEqual(result?.stderr || '', tc.stderr);
152
- }
153
- });
154
- }
155
- });
156
- }
157
-
158
- after(async () => {
159
- await cleanDir();
160
- if (args.update) {
161
- await writeTestCases();
162
- }
163
- });
164
-
165
- /**
166
- * @param {TestCase} testCase
167
- * @param {boolean} [output=false]
168
- */
169
- async function exportFiles(testCase, output = false) {
170
- await cleanDir();
171
- await fs.mkdir(dir, { recursive: true });
172
- await stringToFiles(output ? testCase.output : testCase.input, dir);
173
- }
174
-
175
- /**
176
- * @returns {Promise<string>}
177
- */
178
- async function captureFiles() {
179
- return await filesToString(dir, ['node_modules']);
180
- }
181
-
182
- /**
183
- * @returns {Promise<void>}
184
- */
185
- function cleanDir() {
186
- return fs.rm(dir, { recursive: true, force: true });
187
- }
188
-
189
- /**
190
- * @param {string} str
191
- * @returns {string}
192
- */
193
- function replaceTime(str) {
194
- if (!str) {
195
- return str;
196
- }
197
- return str.replaceAll(/in (\d+\.?\d+)m?s$/gm, 'in XXX');
198
- }
199
-
200
- /**
201
- * @returns {Promise<void>}
202
- */
203
- function writeTestCases() {
204
- return fs.writeFile('./tests/tests.json', JSON.stringify(tests, null, 4));
205
- }
package/tests/tests.json DELETED
@@ -1,534 +0,0 @@
1
- {
2
- "prune": [
3
- {
4
- "id": 3,
5
- "name": "simple prune",
6
- "args": "",
7
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"scripts\": {},\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
8
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
9
- "stdout": "preparing..\n\n",
10
- "stderr": "",
11
- "exitCode": 0
12
- },
13
- {
14
- "id": 4,
15
- "name": "prune flatten",
16
- "args": "--flatten",
17
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"scripts\": {},\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
18
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
19
- "stdout": "preparing..\n\nflattening dist...\n",
20
- "stderr": "",
21
- "exitCode": 0
22
- },
23
- {
24
- "id": 5,
25
- "name": "prune flatten (special files)",
26
- "args": "--flatten",
27
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {},\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
28
- "output": "index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|\nREADME.md\n|",
29
- "stdout": "preparing..\n\nflattening dist...\n",
30
- "stderr": "",
31
- "exitCode": 0
32
- },
33
- {
34
- "id": 6,
35
- "name": "prune unknown profile",
36
- "args": "--profile=garbage",
37
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {},\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
38
- "output": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {},\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
39
- "stdout": "preparing..\n\n✕ Error: unknown profile garbage\n",
40
- "stderr": "",
41
- "exitCode": 255
42
- },
43
- {
44
- "id": 7,
45
- "name": "prune with library profile removes all but postinstall from scripts",
46
- "args": "--profile=library",
47
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {\n| \"serve\": \"rollup -c -w\",\n| \"build\": \"rollup -c\",\n| \"postinstall\": \"npm run build\",\n| \"prepack\": \"pkgbld prune\"\n| },\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
48
- "output": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {\n| \"postinstall\": \"npm run build\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|\nREADME.md\n|",
49
- "stdout": "preparing..\n\n",
50
- "stderr": "",
51
- "exitCode": 0
52
- },
53
- {
54
- "id": 8,
55
- "name": "prune with app profile removes all but postinstall and start from scripts",
56
- "args": "prune --profile=app",
57
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {\n| \"start\": \"rollup -c -w\",\n| \"build\": \"rollup -c\",\n| \"postinstall\": \"npm run build\",\n| \"prepack\": \"pkgbld prune\"\n| },\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
58
- "output": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"scripts\": {\n| \"start\": \"rollup -c -w\",\n| \"postinstall\": \"npm run build\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|\nREADME.md\n|",
59
- "stdout": "preparing..\n\n",
60
- "stderr": "",
61
- "exitCode": 0
62
- },
63
- {
64
- "id": 9,
65
- "name": "prune with bin (object form) and flatten",
66
- "args": "--flatten",
67
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./dist/index.js\"\n| },\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
68
- "output": "index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./index.js\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|\nREADME.md\n|",
69
- "stdout": "preparing..\n\nflattening dist...\n",
70
- "stderr": "",
71
- "exitCode": 0
72
- },
73
- {
74
- "id": 10,
75
- "name": "prune flatten with deep folder",
76
- "args": "--flatten",
77
- "input": "dist\n dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./dist/dist/index.js\"\n| },\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
78
- "output": "index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./index.js\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|\nREADME.md\n|",
79
- "stdout": "preparing..\n\nflattening dist/dist...\n",
80
- "stderr": "",
81
- "exitCode": 0
82
- },
83
- {
84
- "id": 11,
85
- "name": "prune with bin (string form) and flatten",
86
- "args": "--flatten",
87
- "input": "dist\n index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": \"./dist/index.js\",\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}\nREADME.md\n|",
88
- "output": "index.js\n|\nlicence.txt\n|\npackage.json\n|{\n| \"bin\": \"./index.js\",\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|\nREADME.md\n|",
89
- "stdout": "preparing..\n\nflattening dist...\n",
90
- "stderr": "",
91
- "exitCode": 0
92
- },
93
- {
94
- "id": 12,
95
- "name": "multilevel",
96
- "args": "--flatten",
97
- "input": "dist\n index.js\n|\n lib\n index.js\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./dist/index.js\"\n| },\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/lib/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ]\n|}",
98
- "output": "index.js\n|\nlib\n index.js\n|\npackage.json\n|{\n| \"bin\": {\n| \"mylib\": \"./index.js\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./lib/index.js\"\n|}\n|",
99
- "stdout": "preparing..\n\nflattening dist...\n",
100
- "stderr": "",
101
- "exitCode": 0
102
- },
103
- {
104
- "id": 13,
105
- "name": "multilevel (another order)",
106
- "args": "--flatten",
107
- "input": "dist\n index.js\n|\n lib\n index.js\n|\npackage.json\n|{\n| \"devDependencies\": {},\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\",\n| \"./licence.txt\",\n| \"README.md\"\n| ],\n| \"bin\": {\n| \"mylib\": \"./dist/lib/index.js\"\n| }\n|}",
108
- "output": "index.js\n|\nlib\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"bin\": {\n| \"mylib\": \"./lib/index.js\"\n| }\n|}\n|",
109
- "stdout": "preparing..\n\nflattening dist...\n",
110
- "stderr": "",
111
- "exitCode": 0
112
- },
113
- {
114
- "id": 14,
115
- "name": "flatten specific folder",
116
- "args": "--flatten=dist",
117
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
118
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
119
- "stdout": "preparing..\n\nflattening dist...\n",
120
- "stderr": "",
121
- "exitCode": 0
122
- },
123
- {
124
- "id": 15,
125
- "name": "file already exists",
126
- "args": "--flatten",
127
- "input": "dist\n index.js\n|\nindex.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
128
- "output": "dist\n index.js\n|\nindex.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
129
- "exitCode": 255,
130
- "stdout": "preparing..\n\nflattening dist...\n✕ Error: dist folder cannot be flattened because files already exist: index.js\n",
131
- "stderr": ""
132
- },
133
- {
134
- "id": 16,
135
- "name": "2 dist folders",
136
- "args": "--flatten",
137
- "input": "dist\n index.js\n|\ndist2\n index2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index2.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
138
- "output": "dist\n index.js\n|\ndist2\n index2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index2.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
139
- "exitCode": 255,
140
- "stdout": "preparing..\n\n✕ Error: could not find dist folder\n",
141
- "stderr": ""
142
- },
143
- {
144
- "id": 17,
145
- "name": "2 dist folders (flatten both separately)",
146
- "args": "--flatten=dist && node ../../index.js --flatten=dist2",
147
- "input": "dist\n index.js\n|\ndist2\n index2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index2.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
148
- "output": "index.js\n|\nindex2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"module\": \"./index2.js\"\n|}\n|",
149
- "stdout": "preparing..\n\nflattening dist...\npreparing..\n\nflattening dist2...\n",
150
- "stderr": "",
151
- "exitCode": 0
152
- },
153
- {
154
- "id": 18,
155
- "name": "folder with / at the end",
156
- "args": "--flatten",
157
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/\"\n| ]\n|}",
158
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
159
- "stdout": "preparing..\n\nflattening dist...\n",
160
- "stderr": "",
161
- "exitCode": 0
162
- },
163
- {
164
- "id": 19,
165
- "name": "flatten with exports",
166
- "args": "--flatten",
167
- "input": "dist\n index.js\n|\n index.mjs\n|\n second.js\n|\n second.mjs\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"exports\": {\n| \".\": {\n| \"import\": \"./dist/index.mjs\",\n| \"require\": \"./dist/index.js\"\n| },\n| \"./second\": {\n| \"import\": \"./dist/second.mjs\",\n| \"require\": \"./dist/second.js\"\n| }\n| },\n| \"files\": [\n| \"dist\"\n| ]\n|}\nsecond\n package.json\n|",
168
- "output": "index.js\n|\nindex.mjs\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"exports\": {\n| \".\": {\n| \"import\": \"./index.mjs\",\n| \"require\": \"./index.js\"\n| },\n| \"./second\": {\n| \"import\": \"./second.mjs\",\n| \"require\": \"./second.js\"\n| }\n| }\n|}\n|\nsecond.js\n|\nsecond.mjs\n|",
169
- "stdout": "preparing..\n\nflattening dist...\ncleaning up files...\n",
170
- "stderr": "",
171
- "exitCode": 0
172
- },
173
- {
174
- "id": 20,
175
- "name": "flatten pkg with extra number property",
176
- "args": "--flatten",
177
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ],\n| \"extra\": 100\n|}",
178
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"extra\": 100\n|}\n|",
179
- "stdout": "preparing..\n\nflattening dist...\n",
180
- "stderr": "",
181
- "exitCode": 0
182
- },
183
- {
184
- "id": 21,
185
- "name": "flatten with directories.bin",
186
- "args": "--flatten",
187
- "input": "dist\n bin\n 1.js\n|\n 2.js\n|\n index.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
188
- "output": "bin\n 1.js\n|\n 2.js\n|\nindex.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
189
- "stdout": "preparing..\n\nflattening dist...\ncleaning up files...\n",
190
- "stderr": "",
191
- "exitCode": 0
192
- },
193
- {
194
- "id": 22,
195
- "name": "flatten with directories.bin 2",
196
- "args": "--flatten --optimize-files=false --cleanup-files=false",
197
- "input": "dist\n bin\n 1.js\n|\n 2.js\n|\n index.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
198
- "output": "bin\n 1.js\n|\n 2.js\n|\nindex.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"files\": [\n| \"index.js\",\n| \"bin/1.js\",\n| \"bin/2.js\"\n| ]\n|}\n|",
199
- "stdout": "preparing..\n\ncleanup is disabled, junk files may cause flatten to fail\nflattening dist...\n",
200
- "stderr": "",
201
- "exitCode": 0
202
- },
203
- {
204
- "id": 23,
205
- "name": "deep optimize",
206
- "args": "",
207
- "input": "dist\n 2\n bin\n 1.js\n|\n 2.js\n|\n index.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/2/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/2/index.js\",\n| \"files\": [\n| \"dist/2/bin/1.js\",\n| \"dist/2/bin/2.js\",\n| \"dist/2/index.js\"\n| ]\n|}",
208
- "output": "dist\n 2\n bin\n 1.js\n|\n 2.js\n|\n index.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/2/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/2/index.js\"\n|}\n|",
209
- "stdout": "preparing..\n\ncleaning up files...\n",
210
- "stderr": "",
211
- "exitCode": 0
212
- },
213
- {
214
- "id": 24,
215
- "name": "deep optimize 2",
216
- "args": "",
217
- "input": "dist\n 2\n 1\n index.js\n|\n bin\n 1.js\n|\n 2.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/2/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/2/1/index.js\",\n| \"files\": [\n| \"dist/2/bin/1.js\",\n| \"dist/2/bin/2.js\",\n| \"dist/2/1/index.js\"\n| ]\n|}",
218
- "output": "dist\n 2\n 1\n index.js\n|\n bin\n 1.js\n|\n 2.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/2/bin\"\n| },\n| \"name\": \"mylib\",\n| \"main\": \"./dist/2/1/index.js\"\n|}\n|",
219
- "stdout": "preparing..\n\ncleaning up files...\n",
220
- "stderr": "",
221
- "exitCode": 0
222
- },
223
- {
224
- "id": 25,
225
- "name": "remove sourcemaps",
226
- "args": "--removeSourcemaps",
227
- "input": "dist\n index.js\n|// something\n|\n|console.log('Hello, world!');\n|\n|//# sourceMappingURL=index.js.map\n|\n index.js.map\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
228
- "output": "dist\n index.js\n|// something\n|\n|console.log('Hello, world!');\n|\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
229
- "stdout": "preparing..\n\n",
230
- "stderr": "",
231
- "exitCode": 0
232
- },
233
- {
234
- "id": 26,
235
- "name": "flatten directories.bin (2 files)",
236
- "args": "--flatten dist/bin",
237
- "input": "dist\n bin\n 1.js\n|\n 2.js\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/bin\"\n| },\n| \"name\": \"mylib\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
238
- "output": "1.js\n|\n2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"bin\": {\n| \"1\": \"1.js\",\n| \"2\": \"2.js\"\n| }\n|}\n|",
239
- "stdout": "preparing..\n\nflattening dist/bin...\n",
240
- "stderr": "",
241
- "exitCode": 0
242
- },
243
- {
244
- "id": 27,
245
- "name": "flatten directories.bin (1 file + man)",
246
- "args": "--flatten dist/bin",
247
- "input": "dist\n bin\n 2.js\n|\nman\n doc.txt\n|\npackage.json\n|{\n| \"directories\": {\n| \"bin\": \"./dist/bin\",\n| \"man\": \"./man\"\n| },\n| \"name\": \"mylib\",\n| \"files\": [\n| \"dist\",\n| \"man\"\n| ]\n|}",
248
- "output": "2.js\n|\nman\n doc.txt\n|\npackage.json\n|{\n| \"directories\": {\n| \"man\": \"./man\"\n| },\n| \"name\": \"mylib\",\n| \"bin\": \"2.js\"\n|}\n|",
249
- "stdout": "preparing..\n\nflattening dist/bin...\n",
250
- "stderr": "",
251
- "exitCode": 0
252
- },
253
- {
254
- "id": 28,
255
- "name": "flatten multiple directories (comma syntax)",
256
- "args": "--flatten=dist,dist2",
257
- "input": "dist\n index.js\n|\ndist2\n index2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index2.js\",\n| \"files\": [\n| \"dist\",\n| \"dist2\"\n| ]\n|}",
258
- "output": "index.js\n|\nindex2.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"module\": \"./index2.js\"\n|}\n|",
259
- "stdout": "preparing..\n\nflattening dist, dist2...\ncleaning up files...\n",
260
- "stderr": "",
261
- "exitCode": 0
262
- },
263
- {
264
- "id": 29,
265
- "name": "flatten multiple directories with cross-directory conflict",
266
- "args": "--flatten=dist,dist2",
267
- "input": "dist\n index.js\n|\ndist2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index.js\",\n| \"files\": [\n| \"dist\",\n| \"dist2\"\n| ]\n|}",
268
- "output": "dist\n index.js\n|\ndist2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"module\": \"./dist2/index.js\",\n| \"files\": [\n| \"dist\",\n| \"dist2\"\n| ]\n|}",
269
- "exitCode": 255,
270
- "stdout": "preparing..\n\nflattening dist, dist2...\n✕ Error: cannot flatten because 'index.js' exists in both 'dist' and 'dist2'\n",
271
- "stderr": ""
272
- },
273
- {
274
- "id": 30,
275
- "name": "flatten multiple directories with subdirectories",
276
- "args": "--flatten=dist,types",
277
- "input": "dist\n lib\n index.js\n|\ntypes\n lib\n index.d.ts\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/lib/index.js\",\n| \"types\": \"./types/lib/index.d.ts\",\n| \"files\": [\n| \"dist\",\n| \"types\"\n| ]\n|}",
278
- "output": "lib\n index.d.ts\n|\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./lib/index.js\",\n| \"types\": \"./lib/index.d.ts\"\n|}\n|",
279
- "stdout": "preparing..\n\nflattening dist, types...\ncleaning up files...\n",
280
- "stderr": "",
281
- "exitCode": 0
282
- },
283
- {
284
- "id": 31,
285
- "name": "flatten multiple directories with exports",
286
- "args": "--flatten=dist,dist2",
287
- "input": "dist\n index.js\n|\n index.mjs\n|\ndist2\n second.js\n|\n second.mjs\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"exports\": {\n| \".\": {\n| \"import\": \"./dist/index.mjs\",\n| \"require\": \"./dist/index.js\"\n| },\n| \"./second\": {\n| \"import\": \"./dist2/second.mjs\",\n| \"require\": \"./dist2/second.js\"\n| }\n| },\n| \"files\": [\n| \"dist\",\n| \"dist2\"\n| ]\n|}\nsecond\n package.json\n|",
288
- "output": "index.js\n|\nindex.mjs\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\",\n| \"exports\": {\n| \".\": {\n| \"import\": \"./index.mjs\",\n| \"require\": \"./index.js\"\n| },\n| \"./second\": {\n| \"import\": \"./second.mjs\",\n| \"require\": \"./second.js\"\n| }\n| }\n|}\n|\nsecond.js\n|\nsecond.mjs\n|",
289
- "stdout": "preparing..\n\nflattening dist, dist2...\ncleaning up files...\n",
290
- "stderr": "",
291
- "exitCode": 0
292
- },
293
- {
294
- "id": 32,
295
- "name": "no package.json",
296
- "args": "",
297
- "input": "file.txt\n|hello",
298
- "output": "file.txt\n|hello",
299
- "exitCode": 255,
300
- "stdout": "preparing..\n\n✕ Error: Could not read package.json\n",
301
- "stderr": ""
302
- },
303
- {
304
- "id": 33,
305
- "name": "prune without scripts key and with packageManager",
306
- "args": "",
307
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"devDependencies\": {\n| \"some-dev-dep\": \"1.0.0\"\n| },\n| \"packageManager\": \"pnpm@8.0.0\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
308
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
309
- "stdout": "preparing..\n\n",
310
- "stderr": "",
311
- "exitCode": 0
312
- },
313
- {
314
- "id": 34,
315
- "name": "empty files array",
316
- "args": "",
317
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": []\n|}",
318
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
319
- "stdout": "preparing..\n\n",
320
- "stderr": "",
321
- "exitCode": 0
322
- },
323
- {
324
- "id": 35,
325
- "name": "flatten auto with root-level references",
326
- "args": "--flatten",
327
- "input": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}",
328
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}",
329
- "exitCode": 255,
330
- "stdout": "preparing..\n\n✕ Error: could not find dist folder\n",
331
- "stderr": ""
332
- },
333
- {
334
- "id": 36,
335
- "name": "prune with bin string and optimize files",
336
- "args": "",
337
- "input": "dist\n cli.js\n|\n index.js\n|\n helper.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"bin\": \"./dist/cli.js\",\n| \"files\": [\n| \"dist/index.js\",\n| \"dist/cli.js\",\n| \"dist/helper.js\"\n| ]\n|}",
338
- "output": "dist\n cli.js\n|\n helper.js\n|\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"bin\": \"./dist/cli.js\"\n|}\n|",
339
- "stdout": "preparing..\n\ncleaning up files...\n",
340
- "stderr": "",
341
- "exitCode": 0
342
- },
343
- {
344
- "id": 37,
345
- "name": "prune with bin object and optimize files",
346
- "args": "",
347
- "input": "dist\n cli.js\n|\n index.js\n|\n helper.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"bin\": {\n| \"mylib\": \"./dist/cli.js\"\n| },\n| \"files\": [\n| \"dist/index.js\",\n| \"dist/cli.js\",\n| \"dist/helper.js\"\n| ]\n|}",
348
- "output": "dist\n cli.js\n|\n helper.js\n|\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"bin\": {\n| \"mylib\": \"./dist/cli.js\"\n| }\n|}\n|",
349
- "stdout": "preparing..\n\ncleaning up files...\n",
350
- "stderr": "",
351
- "exitCode": 0
352
- },
353
- {
354
- "id": 38,
355
- "name": "flatten auto with no references at all",
356
- "args": "--flatten",
357
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\"\n|}",
358
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\"\n|}",
359
- "exitCode": 255,
360
- "stdout": "preparing..\n\n✕ Error: could not find dist folder\n",
361
- "stderr": ""
362
- },
363
- {
364
- "id": 39,
365
- "name": "prune with no files array and no optimize",
366
- "args": "--optimize-files=false --cleanup-files=false",
367
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"devDependencies\": {\n| \"some-dev-dep\": \"1.0.0\"\n| }\n|}",
368
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
369
- "stdout": "preparing..\n\n",
370
- "stderr": "",
371
- "exitCode": 0
372
- },
373
- {
374
- "id": 40,
375
- "name": "prune with all lifecycle scripts kept in library profile",
376
- "args": "--profile=library",
377
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"scripts\": {\n| \"preinstall\": \"echo pre\",\n| \"install\": \"echo install\",\n| \"postinstall\": \"echo post\",\n| \"prepare\": \"echo prepare\",\n| \"preprepare\": \"echo preprepare\",\n| \"postprepare\": \"echo postprepare\",\n| \"prepublish\": \"echo prepublish\",\n| \"build\": \"echo build\",\n| \"test\": \"echo test\",\n| \"start\": \"echo start\",\n| \"lint\": \"echo lint\"\n| },\n| \"files\": [\n| \"dist\"\n| ]\n|}",
378
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"scripts\": {\n| \"preinstall\": \"echo pre\",\n| \"install\": \"echo install\",\n| \"postinstall\": \"echo post\",\n| \"prepare\": \"echo prepare\",\n| \"preprepare\": \"echo preprepare\",\n| \"postprepare\": \"echo postprepare\",\n| \"prepublish\": \"echo prepublish\"\n| }\n|}\n|",
379
- "stdout": "preparing..\n\n",
380
- "stderr": "",
381
- "exitCode": 0
382
- },
383
- {
384
- "id": 41,
385
- "name": "prune with app profile keeps test and start scripts",
386
- "args": "--profile=app",
387
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"myapp\",\n| \"main\": \"./dist/index.js\",\n| \"scripts\": {\n| \"prestart\": \"echo prestart\",\n| \"start\": \"echo start\",\n| \"poststart\": \"echo poststart\",\n| \"prerestart\": \"echo prerestart\",\n| \"restart\": \"echo restart\",\n| \"postrestart\": \"echo postrestart\",\n| \"prestop\": \"echo prestop\",\n| \"stop\": \"echo stop\",\n| \"poststop\": \"echo poststop\",\n| \"pretest\": \"echo pretest\",\n| \"test\": \"echo test\",\n| \"posttest\": \"echo posttest\",\n| \"build\": \"echo build\",\n| \"lint\": \"echo lint\",\n| \"dev\": \"echo dev\"\n| },\n| \"files\": [\n| \"dist\"\n| ]\n|}",
388
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"myapp\",\n| \"main\": \"./dist/index.js\",\n| \"scripts\": {\n| \"prestart\": \"echo prestart\",\n| \"start\": \"echo start\",\n| \"poststart\": \"echo poststart\",\n| \"prerestart\": \"echo prerestart\",\n| \"restart\": \"echo restart\",\n| \"postrestart\": \"echo postrestart\",\n| \"prestop\": \"echo prestop\",\n| \"stop\": \"echo stop\",\n| \"poststop\": \"echo poststop\",\n| \"pretest\": \"echo pretest\",\n| \"test\": \"echo test\",\n| \"posttest\": \"echo posttest\"\n| }\n|}\n|",
389
- "stdout": "preparing..\n\n",
390
- "stderr": "",
391
- "exitCode": 0
392
- },
393
- {
394
- "id": 42,
395
- "name": "cleanup removes extra files from directory",
396
- "args": "--optimize-files=false",
397
- "input": "dist\n index.js\n|\n helper.js\n|\nsrc\n app.js\n|app\ntsconfig.json\n|{}\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
398
- "output": "dist\n helper.js\n|\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
399
- "stdout": "preparing..\n\ncleaning up files...\n",
400
- "stderr": "",
401
- "exitCode": 0
402
- },
403
- {
404
- "id": 43,
405
- "name": "cleanup keeps README and LICENSE",
406
- "args": "",
407
- "input": "dist\n index.js\n|\n helper.js\n|\nextra.txt\n|junk\nLICENSE\n|MIT\nREADME.md\n|readme\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\",\n| \"dist/helper.js\"\n| ]\n|}",
408
- "output": "dist\n helper.js\n|\n index.js\n|\nLICENSE\n|MIT\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|\nREADME.md\n|readme",
409
- "stdout": "preparing..\n\ncleaning up files...\n",
410
- "stderr": "",
411
- "exitCode": 0
412
- },
413
- {
414
- "id": 44,
415
- "name": "cleanup keeps hardIgnored files",
416
- "args": "",
417
- "input": "dist\n index.js\n|\n helper.js\n|\nextra.txt\n|junk\npackage-lock.json\n|lock\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\",\n| \"dist/helper.js\"\n| ]\n|}",
418
- "output": "dist\n helper.js\n|\n index.js\n|\npackage-lock.json\n|lock\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
419
- "stdout": "preparing..\n\ncleaning up files...\n",
420
- "stderr": "",
421
- "exitCode": 0
422
- },
423
- {
424
- "id": 45,
425
- "name": "cleanup disabled with --no-cleanup-files",
426
- "args": "--cleanup-files=false --optimize-files=false",
427
- "input": "dist\n index.js\n|\nsrc\n app.js\n|app\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
428
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}\n|\nsrc\n app.js\n|app",
429
- "stdout": "preparing..\n\n",
430
- "stderr": "",
431
- "exitCode": 0
432
- },
433
- {
434
- "id": 46,
435
- "name": "cleanup with sub-directory file entries removes extra files in subdir",
436
- "args": "--optimize-files=false",
437
- "input": "dist\n index.js\n|\n test.js\n|test\n sub\n helper.js\n|\n junk.js\n|junk\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\",\n| \"dist/sub/helper.js\"\n| ]\n|}",
438
- "output": "dist\n index.js\n|\n sub\n helper.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
439
- "stdout": "preparing..\n\ncleaning up files...\n",
440
- "stderr": "",
441
- "exitCode": 0
442
- },
443
- {
444
- "id": 47,
445
- "name": "cleanup removes empty sub-directory after cleaning",
446
- "args": "--optimize-files=false",
447
- "input": "dist\n index.js\n|\nsrc\n junk.js\n|junk\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\",\n| \"src/ghost.js\"\n| ]\n|}",
448
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
449
- "stdout": "preparing..\n\ncleaning up files...\n",
450
- "stderr": "",
451
- "exitCode": 0
452
- },
453
- {
454
- "id": 48,
455
- "name": "cleanup with sub-directory hardIgnored entry",
456
- "args": "--optimize-files=false",
457
- "input": "dist\n index.js\n|\n .npmrc\n|registry=https://example.com\n junk.txt\n|junk\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\"\n| ]\n|}",
458
- "output": "dist\n .npmrc\n|registry=https://example.com\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
459
- "stdout": "preparing..\n\ncleaning up files...\n",
460
- "stderr": "",
461
- "exitCode": 0
462
- },
463
- {
464
- "id": 49,
465
- "name": "cleanup with sub-directory always-included file",
466
- "args": "--optimize-files=false",
467
- "input": "dist\n index.js\n|\n junk.txt\n|junk\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/junk.txt\"\n| ]\n|}",
468
- "output": "dist\n index.js\n|\n junk.txt\n|junk\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
469
- "stdout": "preparing..\n\ncleaning up files...\n",
470
- "stderr": "",
471
- "exitCode": 0
472
- },
473
- {
474
- "id": 50,
475
- "name": "cleanup removes always-ignored junk files",
476
- "args": "--optimize-files=false",
477
- "input": ".DS_Store\n|junk\n.foo.swp\n|swap\n._metadata\n|meta\n.wafpickle-3\n|waf\ndist\n .DS_Store\n|junk2\n index.js\n|\n something.orig\n|orig\nfile.orig\n|orig\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist/index.js\"\n| ]\n|}",
478
- "output": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\"\n|}\n|",
479
- "stdout": "preparing..\n\ncleaning up files...\n",
480
- "stderr": "",
481
- "exitCode": 0
482
- },
483
- {
484
- "id": 51,
485
- "name": "flatten with junk files in both root and dist",
486
- "args": "--flatten",
487
- "input": ".DS_Store\n|junk\ndist\n .DS_Store\n|junk2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
488
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
489
- "stdout": "preparing..\n\nflattening dist...\n",
490
- "stderr": "",
491
- "exitCode": 0
492
- },
493
- {
494
- "id": 52,
495
- "name": "flatten with junk pattern files in both root and dist",
496
- "args": "--flatten",
497
- "input": "file.orig\n|orig1\ndist\n file.orig\n|orig2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
498
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
499
- "stdout": "preparing..\n\nflattening dist...\n",
500
- "stderr": "",
501
- "exitCode": 0
502
- },
503
- {
504
- "id": 53,
505
- "name": "flatten with multiple junk files in dist subdirectory",
506
- "args": "--flatten",
507
- "input": ".DS_Store\n|junk\n._metadata\n|meta\ndist\n .DS_Store\n|junk2\n ._metadata\n|meta2\n lib\n .DS_Store\n|junk3\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/lib/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
508
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
509
- "stdout": "preparing..\n\nflattening dist/lib...\n",
510
- "stderr": "",
511
- "exitCode": 0
512
- },
513
- {
514
- "id": 54,
515
- "name": "flatten with cleanup disabled warns about junk files",
516
- "args": "--flatten --cleanup-files=false",
517
- "input": "dist\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
518
- "output": "index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./index.js\"\n|}\n|",
519
- "stdout": "preparing..\n\ncleanup is disabled, junk files may cause flatten to fail\nflattening dist...\n",
520
- "stderr": "",
521
- "exitCode": 0
522
- },
523
- {
524
- "id": 55,
525
- "name": "flatten with cleanup disabled fails on junk file conflict",
526
- "args": "--flatten --cleanup-files=false",
527
- "input": ".DS_Store\n|junk\ndist\n .DS_Store\n|junk2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
528
- "output": ".DS_Store\n|junk\ndist\n .DS_Store\n|junk2\n index.js\n|\npackage.json\n|{\n| \"name\": \"mylib\",\n| \"main\": \"./dist/index.js\",\n| \"files\": [\n| \"dist\"\n| ]\n|}",
529
- "stdout": "preparing..\n\ncleanup is disabled, junk files may cause flatten to fail\nflattening dist...\n✕ Error: dist folder cannot be flattened because files already exist: .DS_Store\n",
530
- "stderr": "",
531
- "exitCode": 255
532
- }
533
- ]
534
- }
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "allowJs": true,
7
- "checkJs": true,
8
- "strict": true,
9
- "noEmit": true,
10
- "declaration": true,
11
- "declarationMap": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "resolveJsonModule": true
16
- }
17
- }