Skip to content

Commit

Permalink
chore(deps): Phantom dependencies of x.mjs and scripts (#7178)
Browse files Browse the repository at this point in the history
* chore(deps): Phantom dependence of x.mjs

* chore(deps): Phantom dependence of x.mjs
  • Loading branch information
SoonIter authored Jul 16, 2024
1 parent f76dcb0 commit 5150790
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 153 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"pnpm": "9.3.0"
},
"devDependencies": {
"zx": "7.2.3",
"@biomejs/biome": "1.8.0",
"@microsoft/api-extractor": "^7.43.1",
"@microsoft/api-extractor-model": "^7.28.14",
Expand Down
37 changes: 28 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/alert/lark.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if (!TITLE || !DESCRIPTION) {
throw new Error("please input title and description");
}

if(!LARK_WEBHOOK_URL) {
console.log('missing LARK_WEBHOOK_URL, will exit');
if (!LARK_WEBHOOK_URL) {
console.log("missing LARK_WEBHOOK_URL, will exit");
process.exit(0);
}

Expand Down
140 changes: 72 additions & 68 deletions scripts/diff.cjs
Original file line number Diff line number Diff line change
@@ -1,81 +1,85 @@
// @ts-nocheck
const { Tester, DiffProcessor, DiffStatsReporter, DiffHtmlReporter } = require("../packages/rspack-test-tools/dist");
const {
Tester,
DiffProcessor,
DiffStatsReporter,
DiffHtmlReporter
} = require("../packages/rspack-test-tools/dist");
const rimraf = require("rimraf");
const path = require("path");
const path = require("node:path");
const fs = require("fs-extra");

process.env['RSPACK_DIFF'] = "true"; // enable rspack diff injection
process.env["RSPACK_DIFF"] = "true"; // enable rspack diff injection

const CASE_DIR = path.resolve(__dirname, '../tests/diff-test');
const OUTPUT_DIR = path.join(__dirname, '../diff_output');
const CASE_DIR = path.resolve(__dirname, "../tests/diff-test");
const OUTPUT_DIR = path.join(__dirname, "../diff_output");

(async () => {
const cases = fs
.readdirSync(CASE_DIR)
.filter(testName => !testName.startsWith("."));
const cases = fs
.readdirSync(CASE_DIR)
.filter(testName => !testName.startsWith("."));

rimraf.sync(OUTPUT_DIR);
rimraf.sync(OUTPUT_DIR);

const statsReporter = new DiffStatsReporter({
file: path.join(OUTPUT_DIR, 'stats.md'),
report: true,
});
const htmlReporter = new DiffHtmlReporter({
dist: OUTPUT_DIR,
ignore: {
test: () => false,
},
});
const statsReporter = new DiffStatsReporter({
file: path.join(OUTPUT_DIR, "stats.md"),
report: true
});
const htmlReporter = new DiffHtmlReporter({
dist: OUTPUT_DIR,
ignore: {
test: () => false
}
});

while (cases.length) {
const name = cases.shift();
const source = path.join(CASE_DIR, name);
try {
const processor = new DiffProcessor({
webpackPath: require.resolve('webpack'),
rspackPath: require.resolve('../packages/rspack'),
files: ['bundle.js', 'main.js'],
modules: true,
runtimeModules: true,
ignoreModuleId: true,
ignoreModuleArguments: true,
ignorePropertyQuotationMark: true,
ignoreBlockOnlyStatement: true,
ignoreSwcHelpersPath: true,
ignoreObjectPropertySequence: true,
ignoreCssFilePath: true,
detail: false,
onCompareModules: (file, results) => {
htmlReporter.increment(name, results);
statsReporter.increment(name, results);
},
onCompareRuntimeModules: (file, results) => {
htmlReporter.increment(name, results);
statsReporter.increment(name, results);
},
});
while (cases.length) {
const name = cases.shift();
const source = path.join(CASE_DIR, name);
try {
const processor = new DiffProcessor({
webpackPath: require.resolve("webpack"),
rspackPath: require.resolve("../packages/rspack"),
files: ["bundle.js", "main.js"],
modules: true,
runtimeModules: true,
ignoreModuleId: true,
ignoreModuleArguments: true,
ignorePropertyQuotationMark: true,
ignoreBlockOnlyStatement: true,
ignoreSwcHelpersPath: true,
ignoreObjectPropertySequence: true,
ignoreCssFilePath: true,
detail: false,
onCompareModules: (file, results) => {
htmlReporter.increment(name, results);
statsReporter.increment(name, results);
},
onCompareRuntimeModules: (file, results) => {
htmlReporter.increment(name, results);
statsReporter.increment(name, results);
}
});

const tester = new Tester({
name: 'test',
src: source,
dist: path.join(source, "dist"),
steps: [processor]
});
const tester = new Tester({
name: "test",
src: source,
dist: path.join(source, "dist"),
steps: [processor]
});

rimraf.sync(path.join(source, "dist"));
await tester.prepare();
do {
await tester.compile();
await tester.check({ expect: () => ({ toBe: (() => { }) }) });
} while (tester.next());
await tester.resume();
} catch (e) {
htmlReporter.failure(name)
statsReporter.failure(name);
console.error(e);
}
}
await htmlReporter.output();
await statsReporter.output();
rimraf.sync(path.join(source, "dist"));
await tester.prepare();
do {
await tester.compile();
await tester.check({ expect: () => ({ toBe: () => {} }) });
} while (tester.next());
await tester.resume();
} catch (e) {
htmlReporter.failure(name);
statsReporter.failure(name);
console.error(e);
}
}
await htmlReporter.output();
await statsReporter.output();
})();

5 changes: 4 additions & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
"@actions/core": "1.10.1",
"@pnpm/find-workspace-packages": "6.0.9",
"chalk": "^5.3.0",
"fs-extra": "11.2.0",
"jest-environment-jsdom": "^29.7.0",
"glob":"7.2.3",
"semver": "^7.6.2",
"prettier": "^3.2.4",
"zx": "^7.2.1"
"zx": "7.2.3"
}
}
Loading

2 comments on commit 5150790

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-07-16 8645c8d) Current Change
10000_development-mode + exec 2.25 s ± 17 ms 2.26 s ± 21 ms +0.72 %
10000_development-mode_hmr + exec 698 ms ± 4.7 ms 700 ms ± 5.8 ms +0.30 %
10000_production-mode + exec 2.8 s ± 34 ms 2.88 s ± 39 ms +2.78 %
arco-pro_development-mode + exec 1.88 s ± 72 ms 1.9 s ± 76 ms +1.06 %
arco-pro_development-mode_hmr + exec 434 ms ± 3.2 ms 435 ms ± 3.9 ms +0.18 %
arco-pro_production-mode + exec 3.44 s ± 90 ms 3.45 s ± 78 ms +0.15 %
threejs_development-mode_10x + exec 1.75 s ± 14 ms 1.77 s ± 35 ms +0.80 %
threejs_development-mode_10x_hmr + exec 860 ms ± 12 ms 869 ms ± 12 ms +1.07 %
threejs_production-mode_10x + exec 5.72 s ± 28 ms 5.72 s ± 52 ms -0.00 %

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs ❌ failure
_selftest ✅ success
nx ✅ success
rspress ✅ success
rsbuild ✅ success
examples ✅ success

Please sign in to comment.