Skip to content

Commit c2b51ba

Browse files
committed
improve typescript setup
1 parent 01d0ef6 commit c2b51ba

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

.changeset/upset-eels-sit.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"simplefrontend": patch
3+
---
4+
5+
improve typescript setup

src/solutions/typescript.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const PACKAGE = "typescript";
1212

1313
export async function setupTypescript() {
1414
try {
15+
log.info("Now setting up TypeScript");
1516
// step 1: install package (conveniently updates if needed)
1617
installPackage({
1718
packageName: PACKAGE,
@@ -59,6 +60,10 @@ export async function setupTypescript() {
5960
return;
6061
}
6162

63+
installPackage({
64+
packageName: "@types/node",
65+
agent: packageManager.name,
66+
});
6267
installPackage({
6368
packageName: "@tsconfig/node-lts",
6469
agent: packageManager.name,
@@ -69,11 +74,13 @@ export async function setupTypescript() {
6974
});
7075

7176
if (buildContext === "library") {
77+
log.warn('Make sure to have `"type": "module"` in your package.json');
7278
writeFileSync(
7379
resolve("./tsconfig.json"),
7480
JSON.stringify(typeScriptConfigurationLibrary, null, 2),
7581
);
7682
} else if (buildContext === "script") {
83+
log.warn('Make sure to have `"type": "module"` in your package.json');
7784
writeFileSync(
7885
resolve("./tsconfig.json"),
7986
JSON.stringify(typeScriptConfigurationScript, null, 2),

src/templates/typescript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const typeScriptConfigurationLibrary = {
1111
outDir: "./dist",
1212
rootDir: "./src",
1313
},
14+
include: ["./src"],
1415
};
1516

1617
export const typeScriptConfigurationScript = {

0 commit comments

Comments
 (0)