Skip to content

Commit 419667a

Browse files
committed
wip
1 parent f93d777 commit 419667a

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

ts/create-smelter-app/src/applyTemplate.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ export async function applyTemplate(template: Template, destination: string): Pr
2626
const projectDir = path.join(destination, project.dir ?? '.');
2727
for (const dirToRemove of project.dirsToRemove ?? []) {
2828
await fs.remove(path.join(projectDir, dirToRemove));
29-
30-
const packageJsonPath = path.join(projectDir, 'package.json');
31-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
32-
const transformedPackageJson = transformPackageJson(packageJson, project.projectName);
33-
await fs.writeFile(
34-
packageJsonPath,
35-
JSON.stringify(transformedPackageJson, null, 2) + '\n',
36-
'utf8'
37-
);
3829
}
30+
31+
const packageJsonPath = path.join(projectDir, 'package.json');
32+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
33+
const transformedPackageJson = transformPackageJson(packageJson, project.projectName);
34+
await fs.writeFile(
35+
packageJsonPath,
36+
JSON.stringify(transformedPackageJson, null, 2) + '\n',
37+
'utf8'
38+
);
3939
}
4040
}
4141

ts/create-smelter-app/src/run.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ export default async function run() {
1010
const options = await resolveOptions();
1111
console.log(`Generating project in ${options.directory}`);
1212
await createNodeProject(options);
13+
1314
console.log();
1415
console.log(chalk.green('Project created successfully.'));
1516
console.log();
16-
console.log(`To get started run:`);
1717
console.log(
18-
chalk.bold(
19-
`$ cd ${path.basename(options.directory)} && ${options.packageManager} run build && node ./dist/index.js`
20-
)
18+
options.template.usageInstructions(path.basename(options.directory), options.packageManager)
2119
);
2220
}
2321

ts/create-smelter-app/src/templates.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,20 @@ export const NodeNextWebRTCTemplate: TemplateOption = {
9494
{
9595
projectName,
9696
dir: 'client',
97-
dirsToRemove: ['.next', 'next-env.d.ts', 'node_modules'],
97+
dirsToRemove: [
98+
'.next',
99+
'next-env.d.ts',
100+
'node_modules',
101+
'pnpm-lock.yaml',
102+
'pnpm-workspace.yaml',
103+
],
98104
},
99105
],
100106
usageInstructions: (directoryName: string, packageManager: string) =>
101107
'To get started:\n\n' +
102-
'1. Start the Smelter server:\n' +
108+
'1. Start the Node.js server:\n' +
103109
` $ ${chalk.bold(`cd ${directoryName}/server && ${packageManager} run build && node ./dist/index.js`)}\n\n` +
104-
'2. In a new terminal, start the Next.js client:\n' +
110+
'2. In a new terminal, start the Next.js app:\n' +
105111
` $ ${chalk.bold(`cd ${directoryName}/client && ${packageManager} run dev`)}`,
106112
}),
107113
};

ts/create-smelter-app/templates/node-next-webrtc/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"license": "MIT",
88
"scripts": {
99
"start": "ts-node ./src/index.ts",
10-
"_start": "ts-node ./src/index.ts",
1110
"build": "tsc",
1211
"lint": "eslint ."
1312
},

0 commit comments

Comments
 (0)