Skip to content

Commit 0ef6acd

Browse files
committed
Fix template tsconfig and package name handling
Removes monorepo dependency from copied tsconfig.json by deleting 'extends' and injecting standalone compiler options. Also sets the package name to the destination folder name in the generated package.json.
1 parent 6683c66 commit 0ef6acd

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

packages/tools/create/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@objectql/create",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Create ObjectQL apps with one command",
55
"bin": {
66
"create-objectql": "./dist/bin.js"

packages/tools/create/scripts/copy-templates.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ async function copyTemplates() {
4444
}
4545
console.log(`Copying ${task.src} -> ${task.dest}`);
4646
await fs.copy(task.src, task.dest, { filter: filterFunc });
47+
48+
// Fix tsconfig.json (Remove dependency on monorepo base)
49+
const tsconfigPath = path.join(task.dest, 'tsconfig.json');
50+
if (fs.existsSync(tsconfigPath)) {
51+
const tsconfig = await fs.readJson(tsconfigPath);
52+
delete tsconfig.extends;
53+
54+
// Inject standalone compiler options
55+
tsconfig.compilerOptions = {
56+
target: "ES2019",
57+
module: "commonjs",
58+
declaration: true,
59+
strict: true,
60+
esModuleInterop: true,
61+
skipLibCheck: true,
62+
forceConsistentCasingInFileNames: true,
63+
moduleResolution: "node",
64+
sourceMap: true,
65+
outDir: "./dist",
66+
rootDir: "./src",
67+
resolveJsonModule: true,
68+
...tsconfig.compilerOptions // Keep any specific overrides
69+
};
70+
71+
await fs.writeJson(tsconfigPath, tsconfig, { spaces: 2 });
72+
}
4773
}
4874

4975
console.log('Templates copied successfully.');

packages/tools/create/src/bin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ program
6969
const pkgPath = path.join(root, 'package.json');
7070
if (fs.existsSync(pkgPath)) {
7171
const pkg = await fs.readJson(pkgPath);
72+
pkg.name = path.basename(root);
7273
delete pkg.private;
7374
delete pkg.repository;
7475

0 commit comments

Comments
 (0)