-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: optimize generator download (#6377)
- Loading branch information
Showing
74 changed files
with
1,364 additions
and
894 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
'@modern-js/storybook-next-generator': minor | ||
'@modern-js/tailwindcss-generator': minor | ||
'@modern-js/dependence-generator': minor | ||
'@modern-js/module-doc-generator': minor | ||
'@modern-js/changeset-generator': minor | ||
'@modern-js/generator-generator': minor | ||
'@modern-js/router-v5-generator': minor | ||
'@modern-js/packages-generator': minor | ||
'@modern-js/upgrade-generator': minor | ||
'@modern-js/module-generator': minor | ||
'@modern-js/server-generator': minor | ||
'@modern-js/entry-generator': minor | ||
'@modern-js/base-generator': minor | ||
'@modern-js/repo-generator': minor | ||
'@modern-js/bff-generator': minor | ||
'@modern-js/mwa-generator': minor | ||
'@modern-js/ssg-generator': minor | ||
'@modern-js/generator-plugin-plugin': minor | ||
'@modern-js/generator-common': minor | ||
'@modern-js/generator-plugin': minor | ||
'@modern-js/generator-utils': minor | ||
'@modern-js/sandpack-react': patch | ||
'@modern-js/new-action': patch | ||
'@modern-js/plugin-i18n': patch | ||
'@modern-js/create': patch | ||
--- | ||
|
||
feat: optimize generator download | ||
|
||
feat: 优化生成器下载 |
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
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
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
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
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,12 @@ | ||
import path from 'path'; | ||
import { fs } from '@modern-js/codesmith-utils/fs-extra'; | ||
import json5 from 'json5'; | ||
|
||
export const readTsConfig = (root: string) => { | ||
return readTsConfigByFile(path.resolve(root, './tsconfig.json')); | ||
}; | ||
|
||
export const readTsConfigByFile = (filename: string) => { | ||
const content = fs.readFileSync(path.resolve(filename), 'utf-8'); | ||
return json5.parse(content); | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './stripAnsi'; | ||
export * from './package'; | ||
export { getGeneratorPath } from './getGeneratorPath'; | ||
export * from './getGeneratorPath'; | ||
export * from './get'; | ||
export * from './is'; |
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,23 @@ | ||
import path from 'path'; | ||
import { fs } from '@modern-js/codesmith-utils/fs-extra'; | ||
import { semver } from '@modern-js/codesmith-utils/semver'; | ||
|
||
export const isReact18 = (cwd: string = process.cwd()) => { | ||
const pkgPath = path.join(cwd, 'package.json'); | ||
|
||
if (!fs.existsSync(pkgPath)) { | ||
return false; | ||
} | ||
|
||
const pkgInfo = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); | ||
const deps = { | ||
...pkgInfo.devDependencies, | ||
...pkgInfo.dependencies, | ||
}; | ||
|
||
if (typeof deps.react !== 'string') { | ||
return false; | ||
} | ||
|
||
return semver.satisfies(semver.minVersion(deps.react)!, '>=18.0.0'); | ||
}; |
Oops, something went wrong.