feat(create-cli): support config file format selection#1250
feat(create-cli): support config file format selection#1250hanna-skryl wants to merge 1 commit intomainfrom
Conversation
|
View your CI Pipeline Execution ↗ for commit f4b3065
☁️ Nx Cloud last updated this comment at |
|
View your CI Pipeline Execution ↗ for commit f4b3065
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/models
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit b8dec18 with previous commit d27a23a. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 3 groups improved, 👎 1 group regressed, 👍 6 audits improved, 👎 9 audits regressed, 12 audits changed without impacting score🗃️ Groups
30 other groups are unchanged. 🛡️ Audits
651 other audits are unchanged. |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit b8dec18 with previous commit d27a23a. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🔴 19 | 🔴 22 | |
| Code coverage | 🟢 98 | 🟢 98 |
4 other categories are unchanged.
👍 2 groups improved, 👍 3 audits improved, 👎 1 audit regressed, 1 audit changed without impacting score
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🔴 19 | 🔴 22 | |
| Code coverage | Code coverage metrics | 🟢 98 | 🟢 98 |
13 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| JSDocs coverage | Functions coverage | 🟥 11 undocumented functions | 🟥 17 undocumented functions | |
| Code coverage | Branch coverage | 🟩 92.9 % | 🟩 94.1 % | |
| JSDocs coverage | Types coverage | 🟥 12 undocumented types | 🟥 14 undocumented types | |
| Code coverage | Line coverage | 🟩 98.5 % | 🟩 98.9 % | |
| JSDocs coverage | Variables coverage | 🟥 3 undocumented variables | 🟥 4 undocumented variables |
438 other audits are unchanged.
💼 Project utils
🥳 Code PushUp report has improved.
🕵️ See full comparison in Code PushUp portal 🔍
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🟡 60 | 🟡 60 |
5 other categories are unchanged.
👍 1 group improved
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🟡 60 | 🟡 60 |
14 other groups are unchanged.
🛡️ Audits
All of 444 audits are unchanged.
💼 Project plugin-lighthouse
🤨 Code PushUp report has both improvements and regressions.
🕵️ See full comparison in Code PushUp portal 🔍
All of 6 categories are unchanged.
1 audit changed without impacting score
🗃️ Groups
All of 15 groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| Code coverage | Branch coverage | 🟩 98.8 % | 🟩 98.8 % |
443 other audits are unchanged.
11 other projects are unchanged.
| function isConfigFileFormat( | ||
| value: string | undefined, | ||
| ): value is ConfigFileFormat { | ||
| return value === 'ts' || value === 'js' || value === 'mjs'; |
There was a problem hiding this comment.
When you need a union with runtime validation, it's usually better to have a runtime constant as the source of truth. That allows you to derive both the type and the runtime validation from the same set of values. Otherwise, you have to keep them in sync without any help from TypeScript.
-
source of truth:
export const CONFIG_FILE_FORMATS = ['ts', 'js', 'mjs'] as const;
-
derived type:
export type ConfigFileFormat = (typeof CONFIG_FILE_FORMATS)[number];
-
derived runtime validation:
Suggested changereturn value === 'ts' || value === 'js' || value === 'mjs'; const validValues: readonly string[] = CONFIG_FILE_FORMATS; return value != null && validValues.includes(value);
Closes #1243
Config file format selection is added to the setup wizard. The wizard now prompts users to choose between TypeScript and JavaScript, with the default auto-detected from the filesystem based on
tsconfigpresence. A--config-formatCLI option allows skipping the prompt.