@turbo/gen 2.8.8-canary.2 → 2.8.8-canary.4

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/bin/turbo-gen ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Platform binary resolver for @turbo/gen.
5
+ *
6
+ * The actual turbo-gen binary is compiled per-platform and distributed
7
+ * as optional dependencies (@turbo/gen-darwin-arm64, etc.). This shim
8
+ * resolves the correct binary for the current platform and executes it.
9
+ */
10
+
11
+ const child_process = require('child_process');
12
+ const path = require('path');
13
+ const fs = require('fs');
14
+
15
+ function getBinaryPath() {
16
+ // Allow override for development
17
+ const TURBO_GEN_BINARY_PATH = process.env.TURBO_GEN_BINARY_PATH;
18
+ if (TURBO_GEN_BINARY_PATH) {
19
+ if (!fs.existsSync(TURBO_GEN_BINARY_PATH)) {
20
+ console.error(`TURBO_GEN_BINARY_PATH points to a missing file: ${TURBO_GEN_BINARY_PATH}`);
21
+ process.exit(1);
22
+ }
23
+ return TURBO_GEN_BINARY_PATH;
24
+ }
25
+
26
+ let { platform, arch } = process;
27
+ if (platform === 'win32') platform = 'windows';
28
+ const resolvedArch = arch === 'x64' ? '64' : arch;
29
+ const ext = platform === 'windows' ? '.exe' : '';
30
+
31
+ // Try the exact platform match
32
+ const packageName = `@turbo/gen-${platform}-${resolvedArch}`;
33
+ const binaryName = `bin/turbo-gen${ext}`;
34
+
35
+ try {
36
+ return require.resolve(`${packageName}/${binaryName}`);
37
+ } catch (e) {}
38
+
39
+ // For dev: check if there's a locally-built binary in dist/
40
+ const localBinary = path.join(__dirname, '..', 'dist', `turbo-gen${ext}`);
41
+ if (fs.existsSync(localBinary)) {
42
+ return localBinary;
43
+ }
44
+
45
+ // macOS and Windows ARM can run x64 under emulation
46
+ if (arch === 'arm64' && ['darwin', 'windows'].includes(platform)) {
47
+ const fallbackPackage = `@turbo/gen-${platform}-64`;
48
+ try {
49
+ return require.resolve(`${fallbackPackage}/${binaryName}`);
50
+ } catch (e) {}
51
+ }
52
+
53
+ console.error(`@turbo/gen: Could not find a binary for ${platform} ${resolvedArch}`);
54
+ console.error(`Expected package: ${packageName}`);
55
+ console.error();
56
+ console.error('This usually means the optional dependency was not installed.');
57
+ console.error('Try running your package manager\'s install command again.');
58
+ process.exit(1);
59
+ }
60
+
61
+ try {
62
+ child_process.execFileSync(
63
+ getBinaryPath(),
64
+ process.argv.slice(2),
65
+ { stdio: 'inherit' }
66
+ );
67
+ } catch (e) {
68
+ if (e && e.status) process.exit(e.status);
69
+ throw e;
70
+ }
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@turbo/gen",
3
- "version": "2.8.8-canary.2",
3
+ "version": "2.8.8-canary.4",
4
4
  "description": "Extend a Turborepo",
5
- "type": "commonjs",
6
5
  "homepage": "https://turborepo.dev",
7
6
  "license": "MIT",
8
7
  "repository": {
@@ -13,46 +12,54 @@
13
12
  "bugs": {
14
13
  "url": "https://github.com/vercel/turborepo/issues"
15
14
  },
16
- "bin": "dist/cli.js",
15
+ "bin": "bin/turbo-gen",
17
16
  "types": "dist/types.d.ts",
18
- "dependencies": {
19
- "commander": "10.0.0",
20
- "fs-extra": "10.1.0",
21
- "@inquirer/prompts": "^7.10.1",
22
- "minimatch": "9.0.0",
23
- "node-plop": "0.26.3",
24
- "picocolors": "1.0.1",
25
- "proxy-agent": "6.5.0",
26
- "tsx": "4.21.0",
27
- "update-check": "1.5.4",
28
- "validate-npm-package-name": "5.0.0",
29
- "@turbo/workspaces": "2.8.8-canary.2"
17
+ "dependencies": {},
18
+ "optionalDependencies": {
19
+ "@turbo/gen-darwin-64": "2.8.8-canary.1",
20
+ "@turbo/gen-darwin-arm64": "2.8.8-canary.1",
21
+ "@turbo/gen-linux-64": "2.8.8-canary.1",
22
+ "@turbo/gen-linux-arm64": "2.8.8-canary.1",
23
+ "@turbo/gen-windows-64": "2.8.8-canary.1"
30
24
  },
31
25
  "devDependencies": {
32
26
  "@arethetypeswrong/cli": "0.18.2",
27
+ "@inquirer/prompts": "^7.10.1",
33
28
  "@jest/globals": "30.2.0",
34
29
  "@types/fs-extra": "9.0.13",
35
30
  "@types/node": "18.17.4",
36
31
  "@types/validate-npm-package-name": "4.0.0",
32
+ "commander": "10.0.0",
33
+ "fs-extra": "10.1.0",
37
34
  "jest": "30.2.0",
35
+ "minimatch": "9.0.0",
36
+ "node-plop": "0.26.3",
37
+ "picocolors": "1.0.1",
38
+ "proxy-agent": "6.5.0",
38
39
  "ts-jest": "29.4.6",
39
40
  "ts-node": "10.9.2",
40
41
  "tsdown": "0.9.3",
41
42
  "typescript": "5.5.4",
43
+ "update-check": "1.5.4",
44
+ "validate-npm-package-name": "5.0.0",
42
45
  "@turbo/test-utils": "0.0.0",
46
+ "@turbo/utils": "0.0.0",
43
47
  "@turbo/tsconfig": "0.0.0",
44
- "@turbo/utils": "0.0.0"
48
+ "@turbo/workspaces": "2.8.8-canary.4"
45
49
  },
46
50
  "files": [
47
- "dist"
51
+ "bin",
52
+ "dist/types.d.ts",
53
+ "dist/types.js"
48
54
  ],
49
55
  "publishConfig": {
50
56
  "access": "public"
51
57
  },
52
58
  "scripts": {
53
- "build": "tsdown",
59
+ "build": "bun run scripts/build.ts",
60
+ "build:all": "bun run scripts/build.ts --all-platforms",
61
+ "build:embed": "bun run scripts/embed-templates.ts",
54
62
  "test": "jest",
55
- "check-types": "tsc --noEmit",
56
- "package:types": "attw --profile node16 --pack"
63
+ "check-types": "tsc --noEmit"
57
64
  }
58
65
  }
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node