fix: remove node: prefix from the build

This commit is contained in:
Amin Yahyaabadi 2023-04-22 03:03:35 -07:00
parent d713a6703d
commit f36323172f
7 changed files with 29 additions and 5 deletions

View File

@ -0,0 +1,19 @@
import { readFile, writeFile } from "fs/promises"
import glob from "fast-glob"
const distFolder = "dist"
// remove node: prefix from the scripts in the dist folder
async function main() {
const files = await glob([`${distFolder}/**/*.js`, `${distFolder}/**/*.js.map`], { absolute: true, onlyFiles: true })
await Promise.all(
files.map(async (file) => {
const content = await readFile(file, "utf8")
const newContent = content.replace(/require\("node:/g, 'require("')
await writeFile(file, newContent)
})
)
}
await main()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,8 @@
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
"build.parcel": "cross-env NODE_ENV=production parcel build",
"build.parcel": "cross-env NODE_ENV=production parcel build && pnpm run build.node_prefix",
"build.node_prefix": "node ./dev/scripts/node_prefix.mjs",
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update",
"clean": "shx rm -rf .parcel-cache dist exe",
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/",
@ -87,6 +88,7 @@
"eslint-config-atomic": "^1.18.3",
"exec-powershell": "workspace:*",
"execa": "^7.1.1",
"fast-glob": "^3.2.12",
"gen-readme": "^1.6.0",
"is-url-online": "^1.5.0",
"jest": "^29.5.0",

View File

@ -93,6 +93,9 @@ importers:
execa:
specifier: ^7.1.1
version: 7.1.1
fast-glob:
specifier: ^3.2.12
version: 3.2.12
gen-readme:
specifier: ^1.6.0
version: 1.6.0