create-backtick-app 0.1.1 → 0.1.3

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/index.js CHANGED
@@ -25,25 +25,52 @@ const TEMPLATES = {
25
25
  then: "Then open http://localhost:3000. Edit server/Home.tsx and save to see the page change.",
26
26
  },
27
27
  };
28
- const { values, positionals } = parseArgs({
29
- allowPositionals: true,
30
- options: {
31
- template: { type: "string", short: "t" },
32
- runtime: { type: "string", short: "r" },
33
- yes: { type: "boolean", short: "y" },
34
- "no-install": { type: "boolean" },
35
- },
36
- });
37
- if (values.template !== undefined && !(values.template in TEMPLATES)) {
38
- console.error(`There's no template named ${values.template}. Pick one of: ${Object.keys(TEMPLATES).join(", ")}.`);
39
- process.exit(1);
40
- }
41
28
  // What runs your Backtick server, and the loader that compiles it for that
42
29
  // runtime.
43
30
  const RUNTIMES = {
44
31
  node: { title: "Node", loader: "@backtickjs/node-plugin" },
45
32
  bun: { title: "Bun", loader: "@backtickjs/bun-plugin" },
46
33
  };
34
+ const USAGE = `Usage: create-backtick-app [name] [options]
35
+
36
+ Options:
37
+ -t, --template <name> The framework: ${Object.keys(TEMPLATES).join(", ")}
38
+ -r, --runtime <name> The server's runtime: ${Object.keys(RUNTIMES).join(", ")}
39
+ -y, --yes Use the defaults for anything not given
40
+ --no-install Skip installing packages
41
+ -h, --help Show this help
42
+
43
+ Asks for what isn't given, in a terminal; elsewhere, uses the defaults:
44
+ my-app, react-native, and node (bun when run with bun).`;
45
+ let parsed;
46
+ try {
47
+ parsed = parseArgs({
48
+ allowPositionals: true,
49
+ options: {
50
+ template: { type: "string", short: "t" },
51
+ runtime: { type: "string", short: "r" },
52
+ yes: { type: "boolean", short: "y" },
53
+ "no-install": { type: "boolean" },
54
+ help: { type: "boolean", short: "h" },
55
+ },
56
+ });
57
+ }
58
+ catch (error) {
59
+ // Node's first sentence, as "Unknown option '--framework'.", without its
60
+ // advice on positional arguments.
61
+ const [problem] = error.message.split(". ");
62
+ console.error(`${problem.replace(/\.?$/, ".")}\n\n${USAGE}`);
63
+ process.exit(1);
64
+ }
65
+ const { values, positionals } = parsed;
66
+ if (values.help) {
67
+ console.log(USAGE);
68
+ process.exit(0);
69
+ }
70
+ if (values.template !== undefined && !(values.template in TEMPLATES)) {
71
+ console.error(`There's no template named ${values.template}. Pick one of: ${Object.keys(TEMPLATES).join(", ")}.`);
72
+ process.exit(1);
73
+ }
47
74
  if (values.runtime !== undefined && !(values.runtime in RUNTIMES)) {
48
75
  console.error(`There's no runtime named ${values.runtime}. Pick one of: ${Object.keys(RUNTIMES).join(", ")}.`);
49
76
  process.exit(1);
@@ -53,16 +80,18 @@ if (values.runtime !== undefined && !(values.runtime in RUNTIMES)) {
53
80
  const manager = (process.env.npm_config_user_agent ?? "npm").split("/")[0];
54
81
  const run = ["npm", "pnpm", "yarn", "bun"].includes(manager) ? manager : "npm";
55
82
  const suggestedRuntime = run === "bun" ? "bun" : "node";
56
- // Asked only what the command line didn't say, as `create-expo-app` asks.
83
+ // Asked only what the command line didn't say, and only in a terminal: an
84
+ // agent or a CI script can't answer, so it gets the defaults, as `--yes` does.
85
+ const ask = process.stdin.isTTY === true && !values.yes;
57
86
  const answers = await prompts([
58
87
  {
59
- type: positionals[0] !== undefined || values.yes ? null : "text",
88
+ type: positionals[0] !== undefined || !ask ? null : "text",
60
89
  name: "name",
61
90
  message: "What is your app named?",
62
91
  initial: "my-app",
63
92
  },
64
93
  {
65
- type: values.template !== undefined || values.yes ? null : "select",
94
+ type: values.template !== undefined || !ask ? null : "select",
66
95
  name: "template",
67
96
  message: "Which framework?",
68
97
  choices: Object.entries(TEMPLATES).map(([value, template]) => ({
@@ -72,7 +101,7 @@ const answers = await prompts([
72
101
  })),
73
102
  },
74
103
  {
75
- type: values.runtime !== undefined || values.yes ? null : "select",
104
+ type: values.runtime !== undefined || !ask ? null : "select",
76
105
  name: "runtime",
77
106
  message: "Which runtime?",
78
107
  choices: Object.entries(RUNTIMES).map(([value, runtime]) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-backtick-app",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Creates a Backtick app: React Native, React or Solid, with screens from your server on Node or Bun",
5
5
  "keywords": [
6
6
  "backtick",
@@ -11,15 +11,15 @@
11
11
  "format:check": "prettier --check --ignore-unknown ."
12
12
  },
13
13
  "dependencies": {
14
- "@backtickjs/bundler": "^0.1.1",
15
- "@backtickjs/core": "^0.1.1",
16
- "@backtickjs/node-plugin": "^0.1.1",
14
+ "@backtickjs/bundler": "^0.1.3",
15
+ "@backtickjs/core": "^0.1.3",
16
+ "@backtickjs/node-plugin": "^0.1.3",
17
17
  "@backtickjs/react": "^19.2.3",
18
18
  "typescript": "^6.0.3"
19
19
  },
20
20
  "devDependencies": {
21
- "@backtickjs/prettier-plugin": "^0.1.1",
22
- "@backtickjs/tsc": "^0.1.1",
21
+ "@backtickjs/prettier-plugin": "^0.1.3",
22
+ "@backtickjs/tsc": "^0.1.3",
23
23
  "@types/node": "^25.9.1",
24
24
  "prettier": "^3.6.2"
25
25
  },
@@ -14,12 +14,12 @@
14
14
  "format:check": "prettier --check --ignore-unknown ."
15
15
  },
16
16
  "dependencies": {
17
- "@backtickjs/bundler": "^0.1.1",
18
- "@backtickjs/core": "^0.1.1",
19
- "@backtickjs/node-plugin": "^0.1.1",
17
+ "@backtickjs/bundler": "^0.1.3",
18
+ "@backtickjs/core": "^0.1.3",
19
+ "@backtickjs/node-plugin": "^0.1.3",
20
20
  "@backtickjs/react": "^19.2.3",
21
21
  "@backtickjs/react-native": "^0.86.3",
22
- "@backtickjs/react-native-client": "^0.1.1",
22
+ "@backtickjs/react-native-client": "^0.1.3",
23
23
  "expo": "~57.0.26",
24
24
  "expo-constants": "~57.0.20",
25
25
  "expo-status-bar": "~57.0.1",
@@ -30,8 +30,8 @@
30
30
  "typescript": "^6.0.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@backtickjs/prettier-plugin": "^0.1.1",
34
- "@backtickjs/tsc": "^0.1.1",
33
+ "@backtickjs/prettier-plugin": "^0.1.3",
34
+ "@backtickjs/tsc": "^0.1.3",
35
35
  "@types/node": "^25.9.1",
36
36
  "@types/react": "19.2.18",
37
37
  "prettier": "^3.6.2"
@@ -11,15 +11,15 @@
11
11
  "format:check": "prettier --check --ignore-unknown ."
12
12
  },
13
13
  "dependencies": {
14
- "@backtickjs/bundler": "^0.1.1",
15
- "@backtickjs/core": "^0.1.1",
16
- "@backtickjs/node-plugin": "^0.1.1",
14
+ "@backtickjs/bundler": "^0.1.3",
15
+ "@backtickjs/core": "^0.1.3",
16
+ "@backtickjs/node-plugin": "^0.1.3",
17
17
  "@backtickjs/solid-js": "^1.9.14",
18
18
  "typescript": "^6.0.3"
19
19
  },
20
20
  "devDependencies": {
21
- "@backtickjs/prettier-plugin": "^0.1.1",
22
- "@backtickjs/tsc": "^0.1.1",
21
+ "@backtickjs/prettier-plugin": "^0.1.3",
22
+ "@backtickjs/tsc": "^0.1.3",
23
23
  "@types/node": "^25.9.1",
24
24
  "prettier": "^3.6.2"
25
25
  },