Skip to content

Commit 8302734

Browse files
committed
fix: fix package command
1 parent 5a34b8b commit 8302734

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/command-manager.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { spawn } from 'child_process';
22
import { env } from 'process';
3+
34
import AdmZip from 'adm-zip';
45

6+
import { readJsonFromVisual } from './utils.js';
7+
8+
const ngJson = readJsonFromVisual('angular.json');
9+
510
export default class CommandManager {
611
public static start(name: string, options: Record<string, string>, rootPath: string) {
712
// Store the visual name in the node environment
@@ -30,6 +35,9 @@ export default class CommandManager {
3035
}
3136

3237
public static package(name: string, options: Record<string, any>, rootPath: string) {
38+
// Store the visual name in the node environment
39+
env.VISUAL_NAME = name;
40+
3341
const ng = spawn('ng', ['build', name]);
3442

3543
ng.stdout.on('data', data => {
@@ -42,9 +50,10 @@ export default class CommandManager {
4250

4351
ng.on('close', code => {
4452
if (code == 0) {
53+
const outputPath = ngJson.projects[name].architect.build.options.outputPath;
4554
const zip = new AdmZip();
46-
zip.addLocalFolder(rootPath + `/dist/${name}`);
47-
zip.writeZip(rootPath + `/dist/${name}.zip`, () => {
55+
zip.addLocalFolder(outputPath);
56+
zip.writeZip(outputPath + '.zip', () => {
4857
console.log('Package created.');
4958
});
5059
}

0 commit comments

Comments
 (0)