feat(build): migrate project to Vite+ and TypeScript#152
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates this Babel plugin repo from a Yarn/legacy setup to a Vite+ + TypeScript-based toolchain, updating build/test/CI/hooks and modernizing config and docs to match the new workflow.
Changes:
- Replace the CommonJS
lib/implementation with a TypeScript source implementation insrc/and update packaging metadata to publishdist/outputs. - Switch local tooling and CI to Vite+ (
vp) commands, removing Husky/lint-staged/ESLint/commitlint workflows/configs. - Update tests and documentation to run under the new toolchain and module system.
Reviewed changes
Copilot reviewed 45 out of 52 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.ts | Adds Vite+ configuration for pack/lint/fmt/staged. |
| tsconfig.json | Introduces TypeScript compiler configuration for the migration. |
| test/plugin.test.js | Migrates tests to Vite+ test runner and registers the plugin via @babel/register. |
| test/cartridges/package.json | Sets test cartridges to CommonJS module mode. |
| test/cartridges/app_storefront_base/cartridge/scripts/world.js | Formatting-only string quote update. |
| test/cartridges/app_storefront_base/cartridge/scripts/things.js | Formatting-only string quote update. |
| test/cartridges/app_storefront_base/cartridge/scripts/pet.js | Formatting-only string quote update. |
| test/cartridges/app_storefront_base/cartridge/scripts/monde.js | Formatting-only string quote update. |
| test/cartridges/app_storefront_base/cartridge/scripts/hallo.js | Formatting-only string quote update. |
| test/cartridges/app_storefront_base/.tern-project | Removes obsolete Tern config from fixtures. |
| test/cartridges/app_core/cartridge/scripts/things.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/petstore.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/pet.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/monde.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/hello.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/hallo.js | Formatting-only string quote update. |
| test/cartridges/app_core/cartridge/scripts/bonjour.js | Formatting-only string quote update. |
| test/cartridges/app_core/.tern-project | Removes obsolete Tern config from fixtures. |
| test/cartridges/app_brand/cartridge/scripts/welt.js | Formatting-only string quote update. |
| test/cartridges/app_brand/cartridge/scripts/things.js | Formatting-only string quote update. |
| test/cartridges/app_brand/cartridge/scripts/pet.js | Formatting-only string quote update. |
| test/cartridges/app_brand/cartridge/scripts/hallo.js | Formatting-only string quote update. |
| test/cartridges/app_brand/.tern-project | Removes obsolete Tern config from fixtures. |
| test/cartridges/.eslintrc | Removes fixture-specific ESLint config. |
| test/.babelrc | Removes old test Babel config (now set up in test file). |
| src/index.ts | New TypeScript plugin implementation replacing lib/index.js. |
| src/imports-visitor.d.ts | Adds a local module declaration for imports-visitor. |
| renovate.json | Normalizes formatting of Renovate config. |
| package.json | Switches to ESM package layout, dist/ outputs, Vite+/pnpm toolchain scripts. |
| lint-staged.config.mjs | Removes lint-staged config (replaced by Vite+ staged). |
| lib/index.js | Removes legacy CommonJS implementation. |
| eslint.config.mjs | Removes legacy ESLint configuration (linting now via Vite+). |
| commitlint.config.mjs | Removes commitlint config. |
| README.md | Updates install instructions and examples; removes coverage badge. |
| AGENTS.md | Adds onboarding/usage notes for Vite+ and CI guidance. |
| .yarnrc.yml | Removes Yarn configuration. |
| .vscode/settings.yml | Removes legacy VSCode settings file. |
| .vscode/settings.json | Adds new VSCode settings aligned with Oxc/Vite+. |
| .vscode/extensions.yml | Removes legacy extension recommendations file. |
| .vscode/extensions.json | Recommends the Vite+ extension pack. |
| .vite-hooks/pre-commit | Adds Vite+ pre-commit hook invoking vp staged. |
| .node-version | Adds Node version file for toolchain/CI. |
| .husky/pre-commit | Removes Husky pre-commit hook. |
| .husky/commit-msg | Removes Husky commit-msg hook. |
| .gitignore | Adds dist/ to ignores and removes Yarn-specific ignores. |
| .github/workflows/commitlint.yml | Removes commitlint workflow. |
| .github/workflows/codeql-analysis.yml | Removes CodeQL workflow. |
| .github/workflows/ci.yml | Updates CI to use voidzero-dev/setup-vp and vp commands. |
| .gitattributes | Removes Yarn binary attributes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| const getModulePath = (moduleName: string, basePath: string, cartridge: string, target: string) => { | ||
| const relativePath = path.relative(path.dirname(moduleName), `${basePath}/${cartridge}${target}`) | ||
| return (relativePath.includes(".") ? "" : "./") + relativePath |
| // eslint-disable-next-line no-restricted-syntax | ||
| for (const imp of imports) { | ||
| /** | ||
| * Finds and sets the rewrittten module path. |
| // all cartridges after the found cartridges in cartridge path | ||
| const newCartridgePath = cartridgePath.slice(cartridgePath.indexOf(cartridge) + 1) | ||
|
|
||
| // Find the the cartridge which contains the next match for the module path |
Comment on lines
+28
to
+36
| "type": "module", | ||
| "main": "./dist/index.cjs", | ||
| "module": "./dist/index.mjs", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.mjs", | ||
| "require": "./dist/index.cjs" | ||
| } | ||
| }, |
Comment on lines
+57
to
+69
| "vite-plus": "latest" | ||
| }, | ||
| "release": { | ||
| "branches": [ | ||
| "main" | ||
| ] | ||
| }, | ||
| "packageManager": "pnpm@10.33.1", | ||
| "pnpm": { | ||
| "overrides": { | ||
| "vite": "npm:@voidzero-dev/vite-plus-core@latest", | ||
| "vitest": "npm:@voidzero-dev/vite-plus-test@latest" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request migrates the project from Yarn and legacy configuration to the Vite+ unified toolchain and streamlines the development workflow. It removes Yarn-specific files and configurations, replaces CI and pre-commit hooks with Vite+ equivalents, updates documentation, and modernizes project settings for improved consistency and maintainability.
Toolchain migration and configuration:
.yarnrc.yml,.yarn/releases,.yarn/plugins, and replaced package manager commands with Vite+ commands throughout the project. (.yarnrc.yml,.gitattributes,.husky/pre-commit,.husky/commit-msg,lint-staged.config.mjs,eslint.config.mjs, [1] [2] [3] [4] [5] [6].vite-hooks/pre-committo runvp stagedfor pre-commit linting and formatting..vscode/extensions.json,.vscode/settings.json,.vscode/extensions.yml,.vscode/settings.yml, [1] [2] [3] [4]Continuous Integration (CI) updates:
voidzero-dev/setup-vpand Vite+ commands (vp check,vp test,vp pack,vp exec semantic-release) instead of Node.js and Yarn, simplifying setup and caching. (.github/workflows/ci.yml, [1] [2].github/workflows/commitlint.yml,.github/workflows/codeql-analysis.yml, [1] [2]Documentation and onboarding:
AGENTS.mdwith a comprehensive guide to using Vite+, common pitfalls, and CI integration instructions.README.mdto reflect the migration to pnpm and Vite+ (e.g., install instructions, formatting, and removal of Coveralls badge). [1] [2] [3] [4]Codebase cleanup:
lib/index.js) and commitlint/eslint/lint-staged configs, to reflect the new toolchain. [1] [2] [3] [4]These changes collectively modernize the project setup, streamline developer experience, and ensure consistency with the Vite+ toolchain.