publish-flat 1.4.0 → 1.4.2
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/PublishFlat.js +10 -11
- package/PublishFlat.js.map +1 -1
- package/README.md +1 -1
- package/cli-copy.js +6 -5
- package/cli-copy.js.map +1 -1
- package/cli.js +29 -20
- package/cli.js.map +1 -1
- package/copyJson.js +2 -1
- package/copyJson.js.map +1 -1
- package/index.js +16 -5
- package/index.js.map +1 -1
- package/package.json +18 -57
- package/CHANGELOG.md +0 -96
package/PublishFlat.js
CHANGED
|
@@ -12,7 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PublishFlat = void 0;
|
|
15
16
|
const child_process_1 = require("child_process");
|
|
17
|
+
const arborist_1 = __importDefault(require("@npmcli/arborist"));
|
|
16
18
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
19
|
const logdown_1 = __importDefault(require("logdown"));
|
|
18
20
|
const npm_packlist_1 = __importDefault(require("npm-packlist"));
|
|
@@ -21,7 +23,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
21
23
|
class PublishFlat {
|
|
22
24
|
constructor(options) {
|
|
23
25
|
this.options = options;
|
|
24
|
-
this.logger = logdown_1.default('publish-flat', {
|
|
26
|
+
this.logger = (0, logdown_1.default)('publish-flat', {
|
|
25
27
|
logger: console,
|
|
26
28
|
markdown: false,
|
|
27
29
|
});
|
|
@@ -32,7 +34,9 @@ class PublishFlat {
|
|
|
32
34
|
}
|
|
33
35
|
build() {
|
|
34
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const
|
|
37
|
+
const arborist = new arborist_1.default({ path: this.packageDir });
|
|
38
|
+
const tree = yield arborist.loadActual();
|
|
39
|
+
const files = yield (0, npm_packlist_1.default)(tree);
|
|
36
40
|
if (!files.length) {
|
|
37
41
|
this.logger.info('No files to publish');
|
|
38
42
|
return;
|
|
@@ -49,16 +53,13 @@ class PublishFlat {
|
|
|
49
53
|
result.normalFiles.push(fileName);
|
|
50
54
|
}
|
|
51
55
|
return result;
|
|
52
|
-
}, {
|
|
56
|
+
}, { filesInFlattenedDir: [], normalFiles: [] });
|
|
53
57
|
const outputDir = this.options.outputDir ? path_1.default.resolve(this.options.outputDir) : yield this.createTempDir();
|
|
54
58
|
for (const file of normalFiles) {
|
|
55
|
-
yield fs_extra_1.default.copy(path_1.default.join(this.packageDir, file), path_1.default.join(outputDir, file)
|
|
59
|
+
yield fs_extra_1.default.copy(path_1.default.join(this.packageDir, file), path_1.default.join(outputDir, file));
|
|
56
60
|
}
|
|
57
61
|
for (const { fileName, replacedFilename } of filesInFlattenedDir) {
|
|
58
|
-
yield fs_extra_1.default.copy(path_1.default.join(this.packageDir, fileName), path_1.default.join(outputDir, replacedFilename)
|
|
59
|
-
overwrite: true,
|
|
60
|
-
recursive: true,
|
|
61
|
-
});
|
|
62
|
+
yield fs_extra_1.default.copy(path_1.default.join(this.packageDir, fileName), path_1.default.join(outputDir, replacedFilename));
|
|
62
63
|
}
|
|
63
64
|
this.logger.info(`Flattened ${files.length} files in "${outputDir}".`);
|
|
64
65
|
yield this.cleanPackageJson(path_1.default.join(outputDir, 'package.json'), filesInFlattenedDir);
|
|
@@ -72,9 +73,7 @@ class PublishFlat {
|
|
|
72
73
|
const args = ['publish', `"${tempDir}"`].concat(this.options.publishArguments || []);
|
|
73
74
|
const command = `${executor} ${args.join(' ')}`;
|
|
74
75
|
this.logger.info(`Running "${command}" ...`);
|
|
75
|
-
const stdout = child_process_1.execSync(command)
|
|
76
|
-
.toString()
|
|
77
|
-
.trim();
|
|
76
|
+
const stdout = (0, child_process_1.execSync)(command).toString().trim();
|
|
78
77
|
if (stdout) {
|
|
79
78
|
this.logger.info(stdout);
|
|
80
79
|
}
|
package/PublishFlat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublishFlat.js","sourceRoot":"","sources":["../src/PublishFlat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PublishFlat.js","sourceRoot":"","sources":["../src/PublishFlat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAAuC;AACvC,gEAAwC;AACxC,wDAA0B;AAC1B,sDAA8B;AAC9B,gEAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AA0BxB,MAAa,WAAW;IAOtB,YAAY,OAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,IAAA,iBAAO,EAAC,cAAc,EAAE;YACpC,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;QAEnC,IAAI,CAAC,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjE,IAAI,CAAC,iBAAiB,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,OAAO,CAAC,CAAC;IACnE,CAAC;IAEK,KAAK;;YACT,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAC,CAAC,CAAC;YACvD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,KAAK,GAAG,MAAM,IAAA,sBAAQ,EAAC,IAAI,CAAC,CAAC;YAEnC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;gBACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;g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I,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;iBACzF;aACF;YAED,IAAI,WAAW,CAAC,IAAI,EAAE;gBACpB,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;aACzE;YAED,MAAM,iBAAiB,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;YACtE,MAAM,kBAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;KAAA;IAEO,aAAa;QACnB,OAAO,kBAAE,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF;AA1HD,kCA0HC"}
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# publish-flat [](https://www.npmjs.com/package/publish-flat)
|
|
2
2
|
|
|
3
3
|
Publish your project flattened. No more `dist` in `require('project/dist/Options')`.
|
|
4
4
|
|
package/cli-copy.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commander_1 =
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const copyJson_1 = require("./copyJson");
|
|
@@ -14,19 +14,20 @@ const packageJsonPath = fs_extra_1.default.existsSync(defaultPackageJsonPath)
|
|
|
14
14
|
: path_1.default.join(__dirname, '../package.json');
|
|
15
15
|
const { bin, version } = fs_extra_1.default.readJSONSync(packageJsonPath);
|
|
16
16
|
const name = Object.keys(bin)[1];
|
|
17
|
-
commander_1.
|
|
17
|
+
commander_1.program
|
|
18
18
|
.name(name)
|
|
19
19
|
.version(version)
|
|
20
20
|
.description(`Copy entries from one JSON file to the other (example: "${name} version")`)
|
|
21
21
|
.option('-i, --input <file>', 'Set the input JSON file', './package.json')
|
|
22
22
|
.option('-o, --output <file>', 'Set the output JSON file', '../package.json')
|
|
23
23
|
.parse(process.argv);
|
|
24
|
-
const values = commander_1.
|
|
24
|
+
const values = commander_1.program.args;
|
|
25
|
+
const commanderOptions = commander_1.program.opts();
|
|
25
26
|
if (!values.length) {
|
|
26
27
|
console.error('No values to copy');
|
|
27
|
-
commander_1.
|
|
28
|
+
commander_1.program.help();
|
|
28
29
|
}
|
|
29
|
-
copyJson_1.copyJson(
|
|
30
|
+
(0, copyJson_1.copyJson)(commanderOptions.input, commanderOptions.output, values).catch(error => {
|
|
30
31
|
console.error(error);
|
|
31
32
|
process.exit(1);
|
|
32
33
|
});
|
package/cli-copy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-copy.js","sourceRoot":"","sources":["../src/cli-copy.ts"],"names":[],"mappings":";;;;;;AAEA,
|
|
1
|
+
{"version":3,"file":"cli-copy.js","sourceRoot":"","sources":["../src/cli-copy.ts"],"names":[],"mappings":";;;;;;AAEA,yCAA+C;AAC/C,wDAA0B;AAC1B,gDAAwB;AAExB,yCAAoC;AAEpC,MAAM,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACpE,MAAM,eAAe,GAAG,kBAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAC3D,CAAC,CAAC,sBAAsB;IACxB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE5C,MAAM,EAAC,GAAG,EAAE,OAAO,EAAC,GAAG,kBAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;AACxD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,mBAAS;KACN,IAAI,CAAC,IAAI,CAAC;KACV,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,2DAA2D,IAAI,YAAY,CAAC;KACxF,MAAM,CAAC,oBAAoB,EAAE,yBAAyB,EAAE,gBAAgB,CAAC;KACzE,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,EAAE,iBAAiB,CAAC;KAC5E,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,MAAM,GAAG,mBAAS,CAAC,IAAI,CAAC;AAC9B,MAAM,gBAAgB,GAAG,mBAAS,CAAC,IAAI,EAAE,CAAC;AAE1C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACnC,mBAAS,CAAC,IAAI,EAAE,CAAC;CAClB;AAED,IAAA,mBAAQ,EAAC,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IAC9E,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/cli.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
3
12
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
14
|
};
|
|
6
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commander_1 =
|
|
8
|
-
const commander_remaining_args_1 = __importDefault(require("commander-remaining-args"));
|
|
16
|
+
const commander_1 = require("commander");
|
|
9
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
10
18
|
const path_1 = __importDefault(require("path"));
|
|
11
19
|
const PublishFlat_1 = require("./PublishFlat");
|
|
@@ -14,7 +22,7 @@ const packageJsonPath = fs_extra_1.default.existsSync(defaultPackageJsonPath)
|
|
|
14
22
|
? defaultPackageJsonPath
|
|
15
23
|
: path_1.default.join(__dirname, '../package.json');
|
|
16
24
|
const { bin, description, version } = fs_extra_1.default.readJSONSync(packageJsonPath);
|
|
17
|
-
commander_1.
|
|
25
|
+
commander_1.program
|
|
18
26
|
.name(Object.keys(bin)[0])
|
|
19
27
|
.version(version)
|
|
20
28
|
.description(description)
|
|
@@ -25,24 +33,25 @@ commander_1.default
|
|
|
25
33
|
.arguments('[dir]')
|
|
26
34
|
.allowUnknownOption()
|
|
27
35
|
.parse(process.argv);
|
|
28
|
-
const
|
|
36
|
+
const commanderOptions = commander_1.program.opts();
|
|
29
37
|
const flatPublisher = new PublishFlat_1.PublishFlat({
|
|
30
|
-
dirToFlatten:
|
|
31
|
-
outputDir:
|
|
32
|
-
packageDir:
|
|
33
|
-
publishArguments:
|
|
34
|
-
useYarn:
|
|
38
|
+
dirToFlatten: commanderOptions.flatten,
|
|
39
|
+
outputDir: commanderOptions.output,
|
|
40
|
+
packageDir: commanderOptions.dir || '.',
|
|
41
|
+
publishArguments: commanderOptions.args,
|
|
42
|
+
useYarn: commanderOptions.yarn || false,
|
|
35
43
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
void (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
try {
|
|
46
|
+
const outputDir = yield flatPublisher.build();
|
|
47
|
+
if (commanderOptions.publish && outputDir) {
|
|
48
|
+
yield flatPublisher.publish(outputDir);
|
|
49
|
+
}
|
|
50
|
+
process.exit();
|
|
41
51
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error(error);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}))();
|
|
48
57
|
//# sourceMappingURL=cli.js.map
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,yCAA+C;AAC/C,wDAA0B;AAC1B,gDAAwB;AAExB,+CAA0C;AAE1C,MAAM,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACpE,MAAM,eAAe,GAAG,kBAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAC3D,CAAC,CAAC,sBAAsB;IACxB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE5C,MAAM,EAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAC,GAAG,kBAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;AAErE,mBAAS;KACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACzB,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,WAAW,CAAC;KACxB,MAAM,CAAC,YAAY,EAAE,0CAA0C,CAAC;KAChE,MAAM,CAAC,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,CAAC;KACnE,MAAM,CAAC,oBAAoB,EAAE,oDAAoD,CAAC;KAClF,MAAM,CAAC,eAAe,EAAE,0BAA0B,CAAC;KACnD,SAAS,CAAC,OAAO,CAAC;KAClB,kBAAkB,EAAE;KACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,gBAAgB,GAAG,mBAAS,CAAC,IAAI,EAAE,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,yBAAW,CAAC;IACpC,YAAY,EAAE,gBAAgB,CAAC,OAAO;IACtC,SAAS,EAAE,gBAAgB,CAAC,MAAM;IAClC,UAAU,EAAE,gBAAgB,CAAC,GAAG,IAAI,GAAG;IACvC,gBAAgB,EAAE,gBAAgB,CAAC,IAAI;IACvC,OAAO,EAAE,gBAAgB,CAAC,IAAI,IAAI,KAAK;CACxC,CAAC,CAAC;AAEH,KAAK,CAAC,GAAS,EAAE;IACf,IAAI;QACF,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC;QAC9C,IAAI,gBAAgB,CAAC,OAAO,IAAI,SAAS,EAAE;YACzC,MAAM,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACxC;QACD,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
package/copyJson.js
CHANGED
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.copyJson = void 0;
|
|
15
16
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
17
|
const path_1 = __importDefault(require("path"));
|
|
17
18
|
function checkFile(filePath) {
|
|
@@ -37,7 +38,7 @@ function copyJson(inputFile, outputFile, values) {
|
|
|
37
38
|
let newJSONRaw = yield fs_extra_1.default.readFile(outputResolved, 'utf-8');
|
|
38
39
|
let spaces = 2;
|
|
39
40
|
if (!newJSONRaw) {
|
|
40
|
-
console.
|
|
41
|
+
console.info('New JSON file has no content.');
|
|
41
42
|
newJSONRaw = '{}';
|
|
42
43
|
}
|
|
43
44
|
else if (/^\{/.test(newJSONRaw)) {
|
package/copyJson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyJson.js","sourceRoot":"","sources":["../src/copyJson.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copyJson.js","sourceRoot":"","sources":["../src/copyJson.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAExB,SAAe,SAAS,CAAC,QAAgB;;QACvC,IAAI;YACF,MAAM,kBAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAE,CAAC,SAAS,CAAC,IAAI,GAAG,kBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;SAClE;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,oCAAoC,CAAC,CAAC;SAC9E;IACH,CAAC;CAAA;AAMD,SAAsB,QAAQ,CAAC,SAAiB,EAAE,UAAkB,EAAE,MAAgB;;QACpF,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,OAAO;SACR;QAED,MAAM,aAAa,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,MAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEhD,MAAM,SAAS,CAAC,aAAa,CAAC,CAAC;QAC/B,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAgB,MAAM,kBAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,UAAU,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAE5D,IAAI,MAAM,GAAG,CAAC,CAAC;QAEf,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;YAC9C,UAAU,GAAG,IAAI,CAAC;SACnB;aAAM,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACjC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACvD,IAAI,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE;gBACjC,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;aAChC;SACF;QAED,MAAM,OAAO,GAAgB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAEpD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IAAI,KAAK,IAAI,YAAY,EAAE;gBACzB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;aACtC;SACF;QAED,MAAM,kBAAE,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,EAAC,MAAM,EAAC,CAAC,CAAC;IACxD,CAAC;CAAA;AAnCD,4BAmCC"}
|
package/index.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
__exportStar(require("./PublishFlat"), exports);
|
|
18
|
+
__exportStar(require("./copyJson"), exports);
|
|
8
19
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "Florian
|
|
2
|
+
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"bin": {
|
|
4
4
|
"publish-flat": "cli.js",
|
|
5
5
|
"publish-flat-copy": "cli-copy.js"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
8
|
+
"@npmcli/arborist": "6.2.1",
|
|
9
|
+
"@types/npmcli__arborist": "5.6.1",
|
|
10
|
+
"commander": "10.0.0",
|
|
11
|
+
"fs-extra": "11.1.0",
|
|
12
|
+
"logdown": "3.3.1",
|
|
13
|
+
"npm-packlist": "7.0.4"
|
|
13
14
|
},
|
|
14
15
|
"description": "Publish your project without the dist directory",
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"@semantic-release/git": "8.0.0",
|
|
21
|
-
"@types/commander-remaining-args": "1.2.1",
|
|
22
|
-
"@types/fs-extra": "8.0.1",
|
|
23
|
-
"@types/node": "~12",
|
|
24
|
-
"@types/npm-packlist": "1.1.1",
|
|
25
|
-
"husky": "4.0.5",
|
|
26
|
-
"lint-staged": "9.5.0",
|
|
27
|
-
"prettier": "1.19.1",
|
|
28
|
-
"rimraf": "3.0.0",
|
|
29
|
-
"semantic-release": "16.0.0",
|
|
30
|
-
"ts-node": "8.6.0",
|
|
31
|
-
"tslint": "5.20.1",
|
|
32
|
-
"tslint-config-prettier": "1.18.0",
|
|
33
|
-
"tslint-plugin-prettier": "2.1.0",
|
|
34
|
-
"typescript": "3.7.4"
|
|
17
|
+
"@types/fs-extra": "11.0.1",
|
|
18
|
+
"@types/npm-packlist": "7.0.0",
|
|
19
|
+
"rimraf": "4.1.2",
|
|
20
|
+
"typescript": "4.9.5"
|
|
35
21
|
},
|
|
36
22
|
"files": [
|
|
37
23
|
"PublishFlat.d.ts",
|
|
@@ -50,49 +36,24 @@
|
|
|
50
36
|
"index.js",
|
|
51
37
|
"index.js.map"
|
|
52
38
|
],
|
|
53
|
-
"husky": {
|
|
54
|
-
"hooks": {
|
|
55
|
-
"pre-commit": "lint-staged"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
39
|
"keywords": [
|
|
59
40
|
"cli",
|
|
60
41
|
"typescript"
|
|
61
42
|
],
|
|
62
43
|
"license": "GPL-3.0",
|
|
63
|
-
"lint-staged": {
|
|
64
|
-
"*.{json,md}": [
|
|
65
|
-
"prettier --write",
|
|
66
|
-
"git add"
|
|
67
|
-
],
|
|
68
|
-
"*.ts": [
|
|
69
|
-
"tslint --project tsconfig.json --fix",
|
|
70
|
-
"git add"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
44
|
"main": "index.js",
|
|
74
45
|
"name": "publish-flat",
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
"extends": "@ffflorian/semantic-release-config"
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"directory": "flattened"
|
|
78
48
|
},
|
|
79
|
-
"repository": "https://github.com/ffflorian/publish-flat
|
|
49
|
+
"repository": "https://github.com/ffflorian/node-packages/tree/main/packages/publish-flat",
|
|
80
50
|
"scripts": {
|
|
81
51
|
"build": "tsc",
|
|
82
52
|
"clean": "rimraf dist",
|
|
83
53
|
"dist": "yarn clean && yarn build",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"lint": "yarn lint:ts && yarn lint:other",
|
|
88
|
-
"lint:other": "yarn prettier --list-different",
|
|
89
|
-
"lint:ts": "tslint --project tsconfig.json",
|
|
90
|
-
"flatten": "yarn start -o flattened",
|
|
91
|
-
"prettier": "prettier \"*.{json,md}\"",
|
|
92
|
-
"postversion": "node ../dist/cli-copy.js version",
|
|
93
|
-
"release": "semantic-release",
|
|
94
|
-
"start": "ts-node src/cli.ts",
|
|
95
|
-
"test": "exit 0"
|
|
54
|
+
"flatten": "node ./dist/cli.js -o flattened",
|
|
55
|
+
"postversion": "node ./dist/cli-copy.js -o flattened/package.json version",
|
|
56
|
+
"start": "ts-node src/cli.ts"
|
|
96
57
|
},
|
|
97
|
-
"version": "1.4.
|
|
58
|
+
"version": "1.4.2"
|
|
98
59
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
## [1.3.4](https://github.com/ffflorian/publish-flat/compare/v1.3.3...v1.3.4) (2019-10-18)
|
|
2
|
-
|
|
3
|
-
### Bug Fixes
|
|
4
|
-
|
|
5
|
-
- Check if `files` exists in package.json ([#96](https://github.com/ffflorian/publish-flat/issues/96)) ([5ea9ef2](https://github.com/ffflorian/publish-flat/commit/5ea9ef2))
|
|
6
|
-
|
|
7
|
-
## [1.3.3](https://github.com/ffflorian/publish-flat/compare/v1.3.2...v1.3.3) (2019-10-18)
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
- Default imports ([#95](https://github.com/ffflorian/publish-flat/issues/95)) ([04e532b](https://github.com/ffflorian/publish-flat/commit/04e532b))
|
|
12
|
-
|
|
13
|
-
## [1.3.2](https://github.com/ffflorian/publish-flat/compare/v1.3.1...v1.3.2) (2019-09-06)
|
|
14
|
-
|
|
15
|
-
### Bug Fixes
|
|
16
|
-
|
|
17
|
-
- Use postversion when publishing ([03e34b4](https://github.com/ffflorian/publish-flat/commit/03e34b4))
|
|
18
|
-
|
|
19
|
-
## [1.3.1](https://github.com/ffflorian/publish-flat/compare/v1.3.0...v1.3.1) (2019-08-26)
|
|
20
|
-
|
|
21
|
-
### Bug Fixes
|
|
22
|
-
|
|
23
|
-
- Sort files in flattened package.json ([cf61552](https://github.com/ffflorian/publish-flat/commit/cf61552))
|
|
24
|
-
|
|
25
|
-
# [1.3.0](https://github.com/ffflorian/publish-flat/compare/v1.2.4...v1.3.0) (2019-08-09)
|
|
26
|
-
|
|
27
|
-
### Features
|
|
28
|
-
|
|
29
|
-
- Use -y as alias for --yarn ([a054cb0](https://github.com/ffflorian/publish-flat/commit/a054cb0))
|
|
30
|
-
|
|
31
|
-
## [1.2.4](https://github.com/ffflorian/publish-flat/compare/v1.2.3...v1.2.4) (2019-06-24)
|
|
32
|
-
|
|
33
|
-
### Bug Fixes
|
|
34
|
-
|
|
35
|
-
- Postpublish script ([c214ff1](https://github.com/ffflorian/publish-flat/commit/c214ff1))
|
|
36
|
-
|
|
37
|
-
## [1.2.3](https://github.com/ffflorian/publish-flat/compare/v1.2.2...v1.2.3) (2019-06-24)
|
|
38
|
-
|
|
39
|
-
### Bug Fixes
|
|
40
|
-
|
|
41
|
-
- Default files for copy ([827c474](https://github.com/ffflorian/publish-flat/commit/827c474))
|
|
42
|
-
|
|
43
|
-
## [1.2.2](https://github.com/ffflorian/publish-flat/compare/v1.2.1...v1.2.2) (2019-06-24)
|
|
44
|
-
|
|
45
|
-
### Bug Fixes
|
|
46
|
-
|
|
47
|
-
- Default files for copy ([dc68427](https://github.com/ffflorian/publish-flat/commit/dc68427))
|
|
48
|
-
|
|
49
|
-
## [1.2.1](https://github.com/ffflorian/publish-flat/compare/v1.2.0...v1.2.1) (2019-06-24)
|
|
50
|
-
|
|
51
|
-
### Bug Fixes
|
|
52
|
-
|
|
53
|
-
- Default files for copy ([872e5e5](https://github.com/ffflorian/publish-flat/commit/872e5e5))
|
|
54
|
-
|
|
55
|
-
# [1.2.0](https://github.com/ffflorian/publish-flat/compare/v1.1.3...v1.2.0) (2019-06-22)
|
|
56
|
-
|
|
57
|
-
### Features
|
|
58
|
-
|
|
59
|
-
- Add publish-flat-copy ([f76704f](https://github.com/ffflorian/publish-flat/commit/f76704f))
|
|
60
|
-
|
|
61
|
-
## [1.1.3](https://github.com/ffflorian/publish-flat/compare/v1.1.2...v1.1.3) (2019-06-22)
|
|
62
|
-
|
|
63
|
-
### Bug Fixes
|
|
64
|
-
|
|
65
|
-
- Imports ([08178f1](https://github.com/ffflorian/publish-flat/commit/08178f1))
|
|
66
|
-
- Use @ffflorian/semantic-release-config ([239621e](https://github.com/ffflorian/publish-flat/commit/239621e))
|
|
67
|
-
|
|
68
|
-
## [1.1.2](https://github.com/ffflorian/publish-flat/compare/v1.1.1...v1.1.2) (2019-06-12)
|
|
69
|
-
|
|
70
|
-
### Bug Fixes
|
|
71
|
-
|
|
72
|
-
- package.json path ([15f0558](https://github.com/ffflorian/publish-flat/commit/15f0558))
|
|
73
|
-
|
|
74
|
-
## [1.1.1](https://github.com/ffflorian/publish-flat/compare/v1.1.0...v1.1.1) (2019-06-12)
|
|
75
|
-
|
|
76
|
-
### Bug Fixes
|
|
77
|
-
|
|
78
|
-
- Don't publish by default ([c47f787](https://github.com/ffflorian/publish-flat/commit/c47f787))
|
|
79
|
-
|
|
80
|
-
# [1.1.0](https://github.com/ffflorian/publish-flat/compare/v1.0.1...v1.1.0) (2019-06-12)
|
|
81
|
-
|
|
82
|
-
### Features
|
|
83
|
-
|
|
84
|
-
- Rename to publish-flat ([30d6dba](https://github.com/ffflorian/publish-flat/commit/30d6dba))
|
|
85
|
-
|
|
86
|
-
## [1.0.1](https://github.com/ffflorian/publish-flat/compare/v1.0.0...v1.0.1) (2019-06-12)
|
|
87
|
-
|
|
88
|
-
### Bug Fixes
|
|
89
|
-
|
|
90
|
-
- Package name ([be6de45](https://github.com/ffflorian/publish-flat/commit/be6de45))
|
|
91
|
-
|
|
92
|
-
# 1.0.0 (2019-06-12)
|
|
93
|
-
|
|
94
|
-
### Features
|
|
95
|
-
|
|
96
|
-
- Add base files ([9e613f2](https://github.com/ffflorian/publish-flat/commit/9e613f2))
|