Blame view

build/script/changelog.ts 935 Bytes
陈文彬 authored
1
2
3
4
5
6
7
// #!/usr/bin/env node

import { sh } from 'tasksfile';
import chalk from 'chalk';

const createChangeLog = async () => {
  try {
8
    let cmd = `conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 `;
陈文彬 authored
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    // if (shell.which('git')) {
    //   cmd += '&& git add CHANGELOG.md';
    // }
    await sh(cmd, {
      async: true,
      nopipe: true,
    });

    await sh('prettier --write **/CHANGELOG.md ', {
      async: true,
      nopipe: true,
    });
    console.log(
      chalk.blue.bold('****************  ') +
        chalk.green.bold('CHANGE_LOG generated successfully!') +
        chalk.blue.bold('  ****************')
    );
  } catch (error) {
    console.log(
      chalk.blue.red('****************  ') +
        chalk.green.red('CHANGE_LOG generated error\n' + error) +
        chalk.blue.red('  ****************')
    );
    process.exit(1);
  }
};
createChangeLog();
module.exports = {
  createChangeLog,
};