Skip to content

Commit 2071592

Browse files
authored
chore: fix build (#2504)
* chore: fix build * fix esm import
1 parent 0c72ee4 commit 2071592

File tree

2 files changed

+53
-52
lines changed

2 files changed

+53
-52
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"ts:check": "tsc --project tsconfig.json --noEmit",
1515
"ci:lint": "eslint \"packages/**/*.{js,jsx,ts,tsx}\" --output-file eslint_report.json --format json",
1616
"build": "tsc --project tsconfig.json && bob build",
17-
"test": "jest",
17+
"test": "jest --config jest.config.base.js",
1818
"prerelease": "yarn build",
1919
"release": "changeset publish",
2020
"format": "prettier --cache --ignore-path .gitignore --ignore-path .prettierignore --check --write \"{packages,website}/**/*.{js,jsx,json,css,md,mdx,ts,tsx}\"",
@@ -90,5 +90,6 @@
9090
"lint-staged": {
9191
"*.ts": "eslint",
9292
"*{js,json,css,md,ts,tsx}": "prettier --write"
93-
}
93+
},
94+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
9495
}

scripts/test-esm.mjs

+50-50
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
import globby from 'globby';
2-
import { dirname } from 'path';
3-
import { fileURLToPath } from 'url';
4-
import chalk from 'chalk';
5-
6-
async function main() {
7-
const mjsFiles = await globby(['../packages/*/dist/*.mjs'], {
8-
cwd: dirname(fileURLToPath(import.meta.url)),
9-
});
10-
11-
const ok = [];
12-
const fail = [];
13-
14-
let i = 0;
15-
await Promise.all(
16-
mjsFiles.map((mjsFile) => {
17-
const mjsPath = `./${mjsFile}`;
18-
return import(mjsPath)
19-
.then(() => {
20-
ok.push(mjsPath);
21-
})
22-
.catch((err) => {
23-
const color = i++ % 2 === 0 ? chalk.magenta : chalk.red;
24-
console.error(color('\n\n-----\n' + i + '\n'));
25-
console.error(mjsPath, err);
26-
console.error(color('\n-----\n\n'));
27-
fail.push(mjsPath);
28-
});
29-
})
30-
);
31-
ok.length && console.log(chalk.blue(`${ok.length} OK: ${ok.join(' | ')}`));
32-
fail.length &&
33-
console.error(chalk.red(`${fail.length} Fail: ${fail.join(' | ')}`));
34-
35-
if (fail.length) {
36-
console.error('\nFAILED');
37-
process.exit(1);
38-
} else if (ok.length) {
39-
console.error('\nOK');
40-
process.exit(0);
41-
} else {
42-
console.error('No files analyzed!');
43-
process.exit(1);
44-
}
45-
}
46-
47-
main().catch((err) => {
48-
console.error(err);
49-
process.exit(1);
50-
});
1+
import { globby } from 'globby';
2+
import { dirname } from 'path';
3+
import { fileURLToPath } from 'url';
4+
import chalk from 'chalk';
5+
6+
async function main() {
7+
const mjsFiles = await globby(['../packages/*/dist/*.mjs'], {
8+
cwd: dirname(fileURLToPath(import.meta.url)),
9+
});
10+
11+
const ok = [];
12+
const fail = [];
13+
14+
let i = 0;
15+
await Promise.all(
16+
mjsFiles.map((mjsFile) => {
17+
const mjsPath = `./${mjsFile}`;
18+
return import(mjsPath)
19+
.then(() => {
20+
ok.push(mjsPath);
21+
})
22+
.catch((err) => {
23+
const color = i++ % 2 === 0 ? chalk.magenta : chalk.red;
24+
console.error(color('\n\n-----\n' + i + '\n'));
25+
console.error(mjsPath, err);
26+
console.error(color('\n-----\n\n'));
27+
fail.push(mjsPath);
28+
});
29+
})
30+
);
31+
ok.length && console.log(chalk.blue(`${ok.length} OK: ${ok.join(' | ')}`));
32+
fail.length &&
33+
console.error(chalk.red(`${fail.length} Fail: ${fail.join(' | ')}`));
34+
35+
if (fail.length) {
36+
console.error('\nFAILED');
37+
process.exit(1);
38+
} else if (ok.length) {
39+
console.error('\nOK');
40+
process.exit(0);
41+
} else {
42+
console.error('No files analyzed!');
43+
process.exit(1);
44+
}
45+
}
46+
47+
main().catch((err) => {
48+
console.error(err);
49+
process.exit(1);
50+
});

0 commit comments

Comments
 (0)