@modern-js/tailwindcss-generator 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -18
- package/dist/index.js +4 -4
- package/package.json +7 -7
- package/src/index.ts +62 -0
package/README.md
CHANGED
@@ -1,30 +1,26 @@
|
|
1
|
-
|
2
1
|
<p align="center">
|
3
2
|
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
4
3
|
</p>
|
4
|
+
|
5
|
+
<h1 align="center">Modern.js</h1>
|
6
|
+
|
5
7
|
<p align="center">
|
6
|
-
|
7
|
-
<br/>
|
8
|
-
<a href="https://modernjs.dev" target="blank">
|
9
|
-
modernjs.dev
|
10
|
-
</a>
|
11
|
-
</p>
|
12
|
-
<p align="center">
|
13
|
-
The meta-framework suite designed from scratch for frontend-focused modern web development
|
8
|
+
A Progressive React Framework for modern web development.
|
14
9
|
</p>
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
11
|
+
## Getting Started
|
19
12
|
|
20
|
-
|
13
|
+
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
21
14
|
|
22
|
-
##
|
15
|
+
## Documentation
|
23
16
|
|
24
|
-
- [
|
25
|
-
- [
|
26
|
-
- [API References](https://modernjs.dev/docs/apis)
|
17
|
+
- [English Documentation](https://modernjs.dev/en/)
|
18
|
+
- [中文文档](https://modernjs.dev)
|
27
19
|
|
28
20
|
## Contributing
|
29
21
|
|
30
|
-
|
22
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
23
|
+
|
24
|
+
## License
|
25
|
+
|
26
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
package/dist/index.js
CHANGED
@@ -104972,7 +104972,7 @@ var ZH_LOCALE = {
|
|
104972
104972
|
var EN_LOCALE = {
|
104973
104973
|
solution: {
|
104974
104974
|
self: "Please select the solution you want to create",
|
104975
|
-
mwa: "
|
104975
|
+
mwa: "Web App Solution",
|
104976
104976
|
module: "Module Solution",
|
104977
104977
|
monorepo: "Monorepo Solution",
|
104978
104978
|
custom: "Custom Solution",
|
@@ -104983,10 +104983,10 @@ var EN_LOCALE = {
|
|
104983
104983
|
},
|
104984
104984
|
sub_solution: {
|
104985
104985
|
self: "Please select the solution you want to create",
|
104986
|
-
mwa: "
|
104987
|
-
mwa_test: "
|
104986
|
+
mwa: "Web App Solution",
|
104987
|
+
mwa_test: "Web App Solution (Test)",
|
104988
104988
|
module: "Module Solution",
|
104989
|
-
inner_module: "Module Solution(Inner)",
|
104989
|
+
inner_module: "Module Solution (Inner)",
|
104990
104990
|
monorepo: "Monorepo Solution"
|
104991
104991
|
},
|
104992
104992
|
action: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@modern-js/tailwindcss-generator",
|
3
|
-
"description": "
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
4
4
|
"homepage": "https://modernjs.dev",
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "3.0.
|
14
|
+
"version": "3.0.6",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"main": "./dist/index.js",
|
17
17
|
"files": [
|
@@ -26,11 +26,11 @@
|
|
26
26
|
"@types/node": "^14",
|
27
27
|
"jest": "^27",
|
28
28
|
"typescript": "^4",
|
29
|
-
"@modern-js/generator
|
30
|
-
"@modern-js/
|
31
|
-
"@modern-js/generator-
|
32
|
-
"@scripts/
|
33
|
-
"@scripts/
|
29
|
+
"@modern-js/dependence-generator": "3.0.6",
|
30
|
+
"@modern-js/generator-utils": "3.0.6",
|
31
|
+
"@modern-js/generator-common": "3.0.6",
|
32
|
+
"@scripts/jest-config": "2.4.0",
|
33
|
+
"@scripts/build": "2.4.0"
|
34
34
|
},
|
35
35
|
"sideEffects": false,
|
36
36
|
"publishConfig": {
|
package/src/index.ts
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
3
|
+
import { AppAPI } from '@modern-js/codesmith-api-app';
|
4
|
+
import { DependenceGenerator, i18n } from '@modern-js/generator-common';
|
5
|
+
|
6
|
+
const getGeneratorPath = (generator: string, distTag: string) => {
|
7
|
+
if (process.env.CODESMITH_ENV === 'development') {
|
8
|
+
return path.dirname(require.resolve(generator));
|
9
|
+
} else if (distTag) {
|
10
|
+
return `${generator}@${distTag}`;
|
11
|
+
}
|
12
|
+
return generator;
|
13
|
+
};
|
14
|
+
|
15
|
+
export const handleTemplateFile = async (
|
16
|
+
context: GeneratorContext,
|
17
|
+
generator: GeneratorCore,
|
18
|
+
appApi: AppAPI,
|
19
|
+
) => {
|
20
|
+
const { dependencies, peerDependencies, devDependencies } = context.config;
|
21
|
+
const tailwindVersion = '~3.2.4';
|
22
|
+
if (dependencies?.tailwindcss) {
|
23
|
+
dependencies.tailwindcss = tailwindVersion;
|
24
|
+
}
|
25
|
+
if (peerDependencies?.tailwindcss) {
|
26
|
+
peerDependencies.tailwindcss = tailwindVersion;
|
27
|
+
}
|
28
|
+
if (devDependencies?.tailwindcss) {
|
29
|
+
devDependencies.tailwindcss = tailwindVersion;
|
30
|
+
}
|
31
|
+
await appApi.runSubGenerator(
|
32
|
+
getGeneratorPath(DependenceGenerator, context.config.distTag),
|
33
|
+
undefined,
|
34
|
+
{
|
35
|
+
...context.config,
|
36
|
+
dependencies,
|
37
|
+
devDependencies,
|
38
|
+
peerDependencies,
|
39
|
+
},
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
44
|
+
const appApi = new AppAPI(context, generator);
|
45
|
+
|
46
|
+
const { locale } = context.config;
|
47
|
+
i18n.changeLanguage({ locale });
|
48
|
+
appApi.i18n.changeLanguage({ locale });
|
49
|
+
|
50
|
+
if (!(await appApi.checkEnvironment())) {
|
51
|
+
// eslint-disable-next-line no-process-exit
|
52
|
+
process.exit(1);
|
53
|
+
}
|
54
|
+
|
55
|
+
generator.logger.debug(`start run @modern-js/tailwindcss-generator`);
|
56
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
57
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
58
|
+
|
59
|
+
await handleTemplateFile(context, generator, appApi);
|
60
|
+
|
61
|
+
generator.logger.debug(`forge @modern-js/tailwindcss-generator succeed `);
|
62
|
+
};
|