|
| 1 | +import chalk from "chalk" |
| 2 | + |
1 | 3 | (() => { |
2 | 4 | // const chalk = require('chalk') |
3 | 5 | const execa = require('execa') |
|
37 | 39 | ] |
38 | 40 | } |
39 | 41 |
|
40 | | - run(target) |
| 42 | + run() |
41 | 43 |
|
42 | | - async function run(target: string) { |
| 44 | + async function run() { |
43 | 45 | const nextVersion = await getNextVersion() |
44 | 46 | await prepare(target, nextVersion) |
45 | 47 | await release() |
46 | 48 | } |
47 | 49 |
|
48 | 50 | async function prepare(target: string, nextVersion: string) { |
49 | 51 | const buildScript = path.resolve(__dirname, 'build.ts') |
50 | | - execa.sync('npx', ['ts-node', buildScript, '--nextVersion', nextVersion]) |
51 | | - execa.sync('zip', ['-r', `${target}-dist.zip`, '.', '-i', 'dist']) |
52 | | - execa.sync('npx', ['semantic-release']) |
| 52 | + console.log(chalk.bgCyan("Build package")) |
| 53 | + await execa('npx', ['ts-node', buildScript, '--nextVersion', nextVersion]) |
| 54 | + console.log(chalk.bgCyan("Zipping distribution file")) |
| 55 | + await execa('zip', ['-r', `${target}-dist.zip`, '.', '-i', 'dist']) |
53 | 56 | } |
54 | 57 |
|
55 | 58 | async function release() { |
|
61 | 64 | plugins: releaserc.plugins |
62 | 65 | }, { |
63 | 66 | // Run semantic-release from `/path/to/git/repo/root` without having to change local process `cwd` with `process.chdir()` |
64 | | - cwd: '', |
| 67 | + // cwd: '', |
65 | 68 | // Pass the variable `MY_ENV_VAR` to semantic-release without having to modify the local `process.env` |
66 | 69 | env: { ...process.env }, |
67 | 70 | // Store stdout and stderr to use later instead of writing to `process.stdout` and `process.stderr` |
|
0 commit comments