warpack 0.0.1-dev.ab8ac45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package",
3
+ "name": "warpack",
4
+ "version": "0.0.1-dev.ab8ac45",
5
+ "description": "A build system for Warcraft III maps.",
6
+ "keywords": [
7
+ "warcraft",
8
+ "warpack",
9
+ "warscript"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "rhazarian",
13
+ "main": "lib/cjs/index.d.cts",
14
+ "exports": {
15
+ "./cli": {
16
+ "import": "./lib/cli/cli.js"
17
+ },
18
+ ".": {
19
+ "import": {
20
+ "types": "./lib/esm/index.d.ts",
21
+ "default": "./lib/esm/index.js"
22
+ },
23
+ "require": {
24
+ "types": "./lib/cjs/index.d.cts",
25
+ "default": "./lib/cjs/index.cjs"
26
+ }
27
+ }
28
+ },
29
+ "bin": "lib/cli/cli.js",
30
+ "type": "module",
31
+ "types": "lib/cjs/index.d.cts",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/rhazarian/warpack"
35
+ },
36
+ "scripts": {
37
+ "typecheck": "tsc",
38
+ "lint": "eslint .",
39
+ "lint:fix": "eslint . --fix",
40
+ "build": "tsup"
41
+ },
42
+ "dependencies": {
43
+ "execa": "^8.0.1"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^20.11.22",
47
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
48
+ "@typescript-eslint/parser": "^7.1.0",
49
+ "eslint": "^8.57.0",
50
+ "tsup": "^8.0.2",
51
+ "typescript": "^5.3.3"
52
+ },
53
+ "optionalDependencies": {
54
+ "@warpack/darwin-arm64": "0.0.1",
55
+ "@warpack/darwin-x64": "0.0.1",
56
+ "@warpack/linux-arm64": "0.0.1",
57
+ "@warpack/linux-x64": "0.0.1",
58
+ "@warpack/windows-arm64": "0.0.1",
59
+ "@warpack/windows-x64": "0.0.1"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public",
63
+ "registry": "https://registry.npmjs.org/"
64
+ },
65
+ "module": "lib/esm/index.d.ts"
66
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/package",
3
+ "name": "@warpack/${node_pkg}",
4
+ "version": "0.0.1",
5
+ "description": "A build system for Warcraft III maps.",
6
+ "keywords": [
7
+ "warcraft",
8
+ "warpack",
9
+ "warscript"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "rhazarian",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/rhazarian/warpack"
16
+ },
17
+ "os": [
18
+ "${node_os}"
19
+ ],
20
+ "cpu": [
21
+ "${node_arch}"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "registry": "https://registry.npmjs.org/"
26
+ }
27
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runWarpack } from "./index.js";
4
+
5
+ async function run() {
6
+ const args = process.argv.slice(2);
7
+ const processResult = await runWarpack(args);
8
+
9
+ process.exit(processResult.exitCode ?? 0);
10
+ }
11
+
12
+ void run();
@@ -0,0 +1,33 @@
1
+ import { arch as getArch, platform as getPlatform } from "os";
2
+
3
+ /**
4
+ * Returns the executable path for warpack located inside node_modules
5
+ * The naming convention is warpack-${os}-${arch}
6
+ * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
7
+ * @see https://nodejs.org/api/os.html#osarch
8
+ * @see https://nodejs.org/api/os.html#osplatform
9
+ * @example "x/xx/node_modules/warpack-darwin-arm64"
10
+ */
11
+ export async function getExePath() {
12
+ const platform = getPlatform();
13
+ const arch = getArch();
14
+
15
+ let os = platform as string;
16
+ let extension = "";
17
+
18
+ if (platform === "win32" || platform === "cygwin") {
19
+ os = "windows";
20
+ extension = ".exe";
21
+ }
22
+
23
+ try {
24
+ // Since the bin will be located inside `node_modules`, we can simply call import.meta.resolve
25
+ return import.meta.resolve(
26
+ `warpack-${os}-${arch}/bin/warpack${extension}`,
27
+ );
28
+ } catch (e) {
29
+ throw new Error(
30
+ `Couldn't find warpack binary inside node_modules for ${os}-${arch} (${e})`,
31
+ );
32
+ }
33
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { execa, type Options as ExecaOptions, type ExecaReturnValue, } from "execa";
2
+ import { fileURLToPath } from "node:url";
3
+ import { getExePath } from "./get-exe-path.js";
4
+
5
+ export async function runWarpack(args: string[], execaOptions?: ExecaOptions): Promise<ExecaReturnValue> {
6
+ const exePath = await getExePath();
7
+
8
+ return execa(fileURLToPath(exePath), args, {
9
+ stdio: "inherit",
10
+ ...execaOptions,
11
+ });
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2016",
4
+ "module": "node16",
5
+ "moduleResolution": "node16",
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "strict": true,
9
+ "resolveJsonModule": true,
10
+ "noEmit": true
11
+ }
12
+ }