expo-module-scripts 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -3
- package/babel.config.cli.js +3 -3
- package/babel.config.utils.js +6 -0
- package/bin/expo-module-build +12 -8
- package/bin/expo-module-lint +16 -7
- package/bin/expo-module-prepare +9 -5
- package/bin/expo-module-test +19 -15
- package/bin/expo-module-tsc +1 -1
- package/createJestPreset.js +11 -11
- package/jest-preset-cli.js +2 -0
- package/jest-preset-plugin.js +2 -0
- package/jest-preset-utils.js +14 -0
- package/jest-preset.js +3 -0
- package/package.json +10 -9
- package/ts-declarations/jest-require/index.d.ts +1 -1
- package/universal/jest-preset.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,18 +10,33 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 3.
|
|
13
|
+
## 3.5.0 — 2024-04-18
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Add support for package cli and utils subpackages (like plugins). ([#27083](https://github.com/expo/expo/pull/27083) by [@wschurman](https://github.com/wschurman))
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Use appropriate version of `tsc` when executing `expo-module build` in monorepos with multiple typescript versions installed ([#27779](https://github.com/expo/expo/pull/27779) by [@peter.jozsa](https://github.com/peter.jozsa)
|
|
22
|
+
|
|
23
|
+
### 💡 Others
|
|
24
|
+
|
|
25
|
+
- Target Node 18 in the Babel CLI preset. ([#26847](https://github.com/expo/expo/pull/26847) by [@simek](https://github.com/simek))
|
|
26
|
+
- Update Babel dependencies to the latest version from `7.23` releases. ([#26525](https://github.com/expo/expo/pull/26525) by [@simek](https://github.com/simek))
|
|
27
|
+
|
|
28
|
+
## 3.4.1 - 2024-02-01
|
|
14
29
|
|
|
15
30
|
### 🐛 Bug fixes
|
|
16
31
|
|
|
17
|
-
- Use `node18` tsconfig in `expo-module-scripts` to match the dependencies. ([#26738](https://github.com/expo/expo/pull/26738)) by ([@krystofwoldrich](https://github.com/krystofwoldrich))
|
|
32
|
+
- Use `node18` tsconfig in `expo-module-scripts` to match the dependencies. ([#26738](https://github.com/expo/expo/pull/26738)) by ([@krystofwoldrich](https://github.com/krystofwoldrich)) ([#26738](https://github.com/expo/expo/pull/26738) by [@krystofwoldrich](https://github.com/krystofwoldrich))
|
|
18
33
|
|
|
19
34
|
## 3.4.0 — 2023-12-12
|
|
20
35
|
|
|
21
36
|
### 🎉 New features
|
|
22
37
|
|
|
23
38
|
- Add Node-specific Babel and Jest configurations. ([#25458](https://github.com/expo/expo/pull/25458) by [@byCedric](https://github.com/byCedric))
|
|
24
|
-
- Add Node override in ESLint config for root
|
|
39
|
+
- Add Node override in ESLint config for root configuration files. ([#25767](https://github.com/expo/expo/pull/25767) by [@byCedric](https://github.com/byCedric))
|
|
25
40
|
|
|
26
41
|
## 3.3.0 — 2023-11-14
|
|
27
42
|
|
package/babel.config.cli.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = function (api) {
|
|
|
7
7
|
{
|
|
8
8
|
modules: false, // Disable the default `modules-commonjs`, to enable lazy evaluation
|
|
9
9
|
targets: {
|
|
10
|
-
node: '
|
|
10
|
+
node: '18.0.0',
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
],
|
|
@@ -15,11 +15,11 @@ module.exports = function (api) {
|
|
|
15
15
|
],
|
|
16
16
|
plugins: [
|
|
17
17
|
require('babel-plugin-dynamic-import-node'),
|
|
18
|
-
require('@babel/plugin-
|
|
18
|
+
require('@babel/plugin-transform-export-namespace-from'),
|
|
19
19
|
[
|
|
20
20
|
require('@babel/plugin-transform-modules-commonjs'),
|
|
21
21
|
{
|
|
22
|
-
lazy:
|
|
22
|
+
lazy: () => true,
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
25
|
],
|
package/bin/expo-module-build
CHANGED
|
@@ -8,14 +8,18 @@ args=("$@")
|
|
|
8
8
|
|
|
9
9
|
# If the command is used like `yarn build plugin`, set the --build option to point to
|
|
10
10
|
# plugin/tsconfig.json
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
extra_module_build_types=("plugin" "cli" "utils")
|
|
12
|
+
for i in "${extra_module_build_types[@]}"
|
|
13
|
+
do
|
|
14
|
+
if [ "$1" == "$i" ]; then
|
|
15
|
+
# `--build` must be the first argument, so reset the array
|
|
16
|
+
args=()
|
|
17
|
+
args+=("--build")
|
|
18
|
+
args+=("$(pwd)/$i")
|
|
19
|
+
# Push the rest of the arguments minus the `plugin` arg
|
|
20
|
+
args+=("${@:2}")
|
|
21
|
+
fi
|
|
22
|
+
done
|
|
19
23
|
|
|
20
24
|
if [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then
|
|
21
25
|
args+=("--watch")
|
package/bin/expo-module-lint
CHANGED
|
@@ -7,18 +7,27 @@ script_dir="$(dirname "$0")"
|
|
|
7
7
|
args=()
|
|
8
8
|
|
|
9
9
|
# If the command is used like `yarn lint plugin` then set the target to `plugin/src`
|
|
10
|
-
|
|
10
|
+
extra_module_build_types=("plugin" "cli" "utils")
|
|
11
|
+
found_target=""
|
|
12
|
+
for i in "${extra_module_build_types[@]}"
|
|
13
|
+
do
|
|
14
|
+
if [ "$1" == "$i" ]; then
|
|
15
|
+
found_target=$i
|
|
16
|
+
fi
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
if [[ -n "$found_target" ]]; then
|
|
11
20
|
# Push the rest of the arguments minus the `plugin` arg
|
|
12
21
|
args+=("${@:2}")
|
|
13
|
-
args+=("
|
|
14
|
-
if ! [[ -d
|
|
22
|
+
args+=("$found_target/src")
|
|
23
|
+
if ! [[ -d "$found_target" ]]; then
|
|
15
24
|
# Good DX cuz Expo
|
|
16
|
-
printf "\n\033[1;33mThe
|
|
25
|
+
printf "\n\033[1;33mThe \`$found_target/src\` folder does not exist in this project; please create it and try again.\033[0m\n\n"
|
|
17
26
|
exit 0
|
|
18
27
|
fi
|
|
19
28
|
else
|
|
20
|
-
args+=("$@")
|
|
21
|
-
args+=("src")
|
|
29
|
+
args+=("$@")
|
|
30
|
+
args+=("src")
|
|
22
31
|
fi
|
|
23
32
|
|
|
24
|
-
"$script_dir/expo-module-eslint" "${args[@]}"
|
|
33
|
+
"$script_dir/expo-module-eslint" "${args[@]}"
|
package/bin/expo-module-prepare
CHANGED
|
@@ -11,8 +11,12 @@ echo "Configuring module"
|
|
|
11
11
|
"$script_dir/expo-module-configure"
|
|
12
12
|
"$script_dir/expo-module-build"
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"$
|
|
18
|
-
|
|
14
|
+
extra_module_build_types=("plugin" "cli" "utils")
|
|
15
|
+
for i in "${extra_module_build_types[@]}"
|
|
16
|
+
do
|
|
17
|
+
if [[ -d "$i" ]]; then
|
|
18
|
+
echo "Configuring $i"
|
|
19
|
+
"$script_dir/expo-module-clean" "$i"
|
|
20
|
+
"$script_dir/expo-module-build" "$i"
|
|
21
|
+
fi
|
|
22
|
+
done
|
package/bin/expo-module-test
CHANGED
|
@@ -7,22 +7,26 @@ script_dir="$(dirname "$0")"
|
|
|
7
7
|
args=("$@")
|
|
8
8
|
|
|
9
9
|
# If the command is used like `yarn test plugin`, set the --rootDir option to the `plugin` directory
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
args+=("
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
extra_module_build_types=("plugin" "cli" "utils")
|
|
11
|
+
for i in "${extra_module_build_types[@]}"
|
|
12
|
+
do
|
|
13
|
+
if [ "$1" == "$i" ]; then
|
|
14
|
+
args=()
|
|
15
|
+
args+=("--rootDir")
|
|
16
|
+
args+=("$i")
|
|
17
|
+
|
|
18
|
+
if [[ -f "$i/jest.config.js" ]]; then
|
|
19
|
+
args+=("--config")
|
|
20
|
+
args+=("$i/jest.config.js")
|
|
21
|
+
else
|
|
22
|
+
args+=("--config")
|
|
23
|
+
args+=("$(node --print "require.resolve('expo-module-scripts/jest-preset-$i.js')")")
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Push the rest of the arguments minus the `plugin` arg
|
|
27
|
+
args+=("${@:2}")
|
|
21
28
|
fi
|
|
22
|
-
|
|
23
|
-
# Push the rest of the arguments minus the `plugin` arg
|
|
24
|
-
args+=("${@:2}")
|
|
25
|
-
fi
|
|
29
|
+
done
|
|
26
30
|
|
|
27
31
|
if [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then
|
|
28
32
|
args+=("--watch")
|
package/bin/expo-module-tsc
CHANGED
package/createJestPreset.js
CHANGED
|
@@ -4,7 +4,7 @@ const findYarnWorkspaceRoot = require('find-yarn-workspace-root');
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
|
-
module.exports = function(basePreset) {
|
|
7
|
+
module.exports = function (basePreset) {
|
|
8
8
|
// Explicitly catch and log errors since Jest sometimes suppresses error messages
|
|
9
9
|
try {
|
|
10
10
|
return _createJestPreset(basePreset);
|
|
@@ -41,12 +41,12 @@ function _createBabelConfiguration() {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function _createTypeScriptConfiguration() {
|
|
44
|
-
|
|
44
|
+
const tsConfigFileName = 'tsconfig.json';
|
|
45
45
|
// The path to tsconfig.json is resolved relative to cwd
|
|
46
|
-
|
|
46
|
+
const tsConfigPath = path.resolve(tsConfigFileName);
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const jestTsConfigDirectory = path.join('.expo');
|
|
49
|
+
const jestTsConfig = {
|
|
50
50
|
extends: tsConfigPath,
|
|
51
51
|
compilerOptions: {
|
|
52
52
|
// Explicitly specify "module" so that ts-jest doesn't provide its default
|
|
@@ -59,11 +59,11 @@ function _createTypeScriptConfiguration() {
|
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
const jestTsConfigJson = JSON.stringify(jestTsConfig, null, 2);
|
|
63
63
|
// The TypeScript configuration needs to be under the project directory so that TypeScript finds
|
|
64
64
|
// type declaration packages that are installed in the project or workspace root (writing it to a
|
|
65
65
|
// temporary directory would not work, for example)
|
|
66
|
-
|
|
66
|
+
const jestTsConfigPath = path.join(jestTsConfigDirectory, 'tsconfig.jest.json');
|
|
67
67
|
|
|
68
68
|
// NOTE: remove this existsSync call once we require Node 10.12+
|
|
69
69
|
if (!fs.existsSync(jestTsConfigPath)) {
|
|
@@ -82,21 +82,21 @@ function _createTypeScriptConfiguration() {
|
|
|
82
82
|
*/
|
|
83
83
|
function _getDefaultTypeRoots(currentDirectory) {
|
|
84
84
|
currentDirectory = path.resolve(currentDirectory);
|
|
85
|
-
|
|
85
|
+
const typeRoots = ['./node_modules/@types'];
|
|
86
86
|
|
|
87
87
|
// If the TypeScript configuration is in a subdirectory of a package, find the package's directory
|
|
88
88
|
// since find-yarn-workspace-root works only from workspace packages
|
|
89
|
-
|
|
89
|
+
const packageDirectory = _findPackageDirectory(currentDirectory);
|
|
90
90
|
if (!packageDirectory) {
|
|
91
91
|
return typeRoots;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
const workspaceRootPath = findYarnWorkspaceRoot(packageDirectory);
|
|
95
95
|
|
|
96
96
|
// If the TypeScript configuration is in a Yarn workspace, workspace's npm dependencies may be
|
|
97
97
|
// installed in the workspace root. If the configuration is in a non-workspace package, its
|
|
98
98
|
// dependencies are installed only in the package's directory.
|
|
99
|
-
|
|
99
|
+
const rootPath = workspaceRootPath || packageDirectory;
|
|
100
100
|
|
|
101
101
|
let relativeAncestorDirectoryPath = '..';
|
|
102
102
|
while (currentDirectory !== rootPath) {
|
package/jest-preset-cli.js
CHANGED
package/jest-preset-plugin.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
testEnvironment: 'node',
|
|
4
|
+
testRegex: '/__tests__/.*(test|spec)\\.[jt]sx?$',
|
|
5
|
+
transform: {
|
|
6
|
+
'^.+\\.[jt]sx?$': ['babel-jest', { configFile: require.resolve('./babel.config.cli.js') }],
|
|
7
|
+
},
|
|
8
|
+
watchPlugins: [
|
|
9
|
+
require.resolve('jest-watch-typeahead/filename'),
|
|
10
|
+
require.resolve('jest-watch-typeahead/testname'),
|
|
11
|
+
],
|
|
12
|
+
// See: https://jestjs.io/docs/configuration#prettierpath-string
|
|
13
|
+
prettierPath: require.resolve('jest-snapshot-prettier'),
|
|
14
|
+
};
|
package/jest-preset.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { withWatchPlugins } = require('jest-expo/config');
|
|
2
|
+
|
|
2
3
|
const createJestPreset = require('./createJestPreset');
|
|
3
4
|
module.exports = withWatchPlugins({
|
|
4
5
|
projects: [
|
|
@@ -8,4 +9,6 @@ module.exports = withWatchPlugins({
|
|
|
8
9
|
createJestPreset(require('jest-expo/node/jest-preset')),
|
|
9
10
|
// Remove sub-watch-plugins from the preset when using multi-project runner.
|
|
10
11
|
].map(({ watchPlugins, ...config }) => config),
|
|
12
|
+
// See: https://jestjs.io/docs/configuration#prettierpath-string
|
|
13
|
+
prettierPath: require.resolve('jest-snapshot-prettier'),
|
|
11
14
|
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-module-scripts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "A private package for various tasks for Expo module packages like compiling and testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"expo-module": "bin/expo-module.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"lint": "expo-module
|
|
10
|
+
"lint": "expo-module eslint ."
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -26,24 +26,25 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/expo/expo/tree/main/packages/expo-module-scripts#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/cli": "^7.
|
|
30
|
-
"@babel/plugin-
|
|
31
|
-
"@babel/preset-env": "^7.
|
|
32
|
-
"@babel/preset-typescript": "^7.
|
|
29
|
+
"@babel/cli": "^7.23.4",
|
|
30
|
+
"@babel/plugin-transform-export-namespace-from": "^7.23.4",
|
|
31
|
+
"@babel/preset-env": "^7.23.8",
|
|
32
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
33
33
|
"@expo/npm-proofread": "^1.0.1",
|
|
34
34
|
"@testing-library/react-hooks": "^7.0.1",
|
|
35
35
|
"@tsconfig/node18": "^18.2.2",
|
|
36
36
|
"@types/jest": "^29.2.1",
|
|
37
37
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
38
|
-
"babel-preset-expo": "~
|
|
38
|
+
"babel-preset-expo": "~11.0.0",
|
|
39
39
|
"commander": "^2.19.0",
|
|
40
40
|
"eslint-config-universe": "^12.0.0",
|
|
41
41
|
"find-yarn-workspace-root": "^2.0.0",
|
|
42
42
|
"glob": "^7.1.7",
|
|
43
|
-
"jest-expo": "~
|
|
43
|
+
"jest-expo": "~51.0.0-unreleased",
|
|
44
|
+
"jest-snapshot-prettier": "npm:prettier@^2",
|
|
44
45
|
"jest-watch-typeahead": "2.2.1",
|
|
45
46
|
"ts-jest": "~29.0.4",
|
|
46
47
|
"typescript": "^5.1.3"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110"
|
|
49
50
|
}
|