feature/remove-fleet #2

Merged
elderbraum merged 16 commits from feature/remove-fleet into main 2025-11-29 23:29:17 +01:00
10 changed files with 30229 additions and 14914 deletions
Showing only changes of commit 62d24417d4 - Show all commits

5
.gitignore vendored
View File

@@ -40,4 +40,7 @@ testem.log
Thumbs.db
.nx/cache
.nx/workspace-data
.nx/workspace-data
vite.config.*.timestamp*
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

View File

@@ -0,0 +1,175 @@
# Instructions for LLM: Transform Storybook Config Files from CommonJS to ESM
## Task Overview
Find all .storybook/main.ts and .storybook/main.js files in the workspace and transform
any CommonJS (CJS) configurations to ES Modules (ESM).
### Step 1: Find All Storybook Config Files
Use glob patterns to locate all Storybook main configuration files:
**/.storybook/main.js
**/.storybook/main.ts
### Step 2: Identify CommonJS vs ESM
For each file found, read its contents and determine if it uses CommonJS syntax by
checking for:
CommonJS indicators:
- `module.exports =` or `module.exports.`
- `exports.`
- `require()` function calls
ESM indicators (already correct):
- export default
- export const/export function
- import statements
### Step 3: Transform CJS to ESM
For each file identified as CommonJS, perform the following transformations:
A. Convert `module.exports`
// FROM (CJS):
```
module.exports = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-essentials']
};
```
// TO (ESM):
```
export default {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-essentials']
};
```
B. Convert `require()` to import
// FROM (CJS):
```
const { nxViteTsPaths } = require('@nx/vite/plugins/nx-tsconfig-paths.plugin');
const { mergeConfig } = require('vite');
```
// TO (ESM):
```
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { mergeConfig } from 'vite';
```
C. Handle `path.join()` patterns
// FROM (CJS):
```
const path = require('path');
const rootMain = require(path.join(__dirname, '../../.storybook/main'));
```
// TO (ESM):
```
import { join } from 'path';
import rootMain from '../../.storybook/main';
```
D. Handle Dynamic Requires in Config Functions
// FROM (CJS):
```
module.exports = {
viteFinal: async (config) => {
const { mergeConfig } = require('vite');
return mergeConfig(config, {});
}
};
```
// TO (ESM):
```
import { mergeConfig } from 'vite';
export default {
viteFinal: async (config) => {
return mergeConfig(config, {});
}
};
```
### Step 4: Validation Checks
After transformation, verify:
1. All require() calls have been converted to import statements at the top of the file
2. All module.exports have been converted to export default or named exports
3. Imports are at the top of the file (before the export)
4. The file maintains proper TypeScript typing if it's a .ts file
### Step 5: Report Results
Provide a summary of:
- Total files found
- Files that were already ESM (no changes needed)
- Files that were transformed from CJS to ESM
- List the specific files that were modified
### Example Complete Transformation
Before (CJS):
```
const path = require('path');
const { mergeConfig } = require('vite');
module.exports = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-essentials'],
viteFinal: async (config) => {
return mergeConfig(config, {
resolve: {
alias: {}
}
});
}
};
```
After (ESM):
```
import { join } from 'path';
import { mergeConfig } from 'vite';
export default {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-essentials'],
viteFinal: async (config) => {
return mergeConfig(config, {
resolve: {
alias: {}
}
});
}
};
```
## Important Notes
- Preserve all comments in the original files
- Maintain the same indentation and formatting style
- For TypeScript files (.ts), ensure type imports use import type when appropriate
- Test that the transformations don't break the Storybook configuration

View File

@@ -1,5 +1,5 @@
import { getJestProjects } from '@nx/jest';
import { getJestProjectsAsync } from '@nx/jest';
export default {
projects: getJestProjects(),
};
export default async () => ({
projects: await getJestProjectsAsync(),
});

View File

@@ -3,38 +3,28 @@
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/_internal/styles/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/_internal/styles",
"main": "libs/_internal/styles/src/index.ts",
"tsConfig": "libs/_internal/styles/tsconfig.lib.json",
"assets": [
"libs/_internal/styles/*.md"
]
"assets": ["libs/_internal/styles/*.md"]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/_internal/styles/**/*.ts",
"libs/_internal/styles/package.json"
]
"lintFilePatterns": ["libs/_internal/styles/**/*.ts", "libs/_internal/styles/package.json"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/_internal/styles/jest.config.ts",
"passWithNoTests": true
@@ -46,6 +36,5 @@
}
}
}
},
"tags": []
}
}

View File

@@ -3,39 +3,29 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/accordion/src",
"projectType": "library",
"tags": ["type:component", ""],
"targets": {
"build": {
"executor": "@nx/vite:build",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/accordion"
}
},
"publish": {
"command": "node tools/scripts/publish.mjs accordion {args.ver} {args.tag}",
"dependsOn": [
"build"
]
"dependsOn": ["build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/accordion/**/*.ts",
"libs/accordion/package.json"
]
"lintFilePatterns": ["libs/accordion/**/*.ts", "libs/accordion/package.json"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accordion/jest.config.ts",
"passWithNoTests": true
@@ -47,9 +37,5 @@
}
}
}
},
"tags": [
"type:component",
""
]
}
}

View File

@@ -3,38 +3,28 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/container/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": [
"{options.outputPath}"
],
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/container",
"main": "libs/container/src/index.ts",
"tsConfig": "libs/container/tsconfig.lib.json",
"assets": [
"libs/container/*.md"
]
"assets": ["libs/container/*.md"]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": [
"{options.outputFile}"
],
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"libs/container/**/*.ts",
"libs/container/package.json"
]
"lintFilePatterns": ["libs/container/**/*.ts", "libs/container/package.json"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/container/jest.config.ts",
"passWithNoTests": true
@@ -60,9 +50,7 @@
},
"build-storybook": {
"executor": "@nx/storybook:build",
"outputs": [
"{options.outputDir}"
],
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "dist/storybook/container",
"configDir": "libs/container/.storybook"
@@ -79,6 +67,5 @@
"command": "test-storybook -c libs/container/.storybook --url=http://localhost:4400"
}
}
},
"tags": []
}
}

View File

@@ -1,74 +0,0 @@
{
"migrations": [
{
"cli": "nx",
"version": "17.3.0-beta.6",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-17-3-0/update-nxw",
"package": "nx",
"name": "17.3.0-update-nx-wrapper"
},
{
"cli": "nx",
"version": "18.0.0-beta.2",
"description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
"implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
"x-repair-skip": true,
"package": "nx",
"name": "18.0.0-disable-adding-plugins-for-existing-workspaces"
},
{
"version": "18.1.0-beta.3",
"description": "Moves affected.defaultBase to defaultBase in `nx.json`",
"implementation": "./src/migrations/update-17-2-0/move-default-base",
"package": "nx",
"name": "move-default-base-to-nx-json-root"
},
{
"cli": "nx",
"version": "19.2.0-beta.2",
"description": "Updates the default workspace data directory to .nx/workspace-data",
"implementation": "./src/migrations/update-19-2-0/move-workspace-data-directory",
"package": "nx",
"name": "19-2-0-move-graph-cache-directory"
},
{
"cli": "nx",
"version": "19.2.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-17-3-0/update-nxw",
"package": "nx",
"name": "19-2-2-update-nx-wrapper"
},
{
"version": "19.2.4-beta.0",
"description": "Set project name in nx.json explicitly",
"implementation": "./src/migrations/update-19-2-4/set-project-name",
"x-repair-skip": true,
"package": "nx",
"name": "19-2-4-set-project-name"
},
{
"version": "17.3.0-beta.0",
"description": "Move the vitest coverage thresholds in their own object if exists and add reporters.",
"implementation": "./src/migrations/update-17-3-0/vitest-coverage-and-reporters",
"package": "@nx/vite",
"name": "vitest-coverage-and-reporters"
},
{
"version": "17.2.9",
"description": "Move executor options to target defaults",
"implementation": "./src/migrations/update-17-2-9/move-options-to-target-defaults",
"package": "@nx/linter",
"name": "move-options-to-target-defaults"
},
{
"cli": "nx",
"version": "19.1.0-beta.6",
"description": "Migrate no-extra-semi rules into user config, out of nx extendable configs",
"implementation": "./src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi",
"package": "@nx/eslint-plugin",
"name": "update-19-1-0-rename-no-extra-semi"
}
]
}

29997
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -13,32 +13,29 @@
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.24.7",
"@nx/devkit": "19.5.7",
"@nx/eslint-plugin": "19.5.7",
"@nx/jest": "19.5.7",
"@nx/js": "19.5.7",
"@nx/linter": "19.5.7",
"@nx/playwright": "19.5.7",
"@nx/storybook": "19.5.7",
"@nx/vite": "19.5.7",
"@nx/web": "19.5.7",
"@nx/workspace": "19.5.7",
"@nx/devkit": "22.1.3",
"@nx/eslint-plugin": "22.1.3",
"@nx/jest": "22.1.3",
"@nx/js": "22.1.3",
"@nx/playwright": "22.1.3",
"@nx/storybook": "22.1.3",
"@nx/vite": "22.1.3",
"@nx/web": "22.1.3",
"@nx/workspace": "22.1.3",
"@playwright/test": "^1.46.0",
"@storybook/addon-essentials": "8.2.8",
"@storybook/addon-interactions": "8.2.8",
"@storybook/core-server": "8.2.8",
"@storybook/core-server": "8.6.11",
"@storybook/jest": "0.2.3",
"@storybook/test-runner": "0.19.1",
"@storybook/test-runner": "0.22.0",
"@storybook/testing-library": "0.2.2",
"@storybook/web-components": "^8.2.8",
"@storybook/web-components-vite": "8.2.8",
"@storybook/web-components-webpack5": "8.2.8",
"@storybook/web-components": "10.0.0",
"@storybook/web-components-vite": "10.0.0",
"@storybook/web-components-webpack5": "8.6.11",
"@swc-node/register": "~1.10.9",
"@swc/core": "~1.7.10",
"@swc/helpers": "~0.5.12",
"@swc/jest": "~0.2.36",
"@swc/jest": "0.2.39",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/jest": "^29.5.12",
"@types/jest": "30.0.0",
"@types/node": "22.2.0",
"@typescript-eslint/eslint-plugin": "8.0.1",
"@typescript-eslint/parser": "8.0.1",
@@ -47,21 +44,23 @@
"eslint": "9.9.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-playwright": "^1.6.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest": "30.0.5",
"jest-environment-jsdom": "30.0.5",
"jest-environment-node": "^29.7.0",
"jest-util": "30.0.5",
"jiti": "2.4.2",
"jsdom": "~24.1.1",
"nx": "19.5.7",
"nx": "22.1.3",
"prettier": "^3.3.3",
"rxjs": "^7.8.1",
"storybook": "^8.2.8",
"storybook": "10.0.0",
"swc-loader": "0.2.6",
"ts-jest": "^29.2.4",
"ts-jest": "29.4.5",
"ts-node": "10.9.2",
"typescript": "5.5.4",
"verdaccio": "^5.32.1",
"vite": "5.4.0",
"vite-plugin-dts": "4.0.2",
"typescript": "5.9.3",
"verdaccio": "6.0.5",
"vite": "7.1.3",
"vite-plugin-dts": "4.5.4",
"vitest": "2.0.5"
},
"nx": {

14747
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff