diff --git a/web/docs/Changelog.md b/web/docs/Changelog.md new file mode 100644 index 0000000000..cba5b39992 --- /dev/null +++ b/web/docs/Changelog.md @@ -0,0 +1,17 @@ +### 2024-03-26T09:25:06-0700 + +Split the tsconfig file into a base and build variant. + +Lesson: This lesson is stored here and not in a comment in tsconfig.json because +JSON doesn't like comments. Doug Crockford's purity requirement has doomed an +entire generation to keeping its human-facing meta somewhere other than in the +file where it belongs. + +Lesson: The `extend` command of tsconfig has an unexpected behavior. It is +neither a merge or a replace, but some mixture of the two. The buildfile's +`compilerOptions` is not a full replacement; instead, each of _its_ top-level +fields is a replacement for what is found in the basefile. So while you don't +need to include _everything_ in a `compilerOptions` field if you want to change +one thing, if you want to modify _one_ path in `compilerOptions.path`, you must +include the entire `compilerOptions.path` collection in your buildfile. +g diff --git a/web/tsconfig.base.json b/web/tsconfig.base.json new file mode 100644 index 0000000000..028fbd00f7 --- /dev/null +++ b/web/tsconfig.base.json @@ -0,0 +1,54 @@ +{ + "compilerOptions": { + "strict": true, + "baseUrl": ".", + "esModuleInterop": true, + "paths": { + "@goauthentik/docs/*": ["../website/docs/*"] + }, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "sourceMap": true, + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "lib": [ + "ES5", + "ES2015", + "ES2016", + "ES2017", + "ES2018", + "ES2019", + "ES2020", + "ESNext", + "DOM", + "DOM.Iterable", + "WebWorker" + ], + "noUnusedLocals": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "useDefineForClassFields": false, + "alwaysStrict": true, + "noImplicitAny": true, + "plugins": [ + { + "name": "ts-lit-plugin", + "strict": true, + "rules": { + "no-unknown-tag-name": "off", + "no-missing-import": "off", + "no-incompatible-type-binding": "off", + "no-unknown-property": "off", + "no-unknown-attribute": "off" + } + } + ] + } +} diff --git a/web/tsconfig.json b/web/tsconfig.json index 6c52309f77..887178d6d3 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -1,6 +1,6 @@ { + "extends": "./tsconfig.base.json", "compilerOptions": { - "strict": true, "paths": { "@goauthentik/authentik/*": ["src/*"], "@goauthentik/admin/*": ["src/admin/*"], @@ -14,51 +14,5 @@ "@goauthentik/standalone/*": ["src/standalone/*"], "@goauthentik/user/*": ["src/user/*"] }, - "baseUrl": ".", - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "experimentalDecorators": true, - "sourceMap": true, - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "lib": [ - "ES5", - "ES2015", - "ES2016", - "ES2017", - "ES2018", - "ES2019", - "ES2020", - "ESNext", - "DOM", - "DOM.Iterable", - "WebWorker" - ], - "noUnusedLocals": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "useDefineForClassFields": false, - "alwaysStrict": true, - "noImplicitAny": true, - "plugins": [ - { - "name": "ts-lit-plugin", - "strict": true, - "rules": { - "no-unknown-tag-name": "off", - "no-missing-import": "off", - "no-incompatible-type-binding": "off", - "no-unknown-property": "off", - "no-unknown-attribute": "off" - } - } - ] } }