@expo/fingerprint 0.11.1 → 0.11.2
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 +2 -2
- package/bin/cli.js +1 -53
- package/build/Fingerprint.js +5 -5
- package/build/Fingerprint.js.map +1 -1
- package/build/Fingerprint.types.d.ts +27 -8
- package/build/Fingerprint.types.js.map +1 -1
- package/cli/build/cli.d.ts +2 -0
- package/cli/build/cli.js +96 -0
- package/cli/build/commands/diffFingerprints.d.ts +2 -0
- package/cli/build/commands/diffFingerprints.js +69 -0
- package/cli/build/commands/generateFingerprint.d.ts +2 -0
- package/cli/build/commands/generateFingerprint.js +82 -0
- package/cli/build/runLegacyCLIAsync.d.ts +1 -0
- package/cli/build/runLegacyCLIAsync.js +46 -0
- package/cli/build/utils/args.d.ts +17 -0
- package/cli/build/utils/args.js +85 -0
- package/cli/build/utils/errors.d.ts +10 -0
- package/cli/build/utils/errors.js +41 -0
- package/cli/build/utils/log.d.ts +11 -0
- package/cli/build/utils/log.js +54 -0
- package/cli/build/utils/readFingerprintFileAsync.d.ts +2 -0
- package/cli/build/utils/readFingerprintFileAsync.js +15 -0
- package/cli/build/utils/withConsoleDisabledAsync.d.ts +1 -0
- package/cli/build/utils/withConsoleDisabledAsync.js +24 -0
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -214,10 +214,10 @@ const config = {
|
|
|
214
214
|
module.exports = config;
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
If you are using `@expo/fingerprint` through `expo
|
|
217
|
+
If you are using `@expo/fingerprint` through `expo` (where `@expo/fingerprint` is installed as a transitive dependency), you can import fingerprint from `expo/fingerprint`:
|
|
218
218
|
|
|
219
219
|
```js
|
|
220
|
-
/** @type {import('expo
|
|
220
|
+
/** @type {import('expo/fingerprint').Config} */
|
|
221
221
|
const config = {
|
|
222
222
|
sourceSkips: [
|
|
223
223
|
'ExpoConfigRuntimeVersionIfString',
|
package/bin/cli.js
CHANGED
|
@@ -1,55 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
Fingerprint = require('@expo/fingerprint');
|
|
8
|
-
} catch { }
|
|
9
|
-
if (!Fingerprint) {
|
|
10
|
-
Fingerprint = require(path.join(__dirname, '..', 'build', 'index'));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
(async () => {
|
|
14
|
-
if (process.argv.length !== 3 && process.argv.length !== 4) {
|
|
15
|
-
console.log(`Usage: ${path.basename(process.argv[1])} projectRoot [fingerprintFileToDiff]`);
|
|
16
|
-
process.exit(1);
|
|
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
|
-
|
|
30
|
-
const projectRoot = process.argv[2];
|
|
31
|
-
|
|
32
|
-
const options = {
|
|
33
|
-
debug: !!process.env.DEBUG,
|
|
34
|
-
useRNCoreAutolinkingFromExpo: process.env.USE_RNCORE_AUTOLINKING_FROM_EXPO
|
|
35
|
-
? ['1', 'true'].includes(process.env.USE_RNCORE_AUTOLINKING_FROM_EXPO)
|
|
36
|
-
: undefined,
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
if (comparatorFingerprint) {
|
|
40
|
-
const diff = await Fingerprint.diffFingerprintChangesAsync(
|
|
41
|
-
comparatorFingerprint,
|
|
42
|
-
projectRoot,
|
|
43
|
-
options
|
|
44
|
-
);
|
|
45
|
-
console.log(JSON.stringify(diff, null, 2));
|
|
46
|
-
} else {
|
|
47
|
-
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot, options);
|
|
48
|
-
console.log(JSON.stringify(fingerprint, null, 2));
|
|
49
|
-
}
|
|
50
|
-
// console.log(fingerprint.hash);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.error('Uncaught Error', e);
|
|
53
|
-
process.exit(1);
|
|
54
|
-
}
|
|
55
|
-
})();
|
|
3
|
+
require('../cli/build/cli.js');
|
package/build/Fingerprint.js
CHANGED
|
@@ -50,26 +50,26 @@ function diffFingerprints(fingerprint1, fingerprint2) {
|
|
|
50
50
|
const compareResult = (0, Sort_1.compareSource)(source1, source2);
|
|
51
51
|
if (compareResult === 0) {
|
|
52
52
|
if (source1.hash !== source2.hash) {
|
|
53
|
-
diff.push({ op: 'changed',
|
|
53
|
+
diff.push({ op: 'changed', beforeSource: source1, afterSource: source2 });
|
|
54
54
|
}
|
|
55
55
|
++index1;
|
|
56
56
|
++index2;
|
|
57
57
|
}
|
|
58
58
|
else if (compareResult < 0) {
|
|
59
|
-
diff.push({ op: 'removed',
|
|
59
|
+
diff.push({ op: 'removed', removedSource: source1 });
|
|
60
60
|
++index1;
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
diff.push({ op: 'added',
|
|
63
|
+
diff.push({ op: 'added', addedSource: source2 });
|
|
64
64
|
++index2;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
while (index1 < fingerprint1.sources.length) {
|
|
68
|
-
diff.push({ op: 'removed',
|
|
68
|
+
diff.push({ op: 'removed', removedSource: fingerprint1.sources[index1] });
|
|
69
69
|
++index1;
|
|
70
70
|
}
|
|
71
71
|
while (index2 < fingerprint2.sources.length) {
|
|
72
|
-
diff.push({ op: 'added',
|
|
72
|
+
diff.push({ op: 'added', addedSource: fingerprint2.sources[index2] });
|
|
73
73
|
++index2;
|
|
74
74
|
}
|
|
75
75
|
return diff;
|
package/build/Fingerprint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|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,EAAE,MAAM,CAAC;SACV;aAAM,IAAI,aAAa,GAAG,CAAC,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;YACrD,EAAE,MAAM,CAAC;SACV;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;YACjD,EAAE,MAAM,CAAC;SACV;KACF;IAED,OAAO,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE;QAC3C,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1E,EAAE,MAAM,CAAC;KACV;IACD,OAAO,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE;QAC3C,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACtE,EAAE,MAAM,CAAC;KACV;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAtCD,4CAsCC"}
|
|
@@ -23,19 +23,38 @@ export interface Fingerprint {
|
|
|
23
23
|
*/
|
|
24
24
|
hash: string;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type FingerprintDiffItem = {
|
|
27
27
|
/**
|
|
28
28
|
* The operation type of the diff item.
|
|
29
29
|
*/
|
|
30
|
-
op: 'added'
|
|
30
|
+
op: 'added';
|
|
31
31
|
/**
|
|
32
|
-
* The source
|
|
33
|
-
* - When type is 'added', the source is the new source.
|
|
34
|
-
* - When type is 'removed', the source is the old source.
|
|
35
|
-
* - When type is 'changed', the source is the new source.
|
|
32
|
+
* The added source.
|
|
36
33
|
*/
|
|
37
|
-
|
|
38
|
-
}
|
|
34
|
+
addedSource: FingerprintSource;
|
|
35
|
+
} | {
|
|
36
|
+
/**
|
|
37
|
+
* The operation type of the diff item.
|
|
38
|
+
*/
|
|
39
|
+
op: 'removed';
|
|
40
|
+
/**
|
|
41
|
+
* The removed source.
|
|
42
|
+
*/
|
|
43
|
+
removedSource: FingerprintSource;
|
|
44
|
+
} | {
|
|
45
|
+
/**
|
|
46
|
+
* The operation type of the diff item.
|
|
47
|
+
*/
|
|
48
|
+
op: 'changed';
|
|
49
|
+
/**
|
|
50
|
+
* The source before.
|
|
51
|
+
*/
|
|
52
|
+
beforeSource: FingerprintSource;
|
|
53
|
+
/**
|
|
54
|
+
* The source after.
|
|
55
|
+
*/
|
|
56
|
+
afterSource: FingerprintSource;
|
|
57
|
+
};
|
|
39
58
|
export type Platform = 'android' | 'ios';
|
|
40
59
|
export interface Options {
|
|
41
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fingerprint.types.js","sourceRoot":"","sources":["../src/Fingerprint.types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Fingerprint.types.js","sourceRoot":"","sources":["../src/Fingerprint.types.ts"],"names":[],"mappings":";;AAiPA,YAAY"}
|
package/cli/build/cli.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const arg_1 = __importDefault(require("arg"));
|
|
31
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
32
|
+
const debug_1 = __importDefault(require("debug"));
|
|
33
|
+
const getenv_1 = require("getenv");
|
|
34
|
+
const runLegacyCLIAsync_1 = require("./runLegacyCLIAsync");
|
|
35
|
+
const errors_1 = require("./utils/errors");
|
|
36
|
+
const Log = __importStar(require("./utils/log"));
|
|
37
|
+
// Setup before requiring `debug`.
|
|
38
|
+
if ((0, getenv_1.boolish)('EXPO_DEBUG', false)) {
|
|
39
|
+
debug_1.default.enable('@expo/fingeprint:*');
|
|
40
|
+
}
|
|
41
|
+
else if (debug_1.default.enabled('@expo/fingeprint:')) {
|
|
42
|
+
process.env.EXPO_DEBUG = '1';
|
|
43
|
+
}
|
|
44
|
+
const commands = {
|
|
45
|
+
// Add a new command here
|
|
46
|
+
'fingerprint:generate': () => import('./commands/generateFingerprint.js').then((i) => i.generateFingerprintAsync),
|
|
47
|
+
'fingerprint:diff': () => import('./commands/diffFingerprints.js').then((i) => i.diffFingerprintsAsync),
|
|
48
|
+
};
|
|
49
|
+
const args = (0, arg_1.default)({
|
|
50
|
+
// Types
|
|
51
|
+
'--version': Boolean,
|
|
52
|
+
'--help': Boolean,
|
|
53
|
+
// Aliases
|
|
54
|
+
'-h': '--help',
|
|
55
|
+
}, {
|
|
56
|
+
permissive: true,
|
|
57
|
+
});
|
|
58
|
+
if (args['--version']) {
|
|
59
|
+
// Version is added in the build script.
|
|
60
|
+
const packageJSON = require('../../package.json');
|
|
61
|
+
console.log(packageJSON.version);
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
const command = args._[0];
|
|
65
|
+
const commandArgs = args._.slice(1);
|
|
66
|
+
// Handle `--help` flag
|
|
67
|
+
if ((args['--help'] && !command) || !command) {
|
|
68
|
+
Log.exit((0, chalk_1.default) `
|
|
69
|
+
{bold Usage}
|
|
70
|
+
{dim $} npx @expo/fingeprint <command>
|
|
71
|
+
|
|
72
|
+
{bold Commands}
|
|
73
|
+
${Object.keys(commands).sort().join(', ')}
|
|
74
|
+
|
|
75
|
+
{bold Options}
|
|
76
|
+
--help, -h Displays this message
|
|
77
|
+
|
|
78
|
+
For more information run a command with the --help flag
|
|
79
|
+
{dim $} npx @expo/fingeprint fingerprint:generate --help
|
|
80
|
+
`, 0);
|
|
81
|
+
}
|
|
82
|
+
// Push the help flag to the subcommand args.
|
|
83
|
+
if (args['--help']) {
|
|
84
|
+
commandArgs.push('--help');
|
|
85
|
+
}
|
|
86
|
+
// Install exit hooks
|
|
87
|
+
process.on('SIGINT', () => process.exit(0));
|
|
88
|
+
process.on('SIGTERM', () => process.exit(0));
|
|
89
|
+
if (!(command in commands)) {
|
|
90
|
+
(0, runLegacyCLIAsync_1.runLegacyCLIAsync)(args._).catch(errors_1.logCmdError);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
commands[command]()
|
|
94
|
+
.then((exec) => exec(commandArgs))
|
|
95
|
+
.catch(errors_1.logCmdError);
|
|
96
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.diffFingerprintsAsync = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const index_1 = require("../../../build/index");
|
|
32
|
+
const args_1 = require("../utils/args");
|
|
33
|
+
const errors_1 = require("../utils/errors");
|
|
34
|
+
const Log = __importStar(require("../utils/log"));
|
|
35
|
+
const readFingerprintFileAsync_1 = __importDefault(require("../utils/readFingerprintFileAsync"));
|
|
36
|
+
const diffFingerprintsAsync = async (argv) => {
|
|
37
|
+
const args = (0, args_1.assertArgs)({
|
|
38
|
+
// Types
|
|
39
|
+
'--help': Boolean,
|
|
40
|
+
// Aliases
|
|
41
|
+
'-h': '--help',
|
|
42
|
+
}, argv ?? []);
|
|
43
|
+
if (args['--help']) {
|
|
44
|
+
Log.exit((0, chalk_1.default) `
|
|
45
|
+
{bold Description}
|
|
46
|
+
Diff two fingerprints
|
|
47
|
+
|
|
48
|
+
{bold Usage}
|
|
49
|
+
{dim $} npx @expo/fingerprint fingerprint:diff <fingerprintFile1> <fingerprintFile2>
|
|
50
|
+
|
|
51
|
+
Options
|
|
52
|
+
-h, --help Output usage information
|
|
53
|
+
`, 0);
|
|
54
|
+
}
|
|
55
|
+
const fingerprintFile1 = (0, args_1.getFileArgumentAtIndex)(args, 0);
|
|
56
|
+
const fingerprintFile2 = (0, args_1.getFileArgumentAtIndex)(args, 1);
|
|
57
|
+
const [fingeprint1ToDiff, fingerprint2ToDiff] = await Promise.all([
|
|
58
|
+
(0, readFingerprintFileAsync_1.default)(fingerprintFile1),
|
|
59
|
+
(0, readFingerprintFileAsync_1.default)(fingerprintFile2),
|
|
60
|
+
]);
|
|
61
|
+
try {
|
|
62
|
+
const diff = (0, index_1.diffFingerprints)(fingeprint1ToDiff, fingerprint2ToDiff);
|
|
63
|
+
console.log(JSON.stringify(diff, null, 2));
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
throw new errors_1.CommandError(e.message);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.diffFingerprintsAsync = diffFingerprintsAsync;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.generateFingerprintAsync = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const getenv_1 = require("getenv");
|
|
32
|
+
const index_1 = require("../../../build/index");
|
|
33
|
+
const args_1 = require("../utils/args");
|
|
34
|
+
const errors_1 = require("../utils/errors");
|
|
35
|
+
const Log = __importStar(require("../utils/log"));
|
|
36
|
+
const withConsoleDisabledAsync_1 = require("../utils/withConsoleDisabledAsync");
|
|
37
|
+
const generateFingerprintAsync = async (argv) => {
|
|
38
|
+
const args = (0, args_1.assertArgs)({
|
|
39
|
+
// Types
|
|
40
|
+
'--help': Boolean,
|
|
41
|
+
'--platform': String,
|
|
42
|
+
'--debug': Boolean,
|
|
43
|
+
// Aliases
|
|
44
|
+
'-h': '--help',
|
|
45
|
+
}, argv ?? []);
|
|
46
|
+
if (args['--help']) {
|
|
47
|
+
Log.exit((0, chalk_1.default) `
|
|
48
|
+
{bold Description}
|
|
49
|
+
Generate fingerprint for a project
|
|
50
|
+
|
|
51
|
+
{bold Usage}
|
|
52
|
+
{dim $} npx @expo/fingerprint fingerprint:generate
|
|
53
|
+
|
|
54
|
+
Options
|
|
55
|
+
--platform <string> Platform to generate a fingerprint for
|
|
56
|
+
--workflow <string> Workflow to use for fingerprint generation, and auto-detected if not provided
|
|
57
|
+
--debug Whether to include verbose debug information in output
|
|
58
|
+
-h, --help Output usage information
|
|
59
|
+
`, 0);
|
|
60
|
+
}
|
|
61
|
+
const platform = args['--platform'];
|
|
62
|
+
if (platform && !['ios', 'android'].includes(platform)) {
|
|
63
|
+
throw new errors_1.CommandError(`Invalid platform argument: ${platform}`);
|
|
64
|
+
}
|
|
65
|
+
const options = {
|
|
66
|
+
debug: !!process.env.DEBUG || args['--debug'],
|
|
67
|
+
useRNCoreAutolinkingFromExpo: (0, getenv_1.boolish)('USE_RNCORE_AUTOLINKING_FROM_EXPO', undefined),
|
|
68
|
+
...(platform ? { platforms: [platform] } : null),
|
|
69
|
+
silent: true,
|
|
70
|
+
};
|
|
71
|
+
const projectRoot = (0, args_1.getProjectRoot)(args);
|
|
72
|
+
const result = await (0, withConsoleDisabledAsync_1.withConsoleDisabledAsync)(async () => {
|
|
73
|
+
try {
|
|
74
|
+
return await (0, index_1.createFingerprintAsync)(projectRoot, options);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
throw new errors_1.CommandError(e.message);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
console.log(JSON.stringify(result));
|
|
81
|
+
};
|
|
82
|
+
exports.generateFingerprintAsync = generateFingerprintAsync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runLegacyCLIAsync(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runLegacyCLIAsync = void 0;
|
|
7
|
+
const readFingerprintFileAsync_js_1 = __importDefault(require("./utils/readFingerprintFileAsync.js"));
|
|
8
|
+
const index_js_1 = require("../../build/index.js");
|
|
9
|
+
async function runLegacyCLIAsync(args) {
|
|
10
|
+
if (args.length !== 1 && args.length !== 2 && args.length !== 3) {
|
|
11
|
+
console.log(`Usage: npx @expo/fingerprint <projectRoot> [fingerprintFile1ToDiff] [fingerprintFile2ToDiff]`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const projectRoot = args[0];
|
|
15
|
+
const fingerprintFile1ToDiff = args[1];
|
|
16
|
+
const fingerprintFile2ToDiff = args[2];
|
|
17
|
+
const [fingeprint1ToDiff, fingerprint2ToDiff] = await Promise.all([
|
|
18
|
+
fingerprintFile1ToDiff ? (0, readFingerprintFileAsync_js_1.default)(fingerprintFile1ToDiff) : null,
|
|
19
|
+
fingerprintFile2ToDiff ? (0, readFingerprintFileAsync_js_1.default)(fingerprintFile2ToDiff) : null,
|
|
20
|
+
]);
|
|
21
|
+
const options = {
|
|
22
|
+
debug: !!process.env.DEBUG,
|
|
23
|
+
useRNCoreAutolinkingFromExpo: process.env.USE_RNCORE_AUTOLINKING_FROM_EXPO
|
|
24
|
+
? ['1', 'true'].includes(process.env.USE_RNCORE_AUTOLINKING_FROM_EXPO)
|
|
25
|
+
: undefined,
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
if (fingeprint1ToDiff && fingerprint2ToDiff) {
|
|
29
|
+
const diff = (0, index_js_1.diffFingerprints)(fingeprint1ToDiff, fingerprint2ToDiff);
|
|
30
|
+
console.log(JSON.stringify(diff, null, 2));
|
|
31
|
+
}
|
|
32
|
+
else if (fingeprint1ToDiff) {
|
|
33
|
+
const diff = await (0, index_js_1.diffFingerprintChangesAsync)(fingeprint1ToDiff, projectRoot, options);
|
|
34
|
+
console.log(JSON.stringify(diff, null, 2));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const fingerprint = await (0, index_js_1.createFingerprintAsync)(projectRoot, options);
|
|
38
|
+
console.log(JSON.stringify(fingerprint, null, 2));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
console.error('Uncaught Error', e);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.runLegacyCLIAsync = runLegacyCLIAsync;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import arg from 'arg';
|
|
2
|
+
/**
|
|
3
|
+
* Parse the first argument as a project directory.
|
|
4
|
+
*
|
|
5
|
+
* @returns valid project directory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getProjectRoot(args: arg.Result<arg.Spec>): string;
|
|
8
|
+
export declare function getFileArgumentAtIndex(args: arg.Result<arg.Spec>, index: number): string;
|
|
9
|
+
/**
|
|
10
|
+
* Parse args and assert unknown options.
|
|
11
|
+
*
|
|
12
|
+
* @param schema the `args` schema for parsing the command line arguments.
|
|
13
|
+
* @param argv extra strings
|
|
14
|
+
* @returns processed args object.
|
|
15
|
+
*/
|
|
16
|
+
export declare function assertArgs(schema: arg.Spec, argv: string[]): arg.Result<arg.Spec>;
|
|
17
|
+
export declare function requireArg(args: arg.Result<arg.Spec>, name: any): any;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.requireArg = exports.assertArgs = exports.getFileArgumentAtIndex = exports.getProjectRoot = void 0;
|
|
30
|
+
// Common utilities for interacting with `args` library.
|
|
31
|
+
// These functions should be used by every command.
|
|
32
|
+
const arg_1 = __importDefault(require("arg"));
|
|
33
|
+
const fs_1 = require("fs");
|
|
34
|
+
const path_1 = require("path");
|
|
35
|
+
const Log = __importStar(require("./log"));
|
|
36
|
+
/**
|
|
37
|
+
* Parse the first argument as a project directory.
|
|
38
|
+
*
|
|
39
|
+
* @returns valid project directory.
|
|
40
|
+
*/
|
|
41
|
+
function getProjectRoot(args) {
|
|
42
|
+
const projectRoot = (0, path_1.resolve)(args._[0] || '.');
|
|
43
|
+
if (!(0, fs_1.existsSync)(projectRoot)) {
|
|
44
|
+
Log.exit(`Invalid project root: ${projectRoot}`);
|
|
45
|
+
}
|
|
46
|
+
return projectRoot;
|
|
47
|
+
}
|
|
48
|
+
exports.getProjectRoot = getProjectRoot;
|
|
49
|
+
function getFileArgumentAtIndex(args, index) {
|
|
50
|
+
const path = (0, path_1.resolve)(args._[index]);
|
|
51
|
+
if (!(0, fs_1.existsSync)(path)) {
|
|
52
|
+
Log.exit(`Invalid file: ${path}`);
|
|
53
|
+
}
|
|
54
|
+
return path;
|
|
55
|
+
}
|
|
56
|
+
exports.getFileArgumentAtIndex = getFileArgumentAtIndex;
|
|
57
|
+
/**
|
|
58
|
+
* Parse args and assert unknown options.
|
|
59
|
+
*
|
|
60
|
+
* @param schema the `args` schema for parsing the command line arguments.
|
|
61
|
+
* @param argv extra strings
|
|
62
|
+
* @returns processed args object.
|
|
63
|
+
*/
|
|
64
|
+
function assertArgs(schema, argv) {
|
|
65
|
+
try {
|
|
66
|
+
return (0, arg_1.default)(schema, { argv });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Ensure unknown options are handled the same way.
|
|
70
|
+
if (error.code === 'ARG_UNKNOWN_OPTION') {
|
|
71
|
+
Log.exit(error.message, 1);
|
|
72
|
+
}
|
|
73
|
+
// Otherwise rethrow the error.
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.assertArgs = assertArgs;
|
|
78
|
+
function requireArg(args, name) {
|
|
79
|
+
const value = args[name];
|
|
80
|
+
if (value === undefined || value === null) {
|
|
81
|
+
Log.exit(`${name} must be provided`, 1);
|
|
82
|
+
}
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
exports.requireArg = requireArg;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.
|
|
3
|
+
*/
|
|
4
|
+
export declare class CommandError extends Error {
|
|
5
|
+
code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
readonly isCommandError = true;
|
|
8
|
+
constructor(code: string, message?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare function logCmdError(error: any): never;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logCmdError = exports.CommandError = void 0;
|
|
7
|
+
const assert_1 = require("assert");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const log_1 = require("./log");
|
|
10
|
+
const ERROR_PREFIX = 'Error: ';
|
|
11
|
+
/**
|
|
12
|
+
* General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.
|
|
13
|
+
*/
|
|
14
|
+
class CommandError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
name = 'CommandError';
|
|
17
|
+
isCommandError = true;
|
|
18
|
+
constructor(code, message = '') {
|
|
19
|
+
super('');
|
|
20
|
+
this.code = code;
|
|
21
|
+
// If e.toString() was called to get `message` we don't want it to look
|
|
22
|
+
// like "Error: Error:".
|
|
23
|
+
if (message.startsWith(ERROR_PREFIX)) {
|
|
24
|
+
message = message.substring(ERROR_PREFIX.length);
|
|
25
|
+
}
|
|
26
|
+
this.message = message || code;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CommandError = CommandError;
|
|
30
|
+
function logCmdError(error) {
|
|
31
|
+
if (!(error instanceof Error)) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof CommandError || error instanceof assert_1.AssertionError) {
|
|
35
|
+
// Print the stack trace in debug mode only.
|
|
36
|
+
(0, log_1.exit)(error);
|
|
37
|
+
}
|
|
38
|
+
const errorDetails = error.stack ? '\n' + chalk_1.default.gray(error.stack) : '';
|
|
39
|
+
(0, log_1.exit)(chalk_1.default.red(error.toString()) + errorDetails);
|
|
40
|
+
}
|
|
41
|
+
exports.logCmdError = logCmdError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function time(label?: string): void;
|
|
2
|
+
export declare function timeEnd(label?: string): void;
|
|
3
|
+
export declare function error(...message: string[]): void;
|
|
4
|
+
/** Print an error and provide additional info (the stack trace) in debug mode. */
|
|
5
|
+
export declare function exception(e: Error): void;
|
|
6
|
+
export declare function warn(...message: string[]): void;
|
|
7
|
+
export declare function log(...message: string[]): void;
|
|
8
|
+
/** Clear the terminal of all text. */
|
|
9
|
+
export declare function clear(): void;
|
|
10
|
+
/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */
|
|
11
|
+
export declare function exit(message: string | Error, code?: number): never;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.exit = exports.clear = exports.log = exports.warn = exports.exception = exports.error = exports.timeEnd = exports.time = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
function time(label) {
|
|
9
|
+
console.time(label);
|
|
10
|
+
}
|
|
11
|
+
exports.time = time;
|
|
12
|
+
function timeEnd(label) {
|
|
13
|
+
console.timeEnd(label);
|
|
14
|
+
}
|
|
15
|
+
exports.timeEnd = timeEnd;
|
|
16
|
+
function error(...message) {
|
|
17
|
+
console.error(...message);
|
|
18
|
+
}
|
|
19
|
+
exports.error = error;
|
|
20
|
+
/** Print an error and provide additional info (the stack trace) in debug mode. */
|
|
21
|
+
function exception(e) {
|
|
22
|
+
error(chalk_1.default.red(e.toString()) + (process.env.EXPO_DEBUG ? '\n' + chalk_1.default.gray(e.stack) : ''));
|
|
23
|
+
}
|
|
24
|
+
exports.exception = exception;
|
|
25
|
+
function warn(...message) {
|
|
26
|
+
console.warn(...message.map((value) => chalk_1.default.yellow(value)));
|
|
27
|
+
}
|
|
28
|
+
exports.warn = warn;
|
|
29
|
+
function log(...message) {
|
|
30
|
+
console.log(...message);
|
|
31
|
+
}
|
|
32
|
+
exports.log = log;
|
|
33
|
+
/** Clear the terminal of all text. */
|
|
34
|
+
function clear() {
|
|
35
|
+
process.stdout.write(process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
|
|
36
|
+
}
|
|
37
|
+
exports.clear = clear;
|
|
38
|
+
/** Log a message and exit the current process. If the `code` is non-zero then `console.error` will be used instead of `console.log`. */
|
|
39
|
+
function exit(message, code = 1) {
|
|
40
|
+
if (message instanceof Error) {
|
|
41
|
+
exception(message);
|
|
42
|
+
process.exit(code);
|
|
43
|
+
}
|
|
44
|
+
if (message) {
|
|
45
|
+
if (code === 0) {
|
|
46
|
+
log(message);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
error(message);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
process.exit(code);
|
|
53
|
+
}
|
|
54
|
+
exports.exit = exit;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
7
|
+
async function readFingerprintFileAsync(path) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(await promises_1.default.readFile(path, 'utf-8'));
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
throw new Error(`Unable to read fingerprint file ${path}: ${e.message}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.default = readFingerprintFileAsync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withConsoleDisabledAsync<T>(block: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withConsoleDisabledAsync = void 0;
|
|
4
|
+
async function withConsoleDisabledAsync(block) {
|
|
5
|
+
const loggingFunctions = {
|
|
6
|
+
log: console.log,
|
|
7
|
+
warn: console.warn,
|
|
8
|
+
error: console.error,
|
|
9
|
+
};
|
|
10
|
+
// Disable logging for this command since the only thing printed to stdout should be the JSON output.
|
|
11
|
+
console.log = function () { };
|
|
12
|
+
console.warn = function () { };
|
|
13
|
+
console.error = function () { };
|
|
14
|
+
try {
|
|
15
|
+
return await block();
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
// Re-enable logging functions for testing.
|
|
19
|
+
console.log = loggingFunctions.log;
|
|
20
|
+
console.warn = loggingFunctions.warn;
|
|
21
|
+
console.error = loggingFunctions.error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.withConsoleDisabledAsync = withConsoleDisabledAsync;
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/fingerprint",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
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
|
-
"build": "expo-module
|
|
8
|
+
"build": "expo-module build",
|
|
9
9
|
"clean": "expo-module clean",
|
|
10
10
|
"lint": "expo-module lint",
|
|
11
|
-
"prepare": "expo-module clean && expo-module tsc",
|
|
12
|
-
"prepublishOnly": "expo-module prepublishOnly",
|
|
13
11
|
"test": "expo-module test",
|
|
12
|
+
"prepare": "expo-module prepare",
|
|
13
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
14
|
+
"expo-module": "expo-module",
|
|
14
15
|
"test:e2e": "yarn run prepare && expo-module test --config e2e/jest.config.js",
|
|
15
16
|
"typecheck": "expo-module typecheck",
|
|
16
17
|
"watch": "expo-module tsc --watch"
|
|
@@ -20,7 +21,8 @@
|
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"bin",
|
|
23
|
-
"build"
|
|
24
|
+
"build",
|
|
25
|
+
"cli/build"
|
|
24
26
|
],
|
|
25
27
|
"keywords": [
|
|
26
28
|
"expo",
|
|
@@ -42,9 +44,11 @@
|
|
|
42
44
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/fingerprint#readme",
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@expo/spawn-async": "^1.7.2",
|
|
47
|
+
"arg": "^5.0.2",
|
|
45
48
|
"chalk": "^4.1.2",
|
|
46
49
|
"debug": "^4.3.4",
|
|
47
50
|
"find-up": "^5.0.0",
|
|
51
|
+
"getenv": "^1.0.0",
|
|
48
52
|
"minimatch": "^3.0.4",
|
|
49
53
|
"p-limit": "^3.1.0",
|
|
50
54
|
"resolve-from": "^5.0.0",
|
|
@@ -57,5 +61,5 @@
|
|
|
57
61
|
"require-from-string": "^2.0.2",
|
|
58
62
|
"temp-dir": "^2.0.0"
|
|
59
63
|
},
|
|
60
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "d97ae0839fa465cee14e13ca38f3c6c84c124d82"
|
|
61
65
|
}
|