@codifycli/plugin-core 1.1.0-beta5 → 1.1.0-beta7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/index.js +6 -6
- package/package.json +1 -1
- package/src/plugin/plugin.ts +2 -1
- package/src/utils/index.ts +6 -6
package/dist/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as fsSync from 'node:fs';
|
|
|
3
3
|
import * as fs from 'node:fs/promises';
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
-
import {
|
|
6
|
+
import { getPty, SpawnStatus } from '../pty/index.js';
|
|
7
7
|
export function isDebug() {
|
|
8
8
|
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
9
9
|
}
|
|
@@ -56,7 +56,7 @@ export const Utils = {
|
|
|
56
56
|
return query.status === SpawnStatus.SUCCESS;
|
|
57
57
|
},
|
|
58
58
|
getShell() {
|
|
59
|
-
const shell = process.env.SHELL || '';
|
|
59
|
+
const shell = process.env.SHELL || os.userInfo().shell || '';
|
|
60
60
|
if (shell.endsWith('bash')) {
|
|
61
61
|
return Shell.BASH;
|
|
62
62
|
}
|
|
@@ -81,7 +81,7 @@ export const Utils = {
|
|
|
81
81
|
return this.getShellRcFiles()[0];
|
|
82
82
|
},
|
|
83
83
|
getShellRcFiles() {
|
|
84
|
-
const shell = process.env.SHELL || '';
|
|
84
|
+
const shell = process.env.SHELL || os.userInfo().shell || '';
|
|
85
85
|
const homeDir = os.homedir();
|
|
86
86
|
if (shell.endsWith('bash')) {
|
|
87
87
|
// Linux typically uses .bashrc, macOS uses .bash_profile
|
|
@@ -167,9 +167,9 @@ Brew can be installed using Codify:
|
|
|
167
167
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
168
168
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
169
169
|
await $.spawn('apt-get update', { requiresRoot: true });
|
|
170
|
-
const { status, data } = await $.spawnSafe(`apt-get -y install ${packageName}`, {
|
|
170
|
+
const { status, data } = await $.spawnSafe(`apt-get -y -qq install -o Dpkg::Use-Pty=0 -o Dpkg::Progress-Fancy=0 ${packageName}`, {
|
|
171
171
|
requiresRoot: true,
|
|
172
|
-
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a' }
|
|
172
|
+
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a', }
|
|
173
173
|
});
|
|
174
174
|
if (status === SpawnStatus.ERROR && data.includes('E: dpkg was interrupted, you must manually run \'sudo dpkg --configure -a\' to correct the problem.')) {
|
|
175
175
|
await $.spawn('dpkg --configure -a', { requiresRoot: true });
|
|
@@ -213,7 +213,7 @@ Brew can be installed using Codify:
|
|
|
213
213
|
if (Utils.isLinux()) {
|
|
214
214
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
215
215
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
216
|
-
const { status } = await $.spawnSafe(`apt-get autoremove -y --purge ${packageName}`, {
|
|
216
|
+
const { status } = await $.spawnSafe(`apt-get -qq autoremove -y -o Dpkg::Use-Pty=0 -o Dpkg::Progress-Fancy=0 --purge ${packageName}`, {
|
|
217
217
|
requiresRoot: true,
|
|
218
218
|
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a' }
|
|
219
219
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codifycli/plugin-core",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-beta7",
|
|
4
4
|
"description": "TypeScript library for building Codify plugins to manage system resources (applications, CLI tools, settings) through infrastructure-as-code",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
package/src/plugin/plugin.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as fs from 'node:fs/promises';
|
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { getPty, SpawnStatus } from '../pty/index.js';
|
|
8
8
|
|
|
9
9
|
export function isDebug(): boolean {
|
|
10
10
|
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
@@ -73,7 +73,7 @@ export const Utils = {
|
|
|
73
73
|
},
|
|
74
74
|
|
|
75
75
|
getShell(): Shell | undefined {
|
|
76
|
-
const shell = process.env.SHELL || '';
|
|
76
|
+
const shell = process.env.SHELL || os.userInfo().shell || '';
|
|
77
77
|
|
|
78
78
|
if (shell.endsWith('bash')) {
|
|
79
79
|
return Shell.BASH
|
|
@@ -108,7 +108,7 @@ export const Utils = {
|
|
|
108
108
|
},
|
|
109
109
|
|
|
110
110
|
getShellRcFiles(): string[] {
|
|
111
|
-
const shell = process.env.SHELL || '';
|
|
111
|
+
const shell = process.env.SHELL || os.userInfo().shell || '';
|
|
112
112
|
const homeDir = os.homedir();
|
|
113
113
|
|
|
114
114
|
if (shell.endsWith('bash')) {
|
|
@@ -209,9 +209,9 @@ Brew can be installed using Codify:
|
|
|
209
209
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
210
210
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
211
211
|
await $.spawn('apt-get update', { requiresRoot: true });
|
|
212
|
-
const { status, data } = await $.spawnSafe(`apt-get -y install ${packageName}`, {
|
|
212
|
+
const { status, data } = await $.spawnSafe(`apt-get -y -qq install -o Dpkg::Use-Pty=0 -o Dpkg::Progress-Fancy=0 ${packageName}`, {
|
|
213
213
|
requiresRoot: true,
|
|
214
|
-
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a'
|
|
214
|
+
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a', }
|
|
215
215
|
});
|
|
216
216
|
|
|
217
217
|
if (status === SpawnStatus.ERROR && data.includes('E: dpkg was interrupted, you must manually run \'sudo dpkg --configure -a\' to correct the problem.')) {
|
|
@@ -265,7 +265,7 @@ Brew can be installed using Codify:
|
|
|
265
265
|
if (Utils.isLinux()) {
|
|
266
266
|
const isAptInstalled = await $.spawnSafe('which apt');
|
|
267
267
|
if (isAptInstalled.status === SpawnStatus.SUCCESS) {
|
|
268
|
-
const { status } = await $.spawnSafe(`apt-get autoremove -y --purge ${packageName}`, {
|
|
268
|
+
const { status } = await $.spawnSafe(`apt-get -qq autoremove -y -o Dpkg::Use-Pty=0 -o Dpkg::Progress-Fancy=0 --purge ${packageName}`, {
|
|
269
269
|
requiresRoot: true,
|
|
270
270
|
env: { DEBIAN_FRONTEND: 'noninteractive', NEEDRESTART_MODE: 'a' }
|
|
271
271
|
});
|