@nx/expo 16.0.0-beta.1
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/.eslintrc.json +19 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/collection.json +0 -0
- package/docs/build-list-examples.md +71 -0
- package/docs/prebuild-examples.md +70 -0
- package/docs/run-examples.md +91 -0
- package/docs/start-examples.md +98 -0
- package/executors.json +116 -0
- package/generators.json +61 -0
- package/index.d.ts +4 -0
- package/index.js +12 -0
- package/index.js.map +1 -0
- package/migrations.json +734 -0
- package/package.json +59 -0
- package/plugins/jest/svg-mock.d.ts +0 -0
- package/plugins/jest/svg-mock.js +4 -0
- package/plugins/jest/svg-mock.js.map +1 -0
- package/plugins/metro-resolver.d.ts +1 -0
- package/plugins/metro-resolver.js +135 -0
- package/plugins/metro-resolver.js.map +1 -0
- package/plugins/with-nx-metro.d.ts +8 -0
- package/plugins/with-nx-metro.js +31 -0
- package/plugins/with-nx-metro.js.map +1 -0
- package/plugins/with-nx-webpack.d.ts +5 -0
- package/plugins/with-nx-webpack.js +52 -0
- package/plugins/with-nx-webpack.js.map +1 -0
- package/project.json +61 -0
- package/src/executors/build/build.impl.d.ts +6 -0
- package/src/executors/build/build.impl.js +62 -0
- package/src/executors/build/build.impl.js.map +1 -0
- package/src/executors/build/compat.d.ts +2 -0
- package/src/executors/build/compat.js +6 -0
- package/src/executors/build/compat.js.map +1 -0
- package/src/executors/build/schema.d.ts +14 -0
- package/src/executors/build/schema.json +60 -0
- package/src/executors/build-list/build-fragment.d.ts +54 -0
- package/src/executors/build-list/build-list.impl.d.ts +7 -0
- package/src/executors/build-list/build-list.impl.js +86 -0
- package/src/executors/build-list/build-list.impl.js.map +1 -0
- package/src/executors/build-list/compat.d.ts +2 -0
- package/src/executors/build-list/compat.js +6 -0
- package/src/executors/build-list/compat.js.map +1 -0
- package/src/executors/build-list/schema.d.ts +25 -0
- package/src/executors/build-list/schema.json +79 -0
- package/src/executors/download/compat.d.ts +2 -0
- package/src/executors/download/compat.js +6 -0
- package/src/executors/download/compat.js.map +1 -0
- package/src/executors/download/download.impl.d.ts +15 -0
- package/src/executors/download/download.impl.js +101 -0
- package/src/executors/download/download.impl.js.map +1 -0
- package/src/executors/download/schema.d.ts +3 -0
- package/src/executors/download/schema.json +59 -0
- package/src/executors/ensure-symlink/compat.d.ts +2 -0
- package/src/executors/ensure-symlink/compat.js +6 -0
- package/src/executors/ensure-symlink/compat.js.map +1 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +5 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +13 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js.map +1 -0
- package/src/executors/ensure-symlink/schema.json +11 -0
- package/src/executors/export/compat.d.ts +2 -0
- package/src/executors/export/compat.js +6 -0
- package/src/executors/export/compat.js.map +1 -0
- package/src/executors/export/export.impl.d.ts +6 -0
- package/src/executors/export/export.impl.js +69 -0
- package/src/executors/export/export.impl.js.map +1 -0
- package/src/executors/export/schema.d.ts +11 -0
- package/src/executors/export/schema.json +48 -0
- package/src/executors/install/compat.d.ts +2 -0
- package/src/executors/install/compat.js +6 -0
- package/src/executors/install/compat.js.map +1 -0
- package/src/executors/install/install.impl.d.ts +7 -0
- package/src/executors/install/install.impl.js +70 -0
- package/src/executors/install/install.impl.js.map +1 -0
- package/src/executors/install/schema.d.ts +7 -0
- package/src/executors/install/schema.json +34 -0
- package/src/executors/prebuild/compat.d.ts +2 -0
- package/src/executors/prebuild/compat.js +6 -0
- package/src/executors/prebuild/compat.js.map +1 -0
- package/src/executors/prebuild/prebuild.impl.d.ts +7 -0
- package/src/executors/prebuild/prebuild.impl.js +70 -0
- package/src/executors/prebuild/prebuild.impl.js.map +1 -0
- package/src/executors/prebuild/schema.d.ts +7 -0
- package/src/executors/prebuild/schema.json +35 -0
- package/src/executors/run/compat.d.ts +2 -0
- package/src/executors/run/compat.js +6 -0
- package/src/executors/run/compat.js.map +1 -0
- package/src/executors/run/run.impl.d.ts +6 -0
- package/src/executors/run/run.impl.js +112 -0
- package/src/executors/run/run.impl.js.map +1 -0
- package/src/executors/run/schema.d.ts +25 -0
- package/src/executors/run/schema.json +71 -0
- package/src/executors/start/compat.d.ts +2 -0
- package/src/executors/start/compat.js +6 -0
- package/src/executors/start/compat.js.map +1 -0
- package/src/executors/start/schema.d.ts +22 -0
- package/src/executors/start/schema.json +93 -0
- package/src/executors/start/start.impl.d.ts +7 -0
- package/src/executors/start/start.impl.js +73 -0
- package/src/executors/start/start.impl.js.map +1 -0
- package/src/executors/sync-deps/compat.d.ts +2 -0
- package/src/executors/sync-deps/compat.js +6 -0
- package/src/executors/sync-deps/compat.js.map +1 -0
- package/src/executors/sync-deps/schema.d.ts +4 -0
- package/src/executors/sync-deps/schema.json +28 -0
- package/src/executors/sync-deps/sync-deps.impl.d.ts +8 -0
- package/src/executors/sync-deps/sync-deps.impl.js +62 -0
- package/src/executors/sync-deps/sync-deps.impl.js.map +1 -0
- package/src/executors/update/compat.d.ts +2 -0
- package/src/executors/update/compat.js +6 -0
- package/src/executors/update/compat.js.map +1 -0
- package/src/executors/update/schema.d.ts +15 -0
- package/src/executors/update/schema.json +65 -0
- package/src/executors/update/update.impl.d.ts +6 -0
- package/src/executors/update/update.impl.js +59 -0
- package/src/executors/update/update.impl.js.map +1 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +33 -0
- package/src/generators/application/application.js.map +1 -0
- package/src/generators/application/files/app.json.template +33 -0
- package/src/generators/application/files/assets/adaptive-icon.png +0 -0
- package/src/generators/application/files/assets/favicon.png +0 -0
- package/src/generators/application/files/assets/icon.png +0 -0
- package/src/generators/application/files/assets/splash.png +0 -0
- package/src/generators/application/files/babel.config.js.template +6 -0
- package/src/generators/application/files/eas.json.template +28 -0
- package/src/generators/application/files/index.js.template +8 -0
- package/src/generators/application/files/metro.config.js.template +25 -0
- package/src/generators/application/files/package.json.template +17 -0
- package/src/generators/application/files/src/app/App.spec.tsx.template +9 -0
- package/src/generators/application/files/src/app/App.tsx.template +694 -0
- package/src/generators/application/files/test-setup.ts.template +1 -0
- package/src/generators/application/files/tsconfig.app.json.template +9 -0
- package/src/generators/application/files/tsconfig.json.template +26 -0
- package/src/generators/application/lib/add-detox.d.ts +3 -0
- package/src/generators/application/lib/add-detox.js +16 -0
- package/src/generators/application/lib/add-detox.js.map +1 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +91 -0
- package/src/generators/application/lib/add-project.js.map +1 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +24 -0
- package/src/generators/application/lib/create-application-files.js.map +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +10 -0
- package/src/generators/application/lib/normalize-options.js +30 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/schema.d.ts +19 -0
- package/src/generators/application/schema.json +88 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +51 -0
- package/src/generators/component/component.js.map +1 -0
- package/src/generators/component/files/__fileName__.spec.tsx.template +11 -0
- package/src/generators/component/files/__fileName__.tsx.template +32 -0
- package/src/generators/component/lib/add-import.d.ts +3 -0
- package/src/generators/component/lib/add-import.js +30 -0
- package/src/generators/component/lib/add-import.js.map +1 -0
- package/src/generators/component/lib/normalize-options.d.ts +8 -0
- package/src/generators/component/lib/normalize-options.js +58 -0
- package/src/generators/component/lib/normalize-options.js.map +1 -0
- package/src/generators/component/schema.d.ts +15 -0
- package/src/generators/component/schema.json +83 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +69 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +2 -0
- package/src/generators/init/lib/add-git-ignore-entry.js +19 -0
- package/src/generators/init/lib/add-git-ignore-entry.js.map +1 -0
- package/src/generators/init/lib/gitignore-entries.d.ts +1 -0
- package/src/generators/init/lib/gitignore-entries.js +20 -0
- package/src/generators/init/lib/gitignore-entries.js.map +1 -0
- package/src/generators/init/lib/init-root-babel-config.d.ts +2 -0
- package/src/generators/init/lib/init-root-babel-config.js +14 -0
- package/src/generators/init/lib/init-root-babel-config.js.map +1 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +38 -0
- package/src/generators/library/files/lib/README.md +7 -0
- package/src/generators/library/files/lib/babel.config.json +17 -0
- package/src/generators/library/files/lib/package.json.template +5 -0
- package/src/generators/library/files/lib/src/index.ts.template +0 -0
- package/src/generators/library/files/lib/test-setup.ts.template +1 -0
- package/src/generators/library/files/lib/tsconfig.json.template +16 -0
- package/src/generators/library/files/lib/tsconfig.lib.json.template +9 -0
- package/src/generators/library/lib/normalize-options.d.ts +12 -0
- package/src/generators/library/lib/normalize-options.js +27 -0
- package/src/generators/library/lib/normalize-options.js.map +1 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +101 -0
- package/src/generators/library/library.js.map +1 -0
- package/src/generators/library/schema.d.ts +22 -0
- package/src/generators/library/schema.json +99 -0
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.d.ts +6 -0
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js +35 -0
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.js.map +1 -0
- package/src/migrations/update-14-1-2/add-eject-target-14-1-2.d.ts +5 -0
- package/src/migrations/update-14-1-2/add-eject-target-14-1-2.js +25 -0
- package/src/migrations/update-14-1-2/add-eject-target-14-1-2.js.map +1 -0
- package/src/migrations/update-14-4-3/add-eas-build-target.d.ts +5 -0
- package/src/migrations/update-14-4-3/add-eas-build-target.js +42 -0
- package/src/migrations/update-14-4-3/add-eas-build-target.js.map +1 -0
- package/src/migrations/update-14-5-1/add-eas-update-target.d.ts +5 -0
- package/src/migrations/update-14-5-1/add-eas-update-target.js +27 -0
- package/src/migrations/update-14-5-1/add-eas-update-target.js.map +1 -0
- package/src/migrations/update-15-0-3/add-new-expo-cli-targets.d.ts +9 -0
- package/src/migrations/update-15-0-3/add-new-expo-cli-targets.js +66 -0
- package/src/migrations/update-15-0-3/add-new-expo-cli-targets.js.map +1 -0
- package/src/migrations/update-15-0-3/change-jest-preset.d.ts +8 -0
- package/src/migrations/update-15-0-3/change-jest-preset.js +74 -0
- package/src/migrations/update-15-0-3/change-jest-preset.js.map +1 -0
- package/src/migrations/update-15-8-3/change-webpack-to-metro.d.ts +8 -0
- package/src/migrations/update-15-8-3/change-webpack-to-metro.js +37 -0
- package/src/migrations/update-15-8-3/change-webpack-to-metro.js.map +1 -0
- package/src/migrations/update-16-0-0/remove-deprecated-targets.d.ts +5 -0
- package/src/migrations/update-16-0-0/remove-deprecated-targets.js +36 -0
- package/src/migrations/update-16-0-0/remove-deprecated-targets.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/add-jest.d.ts +2 -0
- package/src/utils/add-jest.js +39 -0
- package/src/utils/add-jest.js.map +1 -0
- package/src/utils/add-linting.d.ts +3 -0
- package/src/utils/add-linting.js +37 -0
- package/src/utils/add-linting.js.map +1 -0
- package/src/utils/ensure-node-modules-symlink.d.ts +9 -0
- package/src/utils/ensure-node-modules-symlink.js +29 -0
- package/src/utils/ensure-node-modules-symlink.js.map +1 -0
- package/src/utils/find-all-npm-dependencies.d.ts +2 -0
- package/src/utils/find-all-npm-dependencies.js +26 -0
- package/src/utils/find-all-npm-dependencies.js.map +1 -0
- package/src/utils/pod-install-task.d.ts +8 -0
- package/src/utils/pod-install-task.js +53 -0
- package/src/utils/pod-install-task.js.map +1 -0
- package/src/utils/symlink-task.d.ts +2 -0
- package/src/utils/symlink-task.js +19 -0
- package/src/utils/symlink-task.js.map +1 -0
- package/src/utils/versions.d.ts +20 -0
- package/src/utils/versions.js +24 -0
- package/src/utils/versions.js.map +1 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +11 -0
- package/tsconfig.spec.json +20 -0
- package/typings/svg.d.ts +6 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
+
"types": ["node"]
|
|
6
|
+
},
|
|
7
|
+
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.spec.tsx", "test-setup.ts"],
|
|
8
|
+
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "<%= offsetFromRoot %>tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"jsx": "react-native",
|
|
6
|
+
"lib": ["dom", "esnext"],
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"composite": true,
|
|
12
|
+
"declaration": true
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"../../node_modules/@nrwl/expo/typings/svg.d.ts"
|
|
16
|
+
],
|
|
17
|
+
"include": [],
|
|
18
|
+
"references": [
|
|
19
|
+
{
|
|
20
|
+
"path": "./tsconfig.app.json"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDetox = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const detox_1 = require("@nx/detox");
|
|
6
|
+
const linter_1 = require("@nx/linter");
|
|
7
|
+
function addDetox(host, options) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
if ((options === null || options === void 0 ? void 0 : options.e2eTestRunner) !== 'detox') {
|
|
10
|
+
return () => { };
|
|
11
|
+
}
|
|
12
|
+
return (0, detox_1.detoxApplicationGenerator)(host, Object.assign(Object.assign({}, options), { linter: linter_1.Linter.EsLint, e2eName: `${options.name}-e2e`, e2eDirectory: options.directory, appProject: options.projectName, appDisplayName: options.displayName, appName: options.name, framework: 'expo', setParserOptionsProject: options.setParserOptionsProject, skipFormat: true }));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.addDetox = addDetox;
|
|
16
|
+
//# sourceMappingURL=add-detox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-detox.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-detox.ts"],"names":[],"mappings":";;;;AAAA,qCAAsD;AAGtD,uCAAoC;AAEpC,SAAsB,QAAQ,CAAC,IAAU,EAAE,OAAyB;;QAClE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,MAAK,OAAO,EAAE;YACtC,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,OAAO,IAAA,iCAAyB,EAAC,IAAI,kCAChC,OAAO,KACV,MAAM,EAAE,eAAM,CAAC,MAAM,EACrB,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,MAAM,EAC9B,YAAY,EAAE,OAAO,CAAC,SAAS,EAC/B,UAAU,EAAE,OAAO,CAAC,WAAW,EAC/B,cAAc,EAAE,OAAO,CAAC,WAAW,EACnC,OAAO,EAAE,OAAO,CAAC,IAAI,EACrB,SAAS,EAAE,MAAM,EACjB,uBAAuB,EAAE,OAAO,CAAC,uBAAuB,EACxD,UAAU,EAAE,IAAI,IAChB,CAAC;IACL,CAAC;CAAA;AAjBD,4BAiBC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProject = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function addProject(host, options) {
|
|
6
|
+
const projectConfiguration = {
|
|
7
|
+
root: options.appProjectRoot,
|
|
8
|
+
sourceRoot: `${options.appProjectRoot}/src`,
|
|
9
|
+
projectType: 'application',
|
|
10
|
+
targets: Object.assign({}, getTargets(options)),
|
|
11
|
+
tags: options.parsedTags,
|
|
12
|
+
};
|
|
13
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, projectConfiguration, options.standaloneConfig);
|
|
14
|
+
}
|
|
15
|
+
exports.addProject = addProject;
|
|
16
|
+
function getTargets(options) {
|
|
17
|
+
const architect = {};
|
|
18
|
+
architect.start = {
|
|
19
|
+
executor: '@nrwl/expo:start',
|
|
20
|
+
options: {
|
|
21
|
+
port: 8081,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
architect.serve = {
|
|
25
|
+
executor: 'nx:run-commands',
|
|
26
|
+
options: {
|
|
27
|
+
command: `nx start ${options.name}`,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
architect['run-ios'] = {
|
|
31
|
+
executor: '@nrwl/expo:run',
|
|
32
|
+
options: {
|
|
33
|
+
platform: 'ios',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
architect['run-android'] = {
|
|
37
|
+
executor: '@nrwl/expo:run',
|
|
38
|
+
options: {
|
|
39
|
+
platform: 'android',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
architect['build'] = {
|
|
43
|
+
executor: '@nrwl/expo:build',
|
|
44
|
+
options: {},
|
|
45
|
+
};
|
|
46
|
+
architect['build-list'] = {
|
|
47
|
+
executor: '@nrwl/expo:build-list',
|
|
48
|
+
options: {},
|
|
49
|
+
};
|
|
50
|
+
architect['download'] = {
|
|
51
|
+
executor: '@nrwl/expo:download',
|
|
52
|
+
options: {
|
|
53
|
+
output: `${options.appProjectRoot}/dist`,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
architect['sync-deps'] = {
|
|
57
|
+
executor: '@nrwl/expo:sync-deps',
|
|
58
|
+
options: {},
|
|
59
|
+
};
|
|
60
|
+
architect['ensure-symlink'] = {
|
|
61
|
+
executor: '@nrwl/expo:ensure-symlink',
|
|
62
|
+
options: {},
|
|
63
|
+
};
|
|
64
|
+
architect['prebuild'] = {
|
|
65
|
+
executor: '@nrwl/expo:prebuild',
|
|
66
|
+
options: {},
|
|
67
|
+
};
|
|
68
|
+
architect['install'] = {
|
|
69
|
+
executor: '@nrwl/expo:install',
|
|
70
|
+
options: {},
|
|
71
|
+
};
|
|
72
|
+
architect['update'] = {
|
|
73
|
+
executor: '@nrwl/expo:update',
|
|
74
|
+
options: {},
|
|
75
|
+
};
|
|
76
|
+
architect['export'] = {
|
|
77
|
+
executor: '@nrwl/expo:export',
|
|
78
|
+
options: {
|
|
79
|
+
platform: 'all',
|
|
80
|
+
outputDir: `${(0, devkit_1.offsetFromRoot)(options.appProjectRoot)}dist/${options.appProjectRoot}`,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
architect['export-web'] = {
|
|
84
|
+
executor: '@nrwl/expo:export',
|
|
85
|
+
options: {
|
|
86
|
+
bundler: 'metro',
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
return architect;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=add-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-project.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-project.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAGpB,SAAgB,UAAU,CAAC,IAAU,EAAE,OAAyB;IAC9D,MAA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AAE,GAAG,OAAO,CAAC,cAAc,OAAO;SACzC;KACF,CAAC;IAEF,SAAS,CAAC,WAAW,CAAC,GAAG;QACvB,QAAQ,EAAE,sBAAsB;QAChC,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,SAAS,CAAC,gBAAgB,CAAC,GAAG;QAC5B,QAAQ,EAAE,2BAA2B;QACrC,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,SAAS,CAAC,UAAU,CAAC,GAAG;QACtB,QAAQ,EAAE,qBAAqB;QAC/B,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,SAAS,CAAC,SAAS,CAAC,GAAG;QACrB,QAAQ,EAAE,oBAAoB;QAC9B,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,SAAS,CAAC,QAAQ,CAAC,GAAG;QACpB,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,SAAS,CAAC,QAAQ,CAAC,GAAG;QACpB,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE;YACP,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,GAAG,IAAA,uBAAc,EAAC,OAAO,CAAC,cAAc,CAAC,QAClD,OAAO,CAAC,cACV,EAAE;SACH;KACF,CAAC;IAEF,SAAS,CAAC,YAAY,CAAC,GAAG;QACxB,QAAQ,EAAE,mBAAmB;QAC7B,OAAO,EAAE;YACP,OAAO,EAAE,OAAO;SACjB;KACF,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApplicationFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function createApplicationFiles(host, options) {
|
|
7
|
+
const packageManagerLockFile = {
|
|
8
|
+
npm: 'package-lock.json',
|
|
9
|
+
yarn: 'yarn.lock',
|
|
10
|
+
pnpm: 'pnpm-lock.yaml',
|
|
11
|
+
};
|
|
12
|
+
const packageManager = (0, devkit_1.detectPackageManager)(host.root);
|
|
13
|
+
const packageLockFile = packageManagerLockFile[packageManager];
|
|
14
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files'), options.appProjectRoot, Object.assign(Object.assign({}, options), { offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot), packageManager,
|
|
15
|
+
packageLockFile }));
|
|
16
|
+
if (options.unitTestRunner === 'none') {
|
|
17
|
+
host.delete((0, path_1.join)(options.appProjectRoot, `App.spec.tsx`));
|
|
18
|
+
}
|
|
19
|
+
if (options.js) {
|
|
20
|
+
(0, devkit_1.toJS)(host);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.createApplicationFiles = createApplicationFiles;
|
|
24
|
+
//# sourceMappingURL=create-application-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-application-files.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":";;;AAAA,uCAOoB;AACpB,+BAA4B;AAG5B,SAAgB,sBAAsB,CAAC,IAAU,EAAE,OAAyB;IAC1E,MAAM,sBAAsB,GAAmC;QAC7D,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;KACvB,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,6BAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,eAAe,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IAC/D,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,kCAClE,OAAO,KACV,cAAc,EAAE,IAAA,uBAAc,EAAC,OAAO,CAAC,cAAc,CAAC,EACtD,cAAc;QACd,eAAe,IACf,CAAC;IACH,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;KAC3D;IACD,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,IAAA,aAAI,EAAC,IAAI,CAAC,CAAC;KACZ;AACH,CAAC;AApBD,wDAoBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from '../schema';
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
|
+
className: string;
|
|
5
|
+
projectName: string;
|
|
6
|
+
appProjectRoot: string;
|
|
7
|
+
lowerCaseName: string;
|
|
8
|
+
parsedTags: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function normalizeOptions(host: Tree, options: Schema): NormalizedSchema;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function normalizeOptions(host, options) {
|
|
7
|
+
const { fileName, className } = (0, devkit_1.names)(options.name);
|
|
8
|
+
const { appsDir } = (0, devkit_1.getWorkspaceLayout)(host);
|
|
9
|
+
const directoryName = options.directory
|
|
10
|
+
? (0, devkit_1.names)(options.directory).fileName
|
|
11
|
+
: '';
|
|
12
|
+
const projectDirectory = directoryName
|
|
13
|
+
? `${directoryName}/${fileName}`
|
|
14
|
+
: fileName;
|
|
15
|
+
const appProjectName = projectDirectory.replace(new RegExp('/', 'g'), '-');
|
|
16
|
+
const appProjectRoot = (0, path_1.join)(appsDir, projectDirectory);
|
|
17
|
+
const parsedTags = options.tags
|
|
18
|
+
? options.tags.split(',').map((s) => s.trim())
|
|
19
|
+
: [];
|
|
20
|
+
/**
|
|
21
|
+
* if options.name is "my-app"
|
|
22
|
+
* name: "my-app", className: 'MyApp', lowerCaseName: 'myapp', displayName: 'MyApp', projectName: 'my-app', appProjectRoot: 'apps/my-app', androidProjectRoot: 'apps/my-app/android', iosProjectRoot: 'apps/my-app/ios'
|
|
23
|
+
* if options.name is "myApp"
|
|
24
|
+
* name: "my-app", className: 'MyApp', lowerCaseName: 'myapp', displayName: 'MyApp', projectName: 'my-app', appProjectRoot: 'apps/my-app', androidProjectRoot: 'apps/my-app/android', iosProjectRoot: 'apps/my-app/ios'
|
|
25
|
+
*/
|
|
26
|
+
return Object.assign(Object.assign({}, options), { unitTestRunner: options.unitTestRunner || 'jest', e2eTestRunner: options.e2eTestRunner || 'detox', name: fileName, className, lowerCaseName: className.toLowerCase(), displayName: options.displayName || className, projectName: appProjectName, appProjectRoot,
|
|
27
|
+
parsedTags });
|
|
28
|
+
}
|
|
29
|
+
exports.normalizeOptions = normalizeOptions;
|
|
30
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,uCAA6D;AAC7D,+BAA4B;AAW5B,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;IAEf,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAE7C,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS;QACrC,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ;QACnC,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,gBAAgB,GAAG,aAAa;QACpC,CAAC,CAAC,GAAG,aAAa,IAAI,QAAQ,EAAE;QAChC,CAAC,CAAC,QAAQ,CAAC;IAEb,MAAM,cAAc,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAE3E,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEP;;;;;OAKG;IACH,uCACK,OAAO,KACV,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,MAAM,EAChD,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,EAC/C,IAAI,EAAE,QAAQ,EACd,SAAS,EACT,aAAa,EAAE,SAAS,CAAC,WAAW,EAAE,EACtC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,SAAS,EAC7C,WAAW,EAAE,cAAc,EAC3B,cAAc;QACd,UAAU,IACV;AACJ,CAAC;AAxCD,4CAwCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Linter } from '@nx/linter';
|
|
2
|
+
|
|
3
|
+
export interface Schema {
|
|
4
|
+
name: string;
|
|
5
|
+
displayName?: string;
|
|
6
|
+
style?: string;
|
|
7
|
+
skipFormat: boolean; // default is false
|
|
8
|
+
directory?: string;
|
|
9
|
+
tags?: string;
|
|
10
|
+
unitTestRunner: 'jest' | 'none'; // default is jest
|
|
11
|
+
pascalCaseFiles?: boolean;
|
|
12
|
+
classComponent?: boolean;
|
|
13
|
+
js: boolean; // default is false
|
|
14
|
+
linter: Linter; // default is eslint
|
|
15
|
+
setParserOptionsProject?: boolean; // default is false
|
|
16
|
+
e2eTestRunner: 'detox' | 'none'; // default is detox
|
|
17
|
+
standaloneConfig?: boolean;
|
|
18
|
+
skipPackageJson?: boolean; // default is false
|
|
19
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": "nx",
|
|
3
|
+
"$id": "NxExpoApplication",
|
|
4
|
+
"$schema": "http://json-schema.org/schema",
|
|
5
|
+
"description": "Create an Expo Application for Nx.",
|
|
6
|
+
"examples": [
|
|
7
|
+
{
|
|
8
|
+
"command": "g @nrwl/expo:app myapp --directory=nested",
|
|
9
|
+
"description": "Generate apps/nested/myapp"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"command": "g @nrwl/expo:app myapp --classComponent",
|
|
13
|
+
"description": "Use class components instead of functional components"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"name": {
|
|
19
|
+
"description": "The name of the application.",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"$default": {
|
|
22
|
+
"$source": "argv",
|
|
23
|
+
"index": 0
|
|
24
|
+
},
|
|
25
|
+
"x-prompt": "What name would you like to use for the application?"
|
|
26
|
+
},
|
|
27
|
+
"displayName": {
|
|
28
|
+
"description": "The display name to show in the application. Defaults to name.",
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"directory": {
|
|
32
|
+
"description": "The directory of the new application.",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"x-priority": "important"
|
|
35
|
+
},
|
|
36
|
+
"skipFormat": {
|
|
37
|
+
"description": "Skip formatting files",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"default": false,
|
|
40
|
+
"x-priority": "internal"
|
|
41
|
+
},
|
|
42
|
+
"linter": {
|
|
43
|
+
"description": "The tool to use for running lint checks.",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"enum": ["eslint"],
|
|
46
|
+
"default": "eslint"
|
|
47
|
+
},
|
|
48
|
+
"unitTestRunner": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["jest", "none"],
|
|
51
|
+
"description": "Test runner to use for unit tests",
|
|
52
|
+
"default": "jest"
|
|
53
|
+
},
|
|
54
|
+
"tags": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "Add tags to the application (used for linting)",
|
|
57
|
+
"alias": "t"
|
|
58
|
+
},
|
|
59
|
+
"js": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "Generate JavaScript files rather than TypeScript files",
|
|
62
|
+
"default": false
|
|
63
|
+
},
|
|
64
|
+
"setParserOptionsProject": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
|
|
67
|
+
"default": false
|
|
68
|
+
},
|
|
69
|
+
"e2eTestRunner": {
|
|
70
|
+
"description": "Adds the specified e2e test runner",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"enum": ["detox", "none"],
|
|
73
|
+
"default": "detox"
|
|
74
|
+
},
|
|
75
|
+
"standaloneConfig": {
|
|
76
|
+
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"default": true,
|
|
79
|
+
"x-deprecated": "Nx only supports standaloneConfig"
|
|
80
|
+
},
|
|
81
|
+
"skipPackageJson": {
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
84
|
+
"default": false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"required": ["name"]
|
|
88
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Schema } from './schema';
|
|
2
|
+
import { Tree } from '@nx/devkit';
|
|
3
|
+
export declare function expoComponentGenerator(host: Tree, schema: Schema): Promise<void>;
|
|
4
|
+
export default expoComponentGenerator;
|
|
5
|
+
export declare const expoComponentSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expoComponentSchematic = exports.expoComponentGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
8
|
+
const add_import_1 = require("./lib/add-import");
|
|
9
|
+
function expoComponentGenerator(host, schema) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const options = yield (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
12
|
+
createComponentFiles(host, options);
|
|
13
|
+
addExportsToBarrel(host, options);
|
|
14
|
+
if (options.skipFormat) {
|
|
15
|
+
yield (0, devkit_1.formatFiles)(host);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.expoComponentGenerator = expoComponentGenerator;
|
|
20
|
+
function createComponentFiles(host, options) {
|
|
21
|
+
const componentDir = (0, devkit_1.joinPathFragments)(options.projectSourceRoot, options.directory);
|
|
22
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files'), componentDir, Object.assign(Object.assign({}, options), { tmpl: '' }));
|
|
23
|
+
for (const c of host.listChanges()) {
|
|
24
|
+
let deleteFile = false;
|
|
25
|
+
if (options.skipTests && /.*spec.tsx/.test(c.path)) {
|
|
26
|
+
deleteFile = true;
|
|
27
|
+
}
|
|
28
|
+
if (deleteFile) {
|
|
29
|
+
host.delete(c.path);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (options.js) {
|
|
33
|
+
(0, devkit_1.toJS)(host);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function addExportsToBarrel(host, options) {
|
|
37
|
+
const workspace = (0, devkit_1.getProjects)(host);
|
|
38
|
+
const isApp = workspace.get(options.project).projectType === 'application';
|
|
39
|
+
if (options.export && !isApp) {
|
|
40
|
+
const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot, options.js ? 'index.js' : 'index.ts');
|
|
41
|
+
const indexSource = host.read(indexFilePath, 'utf-8');
|
|
42
|
+
if (indexSource !== null) {
|
|
43
|
+
const indexSourceFile = ts.createSourceFile(indexFilePath, indexSource, ts.ScriptTarget.Latest, true);
|
|
44
|
+
const changes = (0, devkit_1.applyChangesToString)(indexSource, (0, add_import_1.addImport)(indexSourceFile, `export * from './${options.directory}/${options.fileName}';`));
|
|
45
|
+
host.write(indexFilePath, changes);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = expoComponentGenerator;
|
|
50
|
+
exports.expoComponentSchematic = (0, devkit_1.convertNxGenerator)(expoComponentGenerator);
|
|
51
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/component/component.ts"],"names":[],"mappings":";;;;AAAA,iCAAiC;AAEjC,uCASoB;AACpB,+DAA6E;AAC7E,iDAA6C;AAE7C,SAAsB,sBAAsB,CAAC,IAAU,EAAE,MAAc;;QACrE,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrD,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEpC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAElC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AATD,wDASC;AAED,SAAS,oBAAoB,CAAC,IAAU,EAAE,OAAyB;IACjE,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,OAAO,CAAC,iBAAiB,EACzB,OAAO,CAAC,SAAS,CAClB,CAAC;IAEF,IAAA,sBAAa,EAAC,IA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AA,sBAAS,EACP,eAAe,EACf,oBAAoB,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,QAAQ,IAAI,CAC9D,CACF,CAAC;YACF,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACpC;KACF;AACH,CAAC;AAED,kBAAe,sBAAsB,CAAC;AACzB,QAAA,sBAAsB,GAAG,IAAA,2BAAkB,EACtD,sBAAsB,CACvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react-native';
|
|
3
|
+
|
|
4
|
+
import <%= className %> from './<%= fileName %>';
|
|
5
|
+
|
|
6
|
+
describe('<%= className %>', () => {
|
|
7
|
+
it('should render successfully', () => {
|
|
8
|
+
const { container } = render(< <%= className %> />);
|
|
9
|
+
expect(container).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<% if (classComponent) { %>
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
<% } else { %>
|
|
4
|
+
import React from 'react';
|
|
5
|
+
<% } %>
|
|
6
|
+
import { View, Text } from 'react-native';
|
|
7
|
+
|
|
8
|
+
/* eslint-disable-next-line */
|
|
9
|
+
export interface <%= className %>Props {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
<% if (classComponent) { %>
|
|
13
|
+
export class <%= className %> extends Component<<%= className %>Props> {
|
|
14
|
+
render() {
|
|
15
|
+
return (
|
|
16
|
+
<View>
|
|
17
|
+
<Text>Welcome to <%= name %>!</Text>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
<% } else { %>
|
|
23
|
+
export function <%= className %>(props: <%= className %>Props) {
|
|
24
|
+
return (
|
|
25
|
+
<View>
|
|
26
|
+
<Text>Welcome to <%= name %>!</Text>
|
|
27
|
+
</View>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
<% } %>
|
|
31
|
+
|
|
32
|
+
export default <%= className %>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addImport = void 0;
|
|
4
|
+
const typescript_1 = require("nx/src/utils/typescript");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
function addImport(source, statement) {
|
|
8
|
+
const allImports = (0, typescript_1.findNodes)(source, ts.SyntaxKind.ImportDeclaration);
|
|
9
|
+
if (allImports.length > 0) {
|
|
10
|
+
const lastImport = allImports[allImports.length - 1];
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
type: devkit_1.ChangeType.Insert,
|
|
14
|
+
index: lastImport.end + 1,
|
|
15
|
+
text: `\n${statement}\n`,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
type: devkit_1.ChangeType.Insert,
|
|
23
|
+
index: 0,
|
|
24
|
+
text: `\n${statement}\n`,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.addImport = addImport;
|
|
30
|
+
//# sourceMappingURL=add-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-import.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/component/lib/add-import.ts"],"names":[],"mappings":";;;AAAA,wDAAoD;AACpD,iCAAiC;AACjC,uCAAsD;AAEtD,SAAgB,SAAS,CACvB,MAAqB,EACrB,SAAiB;IAEjB,MAAM,UAAU,GAAG,IAAA,sBAAS,EAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACtE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QACzB,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACrD,OAAO;YACL;gBACE,IAAI,EAAE,mBAAU,CAAC,MAAM;gBACvB,KAAK,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC;gBACzB,IAAI,EAAE,KAAK,SAAS,IAAI;aACzB;SACF,CAAC;KACH;SAAM;QACL,OAAO;YACL;gBACE,IAAI,EAAE,mBAAU,CAAC,MAAM;gBACvB,KAAK,EAAE,CAAC;gBACR,IAAI,EAAE,KAAK,SAAS,IAAI;aACzB;SACF,CAAC;KACH;AACH,CAAC;AAvBD,8BAuBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from '../schema';
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
|
+
projectSourceRoot: string;
|
|
5
|
+
fileName: string;
|
|
6
|
+
className: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
function normalizeOptions(host, options) {
|
|
7
|
+
var _a;
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
assertValidOptions(options);
|
|
10
|
+
const { className, fileName } = (0, devkit_1.names)(options.name);
|
|
11
|
+
const componentFileName = options.pascalCaseFiles ? className : fileName;
|
|
12
|
+
const project = (0, devkit_1.getProjects)(host).get(options.project);
|
|
13
|
+
if (!project) {
|
|
14
|
+
devkit_1.logger.error(`Cannot find the ${options.project} project. Please double check the project name.`);
|
|
15
|
+
throw new Error();
|
|
16
|
+
}
|
|
17
|
+
const { sourceRoot: projectSourceRoot, projectType } = project;
|
|
18
|
+
const directory = yield getDirectory(host, options);
|
|
19
|
+
if (options.export && projectType === 'application') {
|
|
20
|
+
devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`);
|
|
21
|
+
}
|
|
22
|
+
options.classComponent = (_a = options.classComponent) !== null && _a !== void 0 ? _a : false;
|
|
23
|
+
return Object.assign(Object.assign({}, options), { directory,
|
|
24
|
+
className, fileName: componentFileName, projectSourceRoot });
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.normalizeOptions = normalizeOptions;
|
|
28
|
+
function getDirectory(host, options) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const fileName = (0, devkit_1.names)(options.name).fileName;
|
|
31
|
+
const workspace = (0, devkit_1.getProjects)(host);
|
|
32
|
+
let baseDir;
|
|
33
|
+
if (options.directory) {
|
|
34
|
+
baseDir = options.directory;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
baseDir =
|
|
38
|
+
workspace.get(options.project).projectType === 'application'
|
|
39
|
+
? 'app'
|
|
40
|
+
: 'lib';
|
|
41
|
+
}
|
|
42
|
+
return options.flat ? baseDir : (0, devkit_1.joinPathFragments)(baseDir, fileName);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function assertValidOptions(options) {
|
|
46
|
+
const slashes = ['/', '\\'];
|
|
47
|
+
slashes.forEach((s) => {
|
|
48
|
+
if (options.name.indexOf(s) !== -1) {
|
|
49
|
+
const [name, ...rest] = options.name.split(s).reverse();
|
|
50
|
+
let suggestion = rest.map((x) => x.toLowerCase()).join(s);
|
|
51
|
+
if (options.directory) {
|
|
52
|
+
suggestion = `${options.directory}${s}${suggestion}`;
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Found "${s}" in the component name. Did you mean to use the --directory option (e.g. \`nx g c ${name} --directory ${suggestion}\`)?`);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/component/lib/normalize-options.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AASpB,SAAsB,gBAAgB,CACpC,IAAU,EACV,OAAe;;;QAEf,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAE5B,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;QACzE,MAAM,OAAO,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEvD,IAAI,CAAC,OAAO,EAAE;YACZ,eAAM,CAAC,KAAK,CACV,mBAAmB,OAAO,CAAC,OAAO,iDAAiD,CACpF,CAAC;YACF,MAAM,IAAI,KAAK,EAAE,CAAC;SACnB;QAED,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;QAE/D,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEpD,IAAI,OAAO,CAAC,MAAM,IAAI,WAAW,KAAK,aAAa,EAAE;YACnD,eAAM,CAAC,IAAI,CACT,iFAAiF,CAClF,CAAC;SACH;QAED,OAAO,CAAC,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,KAAK,CAAC;QAEzD,uCACK,OAAO,KACV,SAAS;YACT,SAAS,EACT,QAAQ,EAAE,iBAAiB,EAC3B,iBAAiB,IACjB;;CACH;AApCD,4CAoCC;AAED,SAAe,YAAY,CAAC,IAAU,EAAE,OAAe;;QACrD,MAAM,QAAQ,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,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}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same as the @nrwl/react library schema, except it removes keys: style, routing, globalCss
|
|
3
|
+
*/
|
|
4
|
+
export interface Schema {
|
|
5
|
+
name: string;
|
|
6
|
+
project: string;
|
|
7
|
+
directory?: string;
|
|
8
|
+
skipFormat: boolean; // default is false
|
|
9
|
+
skipTests: boolean; // default is false
|
|
10
|
+
export: boolean; // default is false
|
|
11
|
+
pascalCaseFiles: boolean; // default is false
|
|
12
|
+
classComponent: boolean; // default is false
|
|
13
|
+
js: boolean; // default is false
|
|
14
|
+
flat: boolean; // default is false
|
|
15
|
+
}
|