Skip to content

Commit

Permalink
update vitest build
Browse files Browse the repository at this point in the history
  • Loading branch information
epszaw committed May 16, 2024
1 parent 211d0cb commit c509707
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 49 deletions.
108 changes: 67 additions & 41 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
20 changes: 14 additions & 6 deletions packages/allure-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
"type": "module",
"exports": {
"./reporter": {
"import": "./dist/reporter.js"
"require": "./dist/reporter.cjs",
"import": "./dist/reporter.mjs"
},
"./setup": {
"require": "./dist/setup.js",
"import": "./dist/setup.js"
"require": "./dist/setup.cjs",
"import": "./dist/setup.mjs"
}
},
"files": [
Expand All @@ -35,7 +36,9 @@
],
"scripts": {
"clean": "rimraf ./dist ./out",
"compile": "tsc",
"compile": "run-p 'compile:*'",
"compile:lib": "rollup -c",
"compile:types": "tsc --project ./tsconfig.dts.json",
"generate-report": "allure generate ./out/allure-results -o ./out/allure-report --clean",
"allure-report": "allure serve ./out/allure-results",
"pretest": "run compile",
Expand All @@ -47,6 +50,9 @@
"allure-js-commons": "workspace:*"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/eslint": "^8",
"@types/node": "^20.6.3",
"@typescript-eslint/eslint-plugin": "^6.7.0",
Expand All @@ -58,9 +64,11 @@
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"glob": "^10.3.10",
"npm-run-all2": "^5.0.0",
"glob": "^10.3.15",
"npm-run-all2": "^6.1.2",
"rimraf": "^5.0.1",
"rollup": "^4.17.2",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vite": "^5.0.11",
"vitest": "^1.1.3"
Expand Down
61 changes: 61 additions & 0 deletions packages/allure-vitest/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import commonjsPlugin from "@rollup/plugin-commonjs";
import resolvePlugin from "@rollup/plugin-node-resolve";
import typescriptPlugin from "@rollup/plugin-typescript";
import { globSync } from "glob";
import { join, relative } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "rollup";

const dirname = fileURLToPath(new URL(".", import.meta.url));

const createNodeEntry = (inputFile) => {
const outputFileBase = inputFile.replace(/^src/, "dist");
const external = [
"node:os",
"node:path",
"node:process",
"allure-js-commons/new",
"allure-js-commons/new/sdk/node",
"allure-js-commons/new/internal",
"vitest",
];

return [
defineConfig({
input: inputFile,
output: {
file: join(dirname, outputFileBase.replace(/\.ts$/, ".mjs")),
format: "esm",
exports: "named",
sourcemap: true,
},
plugins: [
typescriptPlugin({
tsconfig: "./tsconfig.rollup.json",
}),
],
external,
}),
defineConfig({
input: inputFile,
output: {
file: join(dirname, outputFileBase.replace(/\.ts$/, ".cjs")),
format: "cjs",
exports: "named",
sourcemap: true,
},
plugins: [
typescriptPlugin({
tsconfig: "./tsconfig.rollup.json",
}),
],
external,
}),
];
};

export default () => {
const entries = globSync("src/*.ts", { cwd: dirname });

return entries.map(createNodeEntry).flat();
};
34 changes: 32 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3802,6 +3802,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "allure-vitest@workspace:packages/allure-vitest"
dependencies:
"@rollup/plugin-commonjs": "npm:^25.0.7"
"@rollup/plugin-node-resolve": "npm:^15.2.3"
"@rollup/plugin-typescript": "npm:^11.1.6"
"@types/eslint": "npm:^8"
"@types/node": "npm:^20.6.3"
"@typescript-eslint/eslint-plugin": "npm:^6.7.0"
Expand All @@ -3814,9 +3817,11 @@ __metadata:
eslint-plugin-no-null: "npm:^1.0.2"
eslint-plugin-node: "npm:^11.1.0"
eslint-plugin-prefer-arrow: "npm:^1.2.3"
glob: "npm:^10.3.10"
npm-run-all2: "npm:^5.0.0"
glob: "npm:^10.3.15"
npm-run-all2: "npm:^6.1.2"
rimraf: "npm:^5.0.1"
rollup: "npm:^4.17.2"
tslib: "npm:^2.6.2"
typescript: "npm:^5.2.2"
vite: "npm:^5.0.11"
vitest: "npm:^1.1.3"
Expand Down Expand Up @@ -7622,6 +7627,21 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^10.3.15":
version: 10.3.15
resolution: "glob@npm:10.3.15"
dependencies:
foreground-child: "npm:^3.1.0"
jackspeak: "npm:^2.3.6"
minimatch: "npm:^9.0.1"
minipass: "npm:^7.0.4"
path-scurry: "npm:^1.11.0"
bin:
glob: dist/esm/bin.mjs
checksum: 10/b2b1c74309979b34fd6010afb50418a12525def32f1d3758d5827fc75d6143fc3ee5d1f3180a43111f6386c9e297c314f208d9d09955a6c6b69f22e92ee97635
languageName: node
linkType: hard

"glob@npm:^6.0.1":
version: 6.0.4
resolution: "glob@npm:6.0.4"
Expand Down Expand Up @@ -11283,6 +11303,16 @@ __metadata:
languageName: node
linkType: hard

"path-scurry@npm:^1.11.0":
version: 1.11.1
resolution: "path-scurry@npm:1.11.1"
dependencies:
lru-cache: "npm:^10.2.0"
minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0"
checksum: 10/5e8845c159261adda6f09814d7725683257fcc85a18f329880ab4d7cc1d12830967eae5d5894e453f341710d5484b8fdbbd4d75181b4d6e1eb2f4dc7aeadc434
languageName: node
linkType: hard

"path-to-regexp@npm:^6.2.0, path-to-regexp@npm:^6.2.1":
version: 6.2.1
resolution: "path-to-regexp@npm:6.2.1"
Expand Down

0 comments on commit c509707

Please sign in to comment.