fix: replace `mkdirp` with an inline script (#1919)

This commit is contained in:
Tommy Nguyen 2024-03-19 16:22:32 +01:00 коммит произвёл GitHub
Родитель 319764b404
Коммит 08bbe5d9f0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 24 добавлений и 19 удалений

Просмотреть файл

@ -289,6 +289,7 @@ export const getConfig = (() => {
},
oldFiles: [],
scripts: {
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
dependencies: {},
@ -349,7 +350,7 @@ export const getConfig = (() => {
scripts: {
android: "react-native run-android",
"build:android":
"mkdirp dist/res && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
},
dependencies: {},
},
@ -365,7 +366,7 @@ export const getConfig = (() => {
],
scripts: {
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
ios: `react-native run-ios${projectPathFlag}`,
},
dependencies: {},
@ -382,7 +383,7 @@ export const getConfig = (() => {
],
scripts: {
"build:macos":
"mkdirp dist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist",
macos: `react-native run-macos --scheme ${name}${projectPathFlag}`,
},
dependencies: {},
@ -399,7 +400,7 @@ export const getConfig = (() => {
],
scripts: {
"build:visionos":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist",
visionos: "react-native run-visionos",
},
dependencies: {},
@ -417,7 +418,7 @@ export const getConfig = (() => {
],
scripts: {
"build:windows":
"mkdirp dist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist",
windows: `react-native run-windows --sln ${flatten ? "" : "windows/"}${name}.sln`,
},
dependencies: {},
@ -583,7 +584,6 @@ export function updatePackageManifest(
const { name: rntaName, version: rntaVersion } = readManifest();
manifest["devDependencies"] = mergeObjects(manifest["devDependencies"], {
"@rnx-kit/metro-config": "^1.3.15",
mkdirp: "^1.0.0",
[rntaName]: `^${rntaVersion}`,
});

Просмотреть файл

@ -210,15 +210,16 @@ describe("gatherConfig()", () => {
scripts: {
android: "react-native run-android",
"build:android":
"mkdirp dist/res && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"build:macos":
"mkdirp dist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform macos --dev true --bundle-output dist/main.macos.jsbundle --assets-dest dist",
"build:windows":
"mkdirp dist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform windows --dev true --bundle-output dist/main.windows.bundle --assets-dest dist",
ios: "react-native run-ios",
macos: "react-native run-macos --scheme Test",
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
windows: "react-native run-windows --sln windows/Test.sln",
},
@ -309,6 +310,7 @@ describe("gatherConfig()", () => {
},
oldFiles: [],
scripts: {
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
});
@ -378,8 +380,9 @@ describe("gatherConfig()", () => {
],
scripts: {
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
ios: "react-native run-ios",
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
});
@ -533,10 +536,11 @@ describe("gatherConfig()", () => {
scripts: {
android: "react-native run-android",
"build:android":
"mkdirp dist/res && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
ios: "react-native run-ios",
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
});
@ -594,8 +598,9 @@ describe("gatherConfig()", () => {
oldFiles: ["Podfile.lock", "Pods", "Test.xcodeproj", "Test.xcworkspace"],
scripts: {
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
ios: "react-native run-ios",
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
});
@ -747,10 +752,11 @@ describe("gatherConfig()", () => {
scripts: {
android: "react-native run-android",
"build:android":
"mkdirp dist/res && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"build:ios":
"mkdirp dist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.ios.jsbundle --assets-dest dist",
ios: "react-native run-ios",
mkdist: `node -e "require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })"`,
start: "react-native start",
},
});

Просмотреть файл

@ -36,7 +36,7 @@ describe("getConfig()", () => {
"react-native.config.js",
]);
deepEqual(config.oldFiles, []);
deepEqual(Object.keys(config.scripts).sort(), ["start"]);
deepEqual(Object.keys(config.scripts).sort(), ["mkdist", "start"]);
deepEqual(getDependencies("common", params), []);
});
@ -57,7 +57,7 @@ describe("getConfig()", () => {
"tsconfig.json",
]);
deepEqual(config.oldFiles, []);
deepEqual(Object.keys(config.scripts).sort(), ["start"]);
deepEqual(Object.keys(config.scripts).sort(), ["mkdist", "start"]);
deepEqual(getDependencies("common", params), []);
});

Просмотреть файл

@ -21,7 +21,6 @@ describe("updatePackageManifest()", () => {
const devDependencies = {
"@rnx-kit/metro-config":
exampleManifest["devDependencies"]?.["@rnx-kit/metro-config"],
mkdirp: "^1.0.0",
"react-native-test-app": "^0.0.1-dev",
};