Skip to content

Commit

Permalink
mv to scripts/
Browse files Browse the repository at this point in the history
  • Loading branch information
xan105 committed May 9, 2024
1 parent 3019771 commit b8f6ce4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1326,17 +1326,17 @@
"lint": "eslint \"./lib/**/*.{js,mjs}\" \"./types/**/*.d.ts\"",
"check": "tsc --noemit --checkjs",
"declare": "tsc --declaration --emitDeclarationOnly --outDir \"./types\"",
"fetch:init": "powershell -NoProfile -ExecutionPolicy Bypass -File ./fetch.ps1",
"fetch:manual": "powershell -NoProfile -ExecutionPolicy Bypass -File ./fetch.ps1 && patch-package",
"fetch:init": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/fetch.ps1",
"fetch:manual": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/fetch.ps1 && patch-package",
"fetch:auto": "npm ci --ignore-scripts && patch-package",
"diff": "powershell -NoProfile -ExecutionPolicy Bypass -File ./diff.ps1",
"build:abi93": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 16.0.0 -abi abi93 -skip",
"build:abi108": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 18.0.0 -abi abi108 -skip",
"build:abi115": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 20.0.0 -abi abi115 -skip",
"build:abi127": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 22.0.0 -abi 127 -skip",
"build:electron:abi119": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 28.0.0 -abi abi119 -runtime electron -skip",
"build:electron:abi121": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 29.0.0 -abi abi121 -runtime electron -skip",
"build:electron:abi123": "powershell -NoProfile -ExecutionPolicy Bypass -File ./build.ps1 -target 30.0.0 -abi abi123 -runtime electron -skip"
"diff": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/diff.ps1",
"build:abi93": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 16.0.0 -abi abi93 -skip",
"build:abi108": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 18.0.0 -abi abi108 -skip",
"build:abi115": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 20.0.0 -abi abi115 -skip",
"build:abi127": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 22.0.0 -abi 127 -skip",
"build:electron:abi119": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 28.0.0 -abi abi119 -runtime electron -skip",
"build:electron:abi121": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 29.0.0 -abi abi121 -runtime electron -skip",
"build:electron:abi123": "powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/build.ps1 -target 30.0.0 -abi abi123 -runtime electron -skip"
},
"keywords": [
"nodeRT",
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions copyTypes.js → scripts/copyTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import { ls, writeFile, readFile } from "@xan105/fs";
import { join } from "node:path";
import { EOL } from "node:os";

const scopes = await ls("./node_modules", { pattern: /^@nodert-.*$/ })
const scopes = await ls("../node_modules", { pattern: /^@nodert-.*$/ })
for (const scope of scopes)
{
const namespaces = await ls(join("./node_modules", scope));
const namespaces = await ls(join("../node_modules", scope));
for (const namespace of namespaces)
{
const name = namespace.replace("windows.","");

const root = namespace.replace("windows.","").split(".")[0];


const types = await readFile(join("./node_modules", scope, namespace, "lib", `NodeRT_Windows_${name.replaceAll('.','_')}.d.ts`), "utf8");
const exports = await readFile(join("./types/namespaces", root, name + ".d.ts"), "utf8");
const types = await readFile(join("../node_modules", scope, namespace, "lib", `NodeRT_Windows_${name.replaceAll('.','_')}.d.ts`), "utf8");
const exports = await readFile(join("../types/namespaces", root, name + ".d.ts"), "utf8");

const sep = types.includes("\r\n") ? "\r\n" : "\n";
const x = types.split(sep).filter(line => !line.includes("declare module"));
Expand All @@ -31,6 +31,6 @@ for (const scope of scopes)

const newFile = z + EOL + exports.split(EOL).filter(line => line.includes("export * as")).join(EOL);

await writeFile(join("./types/namespaces", root, name + ".d.ts"), newFile, "utf8");
await writeFile(join("../types/namespaces", root, name + ".d.ts"), newFile, "utf8");
}
}
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions generate.js → scripts/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ found in the LICENSE file in the root directory of this source tree.
import { ls, writeFile, exists, readFile, writeJSON } from "@xan105/fs";
import { join } from "node:path";
import { EOL } from "node:os";
import { load } from "./lib/util/load.js";
import { load } from "../lib/util/load.js";

const header = `/*` + EOL +
`Copyright (c) Anthony Beaumont` + EOL +
Expand All @@ -19,10 +19,10 @@ const header = `/*` + EOL +

const dependencies = `import { load, reference } from "../../util/load.js";` + EOL + EOL;

const scopes = await ls("./node_modules", { pattern: /^@nodert-.*$/ })
const scopes = await ls("../node_modules", { pattern: /^@nodert-.*$/ })
for (const scope of scopes)
{
const namespaces = await ls(join("./node_modules", scope));
const namespaces = await ls(join("../node_modules", scope));
for (const namespace of namespaces)
{

Expand Down Expand Up @@ -55,7 +55,7 @@ for (const scope of scopes)
`reference(namespace.externalReference);` + EOL;

await writeFile(
join("./lib/namespaces", folder, names.join(".") + ".js"),
join("../lib/namespaces", folder, names.join(".") + ".js"),
file,
"utf8"
);
Expand Down Expand Up @@ -87,7 +87,7 @@ for (const scope of scopes)
async function getExternalRef(scope, namespace){

const filePath = join(
"./node_modules",
"../node_modules",
scope,
namespace,
"lib",
Expand Down Expand Up @@ -119,7 +119,7 @@ let map = {
}
};

const list = await ls("./lib/namespaces", { recursive: true, ignore: { dir : true }, ext: "js" });
const list = await ls("../lib/namespaces", { recursive: true, ignore: { dir : true }, ext: "js" });

for (const exportName of list) {

Expand All @@ -133,4 +133,4 @@ for (const exportName of list) {

}

await writeJSON("./build/exports.json", map, { pretty: true });
await writeJSON("../build/exports.json", map, { pretty: true });
6 changes: 3 additions & 3 deletions updateCompilerFlags.js → scripts/updateCompilerFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ found in the LICENSE file in the root directory of this source tree.
import { join } from "node:path";
import { readJSON, writeJSON, ls } from "@xan105/fs";

const scopes = await ls("./node_modules", { pattern: /^@nodert-.*$/ })
const scopes = await ls("../node_modules", { pattern: /^@nodert-.*$/ })
for (const scope of scopes)
{
const namespaces = await ls(join("./node_modules", scope));
const namespaces = await ls(join("../node_modules", scope));
for (const namespace of namespaces)
{
console.log(scope + "/" + namespace);

const binding = join("./node_modules", scope, namespace, "binding.gyp");
const binding = join("../node_modules", scope, namespace, "binding.gyp");
const gyp = await readJSON(binding);

/*
Expand Down

0 comments on commit b8f6ce4

Please sign in to comment.