@vizejs/create-fresco 0.0.0-stage → 0.719.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ubugeeei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,24 @@
1
- # Temporary Holding Version
1
+ # @vizejs/create-fresco
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Create a Vue SFC terminal app backed by `@vizejs/fresco`:
4
+
5
+ ```sh
6
+ pnpm create @vizejs/fresco my-tui
7
+ cd my-tui
8
+ pnpm install
9
+ pnpm dev
10
+ ```
11
+
12
+ The generated project includes strict TypeScript, `vite-node --watch` development, a Node 22 Vite
13
+ build, a controlled Fresco app lifecycle, and a small keyboard-driven SFC. The command never
14
+ installs dependencies itself. It refuses a non-empty target by default; `--force` overwrites only
15
+ the scaffold-owned paths and does not delete unrelated files.
16
+
17
+ ```text
18
+ create-fresco [directory] [options]
19
+
20
+ --package-manager, --pm <name> npm, pnpm, yarn, or bun
21
+ --force overwrite scaffold-owned files
22
+ --help, -h show help
23
+ --version, -v show version
24
+ ```
package/dist/cli.d.mts ADDED
@@ -0,0 +1,19 @@
1
+ import { r as PackageManager } from "./types-gfBHsajB.mjs";
2
+
3
+ //#region src/version.d.ts
4
+ /** The checked-out or installed create-fresco package version. */
5
+ declare const CREATE_FRESCO_VERSION: string;
6
+ //#endregion
7
+ //#region src/cli.d.ts
8
+ interface CliOptions {
9
+ directory: string;
10
+ force: boolean;
11
+ packageManager?: PackageManager;
12
+ help: boolean;
13
+ version: boolean;
14
+ }
15
+ declare function parseCliArgs(args: readonly string[]): CliOptions;
16
+ declare const helpText = "create-fresco [directory] [options]\n\nOptions:\n --package-manager, --pm <name> npm, pnpm, yarn, or bun\n --force overwrite scaffold-owned files in a non-empty directory\n --help, -h show this help\n --version, -v show the package version";
17
+ declare function runCli(args: readonly string[], output?: (message: string) => void): void;
18
+ //#endregion
19
+ export { CREATE_FRESCO_VERSION, CliOptions, helpText, parseCliArgs, runCli };
package/dist/cli.mjs ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ import { i as CREATE_FRESCO_VERSION, n as commandsFor, t as createFrescoProject } from "./scaffold-CuBjfy8n.mjs";
3
+ import { pathToFileURL } from "node:url";
4
+ //#region src/cli.ts
5
+ const packageManagers = new Set([
6
+ "npm",
7
+ "pnpm",
8
+ "yarn",
9
+ "bun"
10
+ ]);
11
+ function readPackageManager(value) {
12
+ if (value && packageManagers.has(value)) return value;
13
+ throw new Error(`CREATE_FRESCO_PACKAGE_MANAGER: expected npm, pnpm, yarn, or bun; received ${value ?? "nothing"}`);
14
+ }
15
+ function parseCliArgs(args) {
16
+ let directory;
17
+ let force = false;
18
+ let packageManager;
19
+ let help = false;
20
+ let version = false;
21
+ for (let index = 0; index < args.length; index += 1) {
22
+ const argument = args[index];
23
+ if (argument === "--force") force = true;
24
+ else if (argument === "--help" || argument === "-h") help = true;
25
+ else if (argument === "--version" || argument === "-v") version = true;
26
+ else if (argument === "--package-manager" || argument === "--pm") {
27
+ packageManager = readPackageManager(args[index + 1]);
28
+ index += 1;
29
+ } else if (argument?.startsWith("--package-manager=") || argument?.startsWith("--pm=")) packageManager = readPackageManager(argument.slice(argument.indexOf("=") + 1));
30
+ else if (argument?.startsWith("-")) throw new Error(`CREATE_FRESCO_UNKNOWN_OPTION: ${argument}`);
31
+ else if (directory === void 0 && argument) directory = argument;
32
+ else if (argument) throw new Error(`CREATE_FRESCO_EXTRA_ARGUMENT: ${argument}`);
33
+ }
34
+ return {
35
+ directory: directory ?? "fresco-app",
36
+ force,
37
+ packageManager,
38
+ help,
39
+ version
40
+ };
41
+ }
42
+ const helpText = `create-fresco [directory] [options]
43
+
44
+ Options:
45
+ --package-manager, --pm <name> npm, pnpm, yarn, or bun
46
+ --force overwrite scaffold-owned files in a non-empty directory
47
+ --help, -h show this help
48
+ --version, -v show the package version`;
49
+ function runCli(args, output = console.log) {
50
+ const options = parseCliArgs(args);
51
+ if (options.help) {
52
+ output(helpText);
53
+ return;
54
+ }
55
+ if (options.version) {
56
+ output(CREATE_FRESCO_VERSION);
57
+ return;
58
+ }
59
+ const result = createFrescoProject(options);
60
+ const commands = commandsFor(result.packageManager);
61
+ output(`Created ${result.packageName} in ${result.targetDirectory}`);
62
+ output(`\n cd ${options.directory}\n ${commands.install}\n ${commands.dev}\n`);
63
+ }
64
+ const invokedPath = process.argv[1];
65
+ if (invokedPath && import.meta.url === pathToFileURL(invokedPath).href) try {
66
+ runCli(process.argv.slice(2));
67
+ } catch (error) {
68
+ console.error(error instanceof Error ? error.message : error);
69
+ process.exitCode = 1;
70
+ }
71
+ //#endregion
72
+ export { CREATE_FRESCO_VERSION, helpText, parseCliArgs, runCli };
@@ -0,0 +1,19 @@
1
+ import { n as CreateFrescoProjectResult, r as PackageManager, t as CreateFrescoProjectOptions } from "./types-gfBHsajB.mjs";
2
+
3
+ //#region src/scaffold.d.ts
4
+ /** Create a project without installing dependencies or deleting unrelated files. */
5
+ declare function createFrescoProject(options: CreateFrescoProjectOptions): CreateFrescoProjectResult;
6
+ //#endregion
7
+ //#region src/templates.d.ts
8
+ interface ProjectTemplateOptions {
9
+ packageName: string;
10
+ packageManager: PackageManager;
11
+ }
12
+ /** Materialize every deterministic file in a new Fresco project. */
13
+ declare function projectTemplates(options: ProjectTemplateOptions): ReadonlyMap<string, string>;
14
+ declare function commandsFor(packageManager: PackageManager): {
15
+ install: string;
16
+ dev: string;
17
+ };
18
+ //#endregion
19
+ export { type CreateFrescoProjectOptions, type CreateFrescoProjectResult, type PackageManager, type ProjectTemplateOptions, commandsFor, createFrescoProject, projectTemplates };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { n as commandsFor, r as projectTemplates, t as createFrescoProject } from "./scaffold-CuBjfy8n.mjs";
2
+ export { commandsFor, createFrescoProject, projectTemplates };
@@ -0,0 +1,235 @@
1
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { basename, dirname, parse, resolve } from "node:path";
4
+ /** The checked-out or installed create-fresco package version. */
5
+ const CREATE_FRESCO_VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
6
+ //#endregion
7
+ //#region src/templates.ts
8
+ const packageManagerCommands = {
9
+ npm: {
10
+ install: "npm install",
11
+ run: (script) => `npm run ${script}`
12
+ },
13
+ pnpm: {
14
+ install: "pnpm install",
15
+ run: (script) => `pnpm ${script}`
16
+ },
17
+ yarn: {
18
+ install: "yarn",
19
+ run: (script) => `yarn ${script}`
20
+ },
21
+ bun: {
22
+ install: "bun install",
23
+ run: (script) => `bun run ${script}`
24
+ }
25
+ };
26
+ function projectPackageJson(packageName) {
27
+ return `${JSON.stringify({
28
+ name: packageName,
29
+ version: "0.0.0",
30
+ private: true,
31
+ type: "module",
32
+ scripts: {
33
+ dev: "vite-node --watch src/main.ts",
34
+ build: "vite build",
35
+ start: "node dist/main.mjs",
36
+ check: "vue-tsc --noEmit -p tsconfig.json"
37
+ },
38
+ dependencies: {
39
+ "@vizejs/fresco": `^${CREATE_FRESCO_VERSION}`,
40
+ vue: "^3.5.42"
41
+ },
42
+ devDependencies: {
43
+ "@vitejs/plugin-vue": "^6.0.7",
44
+ "@types/node": "^25.0.0",
45
+ typescript: "^6.0.3",
46
+ vite: "^8.2.4",
47
+ "vite-node": "^6.0.0",
48
+ "vue-tsc": "^3.3.11"
49
+ },
50
+ engines: { node: ">=22" }
51
+ }, null, 2)}\n`;
52
+ }
53
+ function projectReadme(options) {
54
+ const commands = packageManagerCommands[options.packageManager];
55
+ return `# ${options.packageName}
56
+
57
+ A Vue-native terminal application built with [Fresco](https://github.com/ubugeeei-prod/vize).
58
+
59
+ ## Develop
60
+
61
+ \`\`\`sh
62
+ ${commands.install}
63
+ ${commands.run("dev")}
64
+ \`\`\`
65
+
66
+ \`vite-node --watch\` reloads the SFC application when source files change. Press the arrow keys
67
+ to update the counter and \`q\` to exit.
68
+
69
+ ## Check and build
70
+
71
+ \`\`\`sh
72
+ ${commands.run("check")}
73
+ ${commands.run("build")}
74
+ ${commands.run("start")}
75
+ \`\`\`
76
+
77
+ The build produces one Node entry at \`dist/main.mjs\`. To use it as an executable launcher on
78
+ macOS or Linux, prepend a Node shebang or invoke it from a small package \`bin\` entry. Fresco's
79
+ platform-native addon remains an installed runtime dependency; this is intentionally not described
80
+ as a static, dependency-free binary.
81
+ `;
82
+ }
83
+ const appVue = `<script setup lang="ts">
84
+ import { ref } from "vue";
85
+ import { Box, Text, useApp, useInput } from "@vizejs/fresco";
86
+
87
+ const count = ref(0);
88
+ const { exit } = useApp();
89
+
90
+ useInput({
91
+ onArrow(direction) {
92
+ if (direction === "up" || direction === "right") count.value += 1;
93
+ if (direction === "down" || direction === "left") count.value -= 1;
94
+ },
95
+ onChar(character) {
96
+ if (character === "q") exit();
97
+ },
98
+ });
99
+ <\/script>
100
+
101
+ <template>
102
+ <Box flex-direction="column" :padding="1" border="rounded" border-color="cyan">
103
+ <Text :bold="true" fg="cyan">Fresco</Text>
104
+ <Text>Count: {{ count }}</Text>
105
+ <Text :dim="true">Use arrow keys; press q to exit.</Text>
106
+ </Box>
107
+ </template>
108
+ `;
109
+ const mainTs = `import { createApp } from "@vizejs/fresco";
110
+ import App from "./App.vue";
111
+
112
+ const app = createApp(App, {
113
+ alternateScreen: true,
114
+ exitOnCtrlC: true,
115
+ });
116
+
117
+ if (import.meta.hot) {
118
+ import.meta.hot.accept();
119
+ import.meta.hot.dispose(async () => {
120
+ await app.unmount();
121
+ });
122
+ }
123
+
124
+ try {
125
+ await app.mount();
126
+ await app.waitUntilExit();
127
+ } catch (error) {
128
+ console.error(error);
129
+ process.exitCode = 1;
130
+ }
131
+ `;
132
+ const viteConfig = `import vue from "@vitejs/plugin-vue";
133
+ import { defineConfig } from "vite";
134
+
135
+ export default defineConfig({
136
+ plugins: [vue()],
137
+ build: {
138
+ ssr: "src/main.ts",
139
+ target: "node22",
140
+ outDir: "dist",
141
+ rollupOptions: {
142
+ external: ["@vizejs/fresco-native"],
143
+ output: {
144
+ entryFileNames: "main.mjs",
145
+ },
146
+ },
147
+ },
148
+ });
149
+ `;
150
+ const tsconfig = `{
151
+ "compilerOptions": {
152
+ "target": "ES2022",
153
+ "module": "NodeNext",
154
+ "moduleResolution": "NodeNext",
155
+ "strict": true,
156
+ "noEmit": true,
157
+ "isolatedModules": true,
158
+ "skipLibCheck": true,
159
+ "types": ["node"]
160
+ },
161
+ "include": ["src/**/*.ts", "src/**/*.vue", "vite.config.ts"]
162
+ }
163
+ `;
164
+ const vueTypes = `/// <reference types="vite/client" />
165
+
166
+ declare module "*.vue" {
167
+ import type { DefineComponent } from "vue";
168
+ const component: DefineComponent<Record<string, never>, Record<string, never>, unknown>;
169
+ export default component;
170
+ }
171
+ `;
172
+ /** Materialize every deterministic file in a new Fresco project. */
173
+ function projectTemplates(options) {
174
+ return new Map([
175
+ [".gitignore", "node_modules\ndist\n*.log\n"],
176
+ ["README.md", projectReadme(options)],
177
+ ["package.json", projectPackageJson(options.packageName)],
178
+ ["tsconfig.json", tsconfig],
179
+ ["vite.config.ts", viteConfig],
180
+ ["src/App.vue", appVue],
181
+ ["src/env.d.ts", vueTypes],
182
+ ["src/main.ts", mainTs]
183
+ ]);
184
+ }
185
+ function commandsFor(packageManager) {
186
+ const commands = packageManagerCommands[packageManager];
187
+ return {
188
+ install: commands.install,
189
+ dev: commands.run("dev")
190
+ };
191
+ }
192
+ //#endregion
193
+ //#region src/scaffold.ts
194
+ function normalizedPackageName(directory) {
195
+ return basename(directory).toLowerCase().replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^[._-]+|[._-]+$/gu, "") || "fresco-app";
196
+ }
197
+ function detectPackageManager(userAgent = process.env.npm_config_user_agent) {
198
+ const name = userAgent?.split("/")[0];
199
+ return name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" ? name : "pnpm";
200
+ }
201
+ function assertSafeTarget(targetDirectory) {
202
+ if (targetDirectory === parse(targetDirectory).root) throw new Error("CREATE_FRESCO_UNSAFE_TARGET: refusing to scaffold into a filesystem root");
203
+ if (targetDirectory === homedir()) throw new Error("CREATE_FRESCO_UNSAFE_TARGET: refusing to scaffold into the home directory");
204
+ if (existsSync(targetDirectory) && !lstatSync(targetDirectory).isDirectory()) throw new Error(`CREATE_FRESCO_TARGET_FILE: ${targetDirectory} is not a directory`);
205
+ }
206
+ function assertWritableTarget(targetDirectory, force) {
207
+ if (!existsSync(targetDirectory)) return;
208
+ if (readdirSync(targetDirectory).length > 0 && !force) throw new Error(`CREATE_FRESCO_TARGET_NOT_EMPTY: ${targetDirectory} is not empty; pass --force to overwrite scaffold-owned files`);
209
+ }
210
+ /** Create a project without installing dependencies or deleting unrelated files. */
211
+ function createFrescoProject(options) {
212
+ const targetDirectory = resolve(resolve(options.cwd ?? process.cwd()), options.directory);
213
+ const packageManager = options.packageManager ?? detectPackageManager();
214
+ const packageName = normalizedPackageName(targetDirectory);
215
+ const templates = projectTemplates({
216
+ packageName,
217
+ packageManager
218
+ });
219
+ assertSafeTarget(targetDirectory);
220
+ assertWritableTarget(targetDirectory, options.force === true);
221
+ mkdirSync(targetDirectory, { recursive: true });
222
+ for (const [relativePath, contents] of templates) {
223
+ const destination = resolve(targetDirectory, relativePath);
224
+ mkdirSync(dirname(destination), { recursive: true });
225
+ writeFileSync(destination, contents, "utf8");
226
+ }
227
+ return {
228
+ targetDirectory,
229
+ packageName,
230
+ packageManager,
231
+ files: [...templates.keys()]
232
+ };
233
+ }
234
+ //#endregion
235
+ export { CREATE_FRESCO_VERSION as i, commandsFor as n, projectTemplates as r, createFrescoProject as t };
@@ -0,0 +1,16 @@
1
+ //#region src/types.d.ts
2
+ type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
3
+ interface CreateFrescoProjectOptions {
4
+ directory: string;
5
+ cwd?: string;
6
+ packageManager?: PackageManager;
7
+ force?: boolean;
8
+ }
9
+ interface CreateFrescoProjectResult {
10
+ targetDirectory: string;
11
+ packageName: string;
12
+ packageManager: PackageManager;
13
+ files: readonly string[];
14
+ }
15
+ //#endregion
16
+ export { CreateFrescoProjectResult as n, PackageManager as r, CreateFrescoProjectOptions as t };
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
1
  {
2
2
  "name": "@vizejs/create-fresco",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.719.0",
4
+ "description": "Create a Vue-native Fresco terminal application",
5
+ "keywords": [
6
+ "create",
7
+ "fresco",
8
+ "scaffold",
9
+ "terminal",
10
+ "tui",
11
+ "vue"
12
+ ],
13
+ "homepage": "https://github.com/ubugeeei-prod/vize",
14
+ "bugs": {
15
+ "url": "https://github.com/ubugeeei-prod/vize/issues"
16
+ },
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/ubugeeei-prod/vize.git",
21
+ "directory": "npm/create-fresco"
22
+ },
23
+ "bin": {
24
+ "create-fresco": "./dist/cli.mjs"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "type": "module",
31
+ "sideEffects": false,
32
+ "main": "./dist/index.mjs",
33
+ "types": "./dist/index.d.mts",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.mts",
37
+ "import": "./dist/index.mjs",
38
+ "default": "./dist/index.mjs"
39
+ }
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "25.9.2",
46
+ "tsx": "4.23.15",
47
+ "typescript": "6.0.3",
48
+ "vite-plus": "0.1.24"
49
+ },
50
+ "engines": {
51
+ "node": ">=22"
52
+ },
53
+ "metadata": {
54
+ "vize": {
55
+ "stability": "experimental",
56
+ "stabilityDocs": "https://github.com/ubugeeei-prod/vize/blob/main/docs/content/stability.md#package-support-tiers"
57
+ }
58
+ },
59
+ "scripts": {
60
+ "build": "vp pack",
61
+ "check": "vp check README.md package.json tsconfig.json src vite.config.ts && tsc --noEmit -p tsconfig.json",
62
+ "check:fix": "vp check --fix README.md package.json tsconfig.json src vite.config.ts",
63
+ "check:types": "tsc --noEmit -p tsconfig.json",
64
+ "fmt": "vp fmt --write README.md package.json tsconfig.json src vite.config.ts",
65
+ "test": "vp exec tsx --test src/**/*.test.ts"
66
+ }
6
67
  }