warpack 0.0.1-dev.2c4e71e → 0.0.1-dev.2e316da

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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 ElusiveMori
4
+
5
+ Copyright (c) 2021 Rhazarian
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Returns the executable path for warpack located inside node_modules
3
- * The naming convention is warpack-${os}-${arch}
2
+ * Returns the executable path for warpack.
3
+ * Git installations from the `release` branch bundle it as `bin/${os}-${arch}/warpack`;
4
+ * registry releases get it from the `@warpack/${os}-${arch}` platform package.
4
5
  * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
5
6
  * @see https://nodejs.org/api/os.html#osarch
6
7
  * @see https://nodejs.org/api/os.html#osplatform
@@ -7,10 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { arch as getArch, platform as getPlatform } from "os";
10
+ import { existsSync } from "node:fs";
11
+ import { arch as getArch, platform as getPlatform } from "node:os";
11
12
  /**
12
- * Returns the executable path for warpack located inside node_modules
13
- * The naming convention is warpack-${os}-${arch}
13
+ * Returns the executable path for warpack.
14
+ * Git installations from the `release` branch bundle it as `bin/${os}-${arch}/warpack`;
15
+ * registry releases get it from the `@warpack/${os}-${arch}` platform package.
14
16
  * If the platform is `win32` or `cygwin`, executable will include a `.exe` extension
15
17
  * @see https://nodejs.org/api/os.html#osarch
16
18
  * @see https://nodejs.org/api/os.html#osplatform
@@ -26,12 +28,16 @@ export function getExePath() {
26
28
  os = "windows";
27
29
  extension = ".exe";
28
30
  }
31
+ const bundled = new URL(`../bin/${os}-${arch}/warpack${extension}`, import.meta.url);
32
+ if (existsSync(bundled)) {
33
+ return bundled.href;
34
+ }
29
35
  try {
30
36
  // Since the bin will be located inside `node_modules`, we can simply call import.meta.resolve
31
37
  return import.meta.resolve(`@warpack/${os}-${arch}/bin/warpack${extension}`);
32
38
  }
33
39
  catch (e) {
34
- throw new Error(`Couldn't find warpack binary inside node_modules for ${os}-${arch} (${e})`);
40
+ throw new Error(`Couldn't find warpack binary for ${os}-${arch}: neither bundled in bin/ (git installations must use the release branch) nor inside node_modules (${e})`);
35
41
  }
36
42
  });
37
43
  }
package/package.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "warpack",
4
4
  "description": "A build system for Warcraft III maps.",
5
+ "version": "0.0.1-dev.2e316da",
5
6
  "keywords": [
6
7
  "warcraft",
7
8
  "warpack",
@@ -10,6 +11,7 @@
10
11
  "license": "MIT",
11
12
  "author": "rhazarian",
12
13
  "files": [
14
+ "bin",
13
15
  "dist/**/*.js",
14
16
  "dist/**/*.d.ts"
15
17
  ],
@@ -24,13 +26,15 @@
24
26
  "url": "git+https://github.com/rhazarian/warpack.git"
25
27
  },
26
28
  "scripts": {
27
- "lint": "eslint .",
28
- "lint:fix": "eslint . --fix",
29
- "build": "tsc"
29
+ "lint": "eslint npm-cli",
30
+ "lint:fix": "eslint npm-cli --fix",
31
+ "build": "tsc -p npm-cli",
32
+ "prepare": "npm run build",
33
+ "check:types": "npm run check -w warpack-types"
30
34
  },
31
35
  "dependencies": {
32
36
  "execa": "^9.5.1",
33
- "warpack-types": "0.0.2"
37
+ "warpack-types": "0.0.6-dev.2e316da"
34
38
  },
35
39
  "devDependencies": {
36
40
  "@types/node": "^22.9.0",
@@ -40,17 +44,17 @@
40
44
  "tsup": "^8.3.5",
41
45
  "typescript": "^5.6.3"
42
46
  },
43
- "optionalDependencies": {
44
- "@warpack/darwin-arm64": "0.0.1-dev.2c4e71e",
45
- "@warpack/darwin-x64": "0.0.1-dev.2c4e71e",
46
- "@warpack/linux-arm64": "0.0.1-dev.2c4e71e",
47
- "@warpack/linux-x64": "0.0.1-dev.2c4e71e",
48
- "@warpack/windows-arm64": "0.0.1-dev.2c4e71e",
49
- "@warpack/windows-x64": "0.0.1-dev.2c4e71e"
50
- },
51
47
  "publishConfig": {
52
48
  "access": "public",
53
49
  "registry": "https://registry.npmjs.org/"
54
50
  },
55
- "version": "0.0.1-dev.2c4e71e"
51
+ "optionalDependencies": {
52
+ "@warpack/darwin-arm64": "0.0.1-dev.2e316da",
53
+ "@warpack/linux-arm64": "0.0.1-dev.2e316da",
54
+ "@warpack/linux-ia32": "0.0.1-dev.2e316da",
55
+ "@warpack/linux-x64": "0.0.1-dev.2e316da",
56
+ "@warpack/windows-arm64": "0.0.1-dev.2e316da",
57
+ "@warpack/windows-ia32": "0.0.1-dev.2e316da",
58
+ "@warpack/windows-x64": "0.0.1-dev.2e316da"
59
+ }
56
60
  }