diff --git a/ai-migrations/MIGRATE_STORYBOOK_10.md b/ai-migrations/MIGRATE_STORYBOOK_10.md deleted file mode 100644 index 7f02854bc..000000000 --- a/ai-migrations/MIGRATE_STORYBOOK_10.md +++ /dev/null @@ -1,175 +0,0 @@ -# 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 diff --git a/migrations.json b/migrations.json deleted file mode 100644 index 4f657bf6e..000000000 --- a/migrations.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "migrations": [ - { - "version": "22.0.0-beta.1", - "description": "Updates release version config based on the breaking changes in Nx v22", - "implementation": "./src/migrations/update-22-0-0/release-version-config-changes", - "package": "nx", - "name": "22-0-0-release-version-config-changes" - }, - { - "version": "22.0.0-beta.2", - "description": "Consolidates releaseTag* options into nested releaseTag object structure", - "implementation": "./src/migrations/update-22-0-0/consolidate-release-tag-config", - "package": "nx", - "name": "22-0-0-consolidate-release-tag-config" - }, - { - "cli": "nx", - "version": "22.1.0-beta.5", - "description": "Updates the nx wrapper.", - "implementation": "./src/migrations/update-22-1-0/update-nx-wrapper", - "package": "nx", - "name": "22-1-0-update-nx-wrapper" - }, - { - "version": "22.0.0-beta.0", - "description": "Remove the deprecated `external` and `externalBuildTargets` options from the `@nx/js:swc` and `@nx/js:tsc` executors.", - "factory": "./src/migrations/update-22-0-0/remove-external-options-from-js-executors", - "package": "@nx/js", - "name": "remove-external-options-from-js-executors" - }, - { - "version": "22.1.0-rc.1", - "description": "Removes redundant TypeScript project references from project's tsconfig.json files when runtime tsconfig files (e.g., tsconfig.lib.json, tsconfig.app.json) exist.", - "factory": "./src/migrations/update-22-1-0/remove-redundant-ts-project-references", - "package": "@nx/js", - "name": "remove-redundant-ts-project-references" - }, - { - "cli": "nx", - "version": "22.1.0-beta.8", - "requires": { "storybook": ">=10.0.0" }, - "description": "Update workspace to use Storybook v10", - "implementation": "./src/migrations/update-22-1-0/migrate-to-storybook-10", - "package": "@nx/storybook", - "name": "update-22-1-0-migrate-storybook-v10" - }, - { - "cli": "nx", - "version": "21.6.1-beta.2", - "requires": { "@angular/core": ">=20.3.0" }, - "description": "Update the @angular/cli package version to ~20.3.0.", - "factory": "./src/migrations/update-21-6-1/update-angular-cli", - "package": "@nx/angular", - "name": "update-angular-cli-version-20-3-0" - }, - { - "version": "20.3.0", - "description": "Adds `BootstrapContext` to `bootstrapApplication` calls in `main.server.ts` to support server rendering.", - "factory": "./bundles/add-bootstrap-context-to-server-main.cjs#migrate", - "package": "@angular/core", - "name": "add-bootstrap-context-to-server-main" - } - ] -} diff --git a/package-lock.json b/package-lock.json index 6915577dc..8f18cd834 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,7 @@ "@angular-eslint/eslint-plugin": "20.3.0", "@angular-eslint/eslint-plugin-template": "20.3.0", "@angular-eslint/template-parser": "20.3.0", - "@angular/cli": "~20.3.0", + "@angular/cli": "20.3.0", "@angular/compiler-cli": "20.3.15", "@angular/language-service": "20.3.15", "@angular/localize": "20.3.15", @@ -463,6 +463,7 @@ "integrity": "sha512-5H40lAFF4CKY32C4HOp6bTlOF1f4WsGCwe7FjFQp9A+T7yoCBiHpIWt2JKTwV4sBoTKVDZOnuf0GG+UVKjQT4A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@angular-devkit/core": "20.3.12", "rxjs": "7.8.2" @@ -479,6 +480,7 @@ "integrity": "sha512-ReFxd/UOoVDr3+kIUjmYILQZF89qg62POdY7a7OqBH7plmInFlYVSEDouJvGqj3LVCPiqTk2ZOSChbhS/eLxXA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ajv": "8.17.1", "ajv-formats": "3.0.1", @@ -507,6 +509,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -520,6 +523,7 @@ "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "tslib": "^2.1.0" } @@ -530,6 +534,7 @@ "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", "dev": true, "license": "BSD-3-Clause", + "peer": true, "engines": { "node": ">= 12" } @@ -1155,19 +1160,19 @@ } }, "node_modules/@angular/cli": { - "version": "20.3.12", - "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-20.3.12.tgz", - "integrity": "sha512-vqVyVjbFPCRMjA5evL7tV2JeR6Anuzb9WcXTMB17fr7uzKNNAvo7KyRaOJjp+TU4JDARTNyGPy0aywfPx7R60A==", + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-20.3.0.tgz", + "integrity": "sha512-NS3ADHPQyMWBE8HN5OzJK2UvyzSjLc3mHRMaoFK3jyNcWVEjbma0Z7lGlztwUB5Rox/qPtApRDUFDkCCyNMp4w==", "dev": true, "license": "MIT", "dependencies": { - "@angular-devkit/architect": "0.2003.12", - "@angular-devkit/core": "20.3.12", - "@angular-devkit/schematics": "20.3.12", + "@angular-devkit/architect": "0.2003.0", + "@angular-devkit/core": "20.3.0", + "@angular-devkit/schematics": "20.3.0", "@inquirer/prompts": "7.8.2", "@listr2/prompt-adapter-inquirer": "3.0.1", "@modelcontextprotocol/sdk": "1.17.3", - "@schematics/angular": "20.3.12", + "@schematics/angular": "20.3.0", "@yarnpkg/lockfile": "1.1.0", "algoliasearch": "5.35.0", "ini": "5.0.0", @@ -1189,10 +1194,26 @@ "yarn": ">= 1.13.0" } }, + "node_modules/@angular/cli/node_modules/@angular-devkit/architect": { + "version": "0.2003.0", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.2003.0.tgz", + "integrity": "sha512-4poZyD6YXvjfHvu4fr/r+2d/BUYcGB5gj+zJiGalJY5oTSHFuDkfJMzo3kaUAhDMFjb6cNgh/64SiLyQOETNJA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "20.3.0", + "rxjs": "7.8.2" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, "node_modules/@angular/cli/node_modules/@angular-devkit/core": { - "version": "20.3.12", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-20.3.12.tgz", - "integrity": "sha512-ReFxd/UOoVDr3+kIUjmYILQZF89qg62POdY7a7OqBH7plmInFlYVSEDouJvGqj3LVCPiqTk2ZOSChbhS/eLxXA==", + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-20.3.0.tgz", + "integrity": "sha512-HRsrM/xeZ90uLkDiBcjk5+qMQf8o6f/KMAZ3DHUp6BB5CT1DwFsCKxVMaqW6tRFr/feNQOqo7zSxNkLUMj4/EQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1218,13 +1239,13 @@ } }, "node_modules/@angular/cli/node_modules/@angular-devkit/schematics": { - "version": "20.3.12", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-20.3.12.tgz", - "integrity": "sha512-JqJ1u59y+Ud51k/8MHYzSP+aQOeC2PJBaDmMnvqfWVaIt6n3x4gc/VtuhqhpJ0SKulbFuOWgAfI6QbPFrgUYQQ==", + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-20.3.0.tgz", + "integrity": "sha512-JSMPgForh04u1XDm703ivaA6xXoS6WXuKFSHLE22neVCadrpJ7wfmTnall/1kNIjkrf3S71yjEpwsmscxw1qjA==", "dev": true, "license": "MIT", "dependencies": { - "@angular-devkit/core": "20.3.12", + "@angular-devkit/core": "20.3.0", "jsonc-parser": "3.3.1", "magic-string": "0.30.17", "ora": "8.2.0", @@ -1237,14 +1258,14 @@ } }, "node_modules/@angular/cli/node_modules/@schematics/angular": { - "version": "20.3.12", - "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-20.3.12.tgz", - "integrity": "sha512-ikl+nkWUab/Z4eSkBHgq9FLIUH8qh4OcYKeBQ0fyWqIUFHyjjK0JOfwmH1g/3zAmuUMtkthHCehAtyKzCTQjVA==", + "version": "20.3.0", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-20.3.0.tgz", + "integrity": "sha512-0muPYUiafiK2oo0aHTFc7ZN4wfdwDDkhRm8YNKI8eQlBS8FwCsjRexRbdzRy1xp7AiLLmu5GVirHgtpvbO0u5w==", "dev": true, "license": "MIT", "dependencies": { - "@angular-devkit/core": "20.3.12", - "@angular-devkit/schematics": "20.3.12", + "@angular-devkit/core": "20.3.0", + "@angular-devkit/schematics": "20.3.0", "jsonc-parser": "3.3.1" }, "engines": { diff --git a/package.json b/package.json index 2d7b9e921..c508e5102 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "@angular-eslint/eslint-plugin": "20.3.0", "@angular-eslint/eslint-plugin-template": "20.3.0", "@angular-eslint/template-parser": "20.3.0", - "@angular/cli": "~20.3.0", + "@angular/cli": "20.3.0", "@angular/compiler-cli": "20.3.15", "@angular/language-service": "20.3.15", "@angular/localize": "20.3.15",