From 733b6cdf775e56ee56c5bb34a2ef6fdc8cbd85a3 Mon Sep 17 00:00:00 2001 From: Alexandre Mouton-Brady Date: Sat, 27 Aug 2022 11:26:19 +0200 Subject: [PATCH] :fire: Remove unnecessary postinstall scripts and config (fix #61 and #50) --- js-vitest/fix-jest-dom.mjs | 18 ------------------ js-vitest/package.json | 3 +-- js-vitest/vite.config.js | 5 ----- ts-vitest/fix-jest-dom.mjs | 21 --------------------- ts-vitest/package.json | 3 +-- ts-vitest/vite.config.ts | 5 ----- 6 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 js-vitest/fix-jest-dom.mjs delete mode 100644 ts-vitest/fix-jest-dom.mjs diff --git a/js-vitest/fix-jest-dom.mjs b/js-vitest/fix-jest-dom.mjs deleted file mode 100644 index 18bc04e..0000000 --- a/js-vitest/fix-jest-dom.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -const typesPath = path.resolve('node_modules', '@types', 'testing-library__jest-dom', 'index.d.ts'); -const refMatcher = /[\r\n]+\/\/\/ /; - -fs.readFile(typesPath, 'utf8', (err, data) => { - if (err) throw err; - - fs.writeFile( - typesPath, - data.replace(refMatcher, ''), - 'utf8', - function(err) { - if (err) throw err; - } - ); -}); diff --git a/js-vitest/package.json b/js-vitest/package.json index 0280647..bafb7e8 100644 --- a/js-vitest/package.json +++ b/js-vitest/package.json @@ -8,8 +8,7 @@ "dev": "vite", "build": "vite build", "serve": "vite preview", - "test": "vitest", - "postinstall": "node ./fix-jest-dom.mjs" + "test": "vitest" }, "license": "MIT", "devDependencies": { diff --git a/js-vitest/vite.config.js b/js-vitest/vite.config.js index 04e09b6..f5e07c9 100644 --- a/js-vitest/vite.config.js +++ b/js-vitest/vite.config.js @@ -9,11 +9,6 @@ export default defineConfig({ web: [/\.jsx?$/], }, setupFiles: './setupVitest.js', - // solid needs to be inline to work around - // a resolution issue in vitest: - deps: { - inline: [/solid-js/, /solid-testing-library/], - }, // if you have few tests, try commenting one // or both out to improve performance: // threads: false, diff --git a/ts-vitest/fix-jest-dom.mjs b/ts-vitest/fix-jest-dom.mjs deleted file mode 100644 index a2ee7ce..0000000 --- a/ts-vitest/fix-jest-dom.mjs +++ /dev/null @@ -1,21 +0,0 @@ -import fs from 'fs'; -import path from 'path'; - -const typesPath = path.resolve('node_modules', '@types', 'testing-library__jest-dom', 'index.d.ts'); -const refMatcher = /[\r\n]+\/\/\/ /; - -fs.readFile(typesPath, 'utf8', (err, data) => { - if (err) { - console.warn('\x1b[33m⚠️ this template expects @types/testing-library__jest-dom to be installed, but it is missing.\n Please run:\x1b[0m\n\npnpm i --save-dev @types/testing-library__jest-dom\n'); - return; - } - - fs.writeFile( - typesPath, - data.replace(refMatcher, ''), - 'utf8', - function(err) { - if (err) throw err; - } - ); -}); diff --git a/ts-vitest/package.json b/ts-vitest/package.json index 08d6b03..b26f449 100644 --- a/ts-vitest/package.json +++ b/ts-vitest/package.json @@ -8,8 +8,7 @@ "dev": "vite", "build": "vite build", "serve": "vite preview", - "test": "vitest", - "postinstall": "node ./fix-jest-dom.mjs" + "test": "vitest" }, "license": "MIT", "devDependencies": { diff --git a/ts-vitest/vite.config.ts b/ts-vitest/vite.config.ts index 64d26a5..314bea7 100644 --- a/ts-vitest/vite.config.ts +++ b/ts-vitest/vite.config.ts @@ -16,11 +16,6 @@ export default defineConfig({ web: [/\.[jt]sx?$/], }, setupFiles: './setupVitest.ts', - // solid needs to be inline to work around - // a resolution issue in vitest: - deps: { - inline: [/solid-js/, 'solid-testing-library'], - }, // if you have few tests, try commenting one // or both out to improve performance: threads: false,