@nx/expo 16.1.3 → 16.1.4
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/migrations.json +12 -0
- package/package.json +10 -10
- package/src/executors/build/build.impl.js +17 -1
- package/src/executors/build/build.impl.js.map +1 -1
- package/src/executors/build/schema.json +4 -0
- package/src/executors/download/download.impl.js +9 -6
- package/src/executors/download/download.impl.js.map +1 -1
- package/src/generators/application/application.js +8 -4
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/files/app.json.template +10 -1
- package/src/generators/application/files/package.json.template +2 -2
- package/src/generators/application/lib/add-eas-scripts.d.ts +2 -0
- package/src/generators/application/lib/add-eas-scripts.js +75 -0
- package/src/generators/application/lib/add-eas-scripts.js.map +1 -0
- package/src/generators/application/schema.json +2 -2
- package/src/generators/component/schema.json +2 -2
- package/src/generators/library/files/lib/tsconfig.json.template +1 -1
- package/src/generators/library/library.js +60 -39
- package/src/generators/library/library.js.map +1 -1
- package/src/generators/library/schema.json +1 -1
- package/src/migrations/update-14-5-1/add-eas-update-target.js +1 -1
- package/src/migrations/update-14-5-1/add-eas-update-target.js.map +1 -1
- package/src/migrations/update-16-1-4/add-detox-app-json.d.ts +5 -0
- package/src/migrations/update-16-1-4/add-detox-app-json.js +33 -0
- package/src/migrations/update-16-1-4/add-detox-app-json.js.map +1 -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 +40 -0
- package/src/migrations/update-16-1-4/update-eas-scripts.js.map +1 -0
- package/src/utils/add-jest.d.ts +1 -1
- package/src/utils/add-jest.js +4 -2
- package/src/utils/add-jest.js.map +1 -1
- package/src/utils/add-linting.d.ts +11 -2
- package/src/utils/add-linting.js +17 -12
- package/src/utils/add-linting.js.map +1 -1
package/migrations.json
CHANGED
|
@@ -53,6 +53,18 @@
|
|
|
53
53
|
"version": "16.0.0-beta.1",
|
|
54
54
|
"description": "Replace @nrwl/expo with @nx/expo",
|
|
55
55
|
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
|
56
|
+
},
|
|
57
|
+
"update-eas-scripts-16-1-4": {
|
|
58
|
+
"cli": "nx",
|
|
59
|
+
"version": "16.1.4-beta.0",
|
|
60
|
+
"description": "Update package.json eas build lifecycle scripts",
|
|
61
|
+
"implementation": "./src/migrations/update-16-1-4/update-eas-scripts"
|
|
62
|
+
},
|
|
63
|
+
"add-detox-app-json-16-1-4": {
|
|
64
|
+
"version": "16.1.4-beta.0",
|
|
65
|
+
"cli": "nx",
|
|
66
|
+
"description": "Add app.json for detox",
|
|
67
|
+
"factory": "./src/migrations/update-16-1-4/add-detox-app-json"
|
|
56
68
|
}
|
|
57
69
|
},
|
|
58
70
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "16.1.
|
|
3
|
+
"version": "16.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"main": "./index",
|
|
27
27
|
"types": "index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@nrwl/expo": "16.1.
|
|
30
|
-
"@nx/detox": "16.1.
|
|
31
|
-
"@nx/devkit": "16.1.
|
|
32
|
-
"@nx/jest": "16.1.
|
|
33
|
-
"@nx/js": "16.1.
|
|
34
|
-
"@nx/linter": "16.1.
|
|
35
|
-
"@nx/react": "16.1.
|
|
36
|
-
"@nx/webpack": "16.1.
|
|
29
|
+
"@nrwl/expo": "16.1.4",
|
|
30
|
+
"@nx/detox": "16.1.4",
|
|
31
|
+
"@nx/devkit": "16.1.4",
|
|
32
|
+
"@nx/jest": "16.1.4",
|
|
33
|
+
"@nx/js": "16.1.4",
|
|
34
|
+
"@nx/linter": "16.1.4",
|
|
35
|
+
"@nx/react": "16.1.4",
|
|
36
|
+
"@nx/webpack": "16.1.4",
|
|
37
37
|
"chalk": "^4.1.0",
|
|
38
38
|
"enhanced-resolve": "^5.8.3",
|
|
39
39
|
"fs-extra": "^11.1.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "16f098804653374057eff7e2f9565fb4c7a90b29"
|
|
59
59
|
}
|
|
@@ -5,13 +5,26 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
7
|
const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
|
|
8
|
+
const download_impl_1 = require("../download/download.impl");
|
|
9
|
+
const fs_extra_1 = require("fs-extra");
|
|
8
10
|
let childProcess;
|
|
9
11
|
function buildExecutor(options, context) {
|
|
10
12
|
return tslib_1.__asyncGenerator(this, arguments, function* buildExecutor_1() {
|
|
11
13
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
12
14
|
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
13
15
|
try {
|
|
16
|
+
// remove the output app if it already existed
|
|
17
|
+
if (options.local && options.output) {
|
|
18
|
+
(0, fs_extra_1.removeSync)(options.output);
|
|
19
|
+
}
|
|
14
20
|
yield tslib_1.__await(runCliBuild(context.root, projectRoot, options));
|
|
21
|
+
// unzip the build if it's a tar.gz
|
|
22
|
+
if (options.local && options.output && options.output.endsWith('.tar.gz')) {
|
|
23
|
+
const directoryPath = (0, path_1.normalize)(options.output).split(path_1.sep);
|
|
24
|
+
directoryPath.pop();
|
|
25
|
+
const outputDirectory = directoryPath.join(path_1.sep);
|
|
26
|
+
yield tslib_1.__await((0, download_impl_1.unzipBuild)(options.output, outputDirectory));
|
|
27
|
+
}
|
|
15
28
|
yield yield tslib_1.__await({ success: true });
|
|
16
29
|
}
|
|
17
30
|
finally {
|
|
@@ -24,7 +37,10 @@ function buildExecutor(options, context) {
|
|
|
24
37
|
exports.default = buildExecutor;
|
|
25
38
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
26
39
|
return new Promise((resolve, reject) => {
|
|
27
|
-
childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/eas-cli/bin/run'), ['build', ...createBuildOptions(options)], {
|
|
40
|
+
childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/eas-cli/bin/run'), ['build', ...createBuildOptions(options)], {
|
|
41
|
+
cwd: (0, path_1.join)(workspaceRoot, projectRoot),
|
|
42
|
+
env: process.env,
|
|
43
|
+
});
|
|
28
44
|
// Ensure the child process is killed when the parent exits
|
|
29
45
|
process.on('exit', () => childProcess.kill());
|
|
30
46
|
process.on('SIGTERM', () => childProcess.kill());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/executors/build/build.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,+
|
|
1
|
+
{"version":3,"file":"build.impl.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/executors/build/build.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAoD;AACpD,+BAA4C;AAC5C,iDAAmD;AAEnD,yFAAmF;AACnF,6DAAsE;AAGtE,uCAAsC;AAMtC,IAAI,YAA0B,CAAC;AAE/B,SAA+B,aAAa,CAC1C,OAA4B,EAC5B,OAAwB;;QAExB,MAAM,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACpE,IAAA,sDAAwB,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAEpD,I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AAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
"description": "Run build locally [experimental]",
|
|
36
36
|
"default": false
|
|
37
37
|
},
|
|
38
|
+
"output": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "Output path for local build"
|
|
41
|
+
},
|
|
38
42
|
"wait": {
|
|
39
43
|
"type": "boolean",
|
|
40
44
|
"description": "Wait for build(s) to complete",
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.copyBuildFile = exports.unzipBuild = exports.getAppExtension = exports.getBuild = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const fs_extra_1 = require("fs-extra");
|
|
7
7
|
const node_fetch_1 = require("node-fetch");
|
|
8
8
|
const util_1 = require("util");
|
|
9
9
|
const stream_1 = require("stream");
|
|
@@ -28,8 +28,8 @@ function downloadExecutor(options, context) {
|
|
|
28
28
|
if (!buildUrl) {
|
|
29
29
|
throw new Error(`No build URL found.`);
|
|
30
30
|
}
|
|
31
|
-
if (!(0,
|
|
32
|
-
(0,
|
|
31
|
+
if (!(0, fs_extra_1.existsSync)(options.output)) {
|
|
32
|
+
(0, fs_extra_1.mkdirSync)(options.output, { recursive: true });
|
|
33
33
|
}
|
|
34
34
|
const downloadFileName = buildUrl.split('/').pop();
|
|
35
35
|
const downloadFilePath = (0, path_1.join)(options.output, downloadFileName);
|
|
@@ -37,6 +37,9 @@ function downloadExecutor(options, context) {
|
|
|
37
37
|
const appExtension = getAppExtension(build.platform, downloadFileName);
|
|
38
38
|
const appName = `${(0, devkit_1.names)((_b = build.project) === null || _b === void 0 ? void 0 : _b.name).className}${appExtension}`;
|
|
39
39
|
const outputFilePath = (0, path_1.join)(options.output, appName);
|
|
40
|
+
if ((0, fs_extra_1.existsSync)(outputFilePath)) {
|
|
41
|
+
(0, fs_extra_1.removeSync)(outputFilePath);
|
|
42
|
+
}
|
|
40
43
|
if (downloadFileName.endsWith('.tar.gz')) {
|
|
41
44
|
yield tslib_1.__await(unzipBuild(downloadFilePath, options.output));
|
|
42
45
|
}
|
|
@@ -53,7 +56,7 @@ function downloadBuild(buildUrl, output) {
|
|
|
53
56
|
const response = yield (0, node_fetch_1.default)(buildUrl);
|
|
54
57
|
if (!response.ok)
|
|
55
58
|
throw new Error(`Unable to download the build ${buildUrl}. Error: ${response.statusText}`);
|
|
56
|
-
return streamPipeline(response.body, (0,
|
|
59
|
+
return streamPipeline(response.body, (0, fs_extra_1.createWriteStream)(output));
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
function getBuild(workspaceRoot, projectRoot, options) {
|
|
@@ -82,12 +85,12 @@ exports.getAppExtension = getAppExtension;
|
|
|
82
85
|
function unzipBuild(downloadFilePath, outputDirectoryPath) {
|
|
83
86
|
const unzip = (0, zlib_1.createUnzip)();
|
|
84
87
|
const extract = tar.extract(outputDirectoryPath);
|
|
85
|
-
return streamPipeline((0,
|
|
88
|
+
return streamPipeline((0, fs_extra_1.createReadStream)(downloadFilePath), unzip, extract);
|
|
86
89
|
}
|
|
87
90
|
exports.unzipBuild = unzipBuild;
|
|
88
91
|
function copyBuildFile(downloadFilePath, outputFilePath) {
|
|
89
92
|
return new Promise((resolve, reject) => {
|
|
90
|
-
(0,
|
|
93
|
+
(0, fs_extra_1.copyFile)(downloadFilePath, outputFilePath, (error) => {
|
|
91
94
|
if (error) {
|
|
92
95
|
reject(error);
|
|
93
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.impl.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/executors/download/download.impl.ts"],"names":[],"mappings":";;;;AAAA,uCAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"download.impl.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/executors/download/download.impl.ts"],"names":[],"mappings":";;;;AAAA,uCAA4D;AAC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EAAE,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;YACnD,IAAI,KAAK,EAAE;gBACT,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;iBAAM;gBACL,OAAO,EAAE,CAAC;aACX;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAbD,sCAaC"}
|
|
@@ -3,24 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.expoApplicationSchematic = exports.expoApplicationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const symlink_task_1 = require("../../utils/symlink-task");
|
|
6
7
|
const add_linting_1 = require("../../utils/add-linting");
|
|
7
8
|
const add_jest_1 = require("../../utils/add-jest");
|
|
8
|
-
const symlink_task_1 = require("../../utils/symlink-task");
|
|
9
9
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
10
10
|
const init_1 = require("../init/init");
|
|
11
11
|
const add_project_1 = require("./lib/add-project");
|
|
12
|
-
const add_detox_1 = require("./lib/add-detox");
|
|
13
12
|
const create_application_files_1 = require("./lib/create-application-files");
|
|
13
|
+
const add_eas_scripts_1 = require("./lib/add-eas-scripts");
|
|
14
|
+
const add_detox_1 = require("./lib/add-detox");
|
|
14
15
|
function expoApplicationGenerator(host, schema) {
|
|
15
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
17
|
const options = (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
17
18
|
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
18
19
|
(0, add_project_1.addProject)(host, options);
|
|
19
20
|
const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true }));
|
|
20
|
-
const lintTask = yield (0, add_linting_1.addLinting)(host,
|
|
21
|
-
|
|
21
|
+
const lintTask = yield (0, add_linting_1.addLinting)(host, Object.assign(Object.assign({}, options), { projectRoot: options.appProjectRoot, tsConfigPaths: [
|
|
22
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
23
|
+
] }));
|
|
24
|
+
const jestTask = yield (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson);
|
|
22
25
|
const detoxTask = yield (0, add_detox_1.addDetox)(host, options);
|
|
23
26
|
const symlinkTask = (0, symlink_task_1.runSymlink)(host.root, options.appProjectRoot);
|
|
27
|
+
(0, add_eas_scripts_1.addEasScripts)(host);
|
|
24
28
|
if (!options.skipFormat) {
|
|
25
29
|
yield (0, devkit_1.formatFiles)(host);
|
|
26
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AAEpB,yDAAqD;AACrD,mDAA+C;
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/application/application.ts"],"names":[],"mappings":";;;;AAAA,uCAOoB;AAEpB,2DAAsD;AACtD,yDAAqD;AACrD,mDAA+C;AAE/C,+DAA2D;AAC3D,uCAAyC;AACzC,mDAA+C;AAC/C,6EAAwE;AACxE,2DAAsD;AACtD,+CAA2C;AAG3C,SAAsB,wBAAwB,CAC5C,IAAU,EACV,MAAc;;QAEd,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,IAAA,iDAAsB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtC,IAAA,wBAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1B,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAa,EAAC,IAAI,kCAAO,OAAO,KAAE,UAAU,EAAE,IAAI,IAAG,CAAC;QAC7E,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAU,EAAC,IAAI,kCACjC,OAAO,KACV,WAAW,EAAE,OAAO,CAAC,cAAc,EACnC,aAAa,EAAE;gBACb,IAAA,0BAAiB,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC;aAC/D,IACD,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,IAAA,kBAAO,EAC5B,IAAI,EACJ,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,cAAc,EACtB,OAAO,CAAC,EAAE,EACV,OAAO,CAAC,eAAe,CACxB,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,IAAA,oBAAQ,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,IAAA,yBAAU,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAClE,IAAA,+BAAa,EAAC,IAAI,CAAC,CAAC;QAEpB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAChF,CAAC;CAAA;AAnCD,4DAmCC;AAED,kBAAe,wBAAwB,CAAC;AAC3B,QAAA,wBAAwB,GAAG,IAAA,2BAAkB,EACxD,wBAAwB,CACzB,CAAC"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"react-native-web": "*"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
|
|
15
|
-
"
|
|
14
|
+
"eas-build-pre-install": "cd <%= offsetFromRoot %> && node tools/scripts/eas-build-pre-install.mjs . <%= appProjectRoot %> && cp <%= packageLockFile %> <%= appProjectRoot %>",
|
|
15
|
+
"eas-build-post-install": "cd <%= offsetFromRoot %> && node tools/scripts/eas-build-post-install.mjs . <%= appProjectRoot %>"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEasScripts = void 0;
|
|
4
|
+
const preInstallScript = `
|
|
5
|
+
/*
|
|
6
|
+
* This script is used to patch the '@nx/expo' package to work with EAS Build.
|
|
7
|
+
* It is run as the eas-build-pre-install script in the 'package.json' of expo app.
|
|
8
|
+
* It is executed as 'node tools/scripts/eas-build-pre-install.mjs <workspace root> <project root>'
|
|
9
|
+
* It will copy the dependencies and devDependencies from the workspace package.json to project's package.json.
|
|
10
|
+
* This is needed because EAS Build does the install in project's directory and not workspace's directory.
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
|
|
15
|
+
const [workspaceRoot, projectRoot] = process.argv.slice(2);
|
|
16
|
+
if (!workspaceRoot) {
|
|
17
|
+
throw new Error('Missing workspace root');
|
|
18
|
+
}
|
|
19
|
+
if (!projectRoot) {
|
|
20
|
+
throw new Error('Missing project root');
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const workspacePackage = JSON.parse(
|
|
24
|
+
readFileSync(join(workspaceRoot, 'package.json')).toString()
|
|
25
|
+
);
|
|
26
|
+
const projectPackage = JSON.parse(
|
|
27
|
+
readFileSync(join(projectRoot, 'package.json')).toString()
|
|
28
|
+
);
|
|
29
|
+
projectPackage.dependencies = workspacePackage.dependencies;
|
|
30
|
+
projectPackage.devDependencies = workspacePackage.devDependencies;
|
|
31
|
+
writeFileSync(
|
|
32
|
+
join(projectRoot, 'package.json'),
|
|
33
|
+
JSON.stringify(projectPackage, null, 2)
|
|
34
|
+
);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error('Error reading package.json file', e);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const postInstallScript = `
|
|
40
|
+
/**
|
|
41
|
+
* This script is used to patch the '@nx/expo' package to work with EAS Build.
|
|
42
|
+
* It is run as a eas-build-post-install script in the 'package.json' of expo app.
|
|
43
|
+
* It is executed as 'node tools/scripts/eas-build-post-install.mjs <workspace root> <project root>'
|
|
44
|
+
* It will create a symlink from the project's node_modules to the workspace's node_modules.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
import { symlink, existsSync } from 'fs';
|
|
48
|
+
import { join } from 'path';
|
|
49
|
+
|
|
50
|
+
const [workspaceRoot, projectRoot] = process.argv.slice(2);
|
|
51
|
+
|
|
52
|
+
if (existsSync(join(workspaceRoot, 'node_modules'))) {
|
|
53
|
+
console.log('Symlink already exists');
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
symlink(join(projectRoot, 'node_modules'), join(workspaceRoot, 'node_modules'), 'dir', (err) => {
|
|
58
|
+
if (err) console.log(err);
|
|
59
|
+
else {
|
|
60
|
+
console.log('Symlink created');
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
`;
|
|
64
|
+
function addEasScripts(tree) {
|
|
65
|
+
const preInstallScriptPath = 'tools/scripts/eas-build-pre-install.mjs';
|
|
66
|
+
const postInstallScriptPath = 'tools/scripts/eas-build-post-install.mjs';
|
|
67
|
+
if (!tree.exists(preInstallScriptPath)) {
|
|
68
|
+
tree.write(preInstallScriptPath, preInstallScript);
|
|
69
|
+
}
|
|
70
|
+
if (!tree.exists(postInstallScriptPath)) {
|
|
71
|
+
tree.write(postInstallScriptPath, postInstallScript);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.addEasScripts = addEasScripts;
|
|
75
|
+
//# sourceMappingURL=add-eas-scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-eas-scripts.js","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-eas-scripts.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBzB,CAAC;AAEF,SAAgB,aAAa,CAAC,IAAU;IACtC,MAAM,oBAAoB,GAAG,yCAAyC,CAAC;IACvE,MAAM,qBAAqB,GAAG,0CAA0C,CAAC;IAEzE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE;QACtC,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;KACpD;IACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;KACtD;AACH,CAAC;AAVD,sCAUC"}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"description": "Create an Expo Application for Nx.",
|
|
6
6
|
"examples": [
|
|
7
7
|
{
|
|
8
|
-
"command": "g @
|
|
8
|
+
"command": "g @nx/expo:app myapp --directory=nested",
|
|
9
9
|
"description": "Generate apps/nested/myapp"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"command": "g @
|
|
12
|
+
"command": "g @nx/expo:app myapp --classComponent",
|
|
13
13
|
"description": "Use class components instead of functional components"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"examples": [
|
|
8
8
|
{
|
|
9
|
-
"command": "g @
|
|
9
|
+
"command": "g @nx/expo:component my-component --project=mylib",
|
|
10
10
|
"description": "Generate a component in the mylib library"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"command": "g @
|
|
13
|
+
"command": "g @nx/expo:component my-component --project=mylib --classComponent",
|
|
14
14
|
"description": "Generate a class component in the mylib library"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
@@ -7,6 +7,7 @@ const js_1 = require("@nx/js");
|
|
|
7
7
|
const init_1 = require("../init/init");
|
|
8
8
|
const add_linting_1 = require("../../utils/add-linting");
|
|
9
9
|
const add_jest_1 = require("../../utils/add-jest");
|
|
10
|
+
const versions_1 = require("../../utils/versions");
|
|
10
11
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
12
|
function expoLibraryGenerator(host, schema) {
|
|
12
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -14,57 +15,77 @@ function expoLibraryGenerator(host, schema) {
|
|
|
14
15
|
if (options.publishable === true && !schema.importPath) {
|
|
15
16
|
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
createFiles(host, options);
|
|
18
|
+
const tasks = [];
|
|
19
19
|
const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true, e2eTestRunner: 'none' }));
|
|
20
|
-
|
|
20
|
+
tasks.push(initTask);
|
|
21
|
+
const addProjectTask = yield addProject(host, options);
|
|
22
|
+
if (addProjectTask) {
|
|
23
|
+
tasks.push(addProjectTask);
|
|
24
|
+
}
|
|
25
|
+
createFiles(host, options);
|
|
26
|
+
const lintTask = yield (0, add_linting_1.addLinting)(host, Object.assign(Object.assign({}, options), { projectName: options.name, tsConfigPaths: [
|
|
27
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
28
|
+
] }));
|
|
29
|
+
tasks.push(lintTask);
|
|
30
|
+
const jestTask = yield (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js, options.skipPackageJson);
|
|
31
|
+
tasks.push(jestTask);
|
|
32
|
+
if (options.publishable || options.buildable) {
|
|
33
|
+
updateLibPackageNpmScope(host, options);
|
|
34
|
+
}
|
|
21
35
|
if (!options.skipTsConfig) {
|
|
22
36
|
(0, js_1.addTsConfigPath)(host, options.importPath, [
|
|
23
37
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
24
38
|
]);
|
|
25
39
|
}
|
|
26
|
-
const jestTask = yield (0, add_jest_1.addJest)(host, options.unitTestRunner, options.name, options.projectRoot, options.js);
|
|
27
|
-
if (options.publishable || options.buildable) {
|
|
28
|
-
updateLibPackageNpmScope(host, options);
|
|
29
|
-
}
|
|
30
40
|
if (!options.skipFormat) {
|
|
31
41
|
yield (0, devkit_1.formatFiles)(host);
|
|
32
42
|
}
|
|
33
|
-
return (0, devkit_1.runTasksInSerial)(
|
|
43
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
34
44
|
});
|
|
35
45
|
}
|
|
36
46
|
exports.expoLibraryGenerator = expoLibraryGenerator;
|
|
37
47
|
function addProject(host, options) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const targets = {};
|
|
50
|
+
let task;
|
|
51
|
+
if (options.publishable || options.buildable) {
|
|
52
|
+
const { rollupInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
|
|
53
|
+
const { libsDir } = (0, devkit_1.getWorkspaceLayout)(host);
|
|
54
|
+
const external = [
|
|
55
|
+
'react/jsx-runtime',
|
|
56
|
+
'react-native',
|
|
57
|
+
'react',
|
|
58
|
+
'react-dom',
|
|
59
|
+
];
|
|
60
|
+
targets.build = {
|
|
61
|
+
executor: '@nx/rollup:rollup',
|
|
62
|
+
outputs: ['{options.outputPath}'],
|
|
63
|
+
options: {
|
|
64
|
+
outputPath: `dist/${libsDir}/${options.projectDirectory}`,
|
|
65
|
+
tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
|
|
66
|
+
project: `${options.projectRoot}/package.json`,
|
|
67
|
+
entryFile: maybeJs(options, `${options.projectRoot}/src/index.ts`),
|
|
68
|
+
external,
|
|
69
|
+
rollupConfig: `@nx/react/plugins/bundle-rollup`,
|
|
70
|
+
assets: [
|
|
71
|
+
{
|
|
72
|
+
glob: `${options.projectRoot}/README.md`,
|
|
73
|
+
input: '.',
|
|
74
|
+
output: '.',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
task = yield rollupInitGenerator(host, Object.assign(Object.assign({}, options), { skipFormat: true }));
|
|
80
|
+
}
|
|
81
|
+
(0, devkit_1.addProjectConfiguration)(host, options.name, {
|
|
82
|
+
root: options.projectRoot,
|
|
83
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
84
|
+
projectType: 'library',
|
|
85
|
+
tags: options.parsedTags,
|
|
86
|
+
targets,
|
|
87
|
+
});
|
|
88
|
+
return task;
|
|
68
89
|
});
|
|
69
90
|
}
|
|
70
91
|
function updateTsConfig(tree, options) {
|
|
@@ -76,7 +97,7 @@ function updateTsConfig(tree, options) {
|
|
|
76
97
|
});
|
|
77
98
|
}
|
|
78
99
|
function createFiles(host, options) {
|
|
79
|
-
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot) }));
|
|
100
|
+
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot) }));
|
|
80
101
|
if (!options.publishable && !options.buildable) {
|
|
81
102
|
host.delete(`${options.projectRoot}/package.json`);
|
|
82
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/library/library.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"library.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/library/library.ts"],"names":[],"mappings":";;;;AAAA,uCAgBoB;AAEpB,+BAAwE;AACxE,uCAAgC;AAChC,yDAAqD;AACrD,mDAA+C;AAC/C,mDAAiD;AACjD,+DAA6E;AAG7E,SAAsB,oBAAoB,CACxC,IAAU,EACV,MAAc;;QAEd,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtD,MAAM,IAAI,KAAK,CACb,oJAAoJ,CACrJ,CAAC;SACH;QAED,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,MAAM,QAAQ,GAAG,MAAM,IAAA,cAAI,EAAC,IAAI,kCAC3B,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,aAAa,EAAE,MAAM,IACrB,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACvD,IAAI,cAAc,EAAE;YAClB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC5B;QAED,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE3B,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAU,EAAC,IAAI,kCACjC,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U,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,OAAyB,EAAE,IAAY;IACtD,OAAO,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;QAChC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,kBAAe,oBAAoB,CAAC;AACvB,QAAA,oBAAoB,GAAG,IAAA,2BAAkB,EAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-eas-update-target.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-14-5-1/add-eas-update-target.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAEpB;;GAEG;AACH,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;YAC/C,IAAI,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,OAAO,CAAC,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;gBAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAC7B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;wBACzB,QAAQ,EAAE,mBAAmB;wBAC7B,OAAO,EAAE,EAAE;qBACZ,CAAC;iBACH;
|
|
1
|
+
{"version":3,"file":"add-eas-update-target.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-14-5-1/add-eas-update-target.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAEpB;;GAEG;AACH,SAA8B,MAAM,CAAC,IAAU;;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;YAC/C,IAAI,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,OAAO,CAAC,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;gBAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAC7B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;wBACzB,QAAQ,EAAE,mBAAmB;wBAC7B,OAAO,EAAE,EAAE;qBACZ,CAAC;iBACH;gBACD,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;aAChD;SACF;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;;CACzB;AAhBD,yBAgBC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
/**
|
|
6
|
+
* Add detox plugin to app.json for expo
|
|
7
|
+
*/
|
|
8
|
+
function update(tree) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
+
projects.forEach((config) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/expo:start') {
|
|
14
|
+
(0, devkit_1.updateJson)(tree, `${config.root}/app.json`, (json) => {
|
|
15
|
+
if (!json.expo.plugins) {
|
|
16
|
+
json.expo.plugins = [];
|
|
17
|
+
}
|
|
18
|
+
json.expo.plugins.push([
|
|
19
|
+
'@config-plugins/detox',
|
|
20
|
+
{
|
|
21
|
+
skipProguard: false,
|
|
22
|
+
subdomains: ['10.0.2.2', 'localhost'],
|
|
23
|
+
},
|
|
24
|
+
]);
|
|
25
|
+
return json;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.default = update;
|
|
33
|
+
//# sourceMappingURL=add-detox-app-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-detox-app-json.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-16-1-4/add-detox-app-json.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AAEpB;;GAEG;AACH,SAA8B,MAAM,CAAC,IAAU;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;;YAC1B,IAAI,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,OAAO,CAAC,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;gBAC9D,IAAA,mBAAU,EAAC,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE;oBACnD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;wBACtB,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;qBACxB;oBACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;wBACrB,uBAAuB;wBACvB;4BACE,YAAY,EAAE,KAAK;4BACnB,UAAU,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;yBACtC;qBACF,CAAC,CAAC;oBACH,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAtBD,yBAsBC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
|
+
const add_eas_scripts_1 = require("../../generators/application/lib/add-eas-scripts");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Update app's package.json to use eas-build-pre-install and eas-build-post-install scripts.
|
|
8
|
+
*/
|
|
9
|
+
function update(tree) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
const packageManagerLockFile = {
|
|
13
|
+
npm: 'package-lock.json',
|
|
14
|
+
yarn: 'yarn.lock',
|
|
15
|
+
pnpm: 'pnpm-lock.yaml',
|
|
16
|
+
};
|
|
17
|
+
for (const [name, config] of projects.entries()) {
|
|
18
|
+
if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/expo:start') {
|
|
19
|
+
try {
|
|
20
|
+
(0, add_eas_scripts_1.addEasScripts)(tree);
|
|
21
|
+
(0, devkit_1.updateJson)(tree, (0, path_1.join)(config.root, 'package.json'), (packageJson) => {
|
|
22
|
+
var _a;
|
|
23
|
+
if ((_a = packageJson.scripts) === null || _a === void 0 ? void 0 : _a['postinstall']) {
|
|
24
|
+
delete packageJson.scripts['postinstall'];
|
|
25
|
+
}
|
|
26
|
+
const packageManager = (0, devkit_1.detectPackageManager)(tree.root);
|
|
27
|
+
const packageLockFile = packageManagerLockFile[packageManager];
|
|
28
|
+
const offset = (0, devkit_1.offsetFromRoot)(config.root);
|
|
29
|
+
packageJson.scripts = Object.assign(Object.assign({}, packageJson.scripts), { 'eas-build-pre-install': `cd ${offset} && node tools/scripts/eas-build-pre-install.mjs . ${config.root} && cp ${packageLockFile} ${config.root}`, 'eas-build-post-install': `cd ${offset} && node tools/scripts/eas-build-post-install.mjs . ${config.root}` });
|
|
30
|
+
return packageJson;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (_c) {
|
|
34
|
+
devkit_1.logger.error(`Unable to update package.json for project ${name}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.default = update;
|
|
40
|
+
//# sourceMappingURL=update-eas-scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-eas-scripts.js","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-16-1-4/update-eas-scripts.ts"],"names":[],"mappings":";;AAAA,uCAQoB;AACpB,sFAAiF;AACjF,+BAA4B;AAE5B;;GAEG;AACH,SAAwB,MAAM,CAAC,IAAU;;IACvC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,sBAAsB,GAAmC;QAC7D,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;KACvB,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;QAC/C,IAAI,CAAA,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,OAAO,CAAC,0CAAE,QAAQ,MAAK,kBAAkB,EAAE;YAC9D,IAAI;gBACF,IAAA,+BAAa,EAAC,IAAI,CAAC,CAAC;gBACpB,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE;;oBAClE,IAAI,MAAA,WAAW,CAAC,OAAO,0CAAG,aAAa,CAAC,EAAE;wBACxC,OAAO,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;qBAC3C;oBACD,MAAM,cAAc,GAAG,IAAA,6BAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACvD,MAAM,eAAe,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;oBAC/D,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBAC3C,WAAW,CAAC,OAAO,mCACd,WAAW,CAAC,OAAO,KACtB,uBAAuB,EAAE,MAAM,MAAM,sDAAsD,MAAM,CAAC,IAAI,UAAU,eAAe,IAAI,MAAM,CAAC,IAAI,EAAE,EAChJ,wBAAwB,EAAE,MAAM,MAAM,uDAAuD,MAAM,CAAC,IAAI,EAAE,GAC3G,CAAC;oBACF,OAAO,WAAW,CAAC;gBACrB,CAAC,CAAC,CAAC;aACJ;YAAC,WAAM;gBACN,eAAM,CAAC,KAAK,CAAC,6CAA6C,IAAI,GAAG,CAAC,CAAC;aACpE;SACF;KACF;AACH,CAAC;AA/BD,yBA+BC"}
|
package/src/utils/add-jest.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
|
-
export declare function addJest(host: Tree, unitTestRunner: 'jest' | 'none', projectName: string, appProjectRoot: string, js: boolean): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
2
|
+
export declare function addJest(host: Tree, unitTestRunner: 'jest' | 'none', projectName: string, appProjectRoot: string, js: boolean, skipPackageJson: boolean): Promise<import("@nx/devkit").GeneratorCallback>;
|
package/src/utils/add-jest.js
CHANGED
|
@@ -3,17 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addJest = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jest_1 = require("@nx/jest");
|
|
6
|
-
function addJest(host, unitTestRunner, projectName, appProjectRoot, js) {
|
|
6
|
+
function addJest(host, unitTestRunner, projectName, appProjectRoot, js, skipPackageJson) {
|
|
7
7
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
8
|
if (unitTestRunner !== 'jest') {
|
|
9
9
|
return () => { };
|
|
10
10
|
}
|
|
11
11
|
const jestTask = yield (0, jest_1.jestProjectGenerator)(host, {
|
|
12
|
+
js,
|
|
12
13
|
project: projectName,
|
|
13
14
|
supportTsx: true,
|
|
14
15
|
skipSerializers: true,
|
|
15
16
|
setupFile: 'none',
|
|
16
|
-
|
|
17
|
+
compiler: 'babel',
|
|
18
|
+
skipPackageJson,
|
|
17
19
|
skipFormat: true,
|
|
18
20
|
});
|
|
19
21
|
// overwrite the jest.config.ts file because react native needs to have special transform property
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../packages/expo/src/utils/add-jest.ts"],"names":[],"mappings":";;;;AACA,mCAAgD;AAEhD,SAAsB,OAAO,CAC3B,IAAU,EACV,cAA+B,EAC/B,WAAmB,EACnB,cAAsB,EACtB,EAAW;;
|
|
1
|
+
{"version":3,"file":"add-jest.js","sourceRoot":"","sources":["../../../../../packages/expo/src/utils/add-jest.ts"],"names":[],"mappings":";;;;AACA,mCAAgD;AAEhD,SAAsB,OAAO,CAC3B,IAAU,EACV,cAA+B,EAC/B,WAAmB,EACnB,cAAsB,EACtB,EAAW,EACX,eAAwB;;QAExB,IAAI,cAAc,KAAK,MAAM,EAAE;YAC7B,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;SACjB;QAED,MAAM,QAAQ,GAAG,MAAM,IAAA,2BAAoB,EAAC,IAAI,EAAE;YAChD,EAAE;YACF,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,IAAI;YAChB,eAAe,EAAE,IAAI;YACrB,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,OAAO;YACjB,eAAe;YACf,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,kGAAkG;QAClG,MAAM,UAAU,GAAG,GAAG,cAAc,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvE,MAAM,OAAO,GAAG;oBACE,WAAW;;;;;;;iDAOkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;;;;KAI5D,CAAC;QACJ,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAEhC,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAzCD,0BAyCC"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { Linter } from '@nx/linter';
|
|
2
|
-
import { Tree } from '@nx/devkit';
|
|
3
|
-
|
|
2
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
3
|
+
interface NormalizedSchema {
|
|
4
|
+
linter?: Linter;
|
|
5
|
+
projectName: string;
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
setParserOptionsProject?: boolean;
|
|
8
|
+
tsConfigPaths: string[];
|
|
9
|
+
skipPackageJson?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function addLinting(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
12
|
+
export {};
|
package/src/utils/add-linting.js
CHANGED
|
@@ -4,22 +4,24 @@ exports.addLinting = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const linter_1 = require("@nx/linter");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
8
|
-
function addLinting(host,
|
|
7
|
+
const lint_1 = require("@nx/react/src/utils/lint");
|
|
8
|
+
function addLinting(host, options) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
if (linter === linter_1.Linter.None) {
|
|
10
|
+
if (options.linter === linter_1.Linter.None) {
|
|
11
11
|
return () => { };
|
|
12
12
|
}
|
|
13
|
+
const tasks = [];
|
|
13
14
|
const lintTask = yield (0, linter_1.lintProjectGenerator)(host, {
|
|
14
|
-
linter,
|
|
15
|
-
project: projectName,
|
|
16
|
-
tsConfigPaths,
|
|
17
|
-
eslintFilePatterns: [`${
|
|
15
|
+
linter: options.linter,
|
|
16
|
+
project: options.projectName,
|
|
17
|
+
tsConfigPaths: options.tsConfigPaths,
|
|
18
|
+
eslintFilePatterns: [`${options.projectRoot}/**/*.{ts,tsx,js,jsx}`],
|
|
18
19
|
skipFormat: true,
|
|
19
|
-
|
|
20
|
+
skipPackageJson: options.skipPackageJson,
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
tasks.push(lintTask);
|
|
23
|
+
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, '.eslintrc.json'), (json) => {
|
|
24
|
+
json = (0, lint_1.extendReactEslintJson)(json);
|
|
23
25
|
json.ignorePatterns = [
|
|
24
26
|
...json.ignorePatterns,
|
|
25
27
|
'.expo',
|
|
@@ -30,8 +32,11 @@ function addLinting(host, projectName, appProjectRoot, tsConfigPaths, linter, se
|
|
|
30
32
|
];
|
|
31
33
|
return json;
|
|
32
34
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
if (!options.skipPackageJson) {
|
|
36
|
+
const installTask = yield (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
37
|
+
tasks.push(installTask);
|
|
38
|
+
}
|
|
39
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
exports.addLinting = addLinting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-linting.js","sourceRoot":"","sources":["../../../../../packages/expo/src/utils/add-linting.ts"],"names":[],"mappings":";;;;AAAA,uCAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"add-linting.js","sourceRoot":"","sources":["../../../../../packages/expo/src/utils/add-linting.ts"],"names":[],"mappings":";;;;AAAA,uCAA0D;AAC1D,uCAOoB;AACpB,mDAGkC;AAYlC,SAAsB,UAAU,C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