@qlover/fe-release 1.0.5 → 1.0.8
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/cli.cjs +60 -1
- package/dist/cli.js +58 -1
- package/dist/index.cjs +5381 -1
- package/dist/index.js +5371 -1
- package/package.json +16 -14
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var releaseIt = require('release-it');
|
|
5
|
+
var commander = require('commander');
|
|
6
|
+
var semver = require('semver');
|
|
7
|
+
var index = require('./index.cjs');
|
|
8
|
+
require('@qlover/scripts-context');
|
|
9
|
+
require('@qlover/env-loader');
|
|
10
|
+
require('@qlover/fe-corekit');
|
|
11
|
+
require('node:path');
|
|
12
|
+
require('node:fs');
|
|
13
|
+
require('node:module');
|
|
14
|
+
require('node:url');
|
|
15
|
+
require('p-limit');
|
|
16
|
+
|
|
17
|
+
var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
|
|
18
|
+
var version = "1.0.7";
|
|
19
|
+
|
|
20
|
+
const ALLOWED_INCREMENTS = ['patch', 'minor', 'major'];
|
|
21
|
+
const DEFAULT_INCREMENT = 'patch';
|
|
22
|
+
const splitWithComma = (value) => value.split(',').filter((value) => value != null && value != '');
|
|
23
|
+
function programArgs() {
|
|
24
|
+
const program = new commander.Command();
|
|
25
|
+
program
|
|
26
|
+
.version(version, '-v, --version', 'Show version')
|
|
27
|
+
.description(description)
|
|
28
|
+
.option('-d, --dry-run', 'Do not touch or write anything, but show the commands')
|
|
29
|
+
.option('-V, --verbose', 'Show more information')
|
|
30
|
+
.option('-P, --release-PR', 'Create a release PR')
|
|
31
|
+
.option('-M, --merge-publish', 'Merge publish')
|
|
32
|
+
// to Workspaces use workspace
|
|
33
|
+
.option('-p, --publish-path <publishPath>', 'The path of the package to release, map to feConfig.release.publishPath')
|
|
34
|
+
.option('-b, --branch-name <branchName>', 'The branch name of the release, map to feConfig.release.branchName, default(release-${pkgName}-${tagName})')
|
|
35
|
+
.option('-s, --source-branch <sourceBranch>', 'The source branch of the release')
|
|
36
|
+
// plugins args
|
|
37
|
+
.option('--pull-request.increment <increment>', 'The increment of the release, map to feConfig.release.increment', (value) => {
|
|
38
|
+
if (!ALLOWED_INCREMENTS.includes(value) && !semver.valid(value)) {
|
|
39
|
+
throw new Error(`Invalid increment(-i) Must be one of [${ALLOWED_INCREMENTS.join(', ')}] or valid version string(semver)`);
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}, DEFAULT_INCREMENT)
|
|
43
|
+
.option('--publish-npm.skip-npmrc', 'Whether to skip setting the npmrc file')
|
|
44
|
+
.option('--packages-directories <packagesDirectories>', 'The packages that have been changed, multiple values use `,` to split, map to feConfig.release.packagesDirectories', splitWithComma)
|
|
45
|
+
.option('--githubPR.dry-run-create-PR', 'Whether to dry run the creation of the pull request')
|
|
46
|
+
.option('-l, --workspaces.change-labels <changeLabels>', 'The change labels of the release, multiple values use `,` to split', splitWithComma);
|
|
47
|
+
program.parse();
|
|
48
|
+
return index.reduceOptions(program.opts(), 'shared');
|
|
49
|
+
}
|
|
50
|
+
async function main() {
|
|
51
|
+
const { shared: commonOptions, ...allOptions } = programArgs();
|
|
52
|
+
const { dryRun, verbose, ...shared } = commonOptions;
|
|
53
|
+
const options = Object.assign(allOptions, {
|
|
54
|
+
releaseIt: { releaseIt }
|
|
55
|
+
});
|
|
56
|
+
await new index.ReleaseTask({ dryRun, verbose, options, shared }).exec();
|
|
57
|
+
}
|
|
58
|
+
main().catch((e) => {
|
|
59
|
+
console.error(e.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,59 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import releaseIt from 'release-it';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import semver from 'semver';
|
|
5
|
+
import { ReleaseTask, reduceOptions } from './index.js';
|
|
6
|
+
import '@qlover/scripts-context';
|
|
7
|
+
import '@qlover/env-loader';
|
|
8
|
+
import '@qlover/fe-corekit';
|
|
9
|
+
import 'node:path';
|
|
10
|
+
import 'node:fs';
|
|
11
|
+
import 'node:module';
|
|
12
|
+
import 'node:url';
|
|
13
|
+
import 'p-limit';
|
|
14
|
+
|
|
15
|
+
var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
|
|
16
|
+
var version = "1.0.7";
|
|
17
|
+
|
|
18
|
+
const ALLOWED_INCREMENTS = ['patch', 'minor', 'major'];
|
|
19
|
+
const DEFAULT_INCREMENT = 'patch';
|
|
20
|
+
const splitWithComma = (value) => value.split(',').filter((value) => value != null && value != '');
|
|
21
|
+
function programArgs() {
|
|
22
|
+
const program = new Command();
|
|
23
|
+
program
|
|
24
|
+
.version(version, '-v, --version', 'Show version')
|
|
25
|
+
.description(description)
|
|
26
|
+
.option('-d, --dry-run', 'Do not touch or write anything, but show the commands')
|
|
27
|
+
.option('-V, --verbose', 'Show more information')
|
|
28
|
+
.option('-P, --release-PR', 'Create a release PR')
|
|
29
|
+
.option('-M, --merge-publish', 'Merge publish')
|
|
30
|
+
// to Workspaces use workspace
|
|
31
|
+
.option('-p, --publish-path <publishPath>', 'The path of the package to release, map to feConfig.release.publishPath')
|
|
32
|
+
.option('-b, --branch-name <branchName>', 'The branch name of the release, map to feConfig.release.branchName, default(release-${pkgName}-${tagName})')
|
|
33
|
+
.option('-s, --source-branch <sourceBranch>', 'The source branch of the release')
|
|
34
|
+
// plugins args
|
|
35
|
+
.option('--pull-request.increment <increment>', 'The increment of the release, map to feConfig.release.increment', (value) => {
|
|
36
|
+
if (!ALLOWED_INCREMENTS.includes(value) && !semver.valid(value)) {
|
|
37
|
+
throw new Error(`Invalid increment(-i) Must be one of [${ALLOWED_INCREMENTS.join(', ')}] or valid version string(semver)`);
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
}, DEFAULT_INCREMENT)
|
|
41
|
+
.option('--publish-npm.skip-npmrc', 'Whether to skip setting the npmrc file')
|
|
42
|
+
.option('--packages-directories <packagesDirectories>', 'The packages that have been changed, multiple values use `,` to split, map to feConfig.release.packagesDirectories', splitWithComma)
|
|
43
|
+
.option('--githubPR.dry-run-create-PR', 'Whether to dry run the creation of the pull request')
|
|
44
|
+
.option('-l, --workspaces.change-labels <changeLabels>', 'The change labels of the release, multiple values use `,` to split', splitWithComma);
|
|
45
|
+
program.parse();
|
|
46
|
+
return reduceOptions(program.opts(), 'shared');
|
|
47
|
+
}
|
|
48
|
+
async function main() {
|
|
49
|
+
const { shared: commonOptions, ...allOptions } = programArgs();
|
|
50
|
+
const { dryRun, verbose, ...shared } = commonOptions;
|
|
51
|
+
const options = Object.assign(allOptions, {
|
|
52
|
+
releaseIt: { releaseIt }
|
|
53
|
+
});
|
|
54
|
+
await new ReleaseTask({ dryRun, verbose, options, shared }).exec();
|
|
55
|
+
}
|
|
56
|
+
main().catch((e) => {
|
|
57
|
+
console.error(e.message);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|