@expo/fingerprint 0.4.0 → 0.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/README.md +10 -0
- package/bin/cli.js +26 -5
- package/build/sourcer/Bare.js +13 -7
- package/build/sourcer/Bare.js.map +1 -1
- package/package.json +16 -9
- package/.eslintignore +0 -1
- package/CHANGELOG.md +0 -51
- package/__mocks__/@expo/spawn-async.ts +0 -30
- package/__mocks__/fs/promises.ts +0 -17
- package/__mocks__/fs.ts +0 -2
- package/__mocks__/resolve-from.ts +0 -24
- package/babel.config.js +0 -6
- package/e2e/__tests__/__snapshots__/managed-test.ts.snap +0 -193
- package/e2e/__tests__/bare-test.ts +0 -73
- package/e2e/__tests__/managed-test.ts +0 -163
- package/e2e/jest.config.js +0 -11
- package/jest.config.js +0 -10
- package/scripts/createFixture.ts +0 -81
- package/src/Dedup.ts +0 -97
- package/src/Fingerprint.ts +0 -60
- package/src/Fingerprint.types.ts +0 -110
- package/src/Options.ts +0 -81
- package/src/Sort.ts +0 -22
- package/src/__tests__/Dedup-test.ts +0 -177
- package/src/__tests__/Fingerprint-test.ts +0 -143
- package/src/__tests__/Sort-test.ts +0 -56
- package/src/hash/Hash.ts +0 -203
- package/src/hash/__tests__/Hash-test.ts +0 -238
- package/src/index.ts +0 -2
- package/src/sourcer/Bare.ts +0 -115
- package/src/sourcer/Expo.ts +0 -223
- package/src/sourcer/ExpoConfigLoader.ts +0 -84
- package/src/sourcer/PatchPackage.ts +0 -18
- package/src/sourcer/Sourcer.ts +0 -58
- package/src/sourcer/Utils.ts +0 -62
- package/src/sourcer/__tests__/Bare-test.ts +0 -88
- package/src/sourcer/__tests__/Expo-test.ts +0 -305
- package/src/sourcer/__tests__/PatchPackage-test.ts +0 -57
- package/src/sourcer/__tests__/Sourcer-test.ts +0 -21
- package/src/sourcer/__tests__/Utils-test.ts +0 -41
- package/src/sourcer/__tests__/__snapshots__/Bare-test.ts.snap +0 -21
- package/src/sourcer/__tests__/__snapshots__/Expo-test.ts.snap +0 -139
- package/src/sourcer/__tests__/fixtures/BareReactNative70Project.json +0 -47
- package/src/sourcer/__tests__/fixtures/ExpoAutolinkingAndroid.json +0 -82
- package/src/sourcer/__tests__/fixtures/ExpoAutolinkingIos.json +0 -114
- package/src/sourcer/__tests__/fixtures/ExpoManaged47Project.json +0 -6
- package/src/sourcer/__tests__/fixtures/PatchPackage.json +0 -4
- package/src/sourcer/__tests__/fixtures/RncliAutoLinking.json +0 -165
- package/src/utils/Path.ts +0 -26
- package/src/utils/Profile.ts +0 -47
- package/src/utils/__tests__/Path-test.ts +0 -36
- package/src/utils/__tests__/Profile-test.ts +0 -11
- package/tsconfig.json +0 -9
package/README.md
CHANGED
|
@@ -115,8 +115,18 @@ console.log(result);
|
|
|
115
115
|
|
|
116
116
|
## CLI Usage
|
|
117
117
|
|
|
118
|
+
### Generate a fingerprint for a given project
|
|
119
|
+
|
|
118
120
|
`npx @expo/fingerprint /path/to/projectRoot`
|
|
119
121
|
|
|
122
|
+
### Generate a fingerprint for a given project and write it to a file
|
|
123
|
+
|
|
124
|
+
`npx @expo/fingerprint /path/to/projectRoot > fingerprint.json`
|
|
125
|
+
|
|
126
|
+
### Compare a fingerprint with the current project state
|
|
127
|
+
|
|
128
|
+
`npx @expo/fingerprint /path/to/projectRoot fingerprint.json`
|
|
129
|
+
|
|
120
130
|
## Limitations
|
|
121
131
|
|
|
122
132
|
## Limited support for [config-plugins raw functions](https://docs.expo.dev/config-plugins/plugins-and-mods/#raw-functions)
|
package/bin/cli.js
CHANGED
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
|
|
4
5
|
let Fingerprint;
|
|
5
6
|
try {
|
|
6
7
|
Fingerprint = require('@expo/fingerprint');
|
|
7
|
-
} catch {}
|
|
8
|
+
} catch { }
|
|
8
9
|
if (!Fingerprint) {
|
|
9
10
|
Fingerprint = require(path.join(__dirname, '..', 'build', 'index'));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
(async () => {
|
|
13
|
-
if (process.argv.length !== 3) {
|
|
14
|
-
console.log(`Usage: ${path.basename(process.argv[1])} projectRoot`);
|
|
14
|
+
if (process.argv.length !== 3 && process.argv.length !== 4) {
|
|
15
|
+
console.log(`Usage: ${path.basename(process.argv[1])} projectRoot [fingerprintFileToDiff]`);
|
|
15
16
|
process.exit(1);
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
let comparatorFingerprint;
|
|
20
|
+
if (process.argv.length === 4) {
|
|
21
|
+
const comparator = process.argv[3];
|
|
22
|
+
try {
|
|
23
|
+
comparatorFingerprint = JSON.parse(fs.readFileSync(comparator));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
console.log(`Unable to diff with fingerprint file ${comparator}: ${e.message}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
const projectRoot = process.argv[2];
|
|
18
31
|
|
|
19
32
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
if (comparatorFingerprint) {
|
|
34
|
+
const diff = await Fingerprint.diffFingerprintChangesAsync(
|
|
35
|
+
comparatorFingerprint,
|
|
36
|
+
projectRoot
|
|
37
|
+
);
|
|
38
|
+
console.log(JSON.stringify(diff, null, 2));
|
|
39
|
+
} else {
|
|
40
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
41
|
+
console.log(JSON.stringify(fingerprint, null, 2));
|
|
42
|
+
}
|
|
22
43
|
// console.log(fingerprint.hash);
|
|
23
44
|
} catch (e) {
|
|
24
45
|
console.error('Uncaught Error', e);
|
package/build/sourcer/Bare.js
CHANGED
|
@@ -74,11 +74,16 @@ async function getRncliAutolinkingSourcesAsync(projectRoot, options) {
|
|
|
74
74
|
const reasons = ['bareRncliAutolinking'];
|
|
75
75
|
const autolinkingConfig = {};
|
|
76
76
|
for (const [depName, depData] of Object.entries(config.dependencies)) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
try {
|
|
78
|
+
stripRncliAutolinkingAbsolutePaths(depData, root);
|
|
79
|
+
const filePath = depData.root;
|
|
80
|
+
debug(`Adding react-native-cli autolinking dir - ${chalk_1.default.dim(filePath)}`);
|
|
81
|
+
results.push({ type: 'dir', filePath, reasons });
|
|
82
|
+
autolinkingConfig[depName] = depData;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
debug(chalk_1.default.red(`Error adding react-native-cli autolinking dir - ${depName}.\n${e}`));
|
|
86
|
+
}
|
|
82
87
|
}
|
|
83
88
|
results.push({
|
|
84
89
|
type: 'contents',
|
|
@@ -88,7 +93,8 @@ async function getRncliAutolinkingSourcesAsync(projectRoot, options) {
|
|
|
88
93
|
});
|
|
89
94
|
return results;
|
|
90
95
|
}
|
|
91
|
-
catch {
|
|
96
|
+
catch (e) {
|
|
97
|
+
debug(chalk_1.default.red(`Error adding react-native-cli autolinking sources.\n${e}`));
|
|
92
98
|
return [];
|
|
93
99
|
}
|
|
94
100
|
}
|
|
@@ -98,7 +104,7 @@ function stripRncliAutolinkingAbsolutePaths(dependency, root) {
|
|
|
98
104
|
const dependencyRoot = dependency.root;
|
|
99
105
|
dependency.root = path_1.default.relative(root, dependencyRoot);
|
|
100
106
|
for (const platformData of Object.values(dependency.platforms)) {
|
|
101
|
-
for (const [key, value] of Object.entries(platformData)) {
|
|
107
|
+
for (const [key, value] of Object.entries(platformData ?? {})) {
|
|
102
108
|
platformData[key] = value.startsWith?.(dependencyRoot) ? path_1.default.relative(root, value) : value;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bare.js","sourceRoot":"","sources":["../../src/sourcer/Bare.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,oDAA4B;AAC5B,kDAA0B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AAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;YAC3C,OAAO;SACR,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;KAChB;IAAC,OAAO,CAAC,EAAE;QACV,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,uDAAuD,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7E,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAnCD,0EAmCC;AAED,SAAS,kCAAkC,CAAC,UAAe,EAAE,IAAY;IACvE,IAAA,gBAAM,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IACvC,UAAU,CAAC,IAAI,GAAG,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACtD,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,MAAM,CAAM,UAAU,CAAC,SAAS,CAAC,EAAE;QACnE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAM,YAAY,IAAI,EAAE,CAAC,EAAE;YAClE,YAAY,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;SAC7F;KACF;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/fingerprint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A library to generate a fingerprint from a React Native project",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"test": "
|
|
14
|
-
"test:e2e": "yarn prepare &&
|
|
8
|
+
"build": "expo-module tsc",
|
|
9
|
+
"clean": "expo-module clean",
|
|
10
|
+
"lint": "expo-module lint",
|
|
11
|
+
"prepare": "expo-module clean && expo-module tsc",
|
|
12
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
13
|
+
"test": "expo-module test",
|
|
14
|
+
"test:e2e": "yarn run prepare && expo-module test --config e2e/jest.config.js",
|
|
15
|
+
"typecheck": "expo-module typecheck",
|
|
16
|
+
"watch": "expo-module tsc --watch"
|
|
15
17
|
},
|
|
16
18
|
"bin": {
|
|
17
19
|
"fingerprint": "bin/cli.js"
|
|
18
20
|
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin",
|
|
23
|
+
"build"
|
|
24
|
+
],
|
|
19
25
|
"keywords": [
|
|
20
26
|
"expo",
|
|
21
27
|
"react-native",
|
|
@@ -45,8 +51,9 @@
|
|
|
45
51
|
},
|
|
46
52
|
"devDependencies": {
|
|
47
53
|
"@types/find-up": "^4.0.0",
|
|
54
|
+
"expo-module-scripts": "^3.3.0",
|
|
48
55
|
"glob": "^7.1.7",
|
|
49
56
|
"temp-dir": "^2.0.0"
|
|
50
57
|
},
|
|
51
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b723f0ff34034e748e8fb1fcd0464daedb56d6c3"
|
|
52
59
|
}
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
build
|
package/CHANGELOG.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Unpublished
|
|
4
|
-
|
|
5
|
-
### 🛠 Breaking changes
|
|
6
|
-
|
|
7
|
-
### 🎉 New features
|
|
8
|
-
|
|
9
|
-
### 🐛 Bug fixes
|
|
10
|
-
|
|
11
|
-
### 💡 Others
|
|
12
|
-
|
|
13
|
-
## 0.4.0 — 2023-10-17
|
|
14
|
-
|
|
15
|
-
### 💡 Others
|
|
16
|
-
|
|
17
|
-
- Transpile for Node 18 (LTS). ([#24471](https://github.com/expo/expo/pull/24471) by [@EvanBacon](https://github.com/EvanBacon))
|
|
18
|
-
|
|
19
|
-
## 0.3.0 — 2023-09-20
|
|
20
|
-
|
|
21
|
-
### 🛠 Breaking changes
|
|
22
|
-
|
|
23
|
-
- This version includes fingerprint result breaking changes. ([#24520](https://github.com/expo/expo/pull/24520) by [@kudo](https://github.com/kudo))
|
|
24
|
-
|
|
25
|
-
### 🎉 New features
|
|
26
|
-
|
|
27
|
-
- Improve fingerprint sourcing scope for local config-plugins. ([#24520](https://github.com/expo/expo/pull/24520) by [@kudo](https://github.com/kudo))
|
|
28
|
-
|
|
29
|
-
## 0.2.0 — 2023-09-08
|
|
30
|
-
|
|
31
|
-
### 🛠 Breaking changes
|
|
32
|
-
|
|
33
|
-
- Normalize Expo config and remove `runtimeVersion` from fingerprint. Note that the fingerprint result will be changed from this version. ([#24290](https://github.com/expo/expo/pull/24290) by [@Kudo](https://github.com/kudo))
|
|
34
|
-
|
|
35
|
-
### 🎉 New features
|
|
36
|
-
|
|
37
|
-
- Added `options.ignorePaths` and **.fingerprintignore** to support. ([#24265](https://github.com/expo/expo/pull/24265) by [@Kudo](https://github.com/kudo))
|
|
38
|
-
|
|
39
|
-
## 0.1.0 — 2023-08-29
|
|
40
|
-
|
|
41
|
-
### 🛠 Breaking changes
|
|
42
|
-
|
|
43
|
-
- The fingerprint result is changed since this version. ([24097](https://github.com/expo/expo/pull/24097) by [@kudo](https://github.com/kudo))
|
|
44
|
-
|
|
45
|
-
### 🎉 New features
|
|
46
|
-
|
|
47
|
-
- Added `diffFingerprints()` to support diff for two fingerprints. ([24097](https://github.com/expo/expo/pull/24097) by [@kudo](https://github.com/kudo))
|
|
48
|
-
|
|
49
|
-
### 🐛 Bug fixes
|
|
50
|
-
|
|
51
|
-
- Fixed non-deterministic hash if packages hoisted from monorepo. ([24097](https://github.com/expo/expo/pull/24097) by [@kudo](https://github.com/kudo))
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import spawnAsync from '@expo/spawn-async';
|
|
2
|
-
import { getConfig } from 'expo/config';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
type SpawnAsyncType = typeof spawnAsync;
|
|
6
|
-
|
|
7
|
-
const origSpawnAsync = jest.requireActual('@expo/spawn-async') as SpawnAsyncType;
|
|
8
|
-
const mockSpawnAsync = jest
|
|
9
|
-
.fn()
|
|
10
|
-
.mockImplementation(
|
|
11
|
-
async (
|
|
12
|
-
command: Parameters<SpawnAsyncType>[0],
|
|
13
|
-
args: Parameters<SpawnAsyncType>[1],
|
|
14
|
-
options: Parameters<SpawnAsyncType>[2]
|
|
15
|
-
) => {
|
|
16
|
-
if (args != null && args.length >= 2 && path.parse(args[0]).name === 'ExpoConfigLoader') {
|
|
17
|
-
// For unit tests, we don't really spawn a process to execute the ExpoConfigLoader because the file system is just a memfs.
|
|
18
|
-
// Rather than that, we just call `getConfig` directly.
|
|
19
|
-
const projectRoot = args[1];
|
|
20
|
-
const config = await getConfig(projectRoot, { skipSDKVersionRequirement: true });
|
|
21
|
-
const stdout = JSON.stringify({ config, loadedModules: [] });
|
|
22
|
-
return {
|
|
23
|
-
stdout,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return origSpawnAsync(command, args, options);
|
|
27
|
-
}
|
|
28
|
-
) as SpawnAsyncType;
|
|
29
|
-
|
|
30
|
-
module.exports = mockSpawnAsync;
|
package/__mocks__/fs/promises.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { fs } from 'memfs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Further mock `fs.promises` to ensure the parent directory exists.
|
|
6
|
-
* We used to call `fs.promises.mkdtemp(path.join(os.tmpdir(), ...))`, so that we don't have to worry about os.tmpdir() exists.
|
|
7
|
-
*/
|
|
8
|
-
const origMkdtemp = fs.promises.mkdtemp;
|
|
9
|
-
fs.promises.mkdtemp = (
|
|
10
|
-
prefix: string,
|
|
11
|
-
options?: Parameters<typeof origMkdtemp>[1]
|
|
12
|
-
): ReturnType<typeof origMkdtemp> => {
|
|
13
|
-
fs.mkdirSync(path.dirname(prefix), { recursive: true });
|
|
14
|
-
return origMkdtemp(prefix, options);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
module.exports = fs.promises;
|
package/__mocks__/fs.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const resolveFrom = jest.requireActual('resolve-from');
|
|
2
|
-
|
|
3
|
-
function mockedResolveFrom(fromDirectory: string, moduleId: string, silent: boolean) {
|
|
4
|
-
if (fromDirectory === '/app' && moduleId === './package.json') {
|
|
5
|
-
// Mock call for resolveFrom('/app', './package.json')
|
|
6
|
-
return '/app/package.json';
|
|
7
|
-
} else {
|
|
8
|
-
// We should use the resolve from current projectRoot rather than mocked /app.
|
|
9
|
-
// E.g. resolveFrom('/app', 'expo/config') -> resolveFrom(__dirname, 'expo/config')
|
|
10
|
-
return silent ? resolveFrom.silent(__dirname, moduleId) : resolveFrom(__dirname, moduleId);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = jest
|
|
15
|
-
.fn()
|
|
16
|
-
.mockImplementation((fromDirectory: string, moduleId: string) =>
|
|
17
|
-
mockedResolveFrom(fromDirectory, moduleId, false)
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
module.exports.silent = jest
|
|
21
|
-
.fn()
|
|
22
|
-
.mockImplementation((fromDirectory: string, moduleId: string) =>
|
|
23
|
-
mockedResolveFrom(fromDirectory, moduleId, true)
|
|
24
|
-
);
|
package/babel.config.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`getHashSourcesAsync - managed project should match snapshot 1`] = `
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
"filePath": "node_modules/expo/android",
|
|
7
|
-
"reasons": [
|
|
8
|
-
"expoAutolinkingAndroid",
|
|
9
|
-
],
|
|
10
|
-
"type": "dir",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"filePath": "node_modules/expo-application/android",
|
|
14
|
-
"reasons": [
|
|
15
|
-
"expoAutolinkingAndroid",
|
|
16
|
-
],
|
|
17
|
-
"type": "dir",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"filePath": "node_modules/expo-constants/android",
|
|
21
|
-
"reasons": [
|
|
22
|
-
"expoAutolinkingAndroid",
|
|
23
|
-
],
|
|
24
|
-
"type": "dir",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"filePath": "node_modules/expo-error-recovery/android",
|
|
28
|
-
"reasons": [
|
|
29
|
-
"expoAutolinkingAndroid",
|
|
30
|
-
],
|
|
31
|
-
"type": "dir",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"filePath": "node_modules/expo-file-system/android",
|
|
35
|
-
"reasons": [
|
|
36
|
-
"expoAutolinkingAndroid",
|
|
37
|
-
],
|
|
38
|
-
"type": "dir",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"filePath": "node_modules/expo-font/android",
|
|
42
|
-
"reasons": [
|
|
43
|
-
"expoAutolinkingAndroid",
|
|
44
|
-
],
|
|
45
|
-
"type": "dir",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"filePath": "node_modules/expo-keep-awake/android",
|
|
49
|
-
"reasons": [
|
|
50
|
-
"expoAutolinkingAndroid",
|
|
51
|
-
],
|
|
52
|
-
"type": "dir",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"filePath": "node_modules/expo-modules-core/android",
|
|
56
|
-
"reasons": [
|
|
57
|
-
"expoAutolinkingAndroid",
|
|
58
|
-
],
|
|
59
|
-
"type": "dir",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"contents": "{"modules":[{"packageName":"expo","packageVersion":"47.0.8","projects":[{"name":"expo","sourceDir":"node_modules/expo/android"}],"modules":[]},{"packageName":"expo-application","packageVersion":"5.0.1","projects":[{"name":"expo-application","sourceDir":"node_modules/expo-application/android"}],"modules":[]},{"packageName":"expo-constants","packageVersion":"14.0.2","projects":[{"name":"expo-constants","sourceDir":"node_modules/expo-constants/android"}],"modules":[]},{"packageName":"expo-error-recovery","packageVersion":"4.0.1","projects":[{"name":"expo-error-recovery","sourceDir":"node_modules/expo-error-recovery/android"}],"modules":[]},{"packageName":"expo-file-system","packageVersion":"15.1.1","projects":[{"name":"expo-file-system","sourceDir":"node_modules/expo-file-system/android"}],"modules":[]},{"packageName":"expo-font","packageVersion":"11.0.1","projects":[{"name":"expo-font","sourceDir":"node_modules/expo-font/android"}],"modules":[]},{"packageName":"expo-keep-awake","packageVersion":"11.0.1","projects":[{"name":"expo-keep-awake","sourceDir":"node_modules/expo-keep-awake/android"}],"modules":[]},{"packageName":"expo-modules-core","packageVersion":"1.0.3","projects":[{"name":"expo-modules-core","sourceDir":"node_modules/expo-modules-core/android"}],"modules":[]}]}",
|
|
63
|
-
"id": "expoAutolinkingConfig:android",
|
|
64
|
-
"reasons": [
|
|
65
|
-
"expoAutolinkingAndroid",
|
|
66
|
-
],
|
|
67
|
-
"type": "contents",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"filePath": "node_modules/expo",
|
|
71
|
-
"reasons": [
|
|
72
|
-
"expoAutolinkingIos",
|
|
73
|
-
],
|
|
74
|
-
"type": "dir",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"filePath": "node_modules/expo-application/ios",
|
|
78
|
-
"reasons": [
|
|
79
|
-
"expoAutolinkingIos",
|
|
80
|
-
],
|
|
81
|
-
"type": "dir",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"filePath": "node_modules/expo-constants/ios",
|
|
85
|
-
"reasons": [
|
|
86
|
-
"expoAutolinkingIos",
|
|
87
|
-
],
|
|
88
|
-
"type": "dir",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"filePath": "node_modules/expo-error-recovery/ios",
|
|
92
|
-
"reasons": [
|
|
93
|
-
"expoAutolinkingIos",
|
|
94
|
-
],
|
|
95
|
-
"type": "dir",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"filePath": "node_modules/expo-file-system/ios",
|
|
99
|
-
"reasons": [
|
|
100
|
-
"expoAutolinkingIos",
|
|
101
|
-
],
|
|
102
|
-
"type": "dir",
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"filePath": "node_modules/expo-font/ios",
|
|
106
|
-
"reasons": [
|
|
107
|
-
"expoAutolinkingIos",
|
|
108
|
-
],
|
|
109
|
-
"type": "dir",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"filePath": "node_modules/expo-keep-awake/ios",
|
|
113
|
-
"reasons": [
|
|
114
|
-
"expoAutolinkingIos",
|
|
115
|
-
],
|
|
116
|
-
"type": "dir",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"filePath": "node_modules/expo-modules-core",
|
|
120
|
-
"reasons": [
|
|
121
|
-
"expoAutolinkingIos",
|
|
122
|
-
],
|
|
123
|
-
"type": "dir",
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
"contents": "{"modules":[{"packageName":"expo","packageVersion":"47.0.8","pods":[{"podName":"Expo","podspecDir":"node_modules/expo"}],"swiftModuleNames":["Expo"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-application","packageVersion":"5.0.1","pods":[{"podName":"EXApplication","podspecDir":"node_modules/expo-application/ios"}],"swiftModuleNames":["EXApplication"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-constants","packageVersion":"14.0.2","pods":[{"podName":"EXConstants","podspecDir":"node_modules/expo-constants/ios"}],"swiftModuleNames":["EXConstants"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-error-recovery","packageVersion":"4.0.1","pods":[{"podName":"EXErrorRecovery","podspecDir":"node_modules/expo-error-recovery/ios"}],"swiftModuleNames":["EXErrorRecovery"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-file-system","packageVersion":"15.1.1","pods":[{"podName":"EXFileSystem","podspecDir":"node_modules/expo-file-system/ios"}],"swiftModuleNames":["EXFileSystem"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-font","packageVersion":"11.0.1","pods":[{"podName":"EXFont","podspecDir":"node_modules/expo-font/ios"}],"swiftModuleNames":["EXFont"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-keep-awake","packageVersion":"11.0.1","pods":[{"podName":"ExpoKeepAwake","podspecDir":"node_modules/expo-keep-awake/ios"}],"swiftModuleNames":["ExpoKeepAwake"],"modules":["KeepAwakeModule"],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false},{"packageName":"expo-modules-core","packageVersion":"1.0.3","pods":[{"podName":"ExpoModulesCore","podspecDir":"node_modules/expo-modules-core"}],"swiftModuleNames":["ExpoModulesCore"],"modules":[],"appDelegateSubscribers":[],"reactDelegateHandlers":[],"debugOnly":false}]}",
|
|
127
|
-
"id": "expoAutolinkingConfig:ios",
|
|
128
|
-
"reasons": [
|
|
129
|
-
"expoAutolinkingIos",
|
|
130
|
-
],
|
|
131
|
-
"type": "contents",
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"contents": "{"android":{"adaptiveIcon":{"backgroundColor":"#FFFFFF","foregroundImage":"./assets/adaptive-icon.png"}},"assetBundlePatterns":["**/*"],"icon":"./assets/icon.png","ios":{"supportsTablet":true},"name":"fingerprint-e2e-managed","orientation":"portrait","platforms":["android","ios"],"sdkVersion":"47.0.0","slug":"fingerprint-e2e-managed","splash":{"backgroundColor":"#ffffff","image":"./assets/splash.png","resizeMode":"contain"},"updates":{"fallbackToCacheTimeout":0},"userInterfaceStyle":"light","version":"1.0.0","web":{"favicon":"./assets/favicon.png"}}",
|
|
135
|
-
"id": "expoConfig",
|
|
136
|
-
"reasons": [
|
|
137
|
-
"expoConfig",
|
|
138
|
-
],
|
|
139
|
-
"type": "contents",
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"filePath": "./assets/icon.png",
|
|
143
|
-
"reasons": [
|
|
144
|
-
"expoConfigExternalFile",
|
|
145
|
-
],
|
|
146
|
-
"type": "file",
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"filePath": "./assets/adaptive-icon.png",
|
|
150
|
-
"reasons": [
|
|
151
|
-
"expoConfigExternalFile",
|
|
152
|
-
],
|
|
153
|
-
"type": "file",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"filePath": "./assets/splash.png",
|
|
157
|
-
"reasons": [
|
|
158
|
-
"expoConfigExternalFile",
|
|
159
|
-
],
|
|
160
|
-
"type": "file",
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"filePath": ".gitignore",
|
|
164
|
-
"reasons": [
|
|
165
|
-
"bareGitIgnore",
|
|
166
|
-
],
|
|
167
|
-
"type": "file",
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"contents": "{"start":"expo start","android":"expo start --android","ios":"expo start --ios","web":"expo start --web"}",
|
|
171
|
-
"id": "packageJson:scripts",
|
|
172
|
-
"reasons": [
|
|
173
|
-
"packageJson:scripts",
|
|
174
|
-
],
|
|
175
|
-
"type": "contents",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"filePath": "node_modules/expo",
|
|
179
|
-
"reasons": [
|
|
180
|
-
"bareRncliAutolinking",
|
|
181
|
-
],
|
|
182
|
-
"type": "dir",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
"contents": "{"expo":{"root":"node_modules/expo","name":"expo","platforms":{"ios":{"podspecPath":"node_modules/expo/Expo.podspec","configurations":[],"scriptPhases":[]},"android":{"sourceDir":"node_modules/expo/android","packageImportPath":"import expo.modules.ExpoModulesPackage;","packageInstance":"new ExpoModulesPackage()","buildTypes":[],"componentDescriptors":[],"androidMkPath":"node_modules/expo/android/build/generated/source/codegen/jni/Android.mk","cmakeListsPath":"node_modules/expo/android/build/generated/source/codegen/jni/CMakeLists.txt"}}}}",
|
|
186
|
-
"id": "rncliAutolinkingConfig",
|
|
187
|
-
"reasons": [
|
|
188
|
-
"bareRncliAutolinking",
|
|
189
|
-
],
|
|
190
|
-
"type": "contents",
|
|
191
|
-
},
|
|
192
|
-
]
|
|
193
|
-
`;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import spawnAsync from '@expo/spawn-async';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import rimraf from 'rimraf';
|
|
6
|
-
|
|
7
|
-
import { createProjectHashAsync } from '../../src/Fingerprint';
|
|
8
|
-
|
|
9
|
-
jest.mock('../../src/sourcer/ExpoConfigLoader', () => ({
|
|
10
|
-
// Mock the getExpoConfigLoaderPath to use the built version rather than the typescript version from src
|
|
11
|
-
getExpoConfigLoaderPath: jest.fn(() =>
|
|
12
|
-
path.resolve(__dirname, '..', '..', 'build', 'sourcer', 'ExpoConfigLoader.js')
|
|
13
|
-
),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
describe('bare project test', () => {
|
|
17
|
-
jest.setTimeout(600000);
|
|
18
|
-
const tmpDir = os.tmpdir();
|
|
19
|
-
const projectName = 'fingerprint-e2e-bare';
|
|
20
|
-
const projectRoot = path.join(tmpDir, projectName);
|
|
21
|
-
|
|
22
|
-
beforeAll(async () => {
|
|
23
|
-
rimraf.sync(projectRoot);
|
|
24
|
-
await spawnAsync('npx', ['create-expo-app', '-t', 'bare-minimum', projectName], {
|
|
25
|
-
stdio: 'inherit',
|
|
26
|
-
cwd: tmpDir,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
afterAll(async () => {
|
|
31
|
-
rimraf.sync(projectRoot);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should have same hash after adding js only library', async () => {
|
|
35
|
-
const hash = await createProjectHashAsync(projectRoot);
|
|
36
|
-
await spawnAsync('npm', ['install', '--save', '@react-navigation/core'], {
|
|
37
|
-
stdio: 'ignore',
|
|
38
|
-
cwd: projectRoot,
|
|
39
|
-
});
|
|
40
|
-
const hash2 = await createProjectHashAsync(projectRoot);
|
|
41
|
-
expect(hash).toBe(hash2);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should have different hash after adding native library', async () => {
|
|
45
|
-
const hash = await createProjectHashAsync(projectRoot);
|
|
46
|
-
await spawnAsync('npm', ['install', '--save', 'react-native-reanimated'], {
|
|
47
|
-
stdio: 'ignore',
|
|
48
|
-
cwd: projectRoot,
|
|
49
|
-
});
|
|
50
|
-
const hash2 = await createProjectHashAsync(projectRoot);
|
|
51
|
-
expect(hash).not.toBe(hash2);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should have different hash after changing podfile', async () => {
|
|
55
|
-
const hash = await createProjectHashAsync(projectRoot);
|
|
56
|
-
const filePath = path.join(projectRoot, 'ios', 'Podfile');
|
|
57
|
-
let contents = await fs.readFile(filePath, 'utf8');
|
|
58
|
-
contents = contents.replace(/(:fabric_enabled)\s*=>.*,$/gm, '$1 => true,');
|
|
59
|
-
await fs.writeFile(filePath, contents);
|
|
60
|
-
const hash2 = await createProjectHashAsync(projectRoot);
|
|
61
|
-
expect(hash).not.toBe(hash2);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should have same hash for specifing android platform after changing podfile', async () => {
|
|
65
|
-
const hash = await createProjectHashAsync(projectRoot, { platforms: ['android'] });
|
|
66
|
-
const filePath = path.join(projectRoot, 'ios', 'Podfile');
|
|
67
|
-
let contents = await fs.readFile(filePath, 'utf8');
|
|
68
|
-
contents = contents.replace(/(:fabric_enabled)\s*=>.*$/gm, '$1 => false,');
|
|
69
|
-
await fs.writeFile(filePath, contents);
|
|
70
|
-
const hash2 = await createProjectHashAsync(projectRoot, { platforms: ['android'] });
|
|
71
|
-
expect(hash).toBe(hash2);
|
|
72
|
-
});
|
|
73
|
-
});
|