-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathpack-scoped.ts
31 lines (23 loc) · 997 Bytes
/
pack-scoped.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import * as path from "path";
import * as fs from "fs-extra";
import { execSync } from "child_process";
console.log(`Packing @nativescript/angular package`);
const distFolderPath = path.resolve("../../dist");
const tempFolderPath = path.resolve("./temp-scoped");
const outFileName = "nativescript-angular-scoped.tgz";
const nsAngularPackagePath = path.resolve("../../nativescript-angular");
execSync(`npm install --save-exact`, {
cwd: nsAngularPackagePath
});
// ensure empty temp and dist folders
fs.emptyDirSync(tempFolderPath);
fs.ensureDirSync(distFolderPath);
// create .tgz in temp folder
execSync(`npm pack ${nsAngularPackagePath}`, {
cwd: tempFolderPath
});
// assume we have a single file built in temp folder, take its name
const currentFileName = fs.readdirSync(tempFolderPath)[0];
// move built file and remove temp folder
fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true });
fs.removeSync(`${tempFolderPath}`);