-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: element plus 的适配并且新增携带 element plus 的模板
- Loading branch information
Showing
47 changed files
with
2,865 additions
and
203 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
47 changes: 47 additions & 0 deletions
47
packages/create-cocos-plugin/scripts/sync-dependencies-version.mjs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { join, dirname } from 'node:path'; | ||
import { existsSync } from 'node:fs'; | ||
import { readdir, stat, readFile, writeFile } from 'node:fs/promises'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
const root = join(__dirname, '../'); | ||
|
||
async function getCocosPanelVersion() { | ||
let version = ''; | ||
const vite_plugin_cocos_panel_pkg = join(root, '../vite-plugin-cocos-panel/package.json'); | ||
if (existsSync(vite_plugin_cocos_panel_pkg)) { | ||
const pkgString = await readFile(vite_plugin_cocos_panel_pkg, { encoding: 'utf-8' }); | ||
version = JSON.parse(pkgString).version; | ||
} | ||
return version; | ||
} | ||
|
||
async function rewrite() { | ||
const cocosPanelVersion = await getCocosPanelVersion(); | ||
if (!cocosPanelVersion) return; | ||
|
||
const templates = await readdir(join(root, 'templates')); | ||
|
||
for (const dir of templates) { | ||
const tplDir = join(root, 'templates', dir); | ||
|
||
const info = await stat(tplDir); | ||
if (info.isDirectory()) { | ||
const pkg = join(tplDir, 'package.json'); | ||
if (existsSync(pkg)) { | ||
const jsonString = await readFile(pkg, { encoding: 'utf-8' }); | ||
if (jsonString) { | ||
const json = JSON.parse(jsonString); | ||
|
||
Object.assign(json.devDependencies, { | ||
'@cocos-fe/vite-plugin-cocos-panel': `^${cocosPanelVersion}`, | ||
'@cocos/creator-types': `^3.8.4`, | ||
}); | ||
writeFile(pkg, JSON.stringify(json, null, 4), { encoding: 'utf-8' }); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
rewrite(); |
This file contains 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
This file contains 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
This file contains 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
45 changes: 34 additions & 11 deletions
45
packages/create-cocos-plugin/templates/react-ts/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.