@modern-js/tailwindcss-generator 3.4.15 → 3.4.17
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +2098 -389
- package/package.json +10 -9
- package/src/index.ts +27 -5
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "3.4.
|
18
|
+
"version": "3.4.17",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"main": "./dist/index.js",
|
21
21
|
"files": [
|
@@ -23,20 +23,21 @@
|
|
23
23
|
"/dist/index.js"
|
24
24
|
],
|
25
25
|
"dependencies": {
|
26
|
-
"@modern-js/utils": "2.58.
|
26
|
+
"@modern-js/utils": "2.58.3"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@modern-js/codesmith": "2.4.
|
30
|
-
"@modern-js/codesmith-api-app": "2.4.
|
29
|
+
"@modern-js/codesmith": "2.4.1",
|
30
|
+
"@modern-js/codesmith-api-app": "2.4.1",
|
31
|
+
"@modern-js/codesmith-api-json": "2.4.1",
|
31
32
|
"@types/jest": "^29",
|
32
33
|
"@types/node": "^14",
|
33
34
|
"jest": "^29",
|
34
35
|
"typescript": "^5",
|
35
|
-
"@modern-js/
|
36
|
-
"@modern-js/generator-utils": "3.4.
|
37
|
-
"@
|
38
|
-
"@
|
39
|
-
"@scripts/
|
36
|
+
"@modern-js/generator-common": "3.4.17",
|
37
|
+
"@modern-js/generator-utils": "3.4.17",
|
38
|
+
"@modern-js/dependence-generator": "3.4.17",
|
39
|
+
"@scripts/build": "2.58.3",
|
40
|
+
"@scripts/jest-config": "2.58.3"
|
40
41
|
},
|
41
42
|
"sideEffects": false,
|
42
43
|
"publishConfig": {
|
package/src/index.ts
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
-
import
|
1
|
+
import path from 'path';
|
2
|
+
import type { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
2
3
|
import { AppAPI } from '@modern-js/codesmith-api-app';
|
4
|
+
import { JsonAPI } from '@modern-js/codesmith-api-json';
|
3
5
|
import {
|
4
|
-
i18n,
|
5
|
-
Language,
|
6
6
|
DependenceGenerator,
|
7
|
+
Language,
|
8
|
+
i18n,
|
7
9
|
} from '@modern-js/generator-common';
|
8
|
-
import {
|
10
|
+
import {
|
11
|
+
getGeneratorPath,
|
12
|
+
isTsProject,
|
13
|
+
readTsConfigByFile,
|
14
|
+
} from '@modern-js/generator-utils';
|
9
15
|
|
10
16
|
export const handleTemplateFile = async (
|
11
17
|
context: GeneratorContext,
|
@@ -13,6 +19,7 @@ export const handleTemplateFile = async (
|
|
13
19
|
appApi: AppAPI,
|
14
20
|
) => {
|
15
21
|
const appDir = context.materials.default.basePath;
|
22
|
+
const jsonAPI = new JsonAPI(generator);
|
16
23
|
const language = isTsProject(appDir) ? Language.TS : Language.JS;
|
17
24
|
|
18
25
|
if (language === Language.TS) {
|
@@ -21,6 +28,22 @@ export const handleTemplateFile = async (
|
|
21
28
|
undefined,
|
22
29
|
resourceKey => resourceKey.replace('templates/ts-template/', ''),
|
23
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
|
+
);
|
46
|
+
}
|
24
47
|
} else {
|
25
48
|
appApi.forgeTemplate('templates/js-template/**/*', undefined, resourceKey =>
|
26
49
|
resourceKey.replace('templates/js-template/', ''),
|
@@ -58,7 +81,6 @@ export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
58
81
|
appApi.i18n.changeLanguage({ locale });
|
59
82
|
|
60
83
|
if (!(await appApi.checkEnvironment())) {
|
61
|
-
// eslint-disable-next-line no-process-exit
|
62
84
|
process.exit(1);
|
63
85
|
}
|
64
86
|
|