ci: ci log

This commit is contained in:
liihuu 2023-12-10 02:09:05 +08:00
parent bbef07d50d
commit dba0127f28
3 changed files with 10 additions and 7 deletions

View File

@ -39,7 +39,7 @@
"build-core:dev": "cross-env NODE_ENV=development node scripts/build.cjs",
"build-core:prod": "cross-env NODE_ENV=production node scripts/build.cjs",
"build-core": "npm run build-core:dev && npm run build-core:prod",
"build-dts": "dts-bundle-generator --no-banner true --umd-module-name klinecharts -o types/index.d.ts src/index.ts",
"build-dts": "dts-bundle-generator --no-banner true --fail-on-class true --umd-module-name klinecharts -o types/index.d.ts src/index.ts",
"build": "npm run clean && npm run build-core && npm run build-dts",
"prepare": "husky install",
"docs:pre-work": "npm run pre-work --prefix docs",
@ -68,7 +68,7 @@
"chalk": "^4.1.2",
"codesandbox": "^2.2.3",
"cross-env": "^7.0.3",
"dts-bundle-generator": "^7.0.0",
"dts-bundle-generator": "^9.0.0",
"eslint": "^8.23.0",
"eslint-config-standard-with-typescript": "^22.0.0",
"eslint-plugin-import": "^2.26.0",

View File

@ -4,13 +4,15 @@ const rollup = require('rollup');
const chalk = require('chalk');
const { inputConfig, outputConfig } = require('./config.cjs');
const { inputConfig, outputConfig, version } = require('./config.cjs');
const env = process.env.NODE_ENV;
async function build() {
const fileName = env === 'development' ? 'klinecharts.js' : 'klinecharts.min.js'
console.log(`Creating an optimized ${chalk.blue(`${fileName}`)} build...\n`);
const fileNameVersion = `v${version} ${fileName}`
console.log(`Creating an optimized version ${chalk.blue(fileNameVersion)} build...\n`);
const input = inputConfig(env);
try {
@ -20,11 +22,11 @@ async function build() {
const output = outputConfig(env, fileName);
await bundle.write(output);
console.log(chalk.green(`\n✔️ Compiled ${fileName} successfully.\n`));
console.log(chalk.green(`\n✔️ Compiled ${fileNameVersion} successfully.\n`));
console.log(`Done in ${((new Date().getTime() - startTime) / 1000 / 60).toFixed(2)}s.\n`)
} catch (err) {
console.log(`\n\n${chalk.red(err)}\n`);
console.log(chalk.red(`✖️ Failed to compile ${fileName}.\n`));
console.log(chalk.red(`✖️ Failed to compile ${fileNameVersion}.\n`));
process.exit(1);
}
}

View File

@ -64,5 +64,6 @@ function outputConfig (env, fileName) {
module.exports = {
inputConfig,
outputConfig
outputConfig,
version
};