@tokamakdev/tok 0.1.0-beta.34 → 0.1.1-beta.38
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/README.md +15 -6
- package/bin/tok.js +9 -2
- package/package.json +12 -5
- package/platform.js +17 -1
package/README.md
CHANGED
|
@@ -4,12 +4,21 @@ The tokamak CLI, published from the tokamak workspace. The version is the
|
|
|
4
4
|
workspace Cargo version, with a `-beta.N` suffix for automated pre-releases.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
|
-
npm install -
|
|
8
|
-
tok targets
|
|
7
|
+
npm install --save-dev @tokamakdev/tok@beta
|
|
8
|
+
npx tok targets
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The package installs the `tok` binary for the current
|
|
11
|
+
The package installs the `tok` binary for the current machine through an
|
|
12
12
|
optional dependency (`@tokamakdev/tok-darwin-arm64`, `-darwin-x64`,
|
|
13
|
-
`-linux-x64`, or `-win32-x64`)
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
`-linux-x64`, or `-win32-x64`), and the platform packs the machine can build
|
|
14
|
+
as `@tokamakdev/platform-<target>` optional dependencies:
|
|
15
|
+
|
|
16
|
+
| Machine | Platform packs |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| macOS, Apple silicon | `android-arm64`, `ios-arm64`, `ios-simulator-arm64`, `macos-arm64` |
|
|
19
|
+
| macOS, Intel | `android-arm64`, `ios-arm64`, `ios-simulator-x64`, `macos-x64` |
|
|
20
|
+
| Windows x64 | `android-arm64`, `windows-x64` |
|
|
21
|
+
| Linux x64 | `android-arm64` |
|
|
22
|
+
|
|
23
|
+
The launcher passes the installed platform packs to `tok` in
|
|
24
|
+
`TOKAMAK_PLATFORM_PACK_PATH`, unless that variable is already set.
|
package/bin/tok.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
const { spawnSync } = require("node:child_process");
|
|
5
|
-
const
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { binaryPath, platformPackRoots } = require("../platform.js");
|
|
6
7
|
|
|
7
8
|
let binary;
|
|
8
9
|
try {
|
|
@@ -16,7 +17,13 @@ try {
|
|
|
16
17
|
// so the launcher only waits for it.
|
|
17
18
|
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) process.on(signal, () => {});
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const env = { ...process.env };
|
|
21
|
+
if (!env.TOKAMAK_PLATFORM_PACK_PATH) {
|
|
22
|
+
const roots = platformPackRoots(require.resolve);
|
|
23
|
+
if (roots.length > 0) env.TOKAMAK_PLATFORM_PACK_PATH = roots.join(path.delimiter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit", env });
|
|
20
27
|
if (result.error) {
|
|
21
28
|
console.error(`could not run ${binary}: ${result.error.message}`);
|
|
22
29
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokamakdev/tok",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-beta.38",
|
|
4
4
|
"description": "The tokamak CLI: build native apps from a Cloudflare Workers codebase",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,10 +19,17 @@
|
|
|
19
19
|
"node": ">=18"
|
|
20
20
|
},
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@tokamakdev/
|
|
23
|
-
"@tokamakdev/
|
|
24
|
-
"@tokamakdev/
|
|
25
|
-
"@tokamakdev/
|
|
22
|
+
"@tokamakdev/platform-android-arm64": "0.1.1-beta.38",
|
|
23
|
+
"@tokamakdev/platform-ios-arm64": "0.1.1-beta.38",
|
|
24
|
+
"@tokamakdev/platform-ios-simulator-arm64": "0.1.1-beta.38",
|
|
25
|
+
"@tokamakdev/platform-ios-simulator-x64": "0.1.1-beta.38",
|
|
26
|
+
"@tokamakdev/platform-macos-arm64": "0.1.1-beta.38",
|
|
27
|
+
"@tokamakdev/platform-macos-x64": "0.1.1-beta.38",
|
|
28
|
+
"@tokamakdev/platform-windows-x64": "0.1.1-beta.38",
|
|
29
|
+
"@tokamakdev/tok-darwin-arm64": "0.1.1-beta.38",
|
|
30
|
+
"@tokamakdev/tok-darwin-x64": "0.1.1-beta.38",
|
|
31
|
+
"@tokamakdev/tok-linux-x64": "0.1.1-beta.38",
|
|
32
|
+
"@tokamakdev/tok-win32-x64": "0.1.1-beta.38"
|
|
26
33
|
},
|
|
27
34
|
"publishConfig": {
|
|
28
35
|
"access": "public"
|
package/platform.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const { optionalDependencies } = require("./package.json");
|
|
5
|
+
|
|
3
6
|
const PACKAGES = {
|
|
4
7
|
"darwin-arm64": "@tokamakdev/tok-darwin-arm64",
|
|
5
8
|
"darwin-x64": "@tokamakdev/tok-darwin-x64",
|
|
@@ -7,6 +10,8 @@ const PACKAGES = {
|
|
|
7
10
|
"win32-x64": "@tokamakdev/tok-win32-x64",
|
|
8
11
|
};
|
|
9
12
|
|
|
13
|
+
const PLATFORM_PACKS = Object.keys(optionalDependencies).filter((name) => name.startsWith("@tokamakdev/platform-"));
|
|
14
|
+
|
|
10
15
|
function packageFor(platform, arch) {
|
|
11
16
|
const name = PACKAGES[`${platform}-${arch}`];
|
|
12
17
|
if (!name) throw new Error(`tokamak does not publish a CLI for ${platform} ${arch}`);
|
|
@@ -23,4 +28,15 @@ function binaryPath(platform, arch, resolve) {
|
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
// npm installs only the platform packs whose os and cpu match this host.
|
|
32
|
+
function platformPackRoots(resolve) {
|
|
33
|
+
return PLATFORM_PACKS.flatMap((name) => {
|
|
34
|
+
try {
|
|
35
|
+
return [path.dirname(resolve(`${name}/package.json`))];
|
|
36
|
+
} catch {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { PLATFORM_PACKS, packageFor, binaryPath, platformPackRoots };
|