@ronas-it/nx-generators 0.1.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 +28 -0
- package/generators.json +19 -0
- package/package.json +15 -0
- package/src/generators/code-checks/config.d.ts +18 -0
- package/src/generators/code-checks/config.js +20 -0
- package/src/generators/code-checks/config.js.map +1 -0
- package/src/generators/code-checks/files/.eslint.ronasit.js.template +186 -0
- package/src/generators/code-checks/files/.eslintrc.json.template +35 -0
- package/src/generators/code-checks/files/.prettierrc.js.template +10 -0
- package/src/generators/code-checks/files/tsconfig.json.template +3 -0
- package/src/generators/code-checks/files/types.d.ts.template +3 -0
- package/src/generators/code-checks/generator.d.ts +4 -0
- package/src/generators/code-checks/generator.js +56 -0
- package/src/generators/code-checks/generator.js.map +1 -0
- package/src/generators/code-checks/schema.d.ts +3 -0
- package/src/generators/code-checks/schema.json +9 -0
- package/src/generators/code-checks/scripts.d.ts +6 -0
- package/src/generators/code-checks/scripts.js +8 -0
- package/src/generators/code-checks/scripts.js.map +1 -0
- package/src/generators/expo-app/files/.env.development.template +1 -0
- package/src/generators/expo-app/files/app/_layout.tsx.template +23 -0
- package/src/generators/expo-app/files/app/index.tsx.template +10 -0
- package/src/generators/expo-app/files/app.config.ts.template +46 -0
- package/src/generators/expo-app/files/eas.json.template +38 -0
- package/src/generators/expo-app/generator.d.ts +4 -0
- package/src/generators/expo-app/generator.js +55 -0
- package/src/generators/expo-app/generator.js.map +1 -0
- package/src/generators/expo-app/schema.d.ts +5 -0
- package/src/generators/expo-app/schema.json +27 -0
- package/src/generators/expo-app/scripts.d.ts +12 -0
- package/src/generators/expo-app/scripts.js +14 -0
- package/src/generators/expo-app/scripts.js.map +1 -0
- package/src/generators/repo-config/files/.npmrc.template +1 -0
- package/src/generators/repo-config/files/README.md.template +79 -0
- package/src/generators/repo-config/generator.d.ts +3 -0
- package/src/generators/repo-config/generator.js +37 -0
- package/src/generators/repo-config/generator.js.map +1 -0
- package/src/generators/repo-config/schema.json +8 -0
- package/src/generators/repo-config/scripts.d.ts +7 -0
- package/src/generators/repo-config/scripts.js +9 -0
- package/src/generators/repo-config/scripts.js.map +1 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -0
- package/src/shared/utils.d.ts +2 -0
- package/src/shared/utils.js +14 -0
- package/src/shared/utils.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# NX Generators
|
|
2
|
+
|
|
3
|
+
NX generators for Ronas IT projects
|
|
4
|
+
|
|
5
|
+
This library contains 3 generators:
|
|
6
|
+
1. repo-config
|
|
7
|
+
2. code-checks
|
|
8
|
+
3. expo-app
|
|
9
|
+
|
|
10
|
+
## Running
|
|
11
|
+
|
|
12
|
+
1. Create monorepo with expo app:
|
|
13
|
+
`npx create-nx-workspace@latest my-project --preset=expo --appName=my-app --e2eTestRunner=none --ci=skip`
|
|
14
|
+
|
|
15
|
+
2. Install this pakage:
|
|
16
|
+
`npm i @ronas-it/nx-generators`
|
|
17
|
+
|
|
18
|
+
3. Start generators:
|
|
19
|
+
`npx nx generate repo-config`
|
|
20
|
+
`npx nx generate code-checks`
|
|
21
|
+
`npx nx generate expo-app`
|
|
22
|
+
|
|
23
|
+
Or install all generators:
|
|
24
|
+
`npx nx generate repo-config && npx nx generate code-checks && npx nx generate expo-app`
|
|
25
|
+
|
|
26
|
+
4. Start app:
|
|
27
|
+
`cd apps/my-app`
|
|
28
|
+
`npm run start`
|
package/generators.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generators": {
|
|
3
|
+
"code-checks": {
|
|
4
|
+
"factory": "./src/generators/code-checks/generator",
|
|
5
|
+
"schema": "./src/generators/code-checks/schema.json",
|
|
6
|
+
"description": "code-checks generator"
|
|
7
|
+
},
|
|
8
|
+
"expo-app": {
|
|
9
|
+
"factory": "./src/generators/expo-app/generator",
|
|
10
|
+
"schema": "./src/generators/expo-app/schema.json",
|
|
11
|
+
"description": "expo-app generator"
|
|
12
|
+
},
|
|
13
|
+
"repo-config": {
|
|
14
|
+
"factory": "./src/generators/repo-config/generator",
|
|
15
|
+
"schema": "./src/generators/repo-config/schema.json",
|
|
16
|
+
"description": "repo-config generator"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ronas-it/nx-generators",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@nx/devkit": "18.1.2",
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"type": "commonjs",
|
|
12
|
+
"main": "./src/index.js",
|
|
13
|
+
"typings": "./src/index.d.ts",
|
|
14
|
+
"generators": "./generators.json"
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'lint-staged': {
|
|
3
|
+
'*.{ts,tsx}': string;
|
|
4
|
+
'*.{ts,tsx,js,html,json,md}': string;
|
|
5
|
+
'*.{ts,tsx,js}': string;
|
|
6
|
+
};
|
|
7
|
+
tsconfig: {
|
|
8
|
+
jsx: string;
|
|
9
|
+
allowJs: boolean;
|
|
10
|
+
noEmit: boolean;
|
|
11
|
+
strict: boolean;
|
|
12
|
+
allowSyntheticDefaultImports: boolean;
|
|
13
|
+
noImplicitAny: boolean;
|
|
14
|
+
strictPropertyInitialization: boolean;
|
|
15
|
+
strictNullChecks: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
'lint-staged': {
|
|
5
|
+
'*.{ts,tsx}': 'tsc-files --noEmit types.d.ts',
|
|
6
|
+
'*.{ts,tsx,js,html,json,md}': 'prettier --write',
|
|
7
|
+
'*.{ts,tsx,js}': 'eslint --cache --fix',
|
|
8
|
+
},
|
|
9
|
+
tsconfig: {
|
|
10
|
+
jsx: 'react-native',
|
|
11
|
+
allowJs: true,
|
|
12
|
+
noEmit: true,
|
|
13
|
+
strict: true,
|
|
14
|
+
allowSyntheticDefaultImports: true,
|
|
15
|
+
noImplicitAny: true,
|
|
16
|
+
strictPropertyInitialization: false,
|
|
17
|
+
strictNullChecks: true,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/code-checks/config.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,aAAa,EAAE;QACb,YAAY,EAAE,+BAA+B;QAC7C,4BAA4B,EAAE,kBAAkB;QAChD,eAAe,EAAE,sBAAsB;KACxC;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,cAAc;QACnB,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,4BAA4B,EAAE,IAAI;QAClC,aAAa,EAAE,IAAI;QACnB,4BAA4B,EAAE,KAAK;QACnC,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
parser: '@typescript-eslint/parser',
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 6,
|
|
9
|
+
project: 'tsconfig.(base|lib).json',
|
|
10
|
+
ecmaFeatures: {
|
|
11
|
+
jsx: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
settings: {
|
|
15
|
+
react: {
|
|
16
|
+
version: 'detect',
|
|
17
|
+
},
|
|
18
|
+
'react-native/style-sheet-object-names': ['EStyleSheet'],
|
|
19
|
+
'import/parsers': {
|
|
20
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
21
|
+
},
|
|
22
|
+
'import/resolver': {
|
|
23
|
+
typescript: {
|
|
24
|
+
alwaysTryTypes: true,
|
|
25
|
+
},
|
|
26
|
+
node: {
|
|
27
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
plugins: ['@typescript-eslint', 'unused-imports', 'react', 'react-hooks', 'react-native', 'import'],
|
|
32
|
+
extends: [
|
|
33
|
+
'eslint:recommended',
|
|
34
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
35
|
+
'plugin:@typescript-eslint/recommended',
|
|
36
|
+
'plugin:react/recommended',
|
|
37
|
+
'prettier',
|
|
38
|
+
],
|
|
39
|
+
rules: {
|
|
40
|
+
indent: ['warn', 2, { SwitchCase: 1 }],
|
|
41
|
+
quotes: ['warn', 'single', { allowTemplateLiterals: true }],
|
|
42
|
+
'react/react-in-jsx-scope': 'off',
|
|
43
|
+
'arrow-parens': ['warn', 'always'],
|
|
44
|
+
'comma-dangle': ['warn', 'never'],
|
|
45
|
+
'no-var': 'warn',
|
|
46
|
+
'no-dupe-class-members': 'off',
|
|
47
|
+
'import/prefer-default-export': 'off',
|
|
48
|
+
'implicit-arrow-linebreak': ['warn', 'beside'],
|
|
49
|
+
'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 2 }],
|
|
50
|
+
'function-call-argument-newline': ['warn', 'consistent'],
|
|
51
|
+
'function-paren-newline': ['warn', 'consistent'],
|
|
52
|
+
'array-element-newline': ['warn', 'consistent'],
|
|
53
|
+
'array-bracket-newline': ['warn', { multiline: true }],
|
|
54
|
+
'padding-line-between-statements': [
|
|
55
|
+
'warn',
|
|
56
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
57
|
+
{ blankLine: 'always', prev: '*', next: 'multiline-block-like' },
|
|
58
|
+
],
|
|
59
|
+
'@typescript-eslint/no-use-before-define': ['warn', { variables: false }],
|
|
60
|
+
'@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
|
|
61
|
+
'@typescript-eslint/no-inferrable-types': ['warn', { ignoreParameters: true }],
|
|
62
|
+
'@typescript-eslint/explicit-module-boundary-types': ['warn', { allowArgumentsExplicitlyTypedAsAny: true }],
|
|
63
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
64
|
+
'@typescript-eslint/explicit-member-accessibility': [
|
|
65
|
+
'warn',
|
|
66
|
+
{ accessibility: 'explicit', overrides: { constructors: 'no-public' } },
|
|
67
|
+
],
|
|
68
|
+
'@typescript-eslint/explicit-function-return-type': ['warn', { allowExpressions: true }],
|
|
69
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
70
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
71
|
+
'@typescript-eslint/array-type': ['warn', { default: 'generic', readonly: 'generic' }],
|
|
72
|
+
'@typescript-eslint/member-ordering': [
|
|
73
|
+
'warn',
|
|
74
|
+
{
|
|
75
|
+
default: [
|
|
76
|
+
'public-static-field',
|
|
77
|
+
'protected-static-field',
|
|
78
|
+
'private-static-field',
|
|
79
|
+
'public-instance-field',
|
|
80
|
+
'protected-instance-field',
|
|
81
|
+
'private-instance-field',
|
|
82
|
+
'public-static-accessor',
|
|
83
|
+
'protected-static-accessor',
|
|
84
|
+
'private-static-accessor',
|
|
85
|
+
'public-instance-accessor',
|
|
86
|
+
'protected-instance-accessor',
|
|
87
|
+
'private-instance-accessor',
|
|
88
|
+
'public-constructor',
|
|
89
|
+
'protected-constructor',
|
|
90
|
+
'private-constructor',
|
|
91
|
+
'public-static-method',
|
|
92
|
+
'public-instance-method',
|
|
93
|
+
'protected-static-method',
|
|
94
|
+
'protected-instance-method',
|
|
95
|
+
'private-static-method',
|
|
96
|
+
'private-instance-method',
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
'@typescript-eslint/naming-convention': [
|
|
101
|
+
'warn',
|
|
102
|
+
{
|
|
103
|
+
selector: 'typeLike',
|
|
104
|
+
format: ['PascalCase'],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
selector: ['parameter'],
|
|
108
|
+
format: ['camelCase', 'PascalCase'],
|
|
109
|
+
leadingUnderscore: 'allow',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
selector: ['classProperty'],
|
|
113
|
+
format: ['camelCase', 'snake_case'],
|
|
114
|
+
leadingUnderscore: 'allow',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
selector: ['method', 'accessor'],
|
|
118
|
+
format: ['camelCase'],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
selector: ['function', 'typeProperty'],
|
|
122
|
+
format: ['camelCase', 'PascalCase'],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
selector: 'variable',
|
|
126
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
selector: 'enumMember',
|
|
130
|
+
format: ['UPPER_CASE'],
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
'unused-imports/no-unused-imports-ts': 'warn',
|
|
134
|
+
'unused-imports/no-unused-vars-ts': [
|
|
135
|
+
'warn',
|
|
136
|
+
{ vars: 'all', varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
137
|
+
],
|
|
138
|
+
'jsx-quotes': ['warn', 'prefer-single'],
|
|
139
|
+
'react/jsx-boolean-value': 'off',
|
|
140
|
+
'react/self-closing-comp': ['warn', { component: true, html: true }],
|
|
141
|
+
'react/jsx-max-props-per-line': [1, { maximum: { single: 2, multi: 1 } }],
|
|
142
|
+
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
|
|
143
|
+
'react/prop-types': 'off',
|
|
144
|
+
'react-native/no-unused-styles': 'warn',
|
|
145
|
+
'react-native/no-inline-styles': 'warn',
|
|
146
|
+
'react-native/no-single-element-style-arrays': 'warn',
|
|
147
|
+
'react/jsx-fragments': ['warn', 'element'],
|
|
148
|
+
'import/newline-after-import': 'warn',
|
|
149
|
+
'import/no-unresolved': 'error',
|
|
150
|
+
'import/no-cycle': 'error',
|
|
151
|
+
'import/order': [
|
|
152
|
+
'warn',
|
|
153
|
+
{
|
|
154
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
|
155
|
+
alphabetize: { order: 'asc' },
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
'import/no-duplicates': 'warn',
|
|
159
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
160
|
+
},
|
|
161
|
+
overrides: [
|
|
162
|
+
{
|
|
163
|
+
files: ['*.js'],
|
|
164
|
+
rules: {
|
|
165
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
166
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
files: ['*actions.ts'],
|
|
171
|
+
rules: {
|
|
172
|
+
'function-call-argument-newline': ['warn', 'always'],
|
|
173
|
+
'function-paren-newline': ['warn', { minItems: 1 }],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
files: ['*selectors.ts'],
|
|
178
|
+
rules: {
|
|
179
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
180
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
181
|
+
'function-call-argument-newline': ['warn', 'always'],
|
|
182
|
+
'function-paren-newline': ['warn', 'multiline-arguments'],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"plugins": ["@nx"],
|
|
4
|
+
"extends": ["./.eslint.ronasit.js"],
|
|
5
|
+
"overrides": [
|
|
6
|
+
{
|
|
7
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
8
|
+
"rules": {
|
|
9
|
+
"@nx/enforce-module-boundaries": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
"enforceBuildableLibDependency": true,
|
|
13
|
+
"allow": [],
|
|
14
|
+
"depConstraints": [
|
|
15
|
+
{
|
|
16
|
+
"sourceTag": "*",
|
|
17
|
+
"onlyDependOnLibsWithTags": ["*"]
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"files": ["*.ts", "*.tsx"],
|
|
26
|
+
"extends": ["plugin:@nx/typescript"],
|
|
27
|
+
"rules": {}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"files": ["*.js", "*.jsx"],
|
|
31
|
+
"extends": ["plugin:@nx/javascript"],
|
|
32
|
+
"rules": {}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codeChecksGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const config_1 = require("./config");
|
|
9
|
+
const scripts_1 = require("./scripts");
|
|
10
|
+
function codeChecksGenerator(tree, options) {
|
|
11
|
+
var _a;
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const projectRoot = '.';
|
|
14
|
+
// Delete files
|
|
15
|
+
tree.delete('.eslintrc.json');
|
|
16
|
+
tree.delete('.prettierrc');
|
|
17
|
+
// Configure pre-commit hook
|
|
18
|
+
(0, child_process_1.execSync)('npx mrm@2 lint-staged', { stdio: 'inherit' });
|
|
19
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
20
|
+
packageJson['lint-staged'] = config_1.default['lint-staged'];
|
|
21
|
+
packageJson.scripts = Object.assign(Object.assign({}, scripts_1.default), packageJson.scripts);
|
|
22
|
+
(0, devkit_1.writeJson)(tree, 'package.json', packageJson);
|
|
23
|
+
// Update tsconfig.base.json
|
|
24
|
+
const tsconfigJson = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
25
|
+
tsconfigJson.compilerOptions = Object.assign(Object.assign({}, config_1.default.tsconfig), tsconfigJson.compilerOptions);
|
|
26
|
+
(0, devkit_1.writeJson)(tree, 'tsconfig.base.json', tsconfigJson);
|
|
27
|
+
// Update .gitignore
|
|
28
|
+
const gitignoreContent = ((_a = tree.read('.gitignore')) === null || _a === void 0 ? void 0 : _a.toString()) + '\n.eslintcache\n';
|
|
29
|
+
tree.write('.gitignore', gitignoreContent);
|
|
30
|
+
// Add files
|
|
31
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, options);
|
|
32
|
+
// Install necessary dependencies
|
|
33
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
34
|
+
'eslint': '^8.48.0',
|
|
35
|
+
'prettier': '^2.6.2',
|
|
36
|
+
'eslint-config-prettier': '^9.0.0',
|
|
37
|
+
'eslint-import-resolver-typescript': '^3.6.1',
|
|
38
|
+
'eslint-plugin-import': '^2.27.5',
|
|
39
|
+
'eslint-plugin-jsx-a11y': '^6.7.1',
|
|
40
|
+
'eslint-plugin-react': '^7.32.2',
|
|
41
|
+
'eslint-plugin-react-hooks': '^4.6.0',
|
|
42
|
+
'eslint-plugin-react-native': '^4.1.0',
|
|
43
|
+
'eslint-plugin-unused-imports': '^3.0.0',
|
|
44
|
+
'@typescript-eslint/eslint-plugin': '^6.13.2',
|
|
45
|
+
'@typescript-eslint/parser': '^6.13.2',
|
|
46
|
+
'tsc-files': '^1.1.4',
|
|
47
|
+
});
|
|
48
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
49
|
+
return () => {
|
|
50
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.codeChecksGenerator = codeChecksGenerator;
|
|
55
|
+
exports.default = codeChecksGenerator;
|
|
56
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/code-checks/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AACpB,qCAA8B;AAE9B,uCAAgC;AAEhC,SAAsB,mBAAmB,CAAC,IAAU,EAAE,OAAkC;;;QACtF,MAAM,WAAW,GAAG,GAAG,CAAC;QAExB,eAAe;QACf,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAE3B,4BAA4B;QAC5B,IAAA,wBAAQ,EAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAExD,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnD,WAAW,CAAC,aAAa,CAAC,GAAG,gBAAM,CAAC,aAAa,CAAC,CAAC;QACnD,WAAW,CAAC,OAAO,mCAAQ,iBAAO,GAAK,WAAW,CAAC,OAAO,CAAE,CAAC;QAC7D,IAAA,kBAAS,EAAC,IAAI,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAE7C,4BAA4B;QAC5B,MAAM,YAAY,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAC1D,YAAY,CAAC,eAAe,mCAAQ,gBAAM,CAAC,Q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DAAiD;IAC3D,QAAQ,EAAE,SAAS;CACpB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
EXPO_USE_METRO_WORKSPACE_ROOT=1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Stack } from 'expo-router';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
export { ErrorBoundary } from 'expo-router';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
+
export const unstable_settings = {
|
|
8
|
+
initialRouteName: 'index',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function App(): ReactElement {
|
|
12
|
+
return (
|
|
13
|
+
<Stack>
|
|
14
|
+
<Stack.Screen name='index' />
|
|
15
|
+
</Stack>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function RootLayout(): ReactElement | null {
|
|
20
|
+
return (
|
|
21
|
+
<App />
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export default function RootScreen(): ReactElement {
|
|
5
|
+
return (
|
|
6
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
7
|
+
<Text>Hello World</Text>
|
|
8
|
+
</View>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ExpoConfig } from '@expo/config';
|
|
2
|
+
import { EASConfig } from 'expo-constants/build/Constants.types';
|
|
3
|
+
|
|
4
|
+
const createConfig = (): Omit<ExpoConfig, 'extra'> & { extra: { eas: EASConfig } & typeof extra } => {
|
|
5
|
+
const projectId = '';
|
|
6
|
+
|
|
7
|
+
const appId = 'com.<%= name %>.dev';
|
|
8
|
+
|
|
9
|
+
const extra = {
|
|
10
|
+
eas: { projectId } as EASConfig,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
name: '<%= formatName(name) %> Dev',
|
|
15
|
+
slug: '<%= name %>-app',
|
|
16
|
+
scheme: '<%= name %>-dev',
|
|
17
|
+
version: '0.1.0',
|
|
18
|
+
orientation: 'portrait',
|
|
19
|
+
icon: './assets/icon.png',
|
|
20
|
+
splash: {
|
|
21
|
+
image: './assets/splash.png',
|
|
22
|
+
resizeMode: 'contain',
|
|
23
|
+
backgroundColor: '#ffffff',
|
|
24
|
+
},
|
|
25
|
+
updates: {
|
|
26
|
+
url: `https://u.expo.dev/${projectId}`,
|
|
27
|
+
},
|
|
28
|
+
ios: {
|
|
29
|
+
bundleIdentifier: appId,
|
|
30
|
+
supportsTablet: false,
|
|
31
|
+
buildNumber: '1',
|
|
32
|
+
},
|
|
33
|
+
android: {
|
|
34
|
+
package: appId,
|
|
35
|
+
versionCode: 1,
|
|
36
|
+
adaptiveIcon: {
|
|
37
|
+
foregroundImage: './assets/adaptive-icon.png',
|
|
38
|
+
backgroundColor: '#FFFFFF',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
plugins: ['expo-router'],
|
|
42
|
+
extra,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default createConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"build": {
|
|
3
|
+
"development": {
|
|
4
|
+
"channel": "development",
|
|
5
|
+
"distribution": "internal",
|
|
6
|
+
"ios": {
|
|
7
|
+
"distribution": "store"
|
|
8
|
+
},
|
|
9
|
+
"env": {
|
|
10
|
+
"APP_ENV": "development"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"debug": {
|
|
14
|
+
"extends": "development",
|
|
15
|
+
"developmentClient": true,
|
|
16
|
+
"ios": {
|
|
17
|
+
"distribution": "internal"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"staging": {
|
|
21
|
+
"channel": "staging",
|
|
22
|
+
"distribution": "store",
|
|
23
|
+
"env": {
|
|
24
|
+
"APP_ENV": "staging"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"production": {
|
|
28
|
+
"channel": "production",
|
|
29
|
+
"distribution": "store",
|
|
30
|
+
"env": {
|
|
31
|
+
"APP_ENV": "production"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"submit": {
|
|
36
|
+
"production": {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expoAppGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const scripts_1 = require("./scripts");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const utils_1 = require("../../shared/utils");
|
|
11
|
+
const dependencies = {
|
|
12
|
+
'expo-constants': '^15.4.5',
|
|
13
|
+
'expo-router': '^3.4.8',
|
|
14
|
+
'react-native-safe-area-context': '^4.8.2',
|
|
15
|
+
'react-native-screens': '^3.29.0',
|
|
16
|
+
'expo-linking': '^6.2.2',
|
|
17
|
+
'expo-status-bar': '^1.11.1',
|
|
18
|
+
'expo-updates': '^0.24.11',
|
|
19
|
+
};
|
|
20
|
+
function expoAppGenerator(tree, options) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const appRoot = `apps/${options.directory}`;
|
|
23
|
+
if (!(0, fs_1.existsSync)(appRoot)) {
|
|
24
|
+
(0, child_process_1.execSync)(`npx nx g app ${options.name} --directory=apps/${options.directory} --projectNameAndRootFormat=as-provided --unitTestRunner=none --e2eTestRunner=none`);
|
|
25
|
+
}
|
|
26
|
+
const appPackagePath = `${appRoot}/package.json`;
|
|
27
|
+
// Remove unnecessary files and files that will be replaced
|
|
28
|
+
tree.delete(`${appRoot}/src`);
|
|
29
|
+
tree.delete(`${appRoot}/index.js`);
|
|
30
|
+
tree.delete(`${appRoot}/webpack.config.js`);
|
|
31
|
+
tree.delete(`${appRoot}/app.json`);
|
|
32
|
+
tree.delete(`${appRoot}/eas.json`);
|
|
33
|
+
// Update app package.json
|
|
34
|
+
const appPackageJson = (0, devkit_1.readJson)(tree, appPackagePath);
|
|
35
|
+
appPackageJson.main = 'expo-router/entry';
|
|
36
|
+
appPackageJson.scripts = Object.assign(Object.assign({}, scripts_1.default), appPackageJson.scripts);
|
|
37
|
+
(0, devkit_1.writeJson)(tree, appPackagePath, appPackageJson);
|
|
38
|
+
// Add app files
|
|
39
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), appRoot, Object.assign(Object.assign({}, options), { formatName: utils_1.formatName }));
|
|
40
|
+
// Add dependencies
|
|
41
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, Object.assign(Object.assign({}, dependencies), {
|
|
42
|
+
// Need new version to fix this error:
|
|
43
|
+
// https://github.com/kristerkari/react-native-svg-transformer/issues/329
|
|
44
|
+
'react-native-svg-transformer': '^1.3.0' }), { 'cross-env': '^7.0.3' });
|
|
45
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, {}, appPackagePath);
|
|
46
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
47
|
+
return () => {
|
|
48
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
49
|
+
(0, child_process_1.execSync)('npx expo install --fix', { stdio: 'inherit' });
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.expoAppGenerator = expoAppGenerator;
|
|
54
|
+
exports.default = expoAppGenerator;
|
|
55
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/generator.ts"],"names":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EAAE,cAAc,CAAC,CAAC;QAEhD,gBAAgB;QAChB,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,kCACrD,OAAO,KACV,UAAU,EAAV,kBAAU,IACV,CAAC;QAEH,mBAAmB;QACnB,IAAA,qCAA4B,EAC1B,IAAI,kCAEC,YAAY;YACf,sCAAsC;YACtC,yEAAyE;YACzE,8BAA8B,EAAE,QAAQ,KAE1C,EAAE,WAAW,EAAE,QAAQ,EAAE,CAC1B,CAAC;QAEF,IAAA,qCAA4B,EAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;QAErE,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;QAC3D,CAAC,CAAC;IACJ,CAAC;CAAA;AAxDD,4CAwDC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "ExpoApp",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "Enter the name of the app for app.config.ts (e.g: my-app)"
|
|
15
|
+
},
|
|
16
|
+
"directory": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "",
|
|
19
|
+
"$default": {
|
|
20
|
+
"$source": "argv",
|
|
21
|
+
"index": 0
|
|
22
|
+
},
|
|
23
|
+
"x-prompt": "Enter the name of the directory in the 'apps/' folder (e.g: mobile)"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["name", "directory"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
start: string;
|
|
3
|
+
'start:prod': string;
|
|
4
|
+
'build:dev': string;
|
|
5
|
+
'build:debug': string;
|
|
6
|
+
'build:prod': string;
|
|
7
|
+
'update:dev': string;
|
|
8
|
+
'update:prod': string;
|
|
9
|
+
'submit:ios:dev': string;
|
|
10
|
+
'submit:ios:prod': string;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
'start': 'npx expo start',
|
|
5
|
+
'start:prod': 'cross-env APP_ENV=production npx expo start',
|
|
6
|
+
'build:dev': 'eas build --no-wait -p all --profile=development',
|
|
7
|
+
'build:debug': 'npm run build:dev -- --profile=debug',
|
|
8
|
+
'build:prod': 'npm run build:dev -- --profile=production',
|
|
9
|
+
'update:dev': 'cross-env APP_ENV=development eas update --branch development',
|
|
10
|
+
'update:prod': 'cross-env APP_ENV=production eas update --branch production',
|
|
11
|
+
'submit:ios:dev': 'cross-env APP_ENV=development eas submit --no-wait -p ios --profile=development',
|
|
12
|
+
'submit:ios:prod': 'cross-env APP_ENV=production eas submit --no-wait -p ios --profile=production',
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/expo-app/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,OAAO,EAAE,gBAAgB;IACzB,YAAY,EAAE,6CAA6C;IAC3D,WAAW,EAAE,kDAAkD;IAC/D,aAAa,EAAE,sCAAsC;IACrD,YAAY,EAAE,2CAA2C;IACzD,YAAY,EAAE,+DAA+D;IAC7E,aAAa,EAAE,6DAA6D;IAC5E,gBAAgB,EAAE,iFAAiF;IACnG,iBAAiB,EAAE,+EAA+E;CACnG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node-linker=hoisted
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# <%= formatName(name) %>
|
|
2
|
+
|
|
3
|
+
✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨
|
|
4
|
+
|
|
5
|
+
## Start the app
|
|
6
|
+
|
|
7
|
+
1. Install dependencies: `npm install`
|
|
8
|
+
1. Start app for local development: `npx nx start {app-name}`
|
|
9
|
+
- Use [Expo Go](https://expo.dev/client) to run mobile version
|
|
10
|
+
|
|
11
|
+
## Generate code
|
|
12
|
+
|
|
13
|
+
### Shortcut scripts
|
|
14
|
+
|
|
15
|
+
See `package.json` for NX generator command shortcuts.
|
|
16
|
+
|
|
17
|
+
#### 1. Generate a library
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm run g:library {app|shared}/{context?}/{type}/{name}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm run g:library mobile/client/features/profile-settings
|
|
27
|
+
# generate a "profile-settings" feature library in "client" context for "mobile" app
|
|
28
|
+
|
|
29
|
+
npm run g:library shared/ui/ui-kit
|
|
30
|
+
# generate a "ui-kit" ui-library shared between all apps
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### 2. Generate components
|
|
34
|
+
|
|
35
|
+
- `npm run g:component --lib={library}` - generate a root component in some library
|
|
36
|
+
- `npm run g:subcomponent --lib={library} --name={name}` - generate a library sub-component.
|
|
37
|
+
|
|
38
|
+
Examples:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm run g:component --lib=mobile/client/features/profile-settings
|
|
42
|
+
# generate a root component.tsx for feature library "profile-settings" in "client" context for "mobile" app
|
|
43
|
+
|
|
44
|
+
npm run g:component --lib=mobile/shared/ui/ui-kit --name=button
|
|
45
|
+
# generate an exported "button/component.tsx" component inside the "ui-kit" library
|
|
46
|
+
|
|
47
|
+
npm run g:subcomponent --lib=mobile/client/features/profile-settings --name=settings-form
|
|
48
|
+
# generate "components/settings-form/component.tsx" sub-component inside the "profile-settings" library
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Use NX-generators directly
|
|
53
|
+
|
|
54
|
+
Run `nx list` to get a list of available plugins and whether they have generators.
|
|
55
|
+
Then run `nx list <plugin-name>` to see what generators are available.
|
|
56
|
+
|
|
57
|
+
Navigate to [@nx/expo](https://nx.dev/packages/expo/generators) for see more available generators.
|
|
58
|
+
|
|
59
|
+
## Running tasks
|
|
60
|
+
|
|
61
|
+
To execute tasks with Nx use the following syntax:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
nx <target> <project> <...options>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
You can also run multiple targets:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
nx run-many -t <target1> <target2>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
..or add `-p` to filter specific projects
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
nx run-many -t <target1> <target2> -p <proj1> <proj2>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Targets can be defined in the `package.json` or `projects.json` . Learn more [in the docs](https://nx.dev/run-tasks).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repoConfigGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
|
+
const scripts_1 = require("./scripts");
|
|
9
|
+
const utils_1 = require("../../shared/utils");
|
|
10
|
+
function repoConfigGenerator(tree) {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const projectRoot = '.';
|
|
13
|
+
const projectPackagePath = 'package.json';
|
|
14
|
+
// Remove unnecessary files and files that will be replaced
|
|
15
|
+
tree.delete('README.md');
|
|
16
|
+
// Update project package.json
|
|
17
|
+
const projectPackageJson = (0, devkit_1.readJson)(tree, projectPackagePath);
|
|
18
|
+
projectPackageJson.workspaces = ['apps/*'];
|
|
19
|
+
projectPackageJson.scripts = Object.assign(Object.assign({}, scripts_1.default), projectPackageJson.scripts);
|
|
20
|
+
(0, devkit_1.writeJson)(tree, projectPackagePath, projectPackageJson);
|
|
21
|
+
// Add project files
|
|
22
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, {
|
|
23
|
+
name: (0, utils_1.getProjectName)(projectPackageJson.name),
|
|
24
|
+
formatName: utils_1.formatName,
|
|
25
|
+
});
|
|
26
|
+
// Add dependencies
|
|
27
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { syncpack: '^12.3.0' });
|
|
28
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
29
|
+
return () => {
|
|
30
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
31
|
+
(0, child_process_1.execSync)('npx expo install --fix', { stdio: 'inherit' });
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.repoConfigGenerator = repoConfigGenerator;
|
|
36
|
+
exports.default = repoConfigGenerator;
|
|
37
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/repo-config/generator.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,6BAA6B;AAC7B,uCAQoB;AACpB,uCAAgC;AAChC,8CAAgE;AAEhE,SAAsB,mBAAmB,CAAC,IAAU;;QAClD,M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nx g @nx/expo:lib --skipPackageJson --unitTestRunner=none',
|
|
6
|
+
'g:component': 'npx nx g @nx/expo:component component --export --flat --skipTests --directory=lib/${npm_config_name}',
|
|
7
|
+
'g:subcomponent': 'npx nx g @nx/expo:component component --export=false --flat --skipTests --directory=lib/components/${npm_config_name}',
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../../../../plugin/src/generators/repo-config/scripts.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,+DAA+D;IAC5E,aAAa,EACX,sGAAsG;IACxG,gBAAgB,EACd,uHAAuH;CAC1H,CAAC"}
|
package/src/index.d.ts
ADDED
|
File without changes
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../plugin/src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProjectName = exports.formatName = void 0;
|
|
4
|
+
const formatName = (value) => value
|
|
5
|
+
.split('-')
|
|
6
|
+
.map((word) => `${word.charAt(0).toUpperCase()}${word.substring(1)}`)
|
|
7
|
+
.join(' ');
|
|
8
|
+
exports.formatName = formatName;
|
|
9
|
+
const getProjectName = (str) => {
|
|
10
|
+
const parts = str.split('@');
|
|
11
|
+
return parts.length > 1 ? parts[1].split('/')[0] : parts[0];
|
|
12
|
+
};
|
|
13
|
+
exports.getProjectName = getProjectName;
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../plugin/src/shared/utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,EAAE,CAC1C,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,IAAI,CAAC,GAAG,CAAC,CAAC;AAJF,QAAA,UAAU,cAIR;AAER,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE;IAC5C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAJW,QAAA,cAAc,kBAIzB"}
|