@modern-js/tailwindcss-generator 3.4.14 → 3.4.16
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 +21492 -19811
- package/package.json +10 -9
- package/src/index.ts +25 -3
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.16",
|
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.2"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@modern-js/codesmith": "2.
|
30
|
-
"@modern-js/codesmith-api-app": "2.
|
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/dependence-generator": "3.4.
|
36
|
-
"@
|
37
|
-
"@
|
38
|
-
"@
|
39
|
-
"@
|
36
|
+
"@modern-js/dependence-generator": "3.4.16",
|
37
|
+
"@scripts/build": "2.58.2",
|
38
|
+
"@scripts/jest-config": "2.58.2",
|
39
|
+
"@modern-js/generator-utils": "3.4.16",
|
40
|
+
"@modern-js/generator-common": "3.4.16"
|
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
6
|
i18n,
|
5
7
|
Language,
|
6
8
|
DependenceGenerator,
|
7
9
|
} from '@modern-js/generator-common';
|
8
|
-
import {
|
10
|
+
import {
|
11
|
+
isTsProject,
|
12
|
+
getGeneratorPath,
|
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
|
|