create-tw-framework 1.0.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 TW Framework Team
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 ADDED
@@ -0,0 +1,55 @@
1
+ # Create TW App
2
+
3
+ The easiest way to get started with [TW Framework](https://github.com/tw-origin/tw-framework) is by using `create-tw-framework`. This CLI tool enables you to quickly start building a new TW application, with everything set up for you — project scaffold, git repository and installed dependencies.
4
+
5
+ To get started, use the following command:
6
+
7
+ ```
8
+ npx create-tw-framework@latest my-app
9
+ # or
10
+ npm create tw-app@latest my-app
11
+ # or
12
+ yarn create tw-app my-app
13
+ # or
14
+ pnpm create tw-app my-app
15
+ # or
16
+ bunx create-tw-framework my-app
17
+ ```
18
+
19
+ You can also pass command line arguments to set up a new project non-interactively. See `create-tw-framework --help`:
20
+
21
+ ```
22
+ Usage: create-tw-framework [project-directory] [options]
23
+
24
+ Options:
25
+ -V, --version output the version number
26
+ --template <name> scaffold with a specific template
27
+ --skip-install skip installing packages
28
+ --disable-git skip initializing a git repository
29
+ -h, --help display help for command
30
+ ```
31
+
32
+ ## Why use Create TW App?
33
+
34
+ `create-tw-framework` lets you create a new TW app within seconds. It is officially maintained by the creators of TW Framework, and includes a number of benefits:
35
+
36
+ - **Zero Configuration**: No configuration needed — the scaffold is complete, correct and buildable the moment it lands.
37
+ - **Sensible Defaults**: `tw dev`, `tw build` and `tw serve` scripts are wired into the generated `package.json` from the start.
38
+ - **Git Ready**: A fresh git repository is initialized in your project automatically (skip with `--disable-git`).
39
+ - **Installs For You**: Dependencies are installed as part of creation (skip with `--skip-install`).
40
+ - **Same Tool, One Command**: `create-tw-framework` runs the same `tw create` command shipped inside TW Framework, so the scaffold is always in sync with the version you install.
41
+
42
+ ## Manual Installation
43
+
44
+ You can also create a project manually:
45
+
46
+ ```
47
+ npm install tw-framework
48
+ npx tw create my-app
49
+ ```
50
+
51
+ Then run `npm run dev` inside the new project to start the development server.
52
+
53
+ ## Feedback
54
+
55
+ Issues and feature requests belong in the [TW Framework repository](https://github.com/tw-origin/tw-framework/issues).
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-tw-framework — the fastest way to start a TW Framework project.
4
+ *
5
+ * npx create-tw-framework@latest my-app
6
+ * npm create tw-app@latest my-app
7
+ * yarn create tw-app my-app
8
+ * pnpm create tw-app my-app
9
+ * bunx create-tw-framework my-app
10
+ *
11
+ * This package is a thin, dependency-free launcher: it resolves the
12
+ * installed `tw-framework` CLI and runs `tw create` with the given
13
+ * arguments — scaffold, git init and dependency install included.
14
+ */
15
+ import { spawn } from "node:child_process";
16
+ import { createRequire } from "node:module";
17
+ import { dirname, join } from "node:path";
18
+ import { fileURLToPath } from "node:url";
19
+
20
+ const require = createRequire(import.meta.url);
21
+ const args = process.argv.slice(2);
22
+
23
+ function printVersion() {
24
+ let version = "1.0.0";
25
+ try {
26
+ version = require("../package.json").version;
27
+ } catch {
28
+ /* fall back to the constant */
29
+ }
30
+ process.stdout.write(`create-tw-framework ${version}\n`);
31
+ }
32
+
33
+ function printHelp() {
34
+ process.stdout.write(
35
+ `
36
+ Usage: create-tw-framework [project-directory] [options]
37
+
38
+ Options:
39
+ -V, --version output the version number
40
+ --template <name> scaffold with a specific template
41
+ --skip-install skip installing packages
42
+ --disable-git skip initializing a git repository
43
+ -h, --help display help for command
44
+
45
+ Examples:
46
+ npx create-tw-framework@latest my-app
47
+ npm create tw-app@latest my-app
48
+
49
+ Everything after the project directory is passed to \`tw create\`.
50
+ `
51
+ );
52
+ }
53
+
54
+ if (args.includes("-V") || args.includes("--version")) {
55
+ printVersion();
56
+ process.exit(0);
57
+ }
58
+ if (args.includes("-h") || args.includes("--help")) {
59
+ printHelp();
60
+ process.exit(0);
61
+ }
62
+
63
+ let binPath;
64
+ try {
65
+ const pkgJsonPath = require.resolve("tw-framework/package.json");
66
+ const pkg = require(pkgJsonPath);
67
+ const bin = pkg.bin && (pkg.bin.tw || pkg.bin["tw-framework"]);
68
+ if (!bin) throw new Error("tw-framework has no tw bin");
69
+ binPath = join(dirname(pkgJsonPath), bin);
70
+ } catch {
71
+ process.stderr.write(
72
+ "\n Could not resolve the tw-framework CLI.\n" +
73
+ " Install it alongside this package and try again:\n" +
74
+ " npm install create-tw-framework\n" +
75
+ " npx create-tw-framework my-app\n\n"
76
+ );
77
+ process.exit(1);
78
+ }
79
+
80
+ const child = spawn(process.execPath, [binPath, "create", ...args], {
81
+ stdio: "inherit",
82
+ });
83
+ child.on("exit", (code) => process.exit(code ?? 1));
84
+ child.on("error", () => process.exit(1));
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "create-tw-framework",
3
+ "version": "1.0.0",
4
+ "description": "The easiest way to get started with TW Framework — scaffolds a complete, ready-to-run TW application in seconds.",
5
+ "bin": {
6
+ "create-tw-framework": "./dist/create.mjs"
7
+ },
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
13
+ "keywords": [
14
+ "tw",
15
+ "tw-framework",
16
+ "create",
17
+ "scaffold",
18
+ "cli",
19
+ "framework",
20
+ "ssr",
21
+ "streaming",
22
+ "web"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/tw-origin/tw-framework.git"
27
+ },
28
+ "homepage": "https://github.com/tw-origin/tw-framework#readme",
29
+ "bugs": {
30
+ "url": "https://github.com/tw-origin/tw-framework/issues"
31
+ },
32
+ "author": "Mlk Raj",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "tw-framework": "^1.0.0"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ }
40
+ }