@nx/expo 19.2.0-beta.3 → 19.2.0-beta.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 CHANGED
@@ -71,6 +71,12 @@
71
71
  "cli": "nx",
72
72
  "description": "Change webpack to metro in expo projects",
73
73
  "factory": "./src/migrations/update-19-0-0/change-webpack-to-metro"
74
+ },
75
+ "update-19-2-0-remove-webpack-config": {
76
+ "version": "19.2.0-beta.2",
77
+ "cli": "nx",
78
+ "description": "Remove deprecated webpack.config.js",
79
+ "factory": "./src/migrations/update-19-2-0/remove-deprecated-webpack-config"
74
80
  }
75
81
  },
76
82
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/expo",
3
- "version": "19.2.0-beta.3",
3
+ "version": "19.2.0-beta.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": [
@@ -28,7 +28,7 @@
28
28
  "main": "./index",
29
29
  "types": "index.d.ts",
30
30
  "dependencies": {
31
- "@nx/devkit": "19.2.0-beta.3",
31
+ "@nx/devkit": "19.2.0-beta.4",
32
32
  "chalk": "^4.1.0",
33
33
  "enhanced-resolve": "^5.8.3",
34
34
  "fs-extra": "^11.1.0",
@@ -37,13 +37,13 @@
37
37
  "node-fetch": "^2.6.7",
38
38
  "tslib": "^2.3.0",
39
39
  "tsconfig-paths": "^4.1.2",
40
- "@nx/jest": "19.2.0-beta.3",
41
- "@nx/js": "19.2.0-beta.3",
42
- "@nx/eslint": "19.2.0-beta.3",
43
- "@nx/react": "19.2.0-beta.3",
44
- "@nx/web": "19.2.0-beta.3",
45
- "@nx/webpack": "19.2.0-beta.3",
46
- "@nrwl/expo": "19.2.0-beta.3"
40
+ "@nx/jest": "19.2.0-beta.4",
41
+ "@nx/js": "19.2.0-beta.4",
42
+ "@nx/eslint": "19.2.0-beta.4",
43
+ "@nx/react": "19.2.0-beta.4",
44
+ "@nx/web": "19.2.0-beta.4",
45
+ "@nx/webpack": "19.2.0-beta.4",
46
+ "@nrwl/expo": "19.2.0-beta.4"
47
47
  },
48
48
  "executors": "./executors.json",
49
49
  "ng-update": {
@@ -17,7 +17,7 @@ async function expoInitGeneratorInternal(host, schema) {
17
17
  schema.addPlugin ??= addPluginDefault;
18
18
  (0, add_git_ignore_entry_1.addGitIgnoreEntry)(host);
19
19
  if (schema.addPlugin) {
20
- await (0, add_plugin_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/expo/plugin', plugin_1.createNodes, {
20
+ await (0, add_plugin_1.addPluginV1)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/expo/plugin', plugin_1.createNodes, {
21
21
  startTargetName: ['start', 'expo:start', 'expo-start'],
22
22
  buildTargetName: ['build', 'expo:build', 'expo-build'],
23
23
  prebuildTargetName: ['prebuild', 'expo:prebuild', 'expo-prebuild'],
@@ -16,12 +16,14 @@ async function update(tree) {
16
16
  if (config.targets['export-web']) {
17
17
  config.targets['export-web'].options.bundler = 'metro';
18
18
  }
19
- (0, devkit_1.updateJson)(tree, `${config.root}/app.json`, (appJson) => {
20
- if (appJson.expo?.web) {
21
- appJson.expo.web.bundler = 'metro';
22
- }
23
- return appJson;
24
- });
19
+ if (tree.exists(`${config.root}/app.json`)) {
20
+ (0, devkit_1.updateJson)(tree, `${config.root}/app.json`, (appJson) => {
21
+ if (appJson.expo?.web) {
22
+ appJson.expo.web.bundler = 'metro';
23
+ }
24
+ return appJson;
25
+ });
26
+ }
25
27
  }
26
28
  (0, devkit_1.updateProjectConfiguration)(tree, name, config);
27
29
  }
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * This function removes the deprecated webpack.config.js file from projects that use the expo:start executor
4
+ * @param tree
5
+ */
6
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const path_1 = require("path");
5
+ /**
6
+ * This function removes the deprecated webpack.config.js file from projects that use the expo:start executor
7
+ * @param tree
8
+ */
9
+ async function update(tree) {
10
+ const projects = (0, devkit_1.getProjects)(tree);
11
+ for (const [_, config] of projects.entries()) {
12
+ if (config.targets?.['start']?.executor === '@nx/expo:start') {
13
+ if (tree.exists((0, path_1.join)(config.root, 'webpack.config.js'))) {
14
+ tree.delete((0, path_1.join)(config.root, 'webpack.config.js'));
15
+ }
16
+ }
17
+ }
18
+ }
19
+ exports.default = update;
@@ -1,57 +0,0 @@
1
- const createExpoWebpackConfigAsync = require('@expo/webpack-config');
2
- const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
3
- const { resolve } = require('path');
4
-
5
- /**
6
- * @deprecated use bundler: 'metro' instead
7
- */
8
- module.exports = async function (env, argv) {
9
- const config = await createExpoWebpackConfigAsync(env, argv);
10
-
11
- // Customize the config before returning it.
12
- // add additional rule to load files under libs
13
- const rules = config.module.rules.find((rule) =>
14
- Array.isArray(rule.oneOf)
15
- )?.oneOf;
16
- if (rules) {
17
- rules.push({
18
- test: /\.(mjs|[jt]sx?)$/,
19
- exclude: /node_modules/,
20
- use: {
21
- loader: require.resolve('@nx/webpack/src/utils/web-babel-loader.js'),
22
- options: {
23
- presets: [
24
- [
25
- '@nx/react/babel',
26
- {
27
- runtime: 'automatic',
28
- },
29
- ],
30
- ],
31
- },
32
- },
33
- });
34
- }
35
-
36
- if (!config.resolve) {
37
- config.resolve = {};
38
- }
39
- if (!config.resolve.plugins) {
40
- config.resolve.plugins = [];
41
- }
42
- const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
43
- const tsConfigPath = resolve(__dirname, 'tsconfig.json');
44
- config.resolve.plugins.push(
45
- new TsconfigPathsPlugin({
46
- configFile: tsConfigPath,
47
- extensions,
48
- })
49
- );
50
- config.resolve.fallback = {
51
- ...config.resolve.fallback,
52
- crypto: require.resolve('crypto-browserify'),
53
- stream: require.resolve('stream-browserify'),
54
- };
55
-
56
- return config;
57
- };