@teaui/cli 1.2.1 → 1.3.7
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/.dist/bin.d.ts +2 -0
- package/.dist/bin.js +29 -0
- package/.dist/bin.js.map +1 -1
- package/.dist/frameworks/none/index.ts +57 -0
- package/.dist/frameworks/none/package.json +17 -0
- package/.dist/frameworks/none/tsconfig.json +18 -0
- package/.dist/frameworks/preact/index.tsx +31 -0
- package/.dist/frameworks/preact/package.json +19 -0
- package/.dist/frameworks/preact/tsconfig.json +26 -0
- package/.dist/frameworks/react/index.tsx +32 -0
- package/.dist/frameworks/react/package.json +20 -0
- package/.dist/frameworks/react/tsconfig.json +19 -0
- package/.dist/index.d.ts +3 -0
- package/.dist/index.js +17 -0
- package/.dist/index.js.map +1 -1
- package/package.json +4 -4
package/.dist/bin.d.ts
CHANGED
package/.dist/bin.js
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const index_js_1 = require("./index.js");
|
|
6
|
+
const program = new commander_1.Command();
|
|
7
|
+
program
|
|
8
|
+
.name('teaui')
|
|
9
|
+
.description('CLI for creating TeaUI applications')
|
|
10
|
+
.version('1.2.1');
|
|
11
|
+
program
|
|
12
|
+
.command('create')
|
|
13
|
+
.description('Create a new TeaUI application')
|
|
14
|
+
.argument('<name>', 'Name of the application')
|
|
15
|
+
.requiredOption('-f, --framework <framework> (none, react, or preact)', 'Framework to use', value => {
|
|
16
|
+
if (!['react', 'preact', 'none'].includes(value)) {
|
|
17
|
+
throw new Error(`Invalid framework: ${value}. Must be one of: react, preact, none`);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
})
|
|
21
|
+
.action(async (name, options) => {
|
|
22
|
+
try {
|
|
23
|
+
(0, index_js_1.create)(name, options);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error(`Error creating application: ${error}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
program.parse();
|
|
2
31
|
//# sourceMappingURL=bin.js.map
|
package/.dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../lib/bin.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../lib/bin.ts"],"names":[],"mappings":";;;AAEA,yCAAiC;AAIjC,yCAAiC;AAEjC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,qCAAqC,CAAC;KAClD,OAAO,CAAC,OAAO,CAAC,CAAA;AAEnB,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,gCAAgC,CAAC;KAC7C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;KAC7C,cAAc,CACb,sDAAsD,EACtD,kBAAkB,EAClB,KAAK,CAAC,EAAE;IACN,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACb,sBAAsB,KAAK,uCAAuC,CACnE,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CACF;KACA,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,OAA4B,EAAE,EAAE;IAC3D,IAAI,CAAC;QACH,IAAA,iBAAM,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAA;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Screen,
|
|
3
|
+
TrackMouse,
|
|
4
|
+
ConsoleLog,
|
|
5
|
+
Button,
|
|
6
|
+
Stack,
|
|
7
|
+
Separator,
|
|
8
|
+
Space,
|
|
9
|
+
Text,
|
|
10
|
+
Window,
|
|
11
|
+
interceptConsoleLog,
|
|
12
|
+
} from '@teaui/core'
|
|
13
|
+
;(async () => {
|
|
14
|
+
interceptConsoleLog()
|
|
15
|
+
console.log('Logs appear in the "ConsoleLog" component')
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
console.log('one more log for good measure')
|
|
18
|
+
}, 1000)
|
|
19
|
+
|
|
20
|
+
process.title = '{{name}}'
|
|
21
|
+
const consoleLog = new ConsoleLog({
|
|
22
|
+
height: 10,
|
|
23
|
+
})
|
|
24
|
+
const [screen, program] = await Screen.start(
|
|
25
|
+
new Window({
|
|
26
|
+
child: new TrackMouse({
|
|
27
|
+
content: Stack.down([
|
|
28
|
+
[
|
|
29
|
+
'flex1',
|
|
30
|
+
Stack.down([
|
|
31
|
+
new Text({alignment: 'center', text: 'Hello to "{{name}}"'}),
|
|
32
|
+
new Separator({
|
|
33
|
+
direction: 'horizontal',
|
|
34
|
+
border: 'trailing',
|
|
35
|
+
padding: 1,
|
|
36
|
+
}),
|
|
37
|
+
Space.vertical(10),
|
|
38
|
+
new Button({
|
|
39
|
+
title: 'Exit',
|
|
40
|
+
onClick: () => {
|
|
41
|
+
screen.exit()
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
]),
|
|
45
|
+
],
|
|
46
|
+
['natural', consoleLog],
|
|
47
|
+
]),
|
|
48
|
+
}),
|
|
49
|
+
}),
|
|
50
|
+
{quitChar: 'q'},
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
program.key('escape', function () {
|
|
54
|
+
consoleLog.clear()
|
|
55
|
+
screen.render()
|
|
56
|
+
})
|
|
57
|
+
})()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"main": ".dist/index.js",
|
|
4
|
+
"license": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "$npm_execpath tsc",
|
|
7
|
+
"start": "$npm_execpath build && node --enable-source-maps -- .dist/index.js",
|
|
8
|
+
"clean": "rm -rf .dist/"
|
|
9
|
+
},
|
|
10
|
+
"private": true,
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@teaui/core": "latest"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.6.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["./"],
|
|
3
|
+
"exclude": [".dist/"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"outDir": ".dist"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {interceptConsoleLog, type Screen} from '@teaui/core'
|
|
2
|
+
import {Button, ConsoleLog, Separator, Space, Stack, run} from '@teaui/preact'
|
|
3
|
+
|
|
4
|
+
function App() {
|
|
5
|
+
function onExit() {
|
|
6
|
+
screen?.exit()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const name = '{{name}}'
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Stack.down>
|
|
13
|
+
<Stack.down flex={1}>
|
|
14
|
+
Hello to "{name}"
|
|
15
|
+
<Separator direction="horizontal" border="trailing" padding={1} />
|
|
16
|
+
<Space flex={1} />
|
|
17
|
+
<Button title="Exit" onClick={onExit} />
|
|
18
|
+
<Space flex={1} />
|
|
19
|
+
</Stack.down>
|
|
20
|
+
<ConsoleLog height={10} />
|
|
21
|
+
</Stack.down>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let screen: Screen | undefined
|
|
26
|
+
;(async () => {
|
|
27
|
+
interceptConsoleLog()
|
|
28
|
+
|
|
29
|
+
const [screen_] = await run(<App />)
|
|
30
|
+
screen = screen_
|
|
31
|
+
})()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"main": ".dist/index.js",
|
|
4
|
+
"license": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "$npm_execpath tsc",
|
|
7
|
+
"start": "$npm_execpath build && node --enable-source-maps -- .dist/index.js",
|
|
8
|
+
"clean": "rm -rf .dist/"
|
|
9
|
+
},
|
|
10
|
+
"private": true,
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"preact": "^10.24.3",
|
|
13
|
+
"@teaui/core": "latest",
|
|
14
|
+
"@teaui/preact": "latest"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"typescript": "^5.6.3"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["./"],
|
|
3
|
+
"exclude": [".dist/"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"outDir": ".dist",
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"jsxImportSource": "preact",
|
|
19
|
+
"paths": {
|
|
20
|
+
"react": ["./node_modules/preact/compat/"],
|
|
21
|
+
"react/jsx-runtime": ["./node_modules/preact/jsx-runtime"],
|
|
22
|
+
"react-dom": ["./node_modules/preact/compat/"],
|
|
23
|
+
"react-dom/*": ["./node_modules/preact/compat/*"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {interceptConsoleLog, type Screen} from '@teaui/core'
|
|
3
|
+
import {Button, ConsoleLog, Separator, Space, Stack, run} from '@teaui/react'
|
|
4
|
+
|
|
5
|
+
function App() {
|
|
6
|
+
function onExit() {
|
|
7
|
+
screen?.exit()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const name = '{{name}}'
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Stack.down>
|
|
14
|
+
<Stack.down flex={1}>
|
|
15
|
+
Hello to "{name}"
|
|
16
|
+
<Separator direction="horizontal" border="trailing" padding={1} />
|
|
17
|
+
<Space flex={1} />
|
|
18
|
+
<Button title="Exit" onClick={onExit} />
|
|
19
|
+
<Space flex={1} />
|
|
20
|
+
</Stack.down>
|
|
21
|
+
<ConsoleLog height={10} />
|
|
22
|
+
</Stack.down>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let screen: Screen | undefined
|
|
27
|
+
;(async () => {
|
|
28
|
+
interceptConsoleLog()
|
|
29
|
+
|
|
30
|
+
const [screen_] = await run(<App />)
|
|
31
|
+
screen = screen_
|
|
32
|
+
})()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"main": ".dist/index.js",
|
|
4
|
+
"license": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "$npm_execpath tsc",
|
|
7
|
+
"start": "$npm_execpath build && node --enable-source-maps -- .dist/index.js",
|
|
8
|
+
"clean": "rm -rf .dist/"
|
|
9
|
+
},
|
|
10
|
+
"private": true,
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@teaui/react": "latest",
|
|
13
|
+
"@teaui/core": "latest",
|
|
14
|
+
"react": "^18.3.1"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^18.3.1",
|
|
18
|
+
"typescript": "^5.6.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["./"],
|
|
3
|
+
"exclude": [".dist/"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"allowJs": true,
|
|
16
|
+
"outDir": ".dist",
|
|
17
|
+
"jsx": "react"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/.dist/index.d.ts
CHANGED
package/.dist/index.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.create = create;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
async function create(name, options) {
|
|
7
|
+
const appPath = (0, path_1.join)(process.cwd(), name);
|
|
8
|
+
await (0, promises_1.mkdir)(appPath, { recursive: true });
|
|
9
|
+
const templatePath = (0, path_1.join)(__dirname, 'frameworks', options.framework);
|
|
10
|
+
const templateFiles = await (0, promises_1.readdir)(templatePath);
|
|
11
|
+
for (const file of templateFiles) {
|
|
12
|
+
const templateFilePath = (0, path_1.join)(templatePath, file);
|
|
13
|
+
const content = await (0, promises_1.readFile)(templateFilePath, 'utf-8');
|
|
14
|
+
const processedContent = content.replace(/\{\{name\}\}/g, name);
|
|
15
|
+
await (0, promises_1.writeFile)((0, path_1.join)(appPath, file), processedContent);
|
|
16
|
+
}
|
|
17
|
+
console.log(`Created new TeaUI application: ${name} with framework: ${options.framework}`);
|
|
18
|
+
}
|
|
2
19
|
//# sourceMappingURL=index.js.map
|
package/.dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;AAGA,wBAiBC;AApBD,0CAA+D;AAC/D,+BAAyB;AAElB,KAAK,UAAU,MAAM,CAAC,IAAY,EAAE,OAA4B;IACrE,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;IACzC,MAAM,IAAA,gBAAK,EAAC,OAAO,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAEvC,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;IACrE,MAAM,aAAa,GAAG,MAAM,IAAA,kBAAO,EAAC,YAAY,CAAC,CAAA;IAEjD,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,gBAAgB,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,IAAI,CAAC,CAAA;QACjD,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;QACzD,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;QAC/D,MAAM,IAAA,oBAAS,EAAC,IAAA,WAAI,EAAC,OAAO,EAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC,CAAA;IACxD,CAAC;IAED,OAAO,CAAC,GAAG,CACT,kCAAkC,IAAI,oBAAoB,OAAO,CAAC,SAAS,EAAE,CAC9E,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "CLI for @teaui packages",
|
|
4
4
|
"author": "Colin T.A. Gray <colinta@colinta.com>",
|
|
5
5
|
"contributors": [],
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.7",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"preferGlobal": false,
|
|
9
9
|
"repository": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"node": ">= 18.12.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"
|
|
41
|
+
"commander": "^14.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@teaui/shared": "1.
|
|
44
|
+
"@teaui/shared": "1.3.7"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"clean": "rm -rf .dist/",
|
|
48
|
-
"build": "pnpm clean && pnpm tsc"
|
|
48
|
+
"build": "pnpm clean && pnpm tsc && cp -r frameworks .dist/"
|
|
49
49
|
}
|
|
50
50
|
}
|