Skip to content

Commit

Permalink
fix(cli): Update watch script: TypeStrong/ts-node#897
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Aug 2, 2022
1 parent 53f559f commit 0f73f86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function init(): Promise<void> {
await loadPackages(logger, [
{ name: 'typescript', version: '4.5.5', isDevDependency: true },
{ name: 'nodemon', version: '2.0.15', isDevDependency: true },
{ name: 'ts-node', version: '10.7.0', isDevDependency: true },
]);

await updatePackageJson();
Expand All @@ -44,7 +43,7 @@ async function updatePackageJson(): Promise<void> {
...(packageJson.scripts ?? {}),
build: 'rm -rf dist && ./node_modules/.bin/tsc -p tsconfig.json',
start: 'npm run build && NODE_ENV=development node ./dist/main.js',
'start:watch': "nodemon --watch './src/**/*.ts' --exec 'ts-node' ./src/main.ts",
'start:watch': "nodemon --watch './src/**/*.ts' --exec 'npm run build && npm start'",
'start:prod': 'npm run build && NODE_ENV=production node dist/main',
};
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4));
Expand Down
3 changes: 1 addition & 2 deletions src/cli/tests/commands/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('Init command', () => {
expect(loadPackagesMock).toHaveBeenCalledWith(expect.anything(), [
{ name: 'typescript', version: '4.5.5', isDevDependency: true },
{ name: 'nodemon', version: '2.0.15', isDevDependency: true },
{ name: 'ts-node', version: '10.7.0', isDevDependency: true },
]);

const packageJson = await import(resolve(fakeProjectPath, 'package.json'));
Expand All @@ -63,7 +62,7 @@ describe('Init command', () => {
expect.objectContaining({
build: 'rm -rf dist && ./node_modules/.bin/tsc -p tsconfig.json',
start: 'npm run build && NODE_ENV=development node ./dist/main.js',
'start:watch': "nodemon --watch './src/**/*.ts' --exec 'ts-node' ./src/main.ts",
'start:watch': "nodemon --watch './src/**/*.ts' --exec 'npm run build && npm start'",
'start:prod': 'npm run build && NODE_ENV=production node dist/main',
})
);
Expand Down

0 comments on commit 0f73f86

Please sign in to comment.