Remove Rollup configuration file to streamline build process

This commit is contained in:
junchi.zhang
2026-07-01 18:30:36 +08:00
parent 62311cf757
commit 38912b6da6
6 changed files with 2698 additions and 2194 deletions
+2 -2
View File
@@ -74,5 +74,5 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Audit dependencies
run: npm audit --audit-level=high
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=critical
+5 -1
View File
@@ -76,7 +76,11 @@ async function downloadCarFile(
const writer = fs.createWriteStream(outputPath);
let downloadedBytes = 0;
const totalBytes = parseInt(response.headers['content-length'] || '0', 10);
const contentLength = response.headers['content-length'];
const totalBytes = parseInt(
typeof contentLength === 'string' ? contentLength : '0',
10,
);
response.data.on('data', (chunk: Buffer) => {
downloadedBytes += chunk.length;
+138 -1381
View File
File diff suppressed because it is too large Load Diff
+3 -10
View File
@@ -36,26 +36,22 @@
"dependencies": {
"adm-zip": "^0.5.17",
"archiver": "7.0.1",
"axios": "1.3.2",
"axios": "1.18.1",
"base-x": "5.0.1",
"bip39": "3.1.0",
"chalk": "2.4.2",
"commander": "11.1.0",
"crypto-js": "4.2.0",
"dayjs": "1.11.7",
"ethers": "5.7.2",
"figlet": "1.7.0",
"form-data": "4.0.0",
"form-data": "4.0.6",
"formdata-node": "6.0.3",
"fs-extra": "11.2.0",
"inquirer": "8.2.6",
"inquirer": "8.2.7",
"ora": "3.4.0",
"uuid": "9.0.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "22.0.2",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "14.1.0",
"@stryker-mutator/core": "^7.3.0",
"@stryker-mutator/vitest-runner": "^7.3.0",
"@types/adm-zip": "^0.5.8",
@@ -73,9 +69,6 @@
"fast-check": "^3.23.2",
"nock": "^13.5.6",
"prettier": "2.8.3",
"rollup": "2.79.2",
"rollup-plugin-copy": "3.5.0",
"rollup-plugin-terser": "7.0.2",
"tmp-promise": "^3.0.3",
"typescript": "^5.4.5",
"vitest": "^0.34.6"
+2550 -727
View File
File diff suppressed because it is too large Load Diff
-73
View File
@@ -1,73 +0,0 @@
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
const typescript = require('@rollup/plugin-typescript');
const { terser } = require('rollup-plugin-terser');
const copy = require('rollup-plugin-copy');
const path = require('path');
const fs = require('fs');
// Ensure dist directory exists
const distDir = path.resolve(__dirname, 'dist');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
}
module.exports = {
input: 'bin/index.ts',
output: {
file: 'dist/index.js',
format: 'cjs',
banner: '#!/usr/bin/env node',
sourcemap: false,
},
// Set all npm dependencies as external, don't bundle into final file
external: [
...Object.keys(require('./package.json').dependencies || {}),
...require('module').builtinModules,
],
plugins: [
typescript({
tsconfig: './tsconfig.json',
sourceMap: false
}),
// Resolve third-party modules
nodeResolve({
preferBuiltins: true,
}),
// Convert CommonJS modules to ES modules
commonjs(),
// Support importing JSON files
json(),
// Minify code
terser({
format: {
comments: false,
},
compress: {
drop_console: false,
drop_debugger: true,
},
}),
// Custom plugin: ensure generated file has executable permissions
{
name: 'make-executable',
writeBundle() {
const outputFile = path.resolve(__dirname, 'dist/index.js');
try {
fs.chmodSync(outputFile, '755');
console.log('Added executable permissions to output file');
} catch (error) {
console.error('Failed to add executable permissions:', error);
}
}
}
],
onwarn(warning, warn) {
// Ignore certain warnings
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
if (warning.code === 'UNRESOLVED_IMPORT' && warning.source.startsWith('node:')) return;
warn(warning);
}
};