@tyndall/create-app 0.0.1 → 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/README.md CHANGED
@@ -5,9 +5,11 @@ Scaffolding package for creating new Hyper applications with a React baseline.
5
5
 
6
6
  ## Responsibilities
7
7
  - Validate scaffold arguments and target directory safety.
8
- - Generate deterministic starter files (`package.json`, `hyper.config.ts`, `tsconfig.json`, `biome.json`, pages, public assets).
8
+ - Generate deterministic starter files (`package.json`, `hyper.config.ts`, `tsconfig.json`, `.oxlintrc.json`, `.oxfmtrc.json`, pages, public assets).
9
+ - Provide dev-friendly TypeScript defaults (DOM libs, noEmit, strictness, module resolution).
10
+ - Provide OXC lint defaults for correctness/suspicious/perf categories plus core rules (no-debugger, no-var).
9
11
  - Configure generated apps to use `cloud-front lint` / `cloud-front format`.
10
- - Apply an initial Biome format + lint baseline through `@tyndall/lint` when CLI scaffolding runs.
12
+ - Apply an initial OXC format + lint baseline through `@tyndall/lint` when CLI scaffolding runs.
11
13
 
12
14
  ## Public API Highlights
13
15
  - `createCloudApp(targetDir, options)`
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,QAAA,MAAM,YAAY,oBAAqB,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D,SAAS,CAAC,EAAE,CAAC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,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AA4ND,eAAO,MAAM,cAAc,GACzB,WAAW,MAAM,EACjB,UAAS,qBAA0B,KAClC,OAAO,CAAC,oBAAoB,CAoB9B,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { mkdir, readdir, stat, writeFile } from "node:fs/promises";
2
+ import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { runFormat as defaultRunFormat, runLint as defaultRunLint, } from "@tyndall/lint";
@@ -8,7 +8,7 @@ const USAGE = `@tyndall/create-app <dir> [--ui react]
8
8
 
9
9
  Options:
10
10
  --ui <library> UI adapter to scaffold (react only)
11
- --no-lint-format Skip automatic Biome format/lint baseline
11
+ --no-lint-format Skip automatic OXC format/lint baseline
12
12
  -h, --help Show this help message
13
13
  `;
14
14
  const normalizeUi = (ui) => {
@@ -48,8 +48,23 @@ const toPackageName = (rawName) => {
48
48
  .replace(/-+$/, "");
49
49
  return cleaned.length > 0 ? cleaned : "hyper-app";
50
50
  };
51
- const buildTemplateFiles = (appName, ui) => {
51
+ let cachedVersion = null;
52
+ const resolveTyndallVersion = async () => {
53
+ if (cachedVersion) {
54
+ return cachedVersion;
55
+ }
56
+ const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
57
+ const raw = await readFile(packageJsonPath, "utf-8");
58
+ const pkg = JSON.parse(raw);
59
+ if (!pkg.version) {
60
+ throw new Error("Failed to resolve @tyndall/create-app package version.");
61
+ }
62
+ cachedVersion = pkg.version;
63
+ return pkg.version;
64
+ };
65
+ const buildTemplateFiles = (appName, ui, tyndallVersion) => {
52
66
  const packageName = toPackageName(appName);
67
+ const tyndallRange = `^${tyndallVersion}`;
53
68
  const files = {
54
69
  "package.json": JSON.stringify({
55
70
  name: packageName,
@@ -65,35 +80,40 @@ const buildTemplateFiles = (appName, ui) => {
65
80
  dependencies: {
66
81
  react: "^18.2.0",
67
82
  "react-dom": "^18.2.0",
68
- "@tyndall/react": "workspace:*",
83
+ "@tyndall/react": tyndallRange,
69
84
  },
70
85
  devDependencies: {
71
- "@tyndall/cli": "workspace:*",
72
- "@tyndall/lint": "workspace:*",
86
+ "@tyndall/cli": tyndallRange,
87
+ "@tyndall/lint": tyndallRange,
73
88
  },
74
89
  }, null, 2),
75
- "biome.json": JSON.stringify({
76
- $schema: "https://biomejs.dev/schemas/latest/schema.json",
77
- formatter: {
78
- enabled: true,
79
- indentStyle: "space",
80
- indentWidth: 2,
81
- lineWidth: 100,
90
+ ".oxlintrc.json": JSON.stringify({
91
+ $schema: "./node_modules/oxlint/configuration_schema.json",
92
+ env: {
93
+ browser: true,
94
+ node: true,
82
95
  },
83
- linter: {
84
- enabled: true,
85
- rules: {
86
- recommended: true,
87
- },
96
+ categories: {
97
+ correctness: "warn",
98
+ suspicious: "warn",
99
+ perf: "warn",
88
100
  },
89
- javascript: {
90
- formatter: {
91
- quoteStyle: "double",
92
- semicolons: "always",
93
- trailingCommas: "all",
94
- },
101
+ rules: {
102
+ "eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }],
103
+ "no-debugger": "error",
104
+ "no-undef": "error",
105
+ "no-var": "error",
106
+ "prefer-const": "warn",
107
+ eqeqeq: "warn",
95
108
  },
96
109
  }, null, 2) + "\n",
110
+ ".oxfmtrc.json": JSON.stringify({
111
+ printWidth: 100,
112
+ tabWidth: 2,
113
+ semi: true,
114
+ singleQuote: false,
115
+ trailingComma: "all",
116
+ }, null, 2) + "\n",
97
117
  "hyper.config.ts": ui === "react"
98
118
  ? [
99
119
  "import { createReactUiAdapterFactory } from \"@tyndall/react\";",
@@ -109,12 +129,21 @@ const buildTemplateFiles = (appName, ui) => {
109
129
  "tsconfig.json": JSON.stringify({
110
130
  compilerOptions: {
111
131
  target: "ES2020",
132
+ lib: ["ES2020", "DOM", "DOM.Iterable"],
112
133
  module: "ESNext",
113
134
  moduleResolution: "Bundler",
114
135
  jsx: "react-jsx",
115
136
  strict: true,
137
+ noEmit: true,
138
+ useDefineForClassFields: true,
139
+ resolveJsonModule: true,
140
+ isolatedModules: true,
141
+ noUncheckedIndexedAccess: true,
142
+ noFallthroughCasesInSwitch: true,
143
+ skipLibCheck: true,
116
144
  },
117
145
  include: ["src"],
146
+ exclude: ["dist", ".hyper"],
118
147
  }, null, 2),
119
148
  "README.md": `# ${appName}\n\nThis app was scaffolded with @tyndall/create-app.\n\n## Commands\n- \`bun run dev\`\n- \`bun run build\`\n- \`bun run start\`\n- \`bun run lint\`\n- \`bun run format\`\n`,
120
149
  ".gitignore": "node_modules\ndist\n.hyper\n",
@@ -163,7 +192,8 @@ export const createCloudApp = async (targetDir, options = {}) => {
163
192
  const rootDir = resolve(process.cwd(), targetDir);
164
193
  await ensureEmptyDir(rootDir);
165
194
  const appName = basename(rootDir);
166
- const files = buildTemplateFiles(appName, ui);
195
+ const tyndallVersion = await resolveTyndallVersion();
196
+ const files = buildTemplateFiles(appName, ui, tyndallVersion);
167
197
  const written = await writeFiles(rootDir, files);
168
198
  const lintFormat = options.lintFormat ?? {};
169
199
  const lintFormatApplied = lintFormat.enabled ?? false;
@@ -238,7 +268,7 @@ if (isMain()) {
238
268
  });
239
269
  console.log(`Created Hyper app at ${result.rootDir} (ui: ${result.ui}).`);
240
270
  if (result.lintFormatApplied) {
241
- console.log("Applied Biome lint/format baseline via @tyndall/lint.");
271
+ console.log("Applied OXC lint/format baseline via @tyndall/lint.");
242
272
  }
243
273
  }
244
274
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyndall/create-app",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,6 +24,6 @@
24
24
  "build": "tsc -p tsconfig.json"
25
25
  },
26
26
  "dependencies": {
27
- "@tyndall/lint": "workspace:*"
27
+ "@tyndall/lint": "^0.0.2"
28
28
  }
29
29
  }