forked from SAP/cloud-mta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvertPackageJsonToMtaLocal.js
More file actions
20 lines (16 loc) · 930 Bytes
/
convertPackageJsonToMtaLocal.js
File metadata and controls
20 lines (16 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const { join } = require("path");
const { readFileSync, writeFileSync } = require("fs");
// Convert the package.json to the mta-local package.
// This package is only used for downloading and running the mta executable locally and not for installing it.
const pkgJsonPath = join(__dirname, "package.json");
// Read the original representation of the pkg.json
const pkgJsonOrgStr = readFileSync(pkgJsonPath, "utf8");
const pkgJson = JSON.parse(pkgJsonOrgStr);
// This package doesn't download the binary on install, and doesn't add scripts in the ".bin" folder.
// Since the install script is removed and the code is packaged, it also doesn't require binwrap in the dependencies.
pkgJson.name = "mta-local";
delete pkgJson.bin;
delete pkgJson.scripts.install;
pkgJson.devDependencies.binwrap = pkgJson.dependencies.binwrap;
delete pkgJson.dependencies.binwrap;
writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, undefined, 2));