Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 438d51b

Browse files
committed
feat: add 'getCompilationContext' helper function
1 parent 035056f commit 438d51b

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

lib/utils.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
const os = require("os");
22

3+
const { getProjectDir, getWebpackConfig } = require("../projectHelpers");
4+
35
function shouldSnapshot($mobileHelper, config) {
4-
const platformSupportsSnapshot = $mobileHelper.isAndroidPlatform(config.platform);
5-
const osSupportsSnapshot = os.type() !== "Windows_NT";
6-
return config.bundle && config.release && platformSupportsSnapshot && osSupportsSnapshot;
6+
const platformSupportsSnapshot = $mobileHelper.isAndroidPlatform(config.platform);
7+
const osSupportsSnapshot = os.type() !== "Windows_NT";
8+
9+
return config.bundle && config.release && platformSupportsSnapshot && osSupportsSnapshot;
10+
}
11+
12+
function getCompilationContext() {
13+
const projectDir = getProjectDir();
14+
const config = getWebpackConfig(projectDir);
15+
const context = config.context || projectDir;
16+
17+
return context;
718
}
819

9-
module.exports.shouldSnapshot = shouldSnapshot;
20+
module.exports = {
21+
shouldSnapshot,
22+
getCompilationContext,
23+
};

0 commit comments

Comments
 (0)