@nx/expo 0.0.0-pr-22179-271588f
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 +46 -0
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/docs/build-list-examples.md +71 -0
- package/docs/export-examples.md +112 -0
- package/docs/prebuild-examples.md +70 -0
- package/docs/run-examples.md +91 -0
- package/docs/start-examples.md +104 -0
- package/executors.json +64 -0
- package/generators.json +33 -0
- package/index.d.ts +3 -0
- package/index.js +9 -0
- package/migrations.json +689 -0
- package/package.json +57 -0
- package/plugin.d.ts +1 -0
- package/plugin.js +6 -0
- package/plugins/jest/svg-mock.d.ts +0 -0
- package/plugins/jest/svg-mock.js +3 -0
- package/plugins/metro-resolver.d.ts +1 -0
- package/plugins/metro-resolver.js +136 -0
- package/plugins/plugin.d.ts +14 -0
- package/plugins/plugin.js +150 -0
- package/plugins/with-nx-metro.d.ts +8 -0
- package/plugins/with-nx-metro.js +31 -0
- package/plugins/with-nx-webpack.d.ts +5 -0
- package/plugins/with-nx-webpack.js +51 -0
- package/project.json +61 -0
- package/src/executors/build/build.impl.d.ts +6 -0
- package/src/executors/build/build.impl.js +70 -0
- package/src/executors/build/schema.d.ts +14 -0
- package/src/executors/build/schema.json +83 -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 +81 -0
- package/src/executors/build-list/schema.d.ts +25 -0
- package/src/executors/build-list/schema.json +79 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +9 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +13 -0
- package/src/executors/ensure-symlink/schema.json +11 -0
- package/src/executors/export/export.impl.d.ts +7 -0
- package/src/executors/export/export.impl.js +73 -0
- package/src/executors/export/schema.d.ts +13 -0
- package/src/executors/export/schema.json +49 -0
- package/src/executors/install/install.impl.d.ts +7 -0
- package/src/executors/install/install.impl.js +63 -0
- package/src/executors/install/schema.d.ts +7 -0
- package/src/executors/install/schema.json +34 -0
- package/src/executors/prebuild/prebuild.impl.d.ts +7 -0
- package/src/executors/prebuild/prebuild.impl.js +69 -0
- package/src/executors/prebuild/schema.d.ts +7 -0
- package/src/executors/prebuild/schema.json +36 -0
- package/src/executors/run/run.impl.d.ts +6 -0
- package/src/executors/run/run.impl.js +96 -0
- package/src/executors/run/schema.d.ts +24 -0
- package/src/executors/run/schema.json +65 -0
- package/src/executors/serve/lib/is-packager-running.d.ts +1 -0
- package/src/executors/serve/lib/is-packager-running.js +15 -0
- package/src/executors/serve/schema.d.ts +7 -0
- package/src/executors/serve/schema.json +35 -0
- package/src/executors/serve/serve.impl.d.ts +11 -0
- package/src/executors/serve/serve.impl.js +105 -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 +77 -0
- package/src/executors/submit/schema.d.ts +12 -0
- package/src/executors/submit/schema.json +57 -0
- package/src/executors/submit/submit.impl.d.ts +6 -0
- package/src/executors/submit/submit.impl.js +70 -0
- package/src/executors/sync-deps/schema.d.ts +5 -0
- package/src/executors/sync-deps/schema.json +33 -0
- package/src/executors/sync-deps/sync-deps.impl.d.ts +9 -0
- package/src/executors/sync-deps/sync-deps.impl.js +78 -0
- package/src/executors/update/schema.d.ts +15 -0
- package/src/executors/update/schema.json +75 -0
- package/src/executors/update/update.impl.d.ts +6 -0
- package/src/executors/update/update.impl.js +67 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +63 -0
- package/src/generators/application/files/.babelrc.js.template +6 -0
- package/src/generators/application/files/app.json.template +44 -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/eas.json.template +25 -0
- package/src/generators/application/files/index.js.template +8 -0
- package/src/generators/application/files/metro.config.js.template +33 -0
- package/src/generators/application/files/package.json.template +18 -0
- package/src/generators/application/files/src/app/App.spec.tsx.template +9 -0
- package/src/generators/application/files/src/app/App.tsx.template +731 -0
- package/src/generators/application/files/test-setup.ts.template +1 -0
- package/src/generators/application/files/tsconfig.app.json.template +10 -0
- package/src/generators/application/files/tsconfig.json.template +20 -0
- package/src/generators/application/files/webpack.config.js.template +57 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +87 -0
- package/src/generators/application/lib/add-eas-scripts.d.ts +2 -0
- package/src/generators/application/lib/add-eas-scripts.js +74 -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/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +27 -0
- package/src/generators/application/lib/normalize-options.d.ts +13 -0
- package/src/generators/application/lib/normalize-options.js +42 -0
- package/src/generators/application/schema.d.ts +22 -0
- package/src/generators/application/schema.json +94 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +62 -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 +29 -0
- package/src/generators/component/lib/normalize-options.d.ts +10 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +25 -0
- package/src/generators/component/schema.json +90 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +74 -0
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +2 -0
- package/src/generators/init/lib/add-git-ignore-entry.js +17 -0
- package/src/generators/init/lib/gitignore-entries.d.ts +1 -0
- package/src/generators/init/lib/gitignore-entries.js +19 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +33 -0
- package/src/generators/library/files/lib/.babelrc.js.template +21 -0
- package/src/generators/library/files/lib/README.md +7 -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 +11 -0
- package/src/generators/library/lib/normalize-options.js +35 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +159 -0
- package/src/generators/library/schema.d.ts +25 -0
- package/src/generators/library/schema.json +104 -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 +61 -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 +69 -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 +31 -0
- package/src/migrations/update-16-0-0/add-jest-expo.d.ts +6 -0
- package/src/migrations/update-16-0-0/add-jest-expo.js +27 -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 +32 -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 +9 -0
- package/src/migrations/update-16-1-4/update-eas-scripts.d.ts +5 -0
- package/src/migrations/update-16-1-4/update-eas-scripts.js +42 -0
- package/src/migrations/update-16-2-2/add-submit-target.d.ts +5 -0
- package/src/migrations/update-16-2-2/add-submit-target.js +22 -0
- package/src/migrations/update-16-6-0/add-depends-on.d.ts +6 -0
- package/src/migrations/update-16-6-0/add-depends-on.js +29 -0
- package/src/migrations/update-16-6-0/update-metro-config.d.ts +6 -0
- package/src/migrations/update-16-6-0/update-metro-config.js +65 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +7 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.js +13 -0
- package/src/migrations/update-16-9-0/update-eas-cli-version.d.ts +2 -0
- package/src/migrations/update-16-9-0/update-eas-cli-version.js +17 -0
- package/src/migrations/update-18-0-0/change-outputDir-export-target.d.ts +5 -0
- package/src/migrations/update-18-0-0/change-outputDir-export-target.js +25 -0
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-block-list.js +28 -0
- package/src/migrations/update-18-0-0/remove-eas-cli.d.ts +12 -0
- package/src/migrations/update-18-0-0/remove-eas-cli.js +18 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.js +29 -0
- package/src/utils/add-jest.d.ts +2 -0
- package/src/utils/add-jest.js +47 -0
- package/src/utils/add-linting.d.ts +13 -0
- package/src/utils/add-linting.js +37 -0
- package/src/utils/ensure-dependencies.d.ts +2 -0
- package/src/utils/ensure-dependencies.js +24 -0
- package/src/utils/ensure-node-modules-symlink.d.ts +9 -0
- package/src/utils/ensure-node-modules-symlink.js +28 -0
- package/src/utils/find-all-npm-dependencies.d.ts +2 -0
- package/src/utils/find-all-npm-dependencies.js +27 -0
- package/src/utils/has-expo-plugin.d.ts +2 -0
- package/src/utils/has-expo-plugin.js +11 -0
- package/src/utils/init-root-babel-config.d.ts +2 -0
- package/src/utils/init-root-babel-config.js +13 -0
- package/src/utils/pod-install-task.d.ts +16 -0
- package/src/utils/pod-install-task.js +66 -0
- package/src/utils/resolve-eas.d.ts +1 -0
- package/src/utils/resolve-eas.js +36 -0
- package/src/utils/versions.d.ts +19 -0
- package/src/utils/versions.js +22 -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,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const chalk = require("chalk");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
let childProcess;
|
|
8
|
+
async function* startExecutor(options, context) {
|
|
9
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
10
|
+
try {
|
|
11
|
+
const baseUrl = `http://localhost:${options.port}`;
|
|
12
|
+
devkit_1.logger.info(chalk.cyan(`Packager is ready at ${baseUrl}`));
|
|
13
|
+
await startAsync(context.root, projectRoot, options);
|
|
14
|
+
yield {
|
|
15
|
+
baseUrl,
|
|
16
|
+
success: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
if (childProcess) {
|
|
21
|
+
childProcess.kill();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = startExecutor;
|
|
26
|
+
function startAsync(workspaceRoot, projectRoot, options) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
childProcess = (0, child_process_1.fork)(require.resolve('@expo/cli/build/bin/cli'), ['start', ...createStartOptions(options)], {
|
|
29
|
+
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
30
|
+
env: {
|
|
31
|
+
RCT_METRO_PORT: options.port.toString(),
|
|
32
|
+
...process.env,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
// Ensure the child process is killed when the parent exits
|
|
36
|
+
process.on('exit', () => childProcess.kill());
|
|
37
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
38
|
+
childProcess.on('error', (err) => {
|
|
39
|
+
reject(err);
|
|
40
|
+
});
|
|
41
|
+
childProcess.on('exit', (code) => {
|
|
42
|
+
if (code === 0) {
|
|
43
|
+
resolve(code);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
reject(code);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// options from https://github.com/expo/expo/blob/main/packages/%40expo/cli/src/start/index.ts
|
|
52
|
+
const nxOptions = ['sync'];
|
|
53
|
+
function createStartOptions(options) {
|
|
54
|
+
return Object.keys(options).reduce((acc, k) => {
|
|
55
|
+
if (nxOptions.includes(k)) {
|
|
56
|
+
return acc;
|
|
57
|
+
}
|
|
58
|
+
const v = options[k];
|
|
59
|
+
if (k === 'dev') {
|
|
60
|
+
if (v === false) {
|
|
61
|
+
acc.push(`--no-dev`); // only no-dev flag is supported
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (typeof v === 'boolean') {
|
|
66
|
+
if (v === true) {
|
|
67
|
+
// when true, does not need to pass the value true, just need to pass the flag in kebob case
|
|
68
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return acc;
|
|
76
|
+
}, []);
|
|
77
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// command to run https://github.com/expo/eas-cli/tree/main#eas-submit
|
|
2
|
+
// options from https://github.com/expo/eas-cli/blob/main/packages/eas-cli/src/commands/submit.ts
|
|
3
|
+
export interface SubmitExecutorSchema {
|
|
4
|
+
profile?: string;
|
|
5
|
+
platform?: 'ios' | 'android' | 'all';
|
|
6
|
+
id?: string;
|
|
7
|
+
latest?: boolean;
|
|
8
|
+
interactive: boolean; // default is true
|
|
9
|
+
path?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
wait: boolean; // default is true
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"title": "EXPO EAS Submit Executor",
|
|
5
|
+
"description": "Submit app binary to App Store and/or Play Store.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"presets": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Submit for a specific platform",
|
|
10
|
+
"keys": ["platform"]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "Submit using a specific profile",
|
|
14
|
+
"keys": ["profile"]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"properties": {
|
|
18
|
+
"profile": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Name of the build profile from eas.json. Defaults to \"production\" if defined in eas.json.",
|
|
21
|
+
"examples": ["production", "development", "preview"],
|
|
22
|
+
"x-priority": "important"
|
|
23
|
+
},
|
|
24
|
+
"platform": {
|
|
25
|
+
"enum": ["ios", "android", "all"],
|
|
26
|
+
"alias": "p",
|
|
27
|
+
"description": "The platform to build the app, example values: ios, android, all.",
|
|
28
|
+
"x-priority": "important"
|
|
29
|
+
},
|
|
30
|
+
"id": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Build ID to submit"
|
|
33
|
+
},
|
|
34
|
+
"path": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Path to the .apk/.aab/.ipa file"
|
|
37
|
+
},
|
|
38
|
+
"url": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "URL to the .apk/.aab/.ipa file, app archive url"
|
|
41
|
+
},
|
|
42
|
+
"latest": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Submit the latest build for specified platform"
|
|
45
|
+
},
|
|
46
|
+
"interactive": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"description": "Run command in interactive mode",
|
|
49
|
+
"default": true
|
|
50
|
+
},
|
|
51
|
+
"wait": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Wait for build(s) to complete",
|
|
54
|
+
"default": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { SubmitExecutorSchema } from './schema';
|
|
3
|
+
export interface ReactNativeSubmitOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function submitExecutor(options: SubmitExecutorSchema, context: ExecutorContext): AsyncGenerator<ReactNativeSubmitOutput>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const resolve_eas_1 = require("../../utils/resolve-eas");
|
|
7
|
+
let childProcess;
|
|
8
|
+
async function* submitExecutor(options, context) {
|
|
9
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
10
|
+
try {
|
|
11
|
+
await runCliSubmit(context.root, projectRoot, options);
|
|
12
|
+
yield { success: true };
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
if (childProcess) {
|
|
16
|
+
childProcess.kill();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = submitExecutor;
|
|
21
|
+
function runCliSubmit(workspaceRoot, projectRoot, options) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['submit', ...createSubmitOptions(options)], {
|
|
24
|
+
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
25
|
+
env: process.env,
|
|
26
|
+
});
|
|
27
|
+
// Ensure the child process is killed when the parent exits
|
|
28
|
+
process.on('exit', () => childProcess.kill());
|
|
29
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
30
|
+
childProcess.on('error', (err) => {
|
|
31
|
+
reject(err);
|
|
32
|
+
});
|
|
33
|
+
childProcess.on('exit', (code) => {
|
|
34
|
+
if (code === 0) {
|
|
35
|
+
resolve(code);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
reject(code);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function createSubmitOptions(options) {
|
|
44
|
+
return Object.keys(options).reduce((acc, k) => {
|
|
45
|
+
const v = options[k];
|
|
46
|
+
if (typeof v === 'boolean') {
|
|
47
|
+
if (k === 'interactive') {
|
|
48
|
+
if (v === false) {
|
|
49
|
+
acc.push('--non-interactive'); // when is false, the flag is --non-interactive
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (k === 'wait') {
|
|
53
|
+
if (v === false) {
|
|
54
|
+
acc.push('--no-wait'); // when is false, the flag is --no-wait
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
acc.push('--wait');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (v === true) {
|
|
61
|
+
// when true, does not need to pass the value true, just need to pass the flag in kebob case
|
|
62
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
67
|
+
}
|
|
68
|
+
return acc;
|
|
69
|
+
}, []);
|
|
70
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"$id": "NxExpoSyncDeps",
|
|
6
|
+
"$schema": "https://json-schema.org/schema",
|
|
7
|
+
"title": "Sync Deps for Expo",
|
|
8
|
+
"description": "Updates package.json with project dependencies.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"include": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"default": [],
|
|
17
|
+
"description": "An array of additional npm packages to include."
|
|
18
|
+
},
|
|
19
|
+
"exclude": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"default": [],
|
|
25
|
+
"description": "An array of npm packages to exclude."
|
|
26
|
+
},
|
|
27
|
+
"all": {
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"description": "Copy all dependencies and devDependencies from the workspace root package.json.",
|
|
30
|
+
"default": false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutorContext, ProjectGraph } from '@nx/devkit';
|
|
2
|
+
import { ExpoSyncDepsOptions } from './schema';
|
|
3
|
+
import { PackageJson } from 'nx/src/utils/package-json';
|
|
4
|
+
export interface ReactNativeSyncDepsOutput {
|
|
5
|
+
success: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function syncDepsExecutor(options: ExpoSyncDepsOptions, context: ExecutorContext): AsyncGenerator<ReactNativeSyncDepsOutput>;
|
|
8
|
+
export declare function syncDeps(projectName: string, projectPackageJson: PackageJson, projectPackageJsonPath: string, workspacePackageJson: PackageJson, projectGraph?: ProjectGraph, include?: string[], exclude?: string[], all?: boolean): Promise<string[]>;
|
|
9
|
+
export declare function displayNewlyAddedDepsMessage(projectName: string, deps: string[]): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.displayNewlyAddedDepsMessage = exports.syncDeps = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const chalk = require("chalk");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
7
|
+
const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
|
|
8
|
+
async function* syncDepsExecutor(options, context) {
|
|
9
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
10
|
+
const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
|
|
11
|
+
const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
|
|
12
|
+
const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
|
|
13
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
|
|
14
|
+
displayNewlyAddedDepsMessage(context.projectName, await syncDeps(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, typeof options.include === 'string'
|
|
15
|
+
? options.include.split(',')
|
|
16
|
+
: options.include, typeof options.exclude === 'string'
|
|
17
|
+
? options.exclude.split(',')
|
|
18
|
+
: options.exclude, options.all));
|
|
19
|
+
yield { success: true };
|
|
20
|
+
}
|
|
21
|
+
exports.default = syncDepsExecutor;
|
|
22
|
+
async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, projectGraph = (0, devkit_1.readCachedProjectGraph)(), include = [], exclude = [], all = false) {
|
|
23
|
+
let npmDeps = all
|
|
24
|
+
? Object.keys(workspacePackageJson.dependencies || {})
|
|
25
|
+
: (0, find_all_npm_dependencies_1.findAllNpmDependencies)(projectGraph, projectName);
|
|
26
|
+
let npmDevdeps = all
|
|
27
|
+
? Object.keys(workspacePackageJson.devDependencies || {})
|
|
28
|
+
: [];
|
|
29
|
+
const newDeps = [];
|
|
30
|
+
let updated = false;
|
|
31
|
+
if (!projectPackageJson.dependencies) {
|
|
32
|
+
projectPackageJson.dependencies = {};
|
|
33
|
+
updated = true;
|
|
34
|
+
}
|
|
35
|
+
if (include && include.length) {
|
|
36
|
+
npmDeps.push(...include);
|
|
37
|
+
}
|
|
38
|
+
if (exclude && exclude.length) {
|
|
39
|
+
npmDeps = npmDeps.filter((dep) => !exclude.includes(dep));
|
|
40
|
+
}
|
|
41
|
+
if (!projectPackageJson.devDependencies) {
|
|
42
|
+
projectPackageJson.devDependencies = {};
|
|
43
|
+
}
|
|
44
|
+
if (!projectPackageJson.dependencies) {
|
|
45
|
+
projectPackageJson.dependencies = {};
|
|
46
|
+
}
|
|
47
|
+
npmDeps.forEach((dep) => {
|
|
48
|
+
if (!projectPackageJson.dependencies[dep] &&
|
|
49
|
+
!projectPackageJson.devDependencies[dep]) {
|
|
50
|
+
projectPackageJson.dependencies[dep] = '*';
|
|
51
|
+
newDeps.push(dep);
|
|
52
|
+
updated = true;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
npmDevdeps.forEach((dep) => {
|
|
56
|
+
if (!projectPackageJson.dependencies[dep] &&
|
|
57
|
+
!projectPackageJson.devDependencies[dep]) {
|
|
58
|
+
projectPackageJson.devDependencies[dep] = '*';
|
|
59
|
+
newDeps.push(dep);
|
|
60
|
+
updated = true;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if (updated) {
|
|
64
|
+
(0, devkit_1.writeJsonFile)(projectPackageJsonPath, projectPackageJson);
|
|
65
|
+
}
|
|
66
|
+
return newDeps;
|
|
67
|
+
}
|
|
68
|
+
exports.syncDeps = syncDeps;
|
|
69
|
+
function displayNewlyAddedDepsMessage(projectName, deps) {
|
|
70
|
+
if (deps.length > 0) {
|
|
71
|
+
devkit_1.logger.info(`${chalk.bold.cyan('info')} Added entries to 'package.json' for '${projectName}' (for autolink):
|
|
72
|
+
${deps.map((d) => chalk.bold.cyan(`"${d}": "*"`)).join('\n ')}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
devkit_1.logger.info(`${chalk.bold.cyan('info')} Dependencies for '${projectName}' are up to date! No changes made.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.displayNewlyAddedDepsMessage = displayNewlyAddedDepsMessage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// command to run https://github.com/expo/eas-cli/tree/main#eas-update
|
|
2
|
+
// options from github.com/expo/eas-cli/blob/main/packages/eas-cli/src/commands/update/index.ts
|
|
3
|
+
export interface ExpoEasUpdateOptions {
|
|
4
|
+
branch?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
republish: boolean; // default is false
|
|
7
|
+
group?: string;
|
|
8
|
+
inputDir: string; // default is "dist"
|
|
9
|
+
skipBundler: boolean; // default is false
|
|
10
|
+
platform: 'ios' | 'android' | 'all'; // default is "all"
|
|
11
|
+
json: boolean; // default is false
|
|
12
|
+
auto: boolean; // default is false
|
|
13
|
+
privateKeyPath?: string;
|
|
14
|
+
interactive: boolean; // default is false
|
|
15
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"$schema": "https://json-schema.org/schema",
|
|
5
|
+
"$id": "NxExpoEasUpdate",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"title": "Expo EAS Update executor",
|
|
8
|
+
"description": "Start an EAS update for your expo project.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"presets": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Update for a specific platform",
|
|
13
|
+
"keys": ["platform"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Update from a specific branch",
|
|
17
|
+
"keys": ["branch"]
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"branch": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Branch to publish the update group on"
|
|
24
|
+
},
|
|
25
|
+
"message": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "A short message describing the update"
|
|
28
|
+
},
|
|
29
|
+
"republish": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Enable JSON output, non-JSON messages will be printed to stderr",
|
|
32
|
+
"default": false
|
|
33
|
+
},
|
|
34
|
+
"group": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Update group to republish"
|
|
37
|
+
},
|
|
38
|
+
"inputDir": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Location of the bundle"
|
|
41
|
+
},
|
|
42
|
+
"skipBundler": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Skip running Expo CLI to bundle the app before publishing",
|
|
45
|
+
"default": false
|
|
46
|
+
},
|
|
47
|
+
"platform": {
|
|
48
|
+
"enum": ["ios", "android", "all"],
|
|
49
|
+
"alias": "p",
|
|
50
|
+
"description": "The platform to build the app, example values: ios, android, all.",
|
|
51
|
+
"default": "all",
|
|
52
|
+
"x-priority": "important"
|
|
53
|
+
},
|
|
54
|
+
"json": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Enable JSON output, non-JSON messages will be printed to stderr",
|
|
57
|
+
"default": false
|
|
58
|
+
},
|
|
59
|
+
"auto": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "Use the current git branch and commit message for the EAS branch and update message",
|
|
62
|
+
"default": false
|
|
63
|
+
},
|
|
64
|
+
"privateKeyPath": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "File containing the PEM-encoded private key corresponding to the certificate in expo-updates' configuration. Defaults to a file named \"private-key.pem\" in the certificate's directory."
|
|
67
|
+
},
|
|
68
|
+
"interactive": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"description": "Run command in interactive mode",
|
|
71
|
+
"default": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": []
|
|
75
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { ExpoEasUpdateOptions } from './schema';
|
|
3
|
+
export interface ReactNativeUpdateOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function buildExecutor(options: ExpoEasUpdateOptions, context: ExecutorContext): AsyncGenerator<ReactNativeUpdateOutput>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const resolve_eas_1 = require("../../utils/resolve-eas");
|
|
7
|
+
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
8
|
+
const install_impl_1 = require("../install/install.impl");
|
|
9
|
+
let childProcess;
|
|
10
|
+
async function* buildExecutor(options, context) {
|
|
11
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
12
|
+
const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
|
|
13
|
+
const projectPackageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
|
|
14
|
+
const workspacePackageJson = (0, devkit_1.readJsonFile)(workspacePackageJsonPath);
|
|
15
|
+
const projectPackageJson = (0, devkit_1.readJsonFile)(projectPackageJsonPath);
|
|
16
|
+
await (0, install_impl_1.installAsync)(context.root, { packages: ['expo-updates'] });
|
|
17
|
+
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, await (0, sync_deps_impl_1.syncDeps)(context.projectName, projectPackageJson, projectPackageJsonPath, workspacePackageJson, context.projectGraph, ['expo-updates']));
|
|
18
|
+
try {
|
|
19
|
+
await runCliUpdate(context.root, projectRoot, options);
|
|
20
|
+
yield { success: true };
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
if (childProcess) {
|
|
24
|
+
childProcess.kill();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = buildExecutor;
|
|
29
|
+
function runCliUpdate(workspaceRoot, projectRoot, options) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
childProcess = (0, child_process_1.fork)((0, resolve_eas_1.resolveEas)(workspaceRoot), ['update', ...createUpdateOptions(options)], { cwd: (0, path_1.resolve)(workspaceRoot, projectRoot), env: process.env });
|
|
32
|
+
// Ensure the child process is killed when the parent exits
|
|
33
|
+
process.on('exit', () => childProcess.kill());
|
|
34
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
35
|
+
childProcess.on('error', (err) => {
|
|
36
|
+
reject(err);
|
|
37
|
+
});
|
|
38
|
+
childProcess.on('exit', (code) => {
|
|
39
|
+
if (code === 0) {
|
|
40
|
+
resolve(code);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reject(code);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function createUpdateOptions(options) {
|
|
49
|
+
return Object.keys(options).reduce((acc, k) => {
|
|
50
|
+
const v = options[k];
|
|
51
|
+
if (typeof v === 'boolean') {
|
|
52
|
+
if (k === 'interactive') {
|
|
53
|
+
if (v === false) {
|
|
54
|
+
acc.push('--non-interactive');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (v === true) {
|
|
58
|
+
// when true, does not need to pass the value true, just need to pass the flag in kebob case
|
|
59
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
acc.push(`--${(0, devkit_1.names)(k).fileName}`, v);
|
|
64
|
+
}
|
|
65
|
+
return acc;
|
|
66
|
+
}, []);
|
|
67
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
export declare function expoApplicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
+
export declare function expoApplicationGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
|
+
export default expoApplicationGenerator;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expoApplicationGeneratorInternal = exports.expoApplicationGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const js_1 = require("@nx/js");
|
|
6
|
+
const add_linting_1 = require("../../utils/add-linting");
|
|
7
|
+
const add_jest_1 = require("../../utils/add-jest");
|
|
8
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
|
+
const init_1 = require("../init/init");
|
|
10
|
+
const add_project_1 = require("./lib/add-project");
|
|
11
|
+
const create_application_files_1 = require("./lib/create-application-files");
|
|
12
|
+
const add_eas_scripts_1 = require("./lib/add-eas-scripts");
|
|
13
|
+
const add_e2e_1 = require("./lib/add-e2e");
|
|
14
|
+
const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
15
|
+
const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
|
|
16
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
17
|
+
async function expoApplicationGenerator(host, schema) {
|
|
18
|
+
return await expoApplicationGeneratorInternal(host, {
|
|
19
|
+
addPlugin: false,
|
|
20
|
+
projectNameAndRootFormat: 'derived',
|
|
21
|
+
...schema,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.expoApplicationGenerator = expoApplicationGenerator;
|
|
25
|
+
async function expoApplicationGeneratorInternal(host, schema) {
|
|
26
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
27
|
+
const tasks = [];
|
|
28
|
+
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
29
|
+
...schema,
|
|
30
|
+
skipFormat: true,
|
|
31
|
+
});
|
|
32
|
+
tasks.push(jsInitTask);
|
|
33
|
+
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
34
|
+
tasks.push(initTask);
|
|
35
|
+
if (!options.skipPackageJson) {
|
|
36
|
+
tasks.push((0, ensure_dependencies_1.ensureDependencies)(host));
|
|
37
|
+
}
|
|
38
|
+
(0, init_root_babel_config_1.initRootBabelConfig)(host);
|
|
39
|
+
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
40
|
+
(0, add_project_1.addProject)(host, options);
|
|
41
|
+
const lintTask = await (0, add_linting_1.addLinting)(host, {
|
|
42
|
+
...options,
|
|
43
|
+
projectRoot: options.appProjectRoot,
|
|
44
|
+
tsConfigPaths: [
|
|
45
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
tasks.push(lintTask);
|
|
49
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin);
|
|
50
|
+
tasks.push(jestTask);
|
|
51
|
+
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
52
|
+
tasks.push(e2eTask);
|
|
53
|
+
(0, add_eas_scripts_1.addEasScripts)(host);
|
|
54
|
+
if (!options.skipFormat) {
|
|
55
|
+
await (0, devkit_1.formatFiles)(host);
|
|
56
|
+
}
|
|
57
|
+
tasks.push(() => {
|
|
58
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
59
|
+
});
|
|
60
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
61
|
+
}
|
|
62
|
+
exports.expoApplicationGeneratorInternal = expoApplicationGeneratorInternal;
|
|
63
|
+
exports.default = expoApplicationGenerator;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "<%= displayName %>",
|
|
4
|
+
"slug": "<%= projectName %>",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"orientation": "portrait",
|
|
7
|
+
"icon": "./assets/icon.png",
|
|
8
|
+
"splash": {
|
|
9
|
+
"image": "./assets/splash.png",
|
|
10
|
+
"resizeMode": "contain",
|
|
11
|
+
"backgroundColor": "#ffffff"
|
|
12
|
+
},
|
|
13
|
+
"updates": {
|
|
14
|
+
"fallbackToCacheTimeout": 0
|
|
15
|
+
},
|
|
16
|
+
"assetBundlePatterns": [
|
|
17
|
+
"**/*"
|
|
18
|
+
],
|
|
19
|
+
"ios": {
|
|
20
|
+
"supportsTablet": true
|
|
21
|
+
},
|
|
22
|
+
"android": {
|
|
23
|
+
"adaptiveIcon": {
|
|
24
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
25
|
+
"backgroundColor": "#FFFFFF"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"web": {
|
|
29
|
+
"favicon": "./assets/favicon.png",
|
|
30
|
+
"bundler": "metro"
|
|
31
|
+
},
|
|
32
|
+
"plugins": [
|
|
33
|
+
<% if (e2eTestRunner === 'detox') { %>
|
|
34
|
+
[
|
|
35
|
+
"@config-plugins/detox",
|
|
36
|
+
{
|
|
37
|
+
"skipProguard": false,
|
|
38
|
+
"subdomains": ["10.0.2.2", "localhost"]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
<% } %>
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|