t3-mono 0.0.24
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/index.js +80 -0
- package/install.js +95 -0
- package/package.json +48 -0
package/bin/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync, spawn } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const PLATFORM_MAP = {
|
|
8
|
+
darwin: {
|
|
9
|
+
arm64: "@t3-mono/darwin-arm64",
|
|
10
|
+
x64: "@t3-mono/darwin-x64",
|
|
11
|
+
},
|
|
12
|
+
linux: {
|
|
13
|
+
x64: "@t3-mono/linux-x64",
|
|
14
|
+
arm64: "@t3-mono/linux-arm64",
|
|
15
|
+
},
|
|
16
|
+
win32: {
|
|
17
|
+
x64: "@t3-mono/win32-x64",
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getBinaryPath() {
|
|
22
|
+
const platform = os.platform();
|
|
23
|
+
const arch = os.arch();
|
|
24
|
+
|
|
25
|
+
const platformPackages = PLATFORM_MAP[platform];
|
|
26
|
+
if (!platformPackages) {
|
|
27
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const packageName = platformPackages[arch];
|
|
32
|
+
if (!packageName) {
|
|
33
|
+
console.error(`Unsupported architecture: ${arch} on ${platform}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const packagePath = require.resolve(`${packageName}/package.json`);
|
|
39
|
+
const packageDir = path.dirname(packagePath);
|
|
40
|
+
const binaryName = "t3-mono" + (platform === "win32" ? ".exe" : "");
|
|
41
|
+
return path.join(packageDir, binaryName);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Fallback to local binary (for development)
|
|
44
|
+
const localBinary = path.join(
|
|
45
|
+
__dirname,
|
|
46
|
+
"..",
|
|
47
|
+
"..",
|
|
48
|
+
"target",
|
|
49
|
+
"release",
|
|
50
|
+
"t3-mono" + (platform === "win32" ? ".exe" : "")
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const fs = require("fs");
|
|
54
|
+
if (fs.existsSync(localBinary)) {
|
|
55
|
+
return localBinary;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.error(`Binary not found. Package: ${packageName}`);
|
|
59
|
+
console.error("Try running: npm install");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Get the binary path and run it with all arguments
|
|
65
|
+
const binaryPath = getBinaryPath();
|
|
66
|
+
const args = process.argv.slice(2);
|
|
67
|
+
|
|
68
|
+
const child = spawn(binaryPath, args, {
|
|
69
|
+
stdio: "inherit",
|
|
70
|
+
shell: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
child.on("error", (err) => {
|
|
74
|
+
console.error("Failed to start binary:", err.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
child.on("exit", (code) => {
|
|
79
|
+
process.exit(code || 0);
|
|
80
|
+
});
|
package/install.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const PLATFORM_MAP = {
|
|
8
|
+
darwin: {
|
|
9
|
+
arm64: "@t3-mono/darwin-arm64",
|
|
10
|
+
x64: "@t3-mono/darwin-x64",
|
|
11
|
+
},
|
|
12
|
+
linux: {
|
|
13
|
+
x64: "@t3-mono/linux-x64",
|
|
14
|
+
arm64: "@t3-mono/linux-arm64",
|
|
15
|
+
},
|
|
16
|
+
win32: {
|
|
17
|
+
x64: "@t3-mono/win32-x64",
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function getBinaryPackage() {
|
|
22
|
+
const platform = os.platform();
|
|
23
|
+
const arch = os.arch();
|
|
24
|
+
|
|
25
|
+
const platformPackages = PLATFORM_MAP[platform];
|
|
26
|
+
if (!platformPackages) {
|
|
27
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const packageName = platformPackages[arch];
|
|
32
|
+
if (!packageName) {
|
|
33
|
+
console.error(`Unsupported architecture: ${arch} on ${platform}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return packageName;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getBinaryPath() {
|
|
41
|
+
const packageName = getBinaryPackage();
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
// Try to resolve the platform-specific package
|
|
45
|
+
const packagePath = require.resolve(`${packageName}/package.json`);
|
|
46
|
+
const packageDir = path.dirname(packagePath);
|
|
47
|
+
const pkg = require(packagePath);
|
|
48
|
+
|
|
49
|
+
// Get binary name from package
|
|
50
|
+
const binaryName = pkg.bin
|
|
51
|
+
? Object.values(pkg.bin)[0]
|
|
52
|
+
: "t3-mono" + (os.platform() === "win32" ? ".exe" : "");
|
|
53
|
+
|
|
54
|
+
return path.join(packageDir, binaryName);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
console.error(`Failed to find binary package: ${packageName}`);
|
|
57
|
+
console.error("Please report this issue at: https://github.com/elijahross/boilerplate_moduls/issues");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function linkBinary() {
|
|
63
|
+
const binaryPath = getBinaryPath();
|
|
64
|
+
const binDir = path.join(__dirname, "bin");
|
|
65
|
+
const linkPath = path.join(binDir, "t3-mono" + (os.platform() === "win32" ? ".exe" : ""));
|
|
66
|
+
|
|
67
|
+
// Ensure bin directory exists
|
|
68
|
+
if (!fs.existsSync(binDir)) {
|
|
69
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Create symlink or copy binary
|
|
73
|
+
try {
|
|
74
|
+
if (fs.existsSync(linkPath)) {
|
|
75
|
+
fs.unlinkSync(linkPath);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (os.platform() === "win32") {
|
|
79
|
+
// On Windows, copy the binary
|
|
80
|
+
fs.copyFileSync(binaryPath, linkPath);
|
|
81
|
+
} else {
|
|
82
|
+
// On Unix, create a symlink
|
|
83
|
+
fs.symlinkSync(binaryPath, linkPath);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Make executable
|
|
87
|
+
fs.chmodSync(linkPath, 0o755);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error("Failed to link binary:", e.message);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Run installation
|
|
95
|
+
linkBinary();
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "t3-mono",
|
|
3
|
+
"version": "0.0.24",
|
|
4
|
+
"description": "CLI to scaffold T3 stack apps with Better Auth and optional AI/UI/Restate extensions",
|
|
5
|
+
"author": "Elijah Ross",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/elijahross/boilerplate_moduls.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/elijahross/boilerplate_moduls/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/elijahross/boilerplate_moduls#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"monorepo",
|
|
18
|
+
"t3-stack",
|
|
19
|
+
"next.js",
|
|
20
|
+
"better-auth",
|
|
21
|
+
"scaffolding",
|
|
22
|
+
"langchain",
|
|
23
|
+
"ai",
|
|
24
|
+
"ui-components",
|
|
25
|
+
"restate",
|
|
26
|
+
"durable-workflows"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"t3-mono": "bin/index.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin",
|
|
33
|
+
"install.js"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"postinstall": "node install.js"
|
|
37
|
+
},
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@t3-mono/darwin-arm64": "0.0.24", "@t3-mono/darwin-x64": "0.0.24", "@t3-mono/linux-x64": "0.0.24", "@t3-mono/linux-arm64": "0.0.24", "@t3-mono/win32-x64": "0.0.24",
|
|
40
|
+
"@t3-mono/darwin-arm64": "0.0.24", "@t3-mono/darwin-x64": "0.0.24", "@t3-mono/linux-x64": "0.0.24", "@t3-mono/linux-arm64": "0.0.24", "@t3-mono/win32-x64": "0.0.24",
|
|
41
|
+
"@t3-mono/darwin-arm64": "0.0.24", "@t3-mono/darwin-x64": "0.0.24", "@t3-mono/linux-x64": "0.0.24", "@t3-mono/linux-arm64": "0.0.24", "@t3-mono/win32-x64": "0.0.24",
|
|
42
|
+
"@t3-mono/darwin-arm64": "0.0.24", "@t3-mono/darwin-x64": "0.0.24", "@t3-mono/linux-x64": "0.0.24", "@t3-mono/linux-arm64": "0.0.24", "@t3-mono/win32-x64": "0.0.24",
|
|
43
|
+
"@t3-mono/darwin-arm64": "0.0.24", "@t3-mono/darwin-x64": "0.0.24", "@t3-mono/linux-x64": "0.0.24", "@t3-mono/linux-arm64": "0.0.24", "@t3-mono/win32-x64": "0.0.24"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18"
|
|
47
|
+
}
|
|
48
|
+
}
|