Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config/update tsconfig #23

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions cmd/utils/generateTemplates.util.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,29 @@ func GenerateTsConfig(cwd string) error {
}
defer w.Close()

wB, errB := os.Create(fmt.Sprintf("%s/tsconfig.build.json", cwd))
if errB != nil {
fmt.Printf("\nUnable to create tsconfig.build.json file: (%v)", errB)
return errB
}
defer wB.Close()

wD, errD := os.Create(fmt.Sprintf("%s/tsconfig.dev.json", cwd))
if errD != nil {
fmt.Printf("\nUnable to create tsconfig.dev.json file: (%v)", errD)
return errD
}
defer wD.Close()

tsTmpl := template.Must(template.New("tsconfig").Parse(ct.TsConfigTemplate))
tsBuildTmpl := template.Must(template.New("tsconfigbuild").Parse(ct.TsConfigBuildTemplate))
tsDevTmpl := template.Must(template.New("tsconfigdev").Parse(ct.TsConfigDevTemplate))

tsTmpl.Execute(w, "")
tsBuildTmpl.Execute(w, "")
tsDevTmpl.Execute(w, "")
tsBuildTmpl.Execute(wB, "")
tsDevTmpl.Execute(wD, "")

fmt.Println("\n~~~Done Generating TsConfig~~~")
fmt.Println("\n~~~Done Generating TsConfigs~~~")
wg.Done()
return nil
}
2 changes: 1 addition & 1 deletion npm/@tmplts/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/darwin-arm64",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/darwin-x64",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "MacOS AMD 64-bit (Intel) binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/windows-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/windows-arm64",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "Windows ARM 64-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/windows-ia32/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/windows-ia32",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "Windows 32-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion npm/@tmplts/windows-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tmplts/windows-x64",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "Windows 64-bit binary for TmplTS",
"license": "Apache-2.0",
"repository": {
Expand Down
14 changes: 7 additions & 7 deletions npm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ev-the-dev/tmplts",
"author": "ev-the-dev",
"version": "0.1.3",
"version": "0.1.4",
"description": "TypeScript Project Configuration Bootstrapper",
"license": "Apache-2.0",
"bin": {
Expand Down Expand Up @@ -29,12 +29,12 @@
"url": "https://github.com/ev-the-dev/tmplts/issues"
},
"optionalDependencies": {
"@tmplts/darwin-arm64": "0.1.3",
"@tmplts/darwin-x64": "0.1.3",
"@tmplts/linux-x64": "0.1.3",
"@tmplts/win32-arm64": "0.1.3",
"@tmplts/win32-ia32": "0.1.3",
"@tmplts/win32-x64": "0.1.3"
"@tmplts/darwin-arm64": "0.1.4",
"@tmplts/darwin-x64": "0.1.4",
"@tmplts/linux-x64": "0.1.4",
"@tmplts/win32-arm64": "0.1.4",
"@tmplts/win32-ia32": "0.1.4",
"@tmplts/win32-x64": "0.1.4"
},
"keywords": [
"typescript",
Expand Down
47 changes: 27 additions & 20 deletions templates/tsconfig.template.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,35 @@ package templates
var TsConfigTemplate = `{
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": false,
"allowUnreachableCode": false,
"alwaysStrict": true,
"baseUrl": ".",
"rootDir": ".",
"outDir": "dist",
"moduleResolution": "nodenext",
"checkJs": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["esnext"],
"module": "nodenext",
"target": "ES6",
"paths": {
"@example/*": ["some/relative/path/*"],
},
"moduleResolution": "nodenext",
"noEmit": true,
"noErrorTruncation": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"outDir": "dist",
"removeComments": true,
"resolveJsonModule": true,
"allowJs": false,
"checkJs": false,
"noImplicitAny": true
"rootDir": ".",
"strict": true,
"target": "esnext",
"paths": {
"@example/*": ["some/relative/path/*"],
}
},
"include": ["./**/package.json", "layers/**/*", "src/**/*", "e2e/**/*"],
"exclude": ["node_modules", "coverage", "__snapshots__", "docs/**", "dist/**"]
Expand All @@ -26,11 +41,7 @@ var TsConfigTemplate = `{
var TsConfigBuildTemplate = `{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"noEmit": false,
"target": "ES6",
"module": "nodenext",
"esModuleInterop": true
"noEmit": false
},
"exclude": [
"node_modules",
Expand All @@ -51,10 +62,6 @@ var TsConfigDevTemplate = `{
"ts-node": {
"require": ["tsconfig-paths/register"],
"swc": true,
"files": true,
"compilerOptions": {
"module": "CommonJS",
"target": "ES2017"
}
"files": true
}
}`
Loading