@ronas-it/nx-generators 0.7.3 → 0.8.0
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 +35 -5
- package/generators.json +10 -0
- package/package.json +1 -1
- package/src/generators/code-checks/files/.eslintrc.json.template +36 -2
- package/src/generators/entity-api/generator.js +1 -6
- package/src/generators/entity-api/generator.js.map +1 -1
- package/src/generators/expo-app/app-files/app/_layout.tsx.template +21 -13
- package/src/generators/expo-app/generator.js +26 -9
- package/src/generators/expo-app/generator.js.map +1 -1
- package/src/generators/expo-app/i18n/app/en.json +3 -0
- package/src/generators/expo-app/i18n/shared/en.json +3 -0
- package/src/generators/expo-app/scripts.js +1 -1
- package/src/generators/expo-app/scripts.js.map +1 -1
- package/src/generators/form/files/form.ts.template +26 -0
- package/src/generators/form/generator.d.ts +4 -0
- package/src/generators/form/generator.js +107 -0
- package/src/generators/form/generator.js.map +1 -0
- package/src/generators/form/schema.d.ts +4 -0
- package/src/generators/form/schema.json +29 -0
- package/src/generators/next-app/generator.js +16 -4
- package/src/generators/next-app/generator.js.map +1 -1
- package/src/generators/react-component/generator.js +3 -8
- package/src/generators/react-component/generator.js.map +1 -1
- package/src/generators/react-lib/generator.js +37 -11
- package/src/generators/react-lib/generator.js.map +1 -1
- package/src/generators/react-lib/schema.d.ts +0 -1
- package/src/generators/react-lib/schema.json +1 -10
- package/src/shared/dependencies.d.ts +6 -0
- package/src/shared/dependencies.js +6 -0
- package/src/shared/dependencies.js.map +1 -1
- package/src/shared/generators/api-client/generator.js +2 -2
- package/src/shared/generators/api-client/generator.js.map +1 -1
- package/src/shared/generators/app-env/generator.js +2 -2
- package/src/shared/generators/app-env/generator.js.map +1 -1
- package/src/shared/generators/auth/generator.js +38 -3
- package/src/shared/generators/auth/generator.js.map +1 -1
- package/src/shared/generators/form-utils/generator.d.ts +6 -0
- package/src/shared/generators/form-utils/generator.js +22 -0
- package/src/shared/generators/form-utils/generator.js.map +1 -0
- package/src/shared/generators/form-utils/index.d.ts +1 -0
- package/src/shared/generators/form-utils/index.js +5 -0
- package/src/shared/generators/form-utils/index.js.map +1 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/index.ts.template +1 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/lib/index.ts.template +2 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/lib/interfaces/base-schema.ts.template +5 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/lib/interfaces/index.ts.template +1 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/lib/types/index.ts.template +1 -0
- package/src/shared/generators/form-utils/lib-files/shared/utils/form/src/lib/types/values.ts.template +1 -0
- package/src/shared/generators/index.d.ts +1 -0
- package/src/shared/generators/index.js +1 -0
- package/src/shared/generators/index.js.map +1 -1
- package/src/shared/generators/rn-styles/generator.js +2 -2
- package/src/shared/generators/rn-styles/generator.js.map +1 -1
- package/src/shared/generators/storage/generator.js +2 -2
- package/src/shared/generators/storage/generator.js.map +1 -1
- package/src/shared/generators/store/expo-app/lib-files/shared/data-access/store/src/store.ts.template +3 -17
- package/src/shared/generators/store/generator.d.ts +2 -6
- package/src/shared/generators/store/generator.js +2 -2
- package/src/shared/generators/store/generator.js.map +1 -1
- package/src/shared/generators/store/schema.d.ts +7 -0
- package/src/shared/generators/store/schema.json +36 -0
- package/src/shared/generators/ui-kitten/generator.js +2 -2
- package/src/shared/generators/ui-kitten/generator.js.map +1 -1
- package/src/shared/utils/cli-utils.d.ts +2 -0
- package/src/shared/utils/cli-utils.js +7 -1
- package/src/shared/utils/cli-utils.js.map +1 -1
- package/src/shared/utils/config-utils.d.ts +4 -0
- package/src/shared/utils/config-utils.js +49 -0
- package/src/shared/utils/config-utils.js.map +1 -0
- package/src/shared/utils/index.d.ts +2 -0
- package/src/shared/utils/index.js +2 -0
- package/src/shared/utils/index.js.map +1 -1
- package/src/shared/utils/ts-utils.d.ts +2 -0
- package/src/shared/utils/ts-utils.js +21 -0
- package/src/shared/utils/ts-utils.js.map +1 -0
package/README.md
CHANGED
|
@@ -112,20 +112,29 @@ Generates a library according to [NX notation](https://nx.dev/concepts/more-conc
|
|
|
112
112
|
|
|
113
113
|
#### Options
|
|
114
114
|
|
|
115
|
-
1. `
|
|
115
|
+
1. `app` (optional) - name of an app or `shared`.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
1. `scope` (optional) - name of a scope or `shared`.
|
|
118
|
+
This option is for a library, related to an app.
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
1. `type` (optional) - type of library.
|
|
121
|
+
Possible values are `features`, `data-access`, `ui` and `utils`.
|
|
122
|
+
|
|
123
|
+
1. `name` (optional) - name of a library.
|
|
124
|
+
|
|
125
|
+
1. `withComponent` (optional) - generate the library with `lib/component.tsx` file.
|
|
126
|
+
This option is for `features` or `ui` library.
|
|
127
|
+
|
|
128
|
+
1. `dryRun` (optional) - generate the library without creating files
|
|
120
129
|
|
|
121
130
|
#### Example
|
|
122
131
|
|
|
123
132
|
```sh
|
|
124
|
-
npx nx g react-lib --
|
|
133
|
+
npx nx g react-lib --app=mobile --scope=account --type=features --name=profile-settings --withComponent --dryRun
|
|
125
134
|
```
|
|
126
135
|
or
|
|
127
136
|
```sh
|
|
128
|
-
npx nx g react-lib
|
|
137
|
+
npx nx g react-lib --dryRun
|
|
129
138
|
```
|
|
130
139
|
|
|
131
140
|
### 6. `react-component`
|
|
@@ -164,6 +173,27 @@ Creates an API with related entities in API library. It also updates redux store
|
|
|
164
173
|
npx nx g entity-api --name=User --baseEndpoint=users
|
|
165
174
|
```
|
|
166
175
|
|
|
176
|
+
### 8. `form`
|
|
177
|
+
|
|
178
|
+
Generates a form schema class and adds its usage to a component or a hook.
|
|
179
|
+
|
|
180
|
+
#### Options
|
|
181
|
+
|
|
182
|
+
1. `name` (optional) - name of the form (e.g: `profile-settings`)
|
|
183
|
+
|
|
184
|
+
2. `placeOfUse` (optional) - name of the component or hook, where the form should be
|
|
185
|
+
(e.g: `ProfileSettings` or `useProfileSettings`)
|
|
186
|
+
|
|
187
|
+
#### Example
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
npx nx g form --name=profile-settings --placeOfUse=ProfileSettings
|
|
191
|
+
```
|
|
192
|
+
or
|
|
193
|
+
```sh
|
|
194
|
+
npx nx g form profile-settings ProfileSettings
|
|
195
|
+
```
|
|
196
|
+
|
|
167
197
|
### Note
|
|
168
198
|
|
|
169
199
|
Each generator accepts the `--help` argument to see generator instructions.
|
package/generators.json
CHANGED
|
@@ -39,6 +39,16 @@
|
|
|
39
39
|
"factory": "./src/generators/entity-api/generator",
|
|
40
40
|
"schema": "./src/generators/entity-api/schema.json",
|
|
41
41
|
"description": "entity-api generator"
|
|
42
|
+
},
|
|
43
|
+
"store": {
|
|
44
|
+
"factory": "./src/shared/generators/store/generator",
|
|
45
|
+
"schema": "./src/shared/generators/store/schema.json",
|
|
46
|
+
"description": "redux store generator"
|
|
47
|
+
},
|
|
48
|
+
"form": {
|
|
49
|
+
"factory": "./src/generators/form/generator",
|
|
50
|
+
"schema": "./src/generators/form/schema.json",
|
|
51
|
+
"description": "form generator"
|
|
42
52
|
}
|
|
43
53
|
}
|
|
44
54
|
}
|
package/package.json
CHANGED
|
@@ -13,8 +13,42 @@
|
|
|
13
13
|
"allow": [],
|
|
14
14
|
"depConstraints": [
|
|
15
15
|
{
|
|
16
|
-
"sourceTag": "
|
|
17
|
-
"onlyDependOnLibsWithTags": ["
|
|
16
|
+
"sourceTag": "app:shared",
|
|
17
|
+
"onlyDependOnLibsWithTags": ["app:shared"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"sourceTag": "scope:shared",
|
|
21
|
+
"onlyDependOnLibsWithTags": ["scope:*"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"sourceTag": "type:app",
|
|
25
|
+
"onlyDependOnLibsWithTags": [
|
|
26
|
+
"type:features",
|
|
27
|
+
"type:ui",
|
|
28
|
+
"type:utils",
|
|
29
|
+
"type:data-access"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"sourceTag": "type:utils",
|
|
34
|
+
"onlyDependOnLibsWithTags": ["type:utils"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"sourceTag": "type:data-access",
|
|
38
|
+
"onlyDependOnLibsWithTags": ["type:data-access", "type:utils"]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"sourceTag": "type:features",
|
|
42
|
+
"onlyDependOnLibsWithTags": [
|
|
43
|
+
"type:features",
|
|
44
|
+
"type:data-access",
|
|
45
|
+
"type:ui",
|
|
46
|
+
"type:utils"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"sourceTag": "type:ui",
|
|
51
|
+
"onlyDependOnLibsWithTags": ["type:ui", "type:utils"]
|
|
18
52
|
}
|
|
19
53
|
]
|
|
20
54
|
}
|
|
@@ -42,12 +42,7 @@ function entityApiGenerator(tree, options) {
|
|
|
42
42
|
const entityName = (0, lodash_1.startCase)((0, lodash_1.camelCase)(apiName)).replace(/\s+/g, '');
|
|
43
43
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, `files`), apiPath, Object.assign(Object.assign({}, options), { apiName: (0, lodash_1.camelCase)(options.name), entityName, entityFileName: apiName, apiClientDirectory, baseEndpoint: options.baseEndpoint.startsWith('/') ? options.baseEndpoint : `/${options.baseEndpoint}` }));
|
|
44
44
|
tree.rename(`${apiPath}/models/entity.ts`, `${apiPath}/models/${apiName}.ts`);
|
|
45
|
-
|
|
46
|
-
const content = tree.read(path, 'utf-8');
|
|
47
|
-
const contentUpdate = content + endContent;
|
|
48
|
-
tree.write(path, contentUpdate);
|
|
49
|
-
};
|
|
50
|
-
appendFileContent(`${libRootPath}/index.ts`, `export * from './${apiName}';\n`);
|
|
45
|
+
(0, utils_1.appendFileContent)(`${libRootPath}/index.ts`, `export * from './${apiName}';\n`, tree);
|
|
51
46
|
const storeLibsPaths = (0, utils_1.searchNxLibsPaths)(nxLibsPaths, 'data-access/store/src', 'endsWith');
|
|
52
47
|
if (!storeLibsPaths.length) {
|
|
53
48
|
yield (0, devkit_1.formatFiles)(tree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/entity-api/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAA8D;AAC9D,uCAA0F;AAC1F,6BAA6B;AAC7B,mCAAyD;AAEzD,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/entity-api/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAA8D;AAC9D,uCAA0F;AAC1F,6BAA6B;AAC7B,mCAAyD;AAEzD,8CAS4B;AAE5B,SAAsB,kBAAkB,CACtC,IAAU,EACV,OAAiC;;QAEjC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,qBAAa,EAAoD,kCAAkC,CAAC,CAAC;QAC7I,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,CAAC,mBAAW,CAAC,WAAW,CAAC,CAAC,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAA,yBAAiB,EAAC,WAAW,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QACvF,MAAM,kBAAkB,GAAG,IAAA,yBAAiB,EAAC,WAAW,EAAE,4BAA4B,EAAE,UAAU,CAAC,CAAC;QAEpG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,kBAAkB,CAAC,CAAC,CAAC,GAAG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,EAAE,0BAAe,CAAC,SAAS;gBAC1C,SAAS,EAAE,oBAAS,CAAC,MAAM;aAC5B;SACF,CAAC,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAC3E,yCAAyC;QACzC,MAAM,qBAAqB,GAAG,KAAK,CAAC,2BAA2B,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,KAAK,YAAY,CAAC,CAAC;QAE3H,qBAAqB,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;QAEzD,MAAM,WAAW,GAAG,KAAK,CAAC,6BAA6B,CAAC,aAAa,CAAC,CAAC;QAEvE,WAAW,CAAC,2BAA2B,CAAC,qBAAU,CAAC,uBAAuB,CAAC;aACxE,WAAW,CAAC;YACX,IAAI,EAAE,IAAI,kBAAkB,eAAe;YAC3C,WAAW,EAAE,GAAG,kBAAkB,UAAU;YAC5C,IAAI,EAAE,wBAAa,CAAC,kBAAkB;SACvC,CAAC,CAAC;QAEL,MAAM,WAAW,GAAG,KAAK,CAAC,6BAA6B,CAAC,aAAa,CAAC,CAAC;QAEvE,WAAW,CAAC,2BAA2B,CAAC,qBAAU,CAAC,sBAAsB,CAAC;aACvE,UAAU,CAAC,GAAG,kBAAkB,aAAa,CAAC,CAAC;QAElD,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEnB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAzGD,gDAyGC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
import { store } from '<%= formatDirectory() %>/shared/data-access/store'
|
|
1
|
+
<% if(isStoreEnabled) { %> import { store } from '<%= formatDirectory() %>/shared/data-access/store';<% } %>
|
|
2
|
+
import { setLanguage } from '@ronas-it/react-native-common-modules';
|
|
2
3
|
<% if(isUIKittenEnabled) { %>
|
|
3
4
|
import { UserThemeProvider } from '<%= formatDirectory() %>/shared/features/user-theme-provider';
|
|
4
5
|
<% } %>
|
|
5
|
-
import { storeActions } from '@ronas-it/rtkq-entity-api'
|
|
6
|
+
<% if(isStoreEnabled) { %>import { storeActions } from '@ronas-it/rtkq-entity-api';<% } %>
|
|
6
7
|
import { Stack } from 'expo-router';
|
|
7
|
-
import { ReactElement
|
|
8
|
-
import { Provider, useDispatch } from 'react-redux'
|
|
8
|
+
import { ReactElement<% if(isStoreEnabled) { %>, useEffect<% } %> } from 'react';
|
|
9
|
+
<% if(isStoreEnabled) { %>import { Provider, useDispatch } from 'react-redux';<% } %>
|
|
9
10
|
|
|
10
11
|
export { ErrorBoundary } from 'expo-router';
|
|
11
12
|
|
|
13
|
+
const translations = {
|
|
14
|
+
en: {
|
|
15
|
+
...require('i18n/<%= appDirectory %>/app/en.json'),
|
|
16
|
+
...require('i18n/<%= appDirectory %>/shared/en.json')
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const useLanguage = setLanguage(translations, 'en');
|
|
21
|
+
|
|
12
22
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
23
|
export const unstable_settings = {
|
|
14
24
|
initialRouteName: 'index',
|
|
15
25
|
};
|
|
16
26
|
|
|
17
27
|
function App(): ReactElement {
|
|
28
|
+
<% if(isStoreEnabled) { %>
|
|
18
29
|
const dispatch = useDispatch();
|
|
30
|
+
useLanguage('en');
|
|
19
31
|
|
|
20
32
|
useEffect(() => {
|
|
21
33
|
dispatch(storeActions.init());
|
|
22
34
|
}, []);
|
|
23
|
-
|
|
35
|
+
<% } %>
|
|
24
36
|
return (
|
|
25
37
|
<Stack>
|
|
26
38
|
<Stack.Screen name='index' />
|
|
@@ -30,14 +42,10 @@ function App(): ReactElement {
|
|
|
30
42
|
|
|
31
43
|
export default function RootLayout(): ReactElement | null {
|
|
32
44
|
return (
|
|
33
|
-
|
|
34
|
-
<% if(isUIKittenEnabled) { %>
|
|
35
|
-
<UserThemeProvider>
|
|
36
|
-
<% } %>
|
|
45
|
+
<% if(isStoreEnabled) { %><Provider store={store}><% } %>
|
|
46
|
+
<% if(isUIKittenEnabled) { %><UserThemeProvider><% } %>
|
|
37
47
|
<App />
|
|
38
|
-
<% if(isUIKittenEnabled) { %>
|
|
39
|
-
|
|
40
|
-
<% } %>
|
|
41
|
-
</Provider>
|
|
48
|
+
<% if(isUIKittenEnabled) { %></UserThemeProvider><% } %>
|
|
49
|
+
<% if(isStoreEnabled) { %></Provider><% } %>
|
|
42
50
|
);
|
|
43
51
|
}
|
|
@@ -14,20 +14,35 @@ const utils_1 = require("../../shared/utils");
|
|
|
14
14
|
function expoAppGenerator(tree, options) {
|
|
15
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const appRoot = `apps/${options.directory}`;
|
|
17
|
+
const i18nRoot = `i18n/${options.directory}`;
|
|
17
18
|
const appTestFolder = `apps/${options.directory}-e2e`;
|
|
18
|
-
const libPath =
|
|
19
|
+
const libPath = `${(0, utils_1.getImportPathPrefix)(tree)}/${options.directory}`;
|
|
20
|
+
const tags = [`app:${options.directory}`, 'type:app'];
|
|
19
21
|
// Install @nx/expo plugin
|
|
20
22
|
(0, child_process_1.execSync)('npx nx add @nx/expo', { stdio: 'inherit' });
|
|
21
23
|
if (!(0, fs_1.existsSync)(appRoot)) {
|
|
22
|
-
(0, child_process_1.execSync)(`npx nx g @nx/expo:app ${options.name} --directory=apps/${options.directory} --projectNameAndRootFormat=as-provided --unitTestRunner=none --e2eTestRunner=none`, { stdio: 'inherit' });
|
|
24
|
+
(0, child_process_1.execSync)(`npx nx g @nx/expo:app ${options.name} --directory=apps/${options.directory} --tags="${tags.join(', ')}" --projectNameAndRootFormat=as-provided --unitTestRunner=none --e2eTestRunner=none`, { stdio: 'inherit' });
|
|
23
25
|
}
|
|
24
26
|
// Generate shared libs
|
|
25
|
-
(0, generators_1.
|
|
26
|
-
(0, generators_1.
|
|
27
|
-
(0, generators_1.
|
|
28
|
-
(0,
|
|
29
|
-
(
|
|
30
|
-
|
|
27
|
+
yield (0, generators_1.runAppEnvGenerator)(tree, options);
|
|
28
|
+
yield (0, generators_1.runStorageGenerator)(tree, options);
|
|
29
|
+
yield (0, generators_1.runRNStylesGenerator)(tree, options);
|
|
30
|
+
const shouldGenerateStoreLib = (yield (0, utils_1.askQuestion)('Do you want to create store lib? (y/n): ')) === 'y';
|
|
31
|
+
if (shouldGenerateStoreLib) {
|
|
32
|
+
(0, child_process_1.execSync)(`npx nx g store ${options.name} ${options.directory} ${enums_1.BaseGeneratorType.EXPO_APP}`, { stdio: 'inherit' });
|
|
33
|
+
}
|
|
34
|
+
const shouldGenerateApiClientLib = shouldGenerateStoreLib && (yield (0, utils_1.askQuestion)('Do you want to create api client lib? (y/n): ')) === 'y';
|
|
35
|
+
if (shouldGenerateApiClientLib) {
|
|
36
|
+
yield (0, generators_1.runApiClientGenerator)(tree, options);
|
|
37
|
+
}
|
|
38
|
+
const shouldGenerateAuthLibs = shouldGenerateApiClientLib && (yield (0, utils_1.askQuestion)('Do you want to create auth lib? (y/n): ')) === 'y';
|
|
39
|
+
if (shouldGenerateAuthLibs) {
|
|
40
|
+
yield (0, generators_1.runAuthGenerator)(tree, options);
|
|
41
|
+
}
|
|
42
|
+
const shouldGenerateFormUtilsLib = (yield (0, utils_1.askQuestion)('Do you want to create a lib with the form utils? (y/n): ')) === 'y';
|
|
43
|
+
if (shouldGenerateFormUtilsLib) {
|
|
44
|
+
(0, generators_1.runFormUtilsGenerator)(tree, options);
|
|
45
|
+
}
|
|
31
46
|
// Workaround: Even with the '--e2eTestRunner=none' parameter, the test folder is created. We delete it manually.
|
|
32
47
|
if ((0, fs_1.existsSync)(appTestFolder)) {
|
|
33
48
|
(0, fs_1.rmSync)(appTestFolder, { recursive: true, force: true });
|
|
@@ -50,7 +65,9 @@ function expoAppGenerator(tree, options) {
|
|
|
50
65
|
(0, devkit_1.writeJson)(tree, appPackagePath, appPackageJson);
|
|
51
66
|
// Add app files
|
|
52
67
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'app-files'), appRoot, Object.assign(Object.assign({}, options), { formatName: utils_1.formatName,
|
|
53
|
-
formatAppIdentifier: utils_1.formatAppIdentifier, formatDirectory: () => libPath, isUIKittenEnabled: false, appDirectory: options.directory }));
|
|
68
|
+
formatAppIdentifier: utils_1.formatAppIdentifier, formatDirectory: () => libPath, isUIKittenEnabled: false, isStoreEnabled: shouldGenerateStoreLib, appDirectory: options.directory }));
|
|
69
|
+
(0, utils_1.addNxAppTag)(tree, options.directory);
|
|
70
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'i18n'), i18nRoot, {});
|
|
54
71
|
// Add dependencies
|
|
55
72
|
(0, devkit_1.addDependenciesToPackageJson)(tree, Object.assign(Object.assign({}, dependencies_1.dependencies['expo-app']), dependencies_1.dependencies['expo-app-root']), Object.assign(Object.assign({}, dependencies_1.devDependencies['expo-app']), dependencies_1.devDependencies['expo-app-root']));
|
|
56
73
|
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies_1.dependencies['expo-app'], dependencies_1.devDependencies['expo-app'], appPackagePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AAEpB,uCAAgC;AAChC,2BAAwC;AACxC,4DAA0E;AAC1E,8CAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AAEpB,uCAAgC;AAChC,2BAAwC;AACxC,4DAA0E;AAC1E,8CAAuD;AACvD,wDAOiC;AACjC,8CAAoH;AAEpH,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAA+B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,8BAAe,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC;QAE1G,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;YAC1B,IAAA,wBAAQ,EAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YACzD,IAAA,wBAAQ,EAAC,sBAAsB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC5F,CAAC,CAAC;IACJ,CAAC;CAAA;AA/GD,4CA+GC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
|
-
'start': 'npx expo start',
|
|
4
|
+
'start': 'cross-env EXPO_PUBLIC_APP_ENV=development npx expo start',
|
|
5
5
|
'start:prod': 'cross-env EXPO_PUBLIC_APP_ENV=production npx expo start',
|
|
6
6
|
'build:dev': 'eas build --no-wait -p all --profile=development',
|
|
7
7
|
'build:debug': 'npm run build:dev -- --profile=debug',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,OAAO,EAAE,0DAA0D;IACnE,YAAY,EAAE,yDAAyD;IACvE,WAAW,EAAE,kDAAkD;IAC/D,aAAa,EAAE,sCAAsC;IACrD,YAAY,EAAE,2CAA2C;IACzD,YAAY,EAAE,2EAA2E;IACzF,aAAa,EAAE,yEAAyE;IACxF,gBAAgB,EAAE,6FAA6F;IAC/G,iBAAiB,EAAE,2FAA2F;CAC/G,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Yup from 'yup';
|
|
2
|
+
import { BaseFormSchema, FormValues } from '<%= formUtilsDirectory %>';
|
|
3
|
+
|
|
4
|
+
export class <%= className %> implements BaseFormSchema<<%= className %>> {
|
|
5
|
+
// Add fields here, for example,
|
|
6
|
+
// public email: string;
|
|
7
|
+
|
|
8
|
+
public get formValues(): FormValues<<%= className %>> {
|
|
9
|
+
return {
|
|
10
|
+
// Add fields here, for example,
|
|
11
|
+
// email: this.email
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static get validationSchema(): Yup.ObjectSchema<FormValues<<%= className %>>> {
|
|
16
|
+
return Yup.object().shape({
|
|
17
|
+
// Add validation rules here, for example,
|
|
18
|
+
// email: Yup.string().required().email()
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
constructor(schema?: Partial<<%= className %>>) {
|
|
23
|
+
// Add initial values here, for example,
|
|
24
|
+
// this.email = schema?.email || ''
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const utils_1 = require("../../shared/utils");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const lodash_1 = require("lodash");
|
|
10
|
+
const dependencies_1 = require("../../shared/dependencies");
|
|
11
|
+
const ts_morph_1 = require("ts-morph");
|
|
12
|
+
function getFormUtilsDirectory() {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const { default: autocomplete } = yield (0, utils_1.dynamicImport)('inquirer-autocomplete-standalone');
|
|
15
|
+
const utilsLibsPaths = (0, utils_1.getNxLibsPaths)([utils_1.LibraryType.UTILS]);
|
|
16
|
+
const formUtilsLibsPaths = (0, utils_1.searchNxLibsPaths)(utilsLibsPaths, 'utils/form/src', 'endsWith');
|
|
17
|
+
if (!formUtilsLibsPaths.length) {
|
|
18
|
+
throw new Error('Could not find a library with the form utilities.');
|
|
19
|
+
}
|
|
20
|
+
if (formUtilsLibsPaths.length > 1) {
|
|
21
|
+
formUtilsLibsPaths[0] = yield autocomplete({
|
|
22
|
+
message: 'Select the path of the library with the form utilities: ',
|
|
23
|
+
source: (input) => (0, utils_1.filterSource)(input, formUtilsLibsPaths)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return (0, utils_1.searchAliasPath)(formUtilsLibsPaths[0]);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function updateIndex(formsPath, fileName, tree) {
|
|
30
|
+
const formsIndexFilePath = `${formsPath}/index.ts`;
|
|
31
|
+
const newIndexContent = `export * from './${(0, lodash_1.kebabCase)(fileName)}';\n`;
|
|
32
|
+
if (!(0, fs_1.existsSync)(formsIndexFilePath)) {
|
|
33
|
+
tree.write(formsIndexFilePath, newIndexContent);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
(0, utils_1.appendFileContent)(formsIndexFilePath, newIndexContent, tree);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getFormUsageCode(formClassName) {
|
|
40
|
+
return `const formSchema = new ${formClassName}();
|
|
41
|
+
const form = useForm<${formClassName}>({
|
|
42
|
+
defaultValues: formSchema.formValues,
|
|
43
|
+
resolver: yupResolver<any>(${formClassName}.validationSchema)
|
|
44
|
+
});\n\n`;
|
|
45
|
+
}
|
|
46
|
+
function addFormUsage(libPath, placeOfUse, formClassName) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const project = new ts_morph_1.Project({
|
|
49
|
+
manipulationSettings: {
|
|
50
|
+
indentationText: ts_morph_1.IndentationText.TwoSpaces,
|
|
51
|
+
quoteKind: ts_morph_1.QuoteKind.Single
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const files = project.addSourceFilesAtPaths([`${libPath}/lib/**/*.tsx`, `${libPath}/lib/**/*.ts`]);
|
|
55
|
+
const file = files.find((file) => file.getFunction(placeOfUse) || file.getVariableDeclaration(placeOfUse));
|
|
56
|
+
if (!file) {
|
|
57
|
+
throw new Error('Could not find the place where the form should be used.');
|
|
58
|
+
}
|
|
59
|
+
const pathToForm = file.getFilePath().includes('components')
|
|
60
|
+
? '../../forms'
|
|
61
|
+
: file.getFilePath().includes('hooks')
|
|
62
|
+
? '../forms'
|
|
63
|
+
: './forms';
|
|
64
|
+
(0, utils_1.addNamedImport)(formClassName, pathToForm, file);
|
|
65
|
+
(0, utils_1.addNamedImport)('useForm', 'react-hook-form', file);
|
|
66
|
+
(0, utils_1.addNamedImport)('yupResolver', '@hookform/resolvers/yup', file);
|
|
67
|
+
const component = file.getFunction(placeOfUse) || file.getVariableDeclaration(placeOfUse).getInitializerIfKindOrThrow(ts_morph_1.SyntaxKind.FunctionExpression);
|
|
68
|
+
component.setBodyText(`${getFormUsageCode(formClassName)}${component.getBodyText()}`);
|
|
69
|
+
project.saveSync();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function formGenerator(tree, options) {
|
|
73
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
// Get input data
|
|
75
|
+
const { default: autocomplete } = yield (0, utils_1.dynamicImport)('inquirer-autocomplete-standalone');
|
|
76
|
+
const availableLibsPaths = (0, utils_1.getNxLibsPaths)([utils_1.LibraryType.FEATURES, utils_1.LibraryType.UI]);
|
|
77
|
+
const libPath = yield autocomplete({
|
|
78
|
+
message: 'Enter the library path: ',
|
|
79
|
+
source: (input) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const filteredNxLibsPaths = (0, utils_1.searchNxLibsPaths)(availableLibsPaths, input);
|
|
81
|
+
return filteredNxLibsPaths.map((path) => ({ value: path }));
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
const fileName = options.name;
|
|
85
|
+
const placeOfUse = options.placeOfUse;
|
|
86
|
+
// Generate form class
|
|
87
|
+
const formsPath = `${libPath}/lib/forms`;
|
|
88
|
+
const formUtilsDirectory = yield getFormUtilsDirectory();
|
|
89
|
+
const formClassName = `${(0, utils_1.formatName)(fileName, true)}FormSchema`;
|
|
90
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, `files`), formsPath, { className: formClassName, formUtilsDirectory });
|
|
91
|
+
tree.rename(`${formsPath}/form.ts`, `${formsPath}/${fileName}.ts`);
|
|
92
|
+
updateIndex(formsPath, fileName, tree);
|
|
93
|
+
// Add form usage
|
|
94
|
+
if (placeOfUse) {
|
|
95
|
+
yield addFormUsage(libPath, placeOfUse, formClassName);
|
|
96
|
+
}
|
|
97
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
98
|
+
// Install dependencies
|
|
99
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies_1.dependencies.form, {});
|
|
100
|
+
return () => {
|
|
101
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
exports.formGenerator = formGenerator;
|
|
106
|
+
exports.default = formGenerator;
|
|
107
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/form/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAAiH;AACjH,6BAA6B;AAE7B,8CAQ4B;AAC5B,2BAAgC;AAChC,mCAAmC;AACnC,4DAAyD;AACzD,uCAA2E;AAE3E,SAAe,qBAAqB;;QAClC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,qBAAa,EAAoD,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GAAG,SAAS,UAAU,EAAE,GAAG,SAAS,IAAI,QAAQ,KAAK,CAAC,CAAC;QACnE,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEvC,iBAAiB;QACjB,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,YAAY,CAAC,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,uBAAuB;QACvB,IAAA,qCAA4B,EAAC,IAAI,EAAE,2BAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AAnCD,sCAmCC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "Form",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Name of the form",
|
|
10
|
+
"default": "",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"x-prompt": "Enter the name of the form (e.g: profile-settings)"
|
|
16
|
+
},
|
|
17
|
+
"placeOfUse": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Name of the component or hook, where the form should be",
|
|
20
|
+
"default": "",
|
|
21
|
+
"$default": {
|
|
22
|
+
"$source": "argv",
|
|
23
|
+
"index": 1
|
|
24
|
+
},
|
|
25
|
+
"x-prompt": "Enter the name of the place, where the form should be (e.g: component ProfileSettings or hook useProfileSettings). If it's not necessary, just press Enter"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": []
|
|
29
|
+
}
|
|
@@ -13,14 +13,25 @@ const path = require("path");
|
|
|
13
13
|
function nextAppGenerator(tree, options) {
|
|
14
14
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
15
|
const appRoot = `apps/${options.directory}`;
|
|
16
|
+
const tags = [`app:${options.directory}`, 'type:app'];
|
|
16
17
|
// Install @nx/next plugin
|
|
17
18
|
(0, child_process_1.execSync)('npx nx add @nx/next', { stdio: 'inherit' });
|
|
18
19
|
if (!(0, fs_1.existsSync)(appRoot)) {
|
|
19
|
-
(0, child_process_1.execSync)(`npx nx g @nx/next:app ${options.name} --directory=apps/${options.directory} --projectNameAndRootFormat=as-provided --appDir=true --style=scss --src=false --unitTestRunner=none --e2eTestRunner=none`, { stdio: 'inherit' });
|
|
20
|
+
(0, child_process_1.execSync)(`npx nx g @nx/next:app ${options.name} --directory=apps/${options.directory} --tags="${tags.join(', ')}" --projectNameAndRootFormat=as-provided --appDir=true --style=scss --src=false --unitTestRunner=none --e2eTestRunner=none`, { stdio: 'inherit' });
|
|
21
|
+
}
|
|
22
|
+
yield (0, generators_1.runAppEnvGenerator)(tree, options);
|
|
23
|
+
const shouldGenerateStoreLib = (yield (0, utils_1.askQuestion)('Do you want to create store lib? (y/n): ')) === 'y';
|
|
24
|
+
if (shouldGenerateStoreLib) {
|
|
25
|
+
(0, child_process_1.execSync)(`npx nx g store ${options.name} ${options.directory} ${enums_1.BaseGeneratorType.NEXT_APP}`, { stdio: 'inherit' });
|
|
26
|
+
}
|
|
27
|
+
const shouldGenerateApiClientLib = shouldGenerateStoreLib && (yield (0, utils_1.askQuestion)('Do you want to create api client lib? (y/n): ')) === 'y';
|
|
28
|
+
if (shouldGenerateApiClientLib) {
|
|
29
|
+
yield (0, generators_1.runApiClientGenerator)(tree, options);
|
|
30
|
+
}
|
|
31
|
+
const shouldGenerateFormUtilsLib = (yield (0, utils_1.askQuestion)('Do you want to create a lib with the form utils? (y/n): ')) === 'y';
|
|
32
|
+
if (shouldGenerateFormUtilsLib) {
|
|
33
|
+
yield (0, generators_1.runFormUtilsGenerator)(tree, options);
|
|
20
34
|
}
|
|
21
|
-
(0, generators_1.runStoreGenerator)(tree, Object.assign(Object.assign({}, options), { baseGeneratorType: enums_1.BaseGeneratorType.NEXT_APP }));
|
|
22
|
-
(0, generators_1.runAppEnvGenerator)(tree, options);
|
|
23
|
-
(0, generators_1.runApiClientGenerator)(tree, options);
|
|
24
35
|
// Remove unnecessary files and files that will be replaced
|
|
25
36
|
tree.delete(`${appRoot}/public/.gitkeep`);
|
|
26
37
|
tree.delete(`${appRoot}/app/api`);
|
|
@@ -40,6 +51,7 @@ function nextAppGenerator(tree, options) {
|
|
|
40
51
|
}
|
|
41
52
|
// Add app files
|
|
42
53
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), appRoot, Object.assign(Object.assign({}, options), { formatName: utils_1.formatName }));
|
|
54
|
+
(0, utils_1.addNxAppTag)(tree, options.directory);
|
|
43
55
|
// Add dependencies
|
|
44
56
|
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies_1.dependencies['next-app'], {});
|
|
45
57
|
yield (0, devkit_1.formatFiles)(tree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/next-app/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,uCAQoB;AAEpB,2BAAgC;AAChC,4DAAyD;AACzD,8CAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/next-app/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,uCAQoB;AAEpB,2BAAgC;AAChC,4DAAyD;AACzD,8CAAuD;AACvD,wDAA2G;AAC3G,8CAA0E;AAC1E,6BAA6B;AAE7B,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAA+B;;QAE/B,MAAM,OAAO,GAAG,QAAQ,OAAO,CAAC,SAAS,EAAE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jE,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,GAAG,EAAE;YACV,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC;CAAA;AAzED,4CAyEC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -28,24 +28,19 @@ function reactComponentGenerator(tree, options) {
|
|
|
28
28
|
const shouldUpdateSrcIndex = !(0, fs_1.existsSync)(libRootPath);
|
|
29
29
|
const shouldUpdateLibIndex = !(0, fs_1.existsSync)(componentsPath) && options.subcomponent;
|
|
30
30
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, `files`), componentPath, Object.assign(Object.assign({}, options), { formatName: utils_1.formatName }));
|
|
31
|
-
const appendFileContent = (path, endContent) => {
|
|
32
|
-
const content = tree.read(path, 'utf-8');
|
|
33
|
-
const contentUpdate = content + endContent;
|
|
34
|
-
tree.write(path, contentUpdate);
|
|
35
|
-
};
|
|
36
31
|
const updateIndexes = () => {
|
|
37
32
|
const componentsIndexFilePath = `${libRootPath}/components/index.ts`;
|
|
38
33
|
if (shouldUpdateSrcIndex) {
|
|
39
|
-
appendFileContent(`${libPath}/index.ts`, `export * from './lib';\n
|
|
34
|
+
(0, utils_1.appendFileContent)(`${libPath}/index.ts`, `export * from './lib';\n`, tree);
|
|
40
35
|
}
|
|
41
36
|
if (shouldUpdateLibIndex) {
|
|
42
|
-
appendFileContent(`${libRootPath}/index.ts`, `export * from './components';\n
|
|
37
|
+
(0, utils_1.appendFileContent)(`${libRootPath}/index.ts`, `export * from './components';\n`, tree);
|
|
43
38
|
}
|
|
44
39
|
if (!(0, fs_1.existsSync)(componentsIndexFilePath)) {
|
|
45
40
|
tree.write(componentsIndexFilePath, `export * from './${(0, lodash_1.kebabCase)(options.name)}';\n`);
|
|
46
41
|
}
|
|
47
42
|
else {
|
|
48
|
-
appendFileContent(componentsIndexFilePath, `export * from './${(0, lodash_1.kebabCase)(options.name)}';\n
|
|
43
|
+
(0, utils_1.appendFileContent)(componentsIndexFilePath, `export * from './${(0, lodash_1.kebabCase)(options.name)}';\n`, tree);
|
|
49
44
|
}
|
|
50
45
|
};
|
|
51
46
|
if (options.subcomponent) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/react-component/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAA8D;AAC9D,6BAA6B;AAC7B,mCAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/react-component/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAA8D;AAC9D,6BAA6B;AAC7B,mCAAmC;AAEnC,8CAQ4B;AAC5B,2BAAgC;AAEhC,SAAsB,uBAAuB,CAC3C,IAAU,EACV,OAAsC;;QAEtC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,qBAAa,EAAoD,kCAAkC,CAAC,CAAC;QAE7I,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,CAAC,mBAAW,CAAC,QAAQ,EAAE,mBAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3E,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC;YACjC,OAAO,EAAE,yBAAyB;YAClC,MAAM,EAAE,CAAO,KAAK,EAAE,EAAE;gBACtB,MAAM,mBAAmB,GAAG,IAAA,yBAAiB,EAAC,WAAW,EAAE,KAAK,CAAC,CAAA;gBAEjE,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;YAC7D,CAAC,CAAA;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,KAAI,MAAM,IAAA,mBAAW,EAAC,oDAAoD,CAAC,CAAA,CAAC;QACvG,OAAO,CAAC,YAAY,GAAG,OAAO,C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