@modern-js/tailwindcss-generator 3.6.3 → 3.7.1
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/dist/index.js +1465 -63693
- package/package.json +10 -12
- package/src/index.ts +0 -97
package/package.json
CHANGED
|
@@ -15,29 +15,27 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.7.1",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
21
|
"files": [
|
|
22
22
|
"/templates",
|
|
23
23
|
"/dist/index.js"
|
|
24
24
|
],
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@modern-js/utils": "2.60.3"
|
|
27
|
-
},
|
|
28
25
|
"devDependencies": {
|
|
29
|
-
"@modern-js/codesmith": "2.5
|
|
30
|
-
"@modern-js/codesmith-
|
|
31
|
-
"@modern-js/codesmith-api-
|
|
26
|
+
"@modern-js/codesmith": "2.6.5",
|
|
27
|
+
"@modern-js/codesmith-utils": "2.6.5",
|
|
28
|
+
"@modern-js/codesmith-api-app": "2.6.5",
|
|
29
|
+
"@modern-js/codesmith-api-json": "2.6.5",
|
|
32
30
|
"@types/jest": "^29",
|
|
33
31
|
"@types/node": "^14",
|
|
34
32
|
"jest": "^29",
|
|
35
33
|
"typescript": "^5",
|
|
36
|
-
"@modern-js/dependence-generator": "3.
|
|
37
|
-
"@modern-js/generator-common": "3.
|
|
38
|
-
"@scripts/
|
|
39
|
-
"@modern-js/generator-utils": "3.
|
|
40
|
-
"@scripts/
|
|
34
|
+
"@modern-js/dependence-generator": "3.7.1",
|
|
35
|
+
"@modern-js/generator-common": "3.7.1",
|
|
36
|
+
"@scripts/jest-config": "2.60.5",
|
|
37
|
+
"@modern-js/generator-utils": "3.7.1",
|
|
38
|
+
"@scripts/build": "2.60.5"
|
|
41
39
|
},
|
|
42
40
|
"sideEffects": false,
|
|
43
41
|
"publishConfig": {
|
package/src/index.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import type { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
|
3
|
-
import { AppAPI } from '@modern-js/codesmith-api-app';
|
|
4
|
-
import { JsonAPI } from '@modern-js/codesmith-api-json';
|
|
5
|
-
import {
|
|
6
|
-
DependenceGenerator,
|
|
7
|
-
Language,
|
|
8
|
-
i18n,
|
|
9
|
-
} from '@modern-js/generator-common';
|
|
10
|
-
import {
|
|
11
|
-
getGeneratorPath,
|
|
12
|
-
isTsProject,
|
|
13
|
-
readTsConfigByFile,
|
|
14
|
-
} from '@modern-js/generator-utils';
|
|
15
|
-
|
|
16
|
-
export const handleTemplateFile = async (
|
|
17
|
-
context: GeneratorContext,
|
|
18
|
-
generator: GeneratorCore,
|
|
19
|
-
appApi: AppAPI,
|
|
20
|
-
) => {
|
|
21
|
-
const appDir = context.materials.default.basePath;
|
|
22
|
-
const jsonAPI = new JsonAPI(generator);
|
|
23
|
-
const language = isTsProject(appDir) ? Language.TS : Language.JS;
|
|
24
|
-
|
|
25
|
-
if (language === Language.TS) {
|
|
26
|
-
await appApi.forgeTemplate(
|
|
27
|
-
'templates/ts-template/**/*',
|
|
28
|
-
undefined,
|
|
29
|
-
resourceKey => resourceKey.replace('templates/ts-template/', ''),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const tsconfigJSON = readTsConfigByFile(path.join(appDir, 'tsconfig.json'));
|
|
33
|
-
|
|
34
|
-
if (!(tsconfigJSON.include || []).includes('tailwind.config.ts')) {
|
|
35
|
-
await jsonAPI.update(
|
|
36
|
-
context.materials.default.get(path.join(appDir, 'tsconfig.json')),
|
|
37
|
-
{
|
|
38
|
-
query: {},
|
|
39
|
-
update: {
|
|
40
|
-
$set: {
|
|
41
|
-
include: [...(tsconfigJSON.include || []), 'tailwind.config.ts'],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
true,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
appApi.forgeTemplate('templates/js-template/**/*', undefined, resourceKey =>
|
|
50
|
-
resourceKey.replace('templates/js-template/', ''),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const { dependencies, peerDependencies, devDependencies } = context.config;
|
|
55
|
-
const tailwindVersion = '~3.3.3';
|
|
56
|
-
if (dependencies?.tailwindcss) {
|
|
57
|
-
dependencies.tailwindcss = tailwindVersion;
|
|
58
|
-
}
|
|
59
|
-
if (peerDependencies?.tailwindcss) {
|
|
60
|
-
peerDependencies.tailwindcss = tailwindVersion;
|
|
61
|
-
}
|
|
62
|
-
if (devDependencies?.tailwindcss) {
|
|
63
|
-
devDependencies.tailwindcss = tailwindVersion;
|
|
64
|
-
}
|
|
65
|
-
await appApi.runSubGenerator(
|
|
66
|
-
getGeneratorPath(DependenceGenerator, context.config.distTag, [__dirname]),
|
|
67
|
-
undefined,
|
|
68
|
-
{
|
|
69
|
-
...context.config,
|
|
70
|
-
dependencies,
|
|
71
|
-
devDependencies,
|
|
72
|
-
peerDependencies,
|
|
73
|
-
},
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
78
|
-
const appApi = new AppAPI(context, generator);
|
|
79
|
-
|
|
80
|
-
const { locale } = context.config;
|
|
81
|
-
i18n.changeLanguage({ locale });
|
|
82
|
-
appApi.i18n.changeLanguage({ locale });
|
|
83
|
-
|
|
84
|
-
if (!(await appApi.checkEnvironment())) {
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
generator.logger.debug(`🚀 [Start Run Tailwindcss Generator]`);
|
|
89
|
-
generator.logger.debug(
|
|
90
|
-
'💡 [Current Config]:',
|
|
91
|
-
JSON.stringify(context.config),
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
await handleTemplateFile(context, generator, appApi);
|
|
95
|
-
|
|
96
|
-
generator.logger.debug(`🌟 [End Run Tailwindcss Generator]`);
|
|
97
|
-
};
|