create-terminatui 0.0.0-development → 0.0.2
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/create-terminatui.js +41 -0
- package/package.json +8 -7
- package/bin/create-terminatui.mjs +0 -45
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
|
|
4
|
+
// src/create-terminatui.ts
|
|
5
|
+
import { copyFileSync, mkdirSync, readdirSync, readlinkSync, symlinkSync } from "fs";
|
|
6
|
+
import { join, dirname, resolve } from "path";
|
|
7
|
+
var templateDir = resolve(dirname(import.meta.path), "../template");
|
|
8
|
+
var destDir = process.argv[2];
|
|
9
|
+
if (!destDir) {
|
|
10
|
+
console.error("Usage: bun create terminatui <destination>");
|
|
11
|
+
console.error(" bunx create-terminatui <destination>");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
function copyDir(src, dest) {
|
|
15
|
+
mkdirSync(dest, { recursive: true });
|
|
16
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
17
|
+
const srcPath = join(src, entry.name);
|
|
18
|
+
const destPath = join(dest, entry.name);
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
copyDir(srcPath, destPath);
|
|
21
|
+
} else if (entry.isSymbolicLink()) {
|
|
22
|
+
const linkTarget = readlinkSync(srcPath);
|
|
23
|
+
symlinkSync(linkTarget, destPath);
|
|
24
|
+
} else {
|
|
25
|
+
copyFileSync(srcPath, destPath);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
console.log(`Creating TerminaTUI app in ${destDir}...`);
|
|
30
|
+
copyDir(templateDir, destDir);
|
|
31
|
+
console.log(`
|
|
32
|
+
Created TerminaTUI app in ${destDir}
|
|
33
|
+
|
|
34
|
+
Next steps:
|
|
35
|
+
cd ${destDir}
|
|
36
|
+
bun install
|
|
37
|
+
bun run start
|
|
38
|
+
|
|
39
|
+
Documentation:
|
|
40
|
+
https://github.com/PabloZaiden/terminatui
|
|
41
|
+
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-terminatui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Create template for TerminaTUI CLI/TUI applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,21 +8,22 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"bin": {
|
|
11
|
-
"create-terminatui": "bin/create-terminatui.
|
|
11
|
+
"create-terminatui": "bin/create-terminatui.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"bin/create-terminatui.
|
|
14
|
+
"bin/create-terminatui.js",
|
|
15
15
|
"template/**/*"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"test
|
|
18
|
+
"build": "bun build src/create-terminatui.ts --outdir bin --target bun",
|
|
19
|
+
"create": "bun run src/create-terminatui.ts",
|
|
20
|
+
"test": "bun run build && bun run test:create && bun run test:template",
|
|
21
|
+
"test:create": "bun run bin/create-terminatui.js /tmp/terminatui-test-app",
|
|
21
22
|
"test:template": "cd /tmp/terminatui-test-app && bun install && bun run build && bun run start --mode cli greet --name Test --loud",
|
|
22
23
|
"test:template:tui": "cd /tmp/terminatui-test-app && bun run start",
|
|
23
24
|
"cleanup": "rm -rf /tmp/terminatui-test-app",
|
|
24
25
|
"dev:template": "cd template && bun install && bun run start",
|
|
25
26
|
"dev:template:cli": "cd template && bun run start --mode cli",
|
|
26
|
-
"publish:local": "bunx npm publish --access public --tag dev"
|
|
27
|
+
"publish:local": "bun run build && bunx npm publish --access public --tag dev"
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { copyFileSync, mkdirSync, readdirSync, readlinkSync, symlinkSync } from "node:fs";
|
|
4
|
-
import { join, dirname, resolve } from "node:path";
|
|
5
|
-
|
|
6
|
-
const templateDir = resolve(dirname(import.meta.path), "../template");
|
|
7
|
-
const destDir = process.argv[2];
|
|
8
|
-
|
|
9
|
-
if (!destDir) {
|
|
10
|
-
console.error("Usage: bun create terminatui <destination>");
|
|
11
|
-
console.error(" bunx create-terminatui <destination>");
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function copyDir(src, dest) {
|
|
16
|
-
mkdirSync(dest, { recursive: true });
|
|
17
|
-
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
18
|
-
const srcPath = join(src, entry.name);
|
|
19
|
-
const destPath = join(dest, entry.name);
|
|
20
|
-
|
|
21
|
-
if (entry.isDirectory()) {
|
|
22
|
-
copyDir(srcPath, destPath);
|
|
23
|
-
} else if (entry.isSymbolicLink()) {
|
|
24
|
-
const linkTarget = readlinkSync(srcPath);
|
|
25
|
-
symlinkSync(linkTarget, destPath);
|
|
26
|
-
} else {
|
|
27
|
-
copyFileSync(srcPath, destPath);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
console.log(`Creating TerminaTUI app in ${destDir}...`);
|
|
33
|
-
copyDir(templateDir, destDir);
|
|
34
|
-
|
|
35
|
-
console.log(`
|
|
36
|
-
Created TerminaTUI app in ${destDir}
|
|
37
|
-
|
|
38
|
-
Next steps:
|
|
39
|
-
cd ${destDir}
|
|
40
|
-
bun install
|
|
41
|
-
bun run start
|
|
42
|
-
|
|
43
|
-
Documentation:
|
|
44
|
-
https://github.com/PabloZaiden/terminatui
|
|
45
|
-
`);
|