-
Notifications
You must be signed in to change notification settings - Fork 360
Feat/compiler auto detects #4539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for vuestic-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vuestic-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the compiler’s ergonomics by auto-detecting project environment, scaffolding missing config files, and improving parsing and logging behavior.
- Introduces a shared
getProjectEnv
helper and updates the main Vite plugin to conditionally enable features based on installed dependencies. - Extends the config-types plugin to generate a default
vuestic.config.ts
if none exists. - Migrates TS config parsing to JSON5 and refines alias resolution in the config resolver.
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/compiler/vuestic-config/plugins/use-config.ts | Improved error message for missing entry functions |
packages/compiler/vuestic-config/plugins/config-types.ts | Scaffold default config file when missing |
packages/compiler/vuestic-config/plugins/config-resolver.ts | Refactored virtual alias resolution logic |
packages/compiler/vite-plugin/index.ts | Auto-detect project environment and adjust plugin defaults |
packages/compiler/tsconfig-plugin/plugin.ts | Switched from JSON.parse to JSON5 parser |
packages/compiler/shared/project-env.ts | New module for dependency and environment detection |
packages/compiler/playground/vuestic.config.ts | Updated demo primary color |
packages/compiler/playground/src/pages/TestButtonBase.vue | Simplified color binding |
packages/compiler/playground/package.json | Removed unused npm-run-all2 dependency |
packages/compiler/package.json | Bumped version, added type:module , refined exports |
packages/compiler/devtools/client/vite.config.ts | Cast vue() plugin and added optimizeDeps |
packages/compiler/auto-import/plugin.ts | Added explicit Plugin cast |
.nvmrc | Updated Node.js version reference |
|
||
function checkModuleExists(moduleName: string): boolean { | ||
try { | ||
import.meta.resolve?.(moduleName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The synchronous checkModuleExists
uses import.meta.resolve
without awaiting it, which will always return a Promise or undefined. Consider using require.resolve
for a synchronous check or properly awaiting import.meta.resolve
.
import.meta.resolve?.(moduleName) | |
require.resolve(moduleName); |
Copilot uses AI. Check for mistakes.
@@ -1,7 +1,10 @@ | |||
import { Plugin } from 'vite' | |||
import { resolveVuesticConfigPath} from './config-resolver' | |||
import { writeFile, mkdir } from 'fs/promises' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mkdir
import is never used in this file. Remove it to avoid dead code.
Copilot uses AI. Check for mistakes.
import { Plugin } from 'vite' | ||
import { existsSync } from 'node:fs' | ||
import { readFile } from 'node:fs/promises' | ||
import { dirname, resolve } from 'node:path' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dirname
import is not used anywhere. It can be removed to clean up unused imports.
import { dirname, resolve } from 'node:path' | |
import { resolve } from 'node:path' |
Copilot uses AI. Check for mistakes.
No description provided.