@modern-js/tailwindcss-generator 3.7.0 → 3.7.2
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 +1 -1
- package/package.json +10 -10
- package/src/index.ts +0 -97
package/dist/index.js
CHANGED
@@ -1513,7 +1513,7 @@
|
|
1513
1513
|
appApi.forgeTemplate("templates/js-template/**/*", void 0, (resourceKey)=>resourceKey.replace("templates/js-template/", ""));
|
1514
1514
|
}
|
1515
1515
|
const { dependencies, peerDependencies, devDependencies } = context.config;
|
1516
|
-
const tailwindVersion = "~3.
|
1516
|
+
const tailwindVersion = "~3.4.14";
|
1517
1517
|
if (dependencies == null ? void 0 : dependencies.tailwindcss) {
|
1518
1518
|
dependencies.tailwindcss = tailwindVersion;
|
1519
1519
|
}
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "3.7.
|
18
|
+
"version": "3.7.2",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"main": "./dist/index.js",
|
21
21
|
"files": [
|
@@ -23,19 +23,19 @@
|
|
23
23
|
"/dist/index.js"
|
24
24
|
],
|
25
25
|
"devDependencies": {
|
26
|
-
"@modern-js/codesmith": "2.6.
|
27
|
-
"@modern-js/codesmith-utils": "2.6.
|
28
|
-
"@modern-js/codesmith-api-app": "2.6.
|
29
|
-
"@modern-js/codesmith-api-json": "2.6.
|
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",
|
30
30
|
"@types/jest": "^29",
|
31
31
|
"@types/node": "^14",
|
32
32
|
"jest": "^29",
|
33
33
|
"typescript": "^5",
|
34
|
-
"@modern-js/
|
35
|
-
"@modern-js/generator-utils": "3.7.
|
36
|
-
"@
|
37
|
-
"@scripts/
|
38
|
-
"@
|
34
|
+
"@modern-js/generator-common": "3.7.2",
|
35
|
+
"@modern-js/generator-utils": "3.7.2",
|
36
|
+
"@scripts/build": "2.60.6",
|
37
|
+
"@scripts/jest-config": "2.60.6",
|
38
|
+
"@modern-js/dependence-generator": "3.7.2"
|
39
39
|
},
|
40
40
|
"sideEffects": false,
|
41
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
|
-
};
|