mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
chore(core): monorepo, esm targeting, improved management (#8707)
This commit is contained in:
41
packages/webpack/lib/utils.js
Normal file
41
packages/webpack/lib/utils.js
Normal file
@ -0,0 +1,41 @@
|
||||
const os = require("os");
|
||||
const { dirname } = require("path");
|
||||
const { existsSync, mkdirSync } = require("fs");
|
||||
const { isAndroid } = require("../helpers/projectHelpers");
|
||||
|
||||
function shouldSnapshot(config) {
|
||||
const platformSupportsSnapshot = isAndroid(config.platform);
|
||||
|
||||
return config.release && platformSupportsSnapshot;
|
||||
}
|
||||
|
||||
function convertToUnixPath(relativePath) {
|
||||
return relativePath.replace(/\\/g, "/");
|
||||
}
|
||||
|
||||
function isWinOS() {
|
||||
return os.type() === "Windows_NT";
|
||||
}
|
||||
|
||||
function warn(message) {
|
||||
if (message) {
|
||||
console.log(`\x1B[33;1m${message}\x1B[0m`);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureDirectoryExistence(filePath) {
|
||||
var dir = dirname(filePath);
|
||||
if (existsSync(dir)) {
|
||||
return true;
|
||||
}
|
||||
ensureDirectoryExistence(dir);
|
||||
mkdirSync(dir);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
shouldSnapshot,
|
||||
convertToUnixPath,
|
||||
isWinOS,
|
||||
warn,
|
||||
ensureDirectoryExistence
|
||||
};
|
Reference in New Issue
Block a user