@ronas-it/nx-generators 0.10.4 → 0.10.5

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.
Files changed (217) hide show
  1. package/package.json +4 -3
  2. package/src/generators/code-checks/config.d.ts +18 -0
  3. package/src/generators/code-checks/config.js +20 -0
  4. package/src/generators/code-checks/config.js.map +1 -0
  5. package/src/generators/code-checks/generator.d.ts +4 -0
  6. package/src/generators/code-checks/generator.js +53 -0
  7. package/src/generators/code-checks/generator.js.map +1 -0
  8. package/src/generators/code-checks/scripts.d.ts +6 -0
  9. package/src/generators/code-checks/scripts.js +8 -0
  10. package/src/generators/code-checks/scripts.js.map +1 -0
  11. package/src/generators/entity-api/generator.d.ts +4 -0
  12. package/src/generators/entity-api/generator.js +87 -0
  13. package/src/generators/entity-api/generator.js.map +1 -0
  14. package/src/generators/expo-app/generator.d.ts +4 -0
  15. package/src/generators/expo-app/generator.js +93 -0
  16. package/src/generators/expo-app/generator.js.map +1 -0
  17. package/src/generators/expo-app/scripts.d.ts +13 -0
  18. package/src/generators/expo-app/scripts.js +15 -0
  19. package/src/generators/expo-app/scripts.js.map +1 -0
  20. package/src/generators/form/generator.d.ts +4 -0
  21. package/src/generators/form/generator.js +55 -0
  22. package/src/generators/form/generator.js.map +1 -0
  23. package/src/generators/form/utils/add-form-usage.d.ts +1 -0
  24. package/src/generators/form/utils/add-form-usage.js +71 -0
  25. package/src/generators/form/utils/add-form-usage.js.map +1 -0
  26. package/src/generators/form/utils/get-app-name.d.ts +1 -0
  27. package/src/generators/form/utils/get-app-name.js +8 -0
  28. package/src/generators/form/utils/get-app-name.js.map +1 -0
  29. package/src/generators/form/utils/get-form-utils-directory.d.ts +2 -0
  30. package/src/generators/form/utils/get-form-utils-directory.js +35 -0
  31. package/src/generators/form/utils/get-form-utils-directory.js.map +1 -0
  32. package/src/generators/form/utils/index.js +8 -0
  33. package/src/generators/form/utils/index.js.map +1 -0
  34. package/src/generators/form/utils/update-index.d.ts +2 -0
  35. package/src/generators/form/utils/update-index.js +18 -0
  36. package/src/generators/form/utils/update-index.js.map +1 -0
  37. package/src/generators/lib-move/generator.d.ts +4 -0
  38. package/src/generators/lib-move/generator.js +37 -0
  39. package/src/generators/lib-move/generator.js.map +1 -0
  40. package/src/generators/lib-remove/generator.d.ts +4 -0
  41. package/src/generators/lib-remove/generator.js +22 -0
  42. package/src/generators/lib-remove/generator.js.map +1 -0
  43. package/src/generators/lib-rename/generator.d.ts +4 -0
  44. package/src/generators/lib-rename/generator.js +22 -0
  45. package/src/generators/lib-rename/generator.js.map +1 -0
  46. package/src/generators/lib-tags/generator.d.ts +4 -0
  47. package/src/generators/lib-tags/generator.js +56 -0
  48. package/src/generators/lib-tags/generator.js.map +1 -0
  49. package/src/generators/lib-tags/interfaces/context.d.ts +8 -0
  50. package/src/generators/lib-tags/interfaces/context.js +3 -0
  51. package/src/generators/lib-tags/interfaces/context.js.map +1 -0
  52. package/src/generators/lib-tags/interfaces/index.js +6 -0
  53. package/src/generators/lib-tags/interfaces/index.js.map +1 -0
  54. package/src/generators/lib-tags/interfaces/{verify-tag-config.ts → verify-tag-config.d.ts} +6 -7
  55. package/src/generators/lib-tags/interfaces/verify-tag-config.js +3 -0
  56. package/src/generators/lib-tags/interfaces/verify-tag-config.js.map +1 -0
  57. package/src/generators/lib-tags/types/index.js +5 -0
  58. package/src/generators/lib-tags/types/index.js.map +1 -0
  59. package/src/generators/lib-tags/types/tag.js +3 -0
  60. package/src/generators/lib-tags/types/tag.js.map +1 -0
  61. package/src/generators/lib-tags/utils/check-lib-tags.d.ts +4 -0
  62. package/src/generators/lib-tags/utils/check-lib-tags.js +113 -0
  63. package/src/generators/lib-tags/utils/check-lib-tags.js.map +1 -0
  64. package/src/generators/lib-tags/utils/index.js +5 -0
  65. package/src/generators/lib-tags/utils/index.js.map +1 -0
  66. package/src/generators/next-app/generator.d.ts +4 -0
  67. package/src/generators/next-app/generator.js +71 -0
  68. package/src/generators/next-app/generator.js.map +1 -0
  69. package/src/generators/react-component/generator.d.ts +4 -0
  70. package/src/generators/react-component/generator.js +60 -0
  71. package/src/generators/react-component/generator.js.map +1 -0
  72. package/src/generators/react-lib/generator.d.ts +4 -0
  73. package/src/generators/react-lib/generator.js +61 -0
  74. package/src/generators/react-lib/generator.js.map +1 -0
  75. package/src/generators/repo-config/generator.d.ts +3 -0
  76. package/src/generators/repo-config/generator.js +36 -0
  77. package/src/generators/repo-config/generator.js.map +1 -0
  78. package/src/generators/repo-config/scripts.d.ts +4 -0
  79. package/src/generators/repo-config/scripts.js +6 -0
  80. package/src/generators/repo-config/scripts.js.map +1 -0
  81. package/src/index.js +2 -0
  82. package/src/index.js.map +1 -0
  83. package/src/shared/dependencies.d.ts +73 -0
  84. package/src/shared/dependencies.js +79 -0
  85. package/src/shared/dependencies.js.map +1 -0
  86. package/src/shared/enums/base-generator-type.d.ts +4 -0
  87. package/src/shared/enums/base-generator-type.js +9 -0
  88. package/src/shared/enums/base-generator-type.js.map +1 -0
  89. package/src/shared/enums/index.js +5 -0
  90. package/src/shared/enums/index.js.map +1 -0
  91. package/src/shared/generators/api-client/generator.d.ts +6 -0
  92. package/src/shared/generators/api-client/generator.js +37 -0
  93. package/src/shared/generators/api-client/generator.js.map +1 -0
  94. package/src/shared/generators/api-client/index.js +5 -0
  95. package/src/shared/generators/api-client/index.js.map +1 -0
  96. package/src/shared/generators/app-env/generator.d.ts +8 -0
  97. package/src/shared/generators/app-env/generator.js +28 -0
  98. package/src/shared/generators/app-env/generator.js.map +1 -0
  99. package/src/shared/generators/app-env/index.js +5 -0
  100. package/src/shared/generators/app-env/index.js.map +1 -0
  101. package/src/shared/generators/auth/generator.d.ts +4 -0
  102. package/src/shared/generators/auth/generator.js +82 -0
  103. package/src/shared/generators/auth/generator.js.map +1 -0
  104. package/src/shared/generators/auth/index.js +5 -0
  105. package/src/shared/generators/auth/index.js.map +1 -0
  106. package/src/shared/generators/form-utils/generator.d.ts +5 -0
  107. package/src/shared/generators/form-utils/generator.js +24 -0
  108. package/src/shared/generators/form-utils/generator.js.map +1 -0
  109. package/src/shared/generators/form-utils/index.js +5 -0
  110. package/src/shared/generators/form-utils/index.js.map +1 -0
  111. package/src/shared/generators/index.js +12 -0
  112. package/src/shared/generators/index.js.map +1 -0
  113. package/src/shared/generators/rn-styles/generator.d.ts +6 -0
  114. package/src/shared/generators/rn-styles/generator.js +36 -0
  115. package/src/shared/generators/rn-styles/generator.js.map +1 -0
  116. package/src/shared/generators/rn-styles/index.js +5 -0
  117. package/src/shared/generators/rn-styles/index.js.map +1 -0
  118. package/src/shared/generators/storage/generator.d.ts +6 -0
  119. package/src/shared/generators/storage/generator.js +27 -0
  120. package/src/shared/generators/storage/generator.js.map +1 -0
  121. package/src/shared/generators/storage/index.js +5 -0
  122. package/src/shared/generators/storage/index.js.map +1 -0
  123. package/src/shared/generators/store/generator.d.ts +4 -0
  124. package/src/shared/generators/store/generator.js +36 -0
  125. package/src/shared/generators/store/generator.js.map +1 -0
  126. package/src/shared/generators/store/index.js +5 -0
  127. package/src/shared/generators/store/index.js.map +1 -0
  128. package/src/shared/generators/ui-kitten/generator.d.ts +6 -0
  129. package/src/shared/generators/ui-kitten/generator.js +40 -0
  130. package/src/shared/generators/ui-kitten/generator.js.map +1 -0
  131. package/src/shared/generators/ui-kitten/index.js +5 -0
  132. package/src/shared/generators/ui-kitten/index.js.map +1 -0
  133. package/src/shared/utils/cli-utils.d.ts +31 -0
  134. package/src/shared/utils/cli-utils.js +129 -0
  135. package/src/shared/utils/cli-utils.js.map +1 -0
  136. package/src/shared/utils/config-utils.d.ts +19 -0
  137. package/src/shared/utils/config-utils.js +124 -0
  138. package/src/shared/utils/config-utils.js.map +1 -0
  139. package/src/shared/utils/constants.d.ts +3 -0
  140. package/src/shared/utils/constants.js +7 -0
  141. package/src/shared/utils/constants.js.map +1 -0
  142. package/src/shared/utils/dynamic-import.d.ts +1 -0
  143. package/src/shared/utils/dynamic-import.js +5 -0
  144. package/src/shared/utils/dynamic-import.js.map +1 -0
  145. package/src/shared/utils/format-utils.d.ts +4 -0
  146. package/src/shared/utils/format-utils.js +18 -0
  147. package/src/shared/utils/format-utils.js.map +1 -0
  148. package/src/shared/utils/get-lib-directory-name.d.ts +1 -0
  149. package/src/shared/utils/get-lib-directory-name.js +15 -0
  150. package/src/shared/utils/get-lib-directory-name.js.map +1 -0
  151. package/src/shared/utils/index.js +11 -0
  152. package/src/shared/utils/index.js.map +1 -0
  153. package/src/shared/utils/ts-utils.d.ts +2 -0
  154. package/src/shared/utils/ts-utils.js +22 -0
  155. package/src/shared/utils/ts-utils.js.map +1 -0
  156. package/.eslintrc.json +0 -37
  157. package/jest.config.ts +0 -10
  158. package/project.json +0 -61
  159. package/src/generators/code-checks/config.ts +0 -17
  160. package/src/generators/code-checks/generator.ts +0 -68
  161. package/src/generators/code-checks/scripts.ts +0 -5
  162. package/src/generators/entity-api/generator.ts +0 -127
  163. package/src/generators/expo-app/generator.ts +0 -152
  164. package/src/generators/expo-app/scripts.ts +0 -12
  165. package/src/generators/form/generator.ts +0 -61
  166. package/src/generators/form/utils/add-form-usage.ts +0 -99
  167. package/src/generators/form/utils/get-app-name.ts +0 -3
  168. package/src/generators/form/utils/get-form-utils-directory.ts +0 -59
  169. package/src/generators/form/utils/update-index.ts +0 -15
  170. package/src/generators/lib-move/generator.ts +0 -57
  171. package/src/generators/lib-remove/generator.ts +0 -22
  172. package/src/generators/lib-rename/generator.ts +0 -25
  173. package/src/generators/lib-tags/generator.ts +0 -66
  174. package/src/generators/lib-tags/interfaces/context.ts +0 -9
  175. package/src/generators/lib-tags/utils/check-lib-tags.ts +0 -145
  176. package/src/generators/next-app/generator.ts +0 -104
  177. package/src/generators/react-component/generator.ts +0 -80
  178. package/src/generators/react-lib/generator.ts +0 -86
  179. package/src/generators/repo-config/generator.ts +0 -44
  180. package/src/generators/repo-config/scripts.ts +0 -3
  181. package/src/shared/dependencies.ts +0 -76
  182. package/src/shared/enums/base-generator-type.ts +0 -4
  183. package/src/shared/generators/api-client/generator.ts +0 -43
  184. package/src/shared/generators/app-env/generator.ts +0 -35
  185. package/src/shared/generators/auth/generator.ts +0 -100
  186. package/src/shared/generators/form-utils/generator.ts +0 -22
  187. package/src/shared/generators/rn-styles/generator.ts +0 -44
  188. package/src/shared/generators/storage/generator.ts +0 -29
  189. package/src/shared/generators/store/generator.ts +0 -42
  190. package/src/shared/generators/ui-kitten/generator.ts +0 -51
  191. package/src/shared/utils/cli-utils.ts +0 -164
  192. package/src/shared/utils/config-utils.ts +0 -159
  193. package/src/shared/utils/constants.ts +0 -3
  194. package/src/shared/utils/dynamic-import.ts +0 -3
  195. package/src/shared/utils/format-utils.ts +0 -15
  196. package/src/shared/utils/get-lib-directory-name.ts +0 -13
  197. package/src/shared/utils/ts-utils.ts +0 -20
  198. package/tsconfig.json +0 -16
  199. package/tsconfig.lib.json +0 -10
  200. package/tsconfig.spec.json +0 -9
  201. /package/src/generators/form/utils/{index.ts → index.d.ts} +0 -0
  202. /package/src/generators/lib-tags/interfaces/{index.ts → index.d.ts} +0 -0
  203. /package/src/generators/lib-tags/types/{index.ts → index.d.ts} +0 -0
  204. /package/src/generators/lib-tags/types/{tag.ts → tag.d.ts} +0 -0
  205. /package/src/generators/lib-tags/utils/{index.ts → index.d.ts} +0 -0
  206. /package/src/{index.ts → index.d.ts} +0 -0
  207. /package/src/shared/enums/{index.ts → index.d.ts} +0 -0
  208. /package/src/shared/generators/api-client/{index.ts → index.d.ts} +0 -0
  209. /package/src/shared/generators/app-env/{index.ts → index.d.ts} +0 -0
  210. /package/src/shared/generators/auth/{index.ts → index.d.ts} +0 -0
  211. /package/src/shared/generators/form-utils/{index.ts → index.d.ts} +0 -0
  212. /package/src/shared/generators/{index.ts → index.d.ts} +0 -0
  213. /package/src/shared/generators/rn-styles/{index.ts → index.d.ts} +0 -0
  214. /package/src/shared/generators/storage/{index.ts → index.d.ts} +0 -0
  215. /package/src/shared/generators/store/{index.ts → index.d.ts} +0 -0
  216. /package/src/shared/generators/ui-kitten/{index.ts → index.d.ts} +0 -0
  217. /package/src/shared/utils/{index.ts → index.d.ts} +0 -0
@@ -1,80 +0,0 @@
1
- import { existsSync } from 'fs';
2
- import * as path from 'path';
3
- import { formatFiles, generateFiles, Tree } from '@nx/devkit';
4
- import { kebabCase } from 'lodash';
5
- import {
6
- appendFileContent,
7
- askQuestion,
8
- createCliReadline,
9
- dynamicImport,
10
- formatName,
11
- getNxLibsPaths,
12
- LibraryType,
13
- searchNxLibsPaths,
14
- } from '../../shared/utils';
15
- import { ReactComponentGeneratorSchema } from './schema';
16
-
17
- export async function reactComponentGenerator(tree: Tree, options: ReactComponentGeneratorSchema): Promise<void> {
18
- const { default: autocomplete } = await dynamicImport<typeof import('inquirer-autocomplete-standalone')>(
19
- 'inquirer-autocomplete-standalone',
20
- );
21
-
22
- const nxLibsPaths = getNxLibsPaths([LibraryType.FEATURES, LibraryType.UI]);
23
-
24
- const libPath = await autocomplete({
25
- message: 'Enter the library path:',
26
- source: async (input) => {
27
- const filteredNxLibsPaths = searchNxLibsPaths(nxLibsPaths, input as string);
28
-
29
- return filteredNxLibsPaths.map((path) => ({ value: path }));
30
- },
31
- });
32
-
33
- const cliReadline = createCliReadline();
34
- options.name =
35
- options.name || (await askQuestion('Enter the name of the component (e.g: AppButton): ', undefined, cliReadline));
36
- options.subcomponent =
37
- options.subcomponent ||
38
- (await askQuestion('Generate component inside components folder? (y/n): ', undefined, cliReadline)) === 'y';
39
- options.withForwardRef =
40
- options.withForwardRef ||
41
- (await askQuestion('Generate component with forwardRef? (y/n): ', undefined, cliReadline)) === 'y';
42
- cliReadline.close();
43
-
44
- const libRootPath = `${libPath}/lib`;
45
- const componentsPath = `${libRootPath}/components`;
46
- const componentPath = options.subcomponent ? `${libRootPath}/components/${kebabCase(options.name)}` : libRootPath;
47
- const shouldUpdateSrcIndex = !existsSync(libRootPath);
48
- const shouldUpdateLibIndex = !existsSync(componentsPath) && options.subcomponent;
49
-
50
- generateFiles(tree, path.join(__dirname, `files`), componentPath, {
51
- ...options,
52
- name: formatName(options.name, true),
53
- });
54
-
55
- const updateIndexes = (): void => {
56
- const componentsIndexFilePath = `${libRootPath}/components/index.ts`;
57
-
58
- if (shouldUpdateSrcIndex) {
59
- appendFileContent(`${libPath}/index.ts`, `export * from './lib';\n`, tree);
60
- }
61
-
62
- if (shouldUpdateLibIndex) {
63
- appendFileContent(`${libRootPath}/index.ts`, `export * from './components';\n`, tree);
64
- }
65
-
66
- if (!existsSync(componentsIndexFilePath)) {
67
- tree.write(componentsIndexFilePath, `export * from './${kebabCase(options.name)}';\n`);
68
- } else {
69
- appendFileContent(componentsIndexFilePath, `export * from './${kebabCase(options.name)}';\n`, tree);
70
- }
71
- };
72
-
73
- if (options.subcomponent) {
74
- updateIndexes();
75
- }
76
-
77
- await formatFiles(tree);
78
- }
79
-
80
- export default reactComponentGenerator;
@@ -1,86 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import * as path from 'path';
3
- import { formatFiles, generateFiles, output, Tree } from '@nx/devkit';
4
- import { isBoolean } from 'lodash';
5
- import {
6
- addNxScopeTag,
7
- askQuestion,
8
- constants,
9
- dynamicImport,
10
- filterSource,
11
- formatName,
12
- LibraryType,
13
- selectProject,
14
- validateLibraryType,
15
- getLibDirectoryName,
16
- createCliReadline,
17
- } from '../../shared/utils';
18
- import { ReactLibGeneratorSchema } from './schema';
19
-
20
- export async function reactLibGenerator(tree: Tree, options: ReactLibGeneratorSchema): Promise<void> {
21
- const { default: autocomplete } = await dynamicImport<typeof import('inquirer-autocomplete-standalone')>(
22
- 'inquirer-autocomplete-standalone',
23
- );
24
-
25
- options.app = options.app || (await selectProject(tree, 'application', 'Select the application: ')).name;
26
-
27
- const isSharedLib = options.app === constants.sharedValue;
28
-
29
- options.scope =
30
- options.scope ||
31
- (isSharedLib ? '' : await askQuestion(`Enter the scope (e.g: profile) or '${constants.sharedValue}': `));
32
- options.type = options.type
33
- ? validateLibraryType(options.type)
34
- : await autocomplete({
35
- message: 'Select the library type: ',
36
- source: (input) => filterSource(input as string, Object.values(LibraryType)),
37
- });
38
-
39
- const cliReadline = createCliReadline();
40
- options.name =
41
- options.name || (await askQuestion('Enter the name of the library (e.g: settings): ', undefined, cliReadline));
42
-
43
- if (
44
- [LibraryType.FEATURES, LibraryType.UI].includes(options.type as LibraryType) &&
45
- !isBoolean(options.withComponent)
46
- ) {
47
- options.withComponent =
48
- (await askQuestion('Generate component inside lib folder? (y/n): ', undefined, cliReadline)) === 'y';
49
-
50
- if (options.withComponent && !isBoolean(options.withComponentForwardRef)) {
51
- options.withComponentForwardRef =
52
- (await askQuestion('Generate component with forwardRef? (y/n): ', undefined, cliReadline)) === 'y';
53
- }
54
- }
55
- cliReadline.close();
56
-
57
- const scopeTag = options.scope || constants.sharedValue;
58
- const tags = [`app:${options.app}`, `scope:${scopeTag}`, `type:${options.type}`];
59
-
60
- const libDirectoryName = getLibDirectoryName(options.name, options.scope);
61
- const libName = path.normalize(`${options.app}/${options.scope}/${options.type}/${libDirectoryName}`);
62
- const libPath = `libs/${libName}`;
63
- const command = `npx nx g @nx/expo:lib --skipPackageJson --unitTestRunner=none --tags="${tags.join(', ')}" --name=${libName} ${libPath} --linter=eslint`;
64
- const commandWithOptions = options.dryRun ? command + ' --dry-run' : command;
65
-
66
- execSync(commandWithOptions, { stdio: 'inherit' });
67
-
68
- if (options.withComponent) {
69
- const srcPath = `${libPath}/src`;
70
-
71
- generateFiles(tree, path.join(__dirname, 'files'), srcPath, { ...options, name: formatName(options.name, true) });
72
- tree.write(`${srcPath}/index.ts`, 'export * from \'./lib\';');
73
- }
74
-
75
- addNxScopeTag(tree, scopeTag);
76
-
77
- await formatFiles(tree);
78
-
79
- if (libDirectoryName !== options.name) {
80
- output.warn({
81
- title: `The library directory was changed to ${output.bold(libDirectoryName)} so that it does not start with the scope name.`,
82
- });
83
- }
84
- }
85
-
86
- export default reactLibGenerator;
@@ -1,44 +0,0 @@
1
- import * as path from 'path';
2
- import {
3
- addDependenciesToPackageJson,
4
- formatFiles,
5
- generateFiles,
6
- installPackagesTask,
7
- readJson,
8
- Tree,
9
- writeJson,
10
- } from '@nx/devkit';
11
- import { devDependencies } from '../../shared/dependencies';
12
- import { formatName, getProjectName } from '../../shared/utils';
13
- import scripts from './scripts';
14
-
15
- export async function repoConfigGenerator(tree: Tree) {
16
- const projectRoot = '.';
17
- const projectPackagePath = 'package.json';
18
-
19
- // Remove unnecessary files and files that will be replaced
20
- tree.delete('README.md');
21
-
22
- // Update project package.json
23
- const projectPackageJson = readJson(tree, projectPackagePath);
24
- projectPackageJson.workspaces = ['apps/*'];
25
- projectPackageJson.scripts = { ...scripts, ...projectPackageJson.scripts };
26
- writeJson(tree, projectPackagePath, projectPackageJson);
27
-
28
- // Add project files
29
- generateFiles(tree, path.join(__dirname, 'files'), projectRoot, {
30
- name: getProjectName(projectPackageJson.name),
31
- formatName,
32
- });
33
-
34
- // Add dependencies
35
- addDependenciesToPackageJson(tree, {}, devDependencies['repo-config']);
36
-
37
- await formatFiles(tree);
38
-
39
- return (): void => {
40
- installPackagesTask(tree);
41
- };
42
- }
43
-
44
- export default repoConfigGenerator;
@@ -1,3 +0,0 @@
1
- export default {
2
- 'deps:sync': 'npx syncpack fix-mismatches',
3
- };
@@ -1,76 +0,0 @@
1
- export const dependencies = {
2
- 'expo-app': {
3
- '@ronas-it/react-native-common-modules': '^0.6.0',
4
- 'expo-constants': '~17.0.3',
5
- 'expo-dev-client': '^5.0.6',
6
- 'expo-router': '~4.0.14',
7
- 'react-native-safe-area-context': '^4.10.5',
8
- 'react-native-screens': '~4.1.0',
9
- 'expo-linking': '~7.0.3',
10
- 'expo-status-bar': '^2.0.0',
11
- 'expo-updates': '^0.26.10',
12
- 'expo-insights': '~0.8.1',
13
- 'lodash-es': '^4.17.21',
14
- },
15
- 'expo-app-root': {
16
- // Need new version to fix this error:
17
- // https://github.com/kristerkari/react-native-svg-transformer/issues/329
18
- 'react-native-svg-transformer': '^1.4.0',
19
- },
20
- 'next-app': {
21
- 'next-intl': '^3.17.2',
22
- },
23
- 'api-client': {
24
- '@ronas-it/axios-api-client': '^0.1.0',
25
- },
26
- auth: {
27
- luxon: '^3.4.4',
28
- },
29
- 'rn-styles': {
30
- 'react-native-extended-stylesheet': '^0.12.0',
31
- },
32
- store: {
33
- '@ronas-it/rtkq-entity-api': '^0.3.1',
34
- 'react-redux': '^9.1.2',
35
- },
36
- 'ui-kitten': {
37
- '@eva-design/eva': '^2.2.0',
38
- '@ui-kitten/components': '^5.3.1',
39
- },
40
- form: {
41
- '@hookform/resolvers': '^3.9.0',
42
- 'react-hook-form': '^7.53.0',
43
- yup: '^1.4.0',
44
- },
45
- };
46
-
47
- export const devDependencies = {
48
- 'code-checks': {
49
- eslint: '^9.8.0',
50
- prettier: '^3.3.2',
51
- 'eslint-config-prettier': '^9.1.0',
52
- 'eslint-import-resolver-typescript': '^3.7.0',
53
- 'eslint-plugin-import': '^2.29.1',
54
- 'eslint-plugin-jsx-a11y': '^6.9.0',
55
- 'eslint-plugin-react': '^7.34.3',
56
- 'eslint-plugin-react-hooks': '^5.0.0',
57
- 'eslint-plugin-unused-imports': '^4.1.4',
58
- husky: '^9.1.5',
59
- '@stylistic/eslint-plugin': '^2.12.1',
60
- '@typescript-eslint/eslint-plugin': '^8.18.1',
61
- '@typescript-eslint/parser': '^8.18.1',
62
- 'tsc-files': '^1.1.4',
63
- },
64
- 'expo-app': {
65
- '@types/lodash': '^4.14.194',
66
- },
67
- 'expo-app-root': {
68
- 'cross-env': '^7.0.3',
69
- },
70
- 'repo-config': {
71
- syncpack: '^12.3.2',
72
- },
73
- auth: {
74
- '@types/luxon': '3.4.2',
75
- },
76
- };
@@ -1,4 +0,0 @@
1
- export enum BaseGeneratorType {
2
- EXPO_APP = 'expo-app',
3
- NEXT_APP = 'next-app',
4
- }
@@ -1,43 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import * as path from 'path';
4
- import { addDependenciesToPackageJson, formatFiles, generateFiles, Tree } from '@nx/devkit';
5
- import { dependencies } from '../../dependencies';
6
- import { formatName, formatAppIdentifier, getImportPathPrefix } from '../../utils';
7
-
8
- export async function runApiClientGenerator(tree: Tree, options: { name: string; directory: string }): Promise<void> {
9
- const appRoot = `apps/${options.directory}`;
10
- const libRoot = `libs/${options.directory}`;
11
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
12
-
13
- // Generate shared libs
14
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=data-access --name=api-client`, {
15
- stdio: 'inherit',
16
- });
17
-
18
- const appPackagePath = `${appRoot}/package.json`;
19
-
20
- // Remove unnecessary files and files that will be replaced
21
- tree.delete(`${libRoot}/shared/data-access/api-client/src/index.ts`);
22
-
23
- // Add lib files
24
- generateFiles(tree, path.join(__dirname, '/lib-files'), libRoot, {
25
- ...options,
26
- formatName,
27
- formatAppIdentifier,
28
- formatDirectory: () => libPath,
29
- });
30
-
31
- // Add dependencies
32
- addDependenciesToPackageJson(tree, dependencies['api-client'], {});
33
-
34
- if (existsSync(appPackagePath)) {
35
- addDependenciesToPackageJson(tree, dependencies['api-client'], {}, appPackagePath);
36
- }
37
-
38
- await formatFiles(tree);
39
-
40
- console.warn(`\nPlease set api endpoint in ${libPath}/shared/data-access/api-client/src/configuration.ts`);
41
- }
42
-
43
- export default runApiClientGenerator;
@@ -1,35 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import * as path from 'path';
3
- import { formatFiles, generateFiles, Tree } from '@nx/devkit';
4
- import { BaseGeneratorType } from '../../enums';
5
- import { formatName, formatAppIdentifier, getImportPathPrefix } from '../../utils';
6
-
7
- export async function runAppEnvGenerator(
8
- tree: Tree,
9
- options: { name: string; directory: string; baseGeneratorType: BaseGeneratorType },
10
- ): Promise<void> {
11
- const libRoot = `libs/${options.directory}`;
12
- const appType = options.baseGeneratorType.split('-')[0].toUpperCase();
13
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
14
-
15
- // Generate shared libs
16
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=utils --name=app-env`, {
17
- stdio: 'inherit',
18
- });
19
-
20
- // Remove unnecessary files and files that will be replaced
21
- tree.delete(`${libRoot}/shared/utils/app-env/src/index.ts`);
22
-
23
- // Add lib files
24
- generateFiles(tree, path.join(__dirname, 'lib-files'), libRoot, {
25
- ...options,
26
- formatName,
27
- formatAppIdentifier,
28
- formatDirectory: () => libPath,
29
- appType,
30
- });
31
-
32
- await formatFiles(tree);
33
- }
34
-
35
- export default runAppEnvGenerator;
@@ -1,100 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import * as path from 'path';
4
- import { addDependenciesToPackageJson, formatFiles, generateFiles, installPackagesTask, Tree } from '@nx/devkit';
5
- import { IndentationText, Project, QuoteKind, StructureKind, SyntaxKind } from 'ts-morph';
6
- import { dependencies, devDependencies } from '../../dependencies';
7
- import { formatName, formatAppIdentifier, searchAliasPath, getImportPathPrefix } from '../../utils';
8
- import { AuthGeneratorSchema } from './schema';
9
-
10
- const updateStore = (libRoot: string): void => {
11
- const project = new Project({
12
- manipulationSettings: {
13
- indentationText: IndentationText.TwoSpaces,
14
- quoteKind: QuoteKind.Single,
15
- },
16
- });
17
-
18
- const storePath = `${libRoot}/shared/data-access/store/src`;
19
- const apiPath = `${libRoot}/shared/data-access/api/src`;
20
- const authPath = `${libRoot}/shared/data-access/auth/src`;
21
- const store = project.addSourceFileAtPath(`${storePath}/store.ts`);
22
- const apiAlias = searchAliasPath(apiPath);
23
- const authAlias = searchAliasPath(authPath);
24
-
25
- if (!apiAlias) {
26
- throw new Error('Could not find API library.');
27
- }
28
-
29
- if (!authAlias) {
30
- throw new Error('Could not find Auth library.');
31
- }
32
-
33
- store.addImportDeclarations([
34
- { moduleSpecifier: apiAlias, namedImports: ['authApi', 'profileApi'] },
35
- { moduleSpecifier: authAlias, namedImports: ['authListenerMiddleware', 'authReducer', 'authReducerPath'] },
36
- ]);
37
-
38
- const rootReducer = store.getVariableDeclarationOrThrow('rootReducer');
39
-
40
- rootReducer.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression).addProperties([
41
- { name: '[authApi.reducerPath]', initializer: 'authApi.reducer', kind: StructureKind.PropertyAssignment },
42
- { name: '[authReducerPath]', initializer: 'authReducer', kind: StructureKind.PropertyAssignment },
43
- { name: '[profileApi.reducerPath]', initializer: 'profileApi.reducer', kind: StructureKind.PropertyAssignment },
44
- ]);
45
-
46
- const middlewares = store.getVariableDeclarationOrThrow('middlewares');
47
-
48
- middlewares
49
- .getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)
50
- .addElements(['authApi.middleware', 'authListenerMiddleware.middleware', 'profileApi.middleware'], {
51
- useNewLines: true,
52
- });
53
-
54
- project.saveSync();
55
- };
56
-
57
- export async function runAuthGenerator(tree: Tree, options: AuthGeneratorSchema) {
58
- const appRoot = `apps/${options.directory}`;
59
- const libRoot = `libs/${options.directory}`;
60
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
61
-
62
- // Generate shared libs
63
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=data-access --name=api`, {
64
- stdio: 'inherit',
65
- });
66
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=data-access --name=auth`, {
67
- stdio: 'inherit',
68
- });
69
-
70
- const appPackagePath = `${appRoot}/package.json`;
71
-
72
- // Remove unnecessary files and files that will be replaced
73
- tree.delete(`${libRoot}/shared/data-access/api/src/index.ts`);
74
- tree.delete(`${libRoot}/shared/data-access/auth/src/index.ts`);
75
-
76
- // Add lib files
77
- generateFiles(tree, path.join(__dirname, '/lib-files'), libRoot, {
78
- ...options,
79
- formatName,
80
- formatAppIdentifier,
81
- formatDirectory: () => libPath,
82
- });
83
-
84
- updateStore(libRoot);
85
-
86
- // Add dependencies
87
- addDependenciesToPackageJson(tree, dependencies['auth'], devDependencies['auth']);
88
-
89
- if (existsSync(appPackagePath)) {
90
- addDependenciesToPackageJson(tree, dependencies['auth'], devDependencies['auth'], appPackagePath);
91
- }
92
-
93
- await formatFiles(tree);
94
-
95
- return (): void => {
96
- installPackagesTask(tree);
97
- };
98
- }
99
-
100
- export default runAuthGenerator;
@@ -1,22 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import * as path from 'path';
3
- import { formatFiles, generateFiles, Tree } from '@nx/devkit';
4
-
5
- export async function runFormUtilsGenerator(tree: Tree, options: { directory: string }): Promise<void> {
6
- const libRoot = `libs/${options.directory}`;
7
-
8
- // Generate shared libs
9
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=utils --name=form`, {
10
- stdio: 'inherit',
11
- });
12
-
13
- // Remove unnecessary files and files that will be replaced
14
- tree.delete(`${libRoot}/shared/utils/form/src/index.ts`);
15
-
16
- // Add lib files
17
- generateFiles(tree, path.join(__dirname, '/lib-files'), libRoot, {});
18
-
19
- await formatFiles(tree);
20
- }
21
-
22
- export default runFormUtilsGenerator;
@@ -1,44 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import * as path from 'path';
4
- import { addDependenciesToPackageJson, formatFiles, generateFiles, Tree } from '@nx/devkit';
5
- import { dependencies } from '../../dependencies';
6
- import { formatName, formatAppIdentifier, getImportPathPrefix } from '../../utils';
7
-
8
- export async function runRNStylesGenerator(tree: Tree, options: { name: string; directory: string }): Promise<void> {
9
- const appRoot = `apps/${options.directory}`;
10
- const libRoot = `libs/${options.directory}`;
11
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
12
-
13
- // Generate shared libs
14
- execSync(
15
- `npx nx g react-lib --app=${options.directory} --scope=shared --type=ui --name=styles --withComponent=false`,
16
- {
17
- stdio: 'inherit',
18
- },
19
- );
20
-
21
- const appPackagePath = `${appRoot}/package.json`;
22
-
23
- // Remove unnecessary files and files that will be replaced
24
- tree.delete(`${libRoot}/shared/ui/styles/src/index.ts`);
25
-
26
- // Add lib files
27
- generateFiles(tree, path.join(__dirname, 'lib-files'), libRoot, {
28
- ...options,
29
- formatName,
30
- formatAppIdentifier,
31
- formatDirectory: () => libPath,
32
- });
33
-
34
- // Add dependencies
35
- addDependenciesToPackageJson(tree, dependencies['rn-styles'], {});
36
-
37
- if (existsSync(appPackagePath)) {
38
- addDependenciesToPackageJson(tree, dependencies['rn-styles'], {}, appPackagePath);
39
- }
40
-
41
- await formatFiles(tree);
42
- }
43
-
44
- export default runRNStylesGenerator;
@@ -1,29 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import * as path from 'path';
3
- import { formatFiles, generateFiles, Tree } from '@nx/devkit';
4
- import { formatName, formatAppIdentifier, getImportPathPrefix } from '../../utils';
5
-
6
- export async function runStorageGenerator(tree: Tree, options: { name: string; directory: string }): Promise<void> {
7
- const libRoot = `libs/${options.directory}`;
8
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
9
-
10
- // Generate shared libs
11
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=data-access --name=storage`, {
12
- stdio: 'inherit',
13
- });
14
-
15
- // Remove unnecessary files and files that will be replaced
16
- tree.delete(`${libRoot}/shared/data-access/storage/src/index.ts`);
17
-
18
- // Add lib files
19
- generateFiles(tree, path.join(__dirname, '/lib-files'), libRoot, {
20
- ...options,
21
- formatName,
22
- formatAppIdentifier,
23
- formatDirectory: () => libPath,
24
- });
25
-
26
- await formatFiles(tree);
27
- }
28
-
29
- export default runStorageGenerator;
@@ -1,42 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import * as path from 'path';
4
- import { addDependenciesToPackageJson, formatFiles, generateFiles, Tree } from '@nx/devkit';
5
- import { dependencies } from '../../dependencies';
6
- import { formatName, formatAppIdentifier, getImportPathPrefix } from '../../utils';
7
- import { StoreGeneratorSchema } from './schema';
8
-
9
- export async function runStoreGenerator(tree: Tree, options: StoreGeneratorSchema): Promise<void> {
10
- const appRoot = `apps/${options.directory}`;
11
- const libRoot = `libs/${options.directory}`;
12
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
13
-
14
- // Generate shared libs
15
- execSync(`npx nx g react-lib --app=${options.directory} --scope=shared --type=data-access --name=store`, {
16
- stdio: 'inherit',
17
- });
18
-
19
- const appPackagePath = `${appRoot}/package.json`;
20
-
21
- // Remove unnecessary files and files that will be replaced
22
- tree.delete(`${libRoot}/shared/data-access/store/src/index.ts`);
23
-
24
- // Add lib files
25
- generateFiles(tree, path.join(__dirname, `${options.baseGeneratorType}/lib-files`), libRoot, {
26
- ...options,
27
- formatName,
28
- formatAppIdentifier,
29
- formatDirectory: () => libPath,
30
- });
31
-
32
- // Add dependencies
33
- addDependenciesToPackageJson(tree, dependencies['store'], {});
34
-
35
- if (existsSync(appPackagePath)) {
36
- addDependenciesToPackageJson(tree, dependencies['store'], {}, appPackagePath);
37
- }
38
-
39
- await formatFiles(tree);
40
- }
41
-
42
- export default runStoreGenerator;
@@ -1,51 +0,0 @@
1
- import { execSync } from 'child_process';
2
- import { existsSync } from 'fs';
3
- import * as path from 'path';
4
- import { addDependenciesToPackageJson, formatFiles, generateFiles, Tree } from '@nx/devkit';
5
- import { dependencies } from '../../dependencies';
6
- import { formatName, formatAppIdentifier, getImportPathPrefix, LibraryType } from '../../utils';
7
-
8
- export async function runUIKittenGenerator(tree: Tree, options: { name: string; directory: string }): Promise<void> {
9
- const appRoot = `apps/${options.directory}`;
10
- const libRoot = `libs/${options.directory}`;
11
- const libPath = `${getImportPathPrefix(tree)}/${options.directory}`;
12
-
13
- // Generate shared libs
14
- execSync(
15
- `npx nx g react-lib --app=${options.directory} --scope=shared --type=${LibraryType.FEATURES} --name=user-theme-provider --withComponent=false`,
16
- {
17
- stdio: 'inherit',
18
- },
19
- );
20
-
21
- const appPackagePath = `${appRoot}/package.json`;
22
-
23
- // Remove unnecessary files and files that will be replaced
24
- tree.delete(`${libRoot}/shared/features/user-theme-provider/src/index.ts`);
25
-
26
- // Add lib files
27
- generateFiles(tree, path.join(__dirname, 'lib-files'), libRoot, {
28
- ...options,
29
- formatName,
30
- formatAppIdentifier,
31
- formatDirectory: () => libPath,
32
- });
33
-
34
- // Update styles lib exports
35
- const stylesLibIndexData = tree.read(`${libRoot}/shared/ui/styles/src/lib/index.ts`);
36
- const newStylesLibIndexData =
37
- stylesLibIndexData + `export * from './create-adaptive-styles';\nexport * from './eva-theme';\n`;
38
-
39
- tree.write(`${libRoot}/shared/ui/styles/src/lib/index.ts`, newStylesLibIndexData);
40
-
41
- // Add dependencies
42
- addDependenciesToPackageJson(tree, dependencies['ui-kitten'], {});
43
-
44
- if (existsSync(appPackagePath)) {
45
- addDependenciesToPackageJson(tree, dependencies['ui-kitten'], {}, appPackagePath);
46
- }
47
-
48
- await formatFiles(tree);
49
- }
50
-
51
- export default runUIKittenGenerator;