MCPcopy
hub / github.com/alibaba/pont / main

Function main

scripts/release.js:26–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24const getPkgRoot = (pkg) => path.resolve(__dirname, '../packages/' + pkg);
25
26async function main() {
27 let targetVersion = args._[0];
28
29 if (!targetVersion) {
30 // no explicit version, offer suggestions
31 const { release } = await prompt({
32 type: 'select',
33 name: 'release',
34 message: 'Select release type',
35 choices: versionIncrements.map((i) => `${i} (${inc(i)})`).concat(['custom'])
36 });
37
38 if (release === 'custom') {
39 targetVersion = (
40 await prompt({
41 type: 'input',
42 name: 'version',
43 message: 'Input custom version',
44 initial: currentVersion
45 })
46 ).version;
47 } else {
48 targetVersion = release.match(/\((.*)\)/)[1];
49 }
50 }
51
52 if (!semver.valid(targetVersion)) {
53 throw new Error(`invalid target version: ${targetVersion}`);
54 }
55
56 const { yes } = await prompt({
57 type: 'confirm',
58 name: 'yes',
59 message: `Releasing v${targetVersion}. Confirm?`
60 });
61
62 if (!yes) {
63 return;
64 }
65
66 // run tests before release
67 if (!skipTests) {
68 await run(bin('jest'), ['--clearCache']);
69 await run('yarn', ['test']);
70 }
71
72 // update all package versions and inter-dependencies
73 updateVersions(targetVersion);
74
75 // copy README and docs to main package
76 run('cp', ['-f', `${rootDir}/README.md`, mainPackagePath]);
77 run('cp', ['-rf', `${rootDir}/docs`, mainPackagePath]);
78
79 // build all packages with types
80 if (!skipBuild) {
81 await run('yarn', ['build']);
82 }
83

Callers 1

release.jsFile · 0.70

Calls 6

incFunction · 0.85
runFunction · 0.85
binFunction · 0.85
updateVersionsFunction · 0.85
publishFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected