From 13eca9807ab25ea224a5797fc5e635924fc05990 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 24 Nov 2023 07:07:31 +0800 Subject: [PATCH] Experiment --- add-ts-nocheck.js | 33 +++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 add-ts-nocheck.js diff --git a/add-ts-nocheck.js b/add-ts-nocheck.js new file mode 100644 index 00000000000..ce0296f6d39 --- /dev/null +++ b/add-ts-nocheck.js @@ -0,0 +1,33 @@ +const fs = require('fs') + +const ADDED_STR = '// @ts-nocheck\n\n' +const FILES = [ + 'node_modules/i18next/index.v4.d.ts', + 'node_modules/react-i18next/index.d.ts' +] + +Promise.allSettled(FILES.map(addTsNoCheck)).then(results => { + let hasErrors = false + + for (const result of results) { + if (result.status === 'rejected') { + hasErrors = true + console.error(result.reason) + } + } + + if (hasErrors) { + process.exit(1) + } +}) + +async function addTsNoCheck(file) { + const content = fs.readFileSync(file).toString() + + if (content.includes(ADDED_STR)) { + console.log(JSON.stringify(ADDED_STR), 'is already in', file) + } else { + fs.writeFileSync(file, ADDED_STR + content) + console.log(JSON.stringify(ADDED_STR), 'added into', file) + } +} diff --git a/package.json b/package.json index f781c8da566..b9928fa9ac5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "starts": "cross-env NODE_ENV=development webpack-dev-server --https --colors --config ./build_scripts/webpack.config.js", "start-prod": "cross-env NODE_ENV=production webpack-dev-server --colors --config ./build_scripts/webpack.config.js", "starts-prod": "cross-env NODE_ENV=production webpack-dev-server --https --colors --config ./build_scripts/webpack.config.js", - "test": "tsc --noEmit && yarn lint-quiet && yarn jest", + "test": "node add-ts-nocheck && tsc --noEmit && yarn lint-quiet && yarn jest", "test-e2e": "npx concurrently --kill-others -n 'neo4j,cypress,browser' 'docker run --env NEO4J_AUTH=neo4j/newpassword -p7474:7474 -p7687:7687 neo4j:4.2.2' 'yarn wait-on-neo4j && yarn wait-on-dev && yarn e2e-local --env server=4.2' 'yarn && yarn start'", "update-licenses": "sh ./scripts/generate_licenses.sh", "version-pom": "node ./scripts/set-pom-version.js -f ./pom.xml -v $npm_package_version",