@invinite-org/create-chartlang 0.1.1

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.
@@ -0,0 +1,83 @@
1
+ // Copyright (c) 2026 Invinite. Licensed under the MIT License.
2
+ // See the LICENSE file in the repo root for full license text.
3
+ import { readFile, writeFile } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ // The monorepo's `tsconfig.base.json`, BAKED verbatim. The cloned starter's
6
+ // `tsconfig.json` `extends` `"../../tsconfig.base.json"` — a monorepo-relative
7
+ // path that does NOT exist in a standalone clone, so both `vite build`
8
+ // ("Tsconfig not found") and `tsc --noEmit` (TS5083) die. The installer writes
9
+ // this content as `<targetDir>/tsconfig.base.json` and repoints the cloned
10
+ // `tsconfig.json` `extends` to `"./tsconfig.base.json"`. The parity test in
11
+ // `starterTsconfig.test.ts` deep-equals this against the real repo-root file so
12
+ // the bake can never silently drift from the monorepo source.
13
+ const TSCONFIG_BASE_FILE = "tsconfig.base.json";
14
+ const TSCONFIG_FILE = "tsconfig.json";
15
+ const STANDALONE_EXTENDS = "./tsconfig.base.json";
16
+ /**
17
+ * The monorepo `tsconfig.base.json` compiler options, baked verbatim so the
18
+ * standalone clone has a self-contained base to `extends`. Kept in sync with
19
+ * the repo-root file by the parity test.
20
+ *
21
+ * @since 0.1
22
+ * @stable
23
+ * @example
24
+ * import { STANDALONE_TSCONFIG_BASE } from "@invinite-org/create-chartlang";
25
+ * void STANDALONE_TSCONFIG_BASE.compilerOptions.strict;
26
+ */
27
+ export const STANDALONE_TSCONFIG_BASE = {
28
+ compilerOptions: {
29
+ target: "ES2022",
30
+ module: "NodeNext",
31
+ moduleResolution: "NodeNext",
32
+ lib: ["ES2022", "DOM", "DOM.Iterable"],
33
+ strict: true,
34
+ noImplicitAny: true,
35
+ noImplicitOverride: true,
36
+ noImplicitReturns: true,
37
+ noUnusedLocals: true,
38
+ noUnusedParameters: true,
39
+ noFallthroughCasesInSwitch: true,
40
+ exactOptionalPropertyTypes: true,
41
+ isolatedModules: true,
42
+ esModuleInterop: true,
43
+ forceConsistentCasingInFileNames: true,
44
+ skipLibCheck: true,
45
+ declaration: true,
46
+ declarationMap: true,
47
+ sourceMap: true,
48
+ inlineSources: true,
49
+ verbatimModuleSyntax: true,
50
+ resolveJsonModule: true,
51
+ noEmit: false,
52
+ },
53
+ };
54
+ /**
55
+ * Make the cloned starter's TypeScript config self-contained: write
56
+ * `<dir>/tsconfig.base.json` from {@link STANDALONE_TSCONFIG_BASE}, then repoint
57
+ * the cloned `<dir>/tsconfig.json` `extends` to the sibling
58
+ * `"./tsconfig.base.json"`. If the clone has no `tsconfig.json`, the base is
59
+ * still written and the repoint is skipped (so the vendored adapter's own
60
+ * `extends: "../../tsconfig.base.json"` still resolves to the clone-root base).
61
+ *
62
+ * @since 0.1
63
+ * @stable
64
+ * @example
65
+ * import { writeStandaloneTsconfig } from "@invinite-org/create-chartlang";
66
+ * await writeStandaloneTsconfig("/tmp/my-app");
67
+ */
68
+ export async function writeStandaloneTsconfig(dir) {
69
+ const baseText = `${JSON.stringify(STANDALONE_TSCONFIG_BASE, null, 4)}\n`;
70
+ await writeFile(join(dir, TSCONFIG_BASE_FILE), baseText, "utf8");
71
+ let source;
72
+ try {
73
+ source = await readFile(join(dir, TSCONFIG_FILE), "utf8");
74
+ }
75
+ catch {
76
+ // No committed `tsconfig.json` in the clone — base is enough.
77
+ return;
78
+ }
79
+ const parsed = JSON.parse(source);
80
+ parsed.extends = STANDALONE_EXTENDS;
81
+ await writeFile(join(dir, TSCONFIG_FILE), `${JSON.stringify(parsed, null, 4)}\n`, "utf8");
82
+ }
83
+ //# sourceMappingURL=starterTsconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starterTsconfig.js","sourceRoot":"","sources":["../src/starterTsconfig.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAE/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB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AAE,kBAAkB,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEjE,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACD,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACL,8DAA8D;QAC9D,OAAO;IACX,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAiB,CAAC;IAClD,MAAM,CAAC,OAAO,GAAG,kBAAkB,CAAC;IACpC,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["// Copyright (c) 2026 Invinite. Licensed under the MIT License.\n// See the LICENSE file in the repo root for full license text.\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\n// The monorepo's `tsconfig.base.json`, BAKED verbatim. The cloned starter's\n// `tsconfig.json` `extends` `\"../../tsconfig.base.json\"` — a monorepo-relative\n// path that does NOT exist in a standalone clone, so both `vite build`\n// (\"Tsconfig not found\") and `tsc --noEmit` (TS5083) die. The installer writes\n// this content as `<targetDir>/tsconfig.base.json` and repoints the cloned\n// `tsconfig.json` `extends` to `\"./tsconfig.base.json\"`. The parity test in\n// `starterTsconfig.test.ts` deep-equals this against the real repo-root file so\n// the bake can never silently drift from the monorepo source.\n\nconst TSCONFIG_BASE_FILE = \"tsconfig.base.json\";\nconst TSCONFIG_FILE = \"tsconfig.json\";\nconst STANDALONE_EXTENDS = \"./tsconfig.base.json\";\n\n/**\n * The monorepo `tsconfig.base.json` compiler options, baked verbatim so the\n * standalone clone has a self-contained base to `extends`. Kept in sync with\n * the repo-root file by the parity test.\n *\n * @since 0.1\n * @stable\n * @example\n * import { STANDALONE_TSCONFIG_BASE } from \"@invinite-org/create-chartlang\";\n * void STANDALONE_TSCONFIG_BASE.compilerOptions.strict;\n */\nexport const STANDALONE_TSCONFIG_BASE = {\n compilerOptions: {\n target: \"ES2022\",\n module: \"NodeNext\",\n moduleResolution: \"NodeNext\",\n lib: [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n strict: true,\n noImplicitAny: true,\n noImplicitOverride: true,\n noImplicitReturns: true,\n noUnusedLocals: true,\n noUnusedParameters: true,\n noFallthroughCasesInSwitch: true,\n exactOptionalPropertyTypes: true,\n isolatedModules: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n skipLibCheck: true,\n declaration: true,\n declarationMap: true,\n sourceMap: true,\n inlineSources: true,\n verbatimModuleSyntax: true,\n resolveJsonModule: true,\n noEmit: false,\n },\n} as const;\n\ntype TsconfigFile = {\n extends?: string;\n [key: string]: unknown;\n};\n\n/**\n * Make the cloned starter's TypeScript config self-contained: write\n * `<dir>/tsconfig.base.json` from {@link STANDALONE_TSCONFIG_BASE}, then repoint\n * the cloned `<dir>/tsconfig.json` `extends` to the sibling\n * `\"./tsconfig.base.json\"`. If the clone has no `tsconfig.json`, the base is\n * still written and the repoint is skipped (so the vendored adapter's own\n * `extends: \"../../tsconfig.base.json\"` still resolves to the clone-root base).\n *\n * @since 0.1\n * @stable\n * @example\n * import { writeStandaloneTsconfig } from \"@invinite-org/create-chartlang\";\n * await writeStandaloneTsconfig(\"/tmp/my-app\");\n */\nexport async function writeStandaloneTsconfig(dir: string): Promise<void> {\n const baseText = `${JSON.stringify(STANDALONE_TSCONFIG_BASE, null, 4)}\\n`;\n await writeFile(join(dir, TSCONFIG_BASE_FILE), baseText, \"utf8\");\n\n let source: string;\n try {\n source = await readFile(join(dir, TSCONFIG_FILE), \"utf8\");\n } catch {\n // No committed `tsconfig.json` in the clone — base is enough.\n return;\n }\n const parsed = JSON.parse(source) as TsconfigFile;\n parsed.extends = STANDALONE_EXTENDS;\n await writeFile(join(dir, TSCONFIG_FILE), `${JSON.stringify(parsed, null, 4)}\\n`, \"utf8\");\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@invinite-org/create-chartlang",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "npm create @invinite-org/chartlang — scaffold a runnable chartlang starter app (TanStack Start + your chosen chart library).",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "bin": {
16
+ "create-chartlang": "./dist/index.js"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "CHANGELOG.md",
22
+ "LICENSE"
23
+ ],
24
+ "dependencies": {
25
+ "giget": "^1.2.3",
26
+ "@invinite-org/chartlang-cli": "^1.3.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^20.0.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "engines": {
36
+ "node": ">=20"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/outraday-org/chartlang.git",
41
+ "directory": "packages/create-chartlang"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc -p tsconfig.json",
45
+ "typecheck": "tsc -p tsconfig.json --noEmit",
46
+ "test": "vitest run --coverage"
47
+ }
48
+ }