From bbef07d50d3100cda9769f7cb157d6eb8a609e75 Mon Sep 17 00:00:00 2001 From: liihuu Date: Sun, 10 Dec 2023 01:23:29 +0800 Subject: [PATCH] ci: upgrade rollup --- .github/workflows/build.yml | 2 +- .github/workflows/deploy-docs.yml | 2 +- .github/workflows/npm-publish.yml | 4 ++-- package.json | 18 +++++++++--------- scripts/build.cjs | 11 +++++------ scripts/clean.cjs | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a65f88e4..9e9e2da0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 21 - run: npm install - run: npm run lint - run: npm run build diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 03c67a49..deda24aa 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 21 - run: npm install - run: npm run docs:build - uses: peaceiris/actions-gh-pages@v3 diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b4e39000..deb260a7 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 21 - run: npm install && npm run build publish-npm: @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 21 registry-url: https://registry.npmjs.org/ - run: npm install && npm run build - run: npm publish diff --git a/package.json b/package.json index 1f7c7ffb..4e8a537e 100644 --- a/package.json +++ b/package.json @@ -49,18 +49,18 @@ "docs:deploy": "npm run docs:build && gh-pages -d website" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" }, "devDependencies": { "@babel/standalone": "^7.23.2", "@docsearch/css": "^3.3.3", "@docsearch/js": "^3.3.3", - "@rollup/plugin-commonjs": "^23.0.2", - "@rollup/plugin-eslint": "^9.0.1", - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-replace": "^5.0.1", - "@rollup/plugin-terser": "^0.1.0", - "@rollup/plugin-typescript": "^9.0.2", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-eslint": "^9.0.5", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-replace": "^5.0.5", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^11.1.5", "@stackblitz/sdk": "^1.9.0", "@types/node": "^18.15.10", "@typescript-eslint/eslint-plugin": "^5.36.2", @@ -78,8 +78,8 @@ "gh-pages": "^2.2.0", "husky": "^8.0.1", "resize-observer-polyfill": "^1.5.1", - "rollup": "^3.2.5", - "rollup-plugin-filesize": "^9.1.2", + "rollup": "^4.7.0", + "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-progress": "^1.1.2", "tslib": "^2.5.0", "typescript": "^4.8.3", diff --git a/scripts/build.cjs b/scripts/build.cjs index b683fb3c..2472d109 100644 --- a/scripts/build.cjs +++ b/scripts/build.cjs @@ -14,18 +14,17 @@ async function build() { const input = inputConfig(env); try { + const startTime = new Date().getTime() const bundle = await rollup.rollup(input); - - console.log('\n\nFile info: '); - + const output = outputConfig(env, fileName); - await bundle.write(output); - console.log(chalk.green(`\nCompiled ${fileName} successfully.\n`)); + console.log(chalk.green(`\n✔️ Compiled ${fileName} 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 ${fileName}.\n`)); process.exit(1); } } diff --git a/scripts/clean.cjs b/scripts/clean.cjs index 9fe434d7..ad8b7cdf 100644 --- a/scripts/clean.cjs +++ b/scripts/clean.cjs @@ -45,7 +45,7 @@ function clean () { eachFiles(buildDir); deleteFiles(buildDir); - console.log(chalk.green('\n\nClean successfully.\n')); + console.log(chalk.green('\n\n✔️ Clean successfully.\n')); } clean();