codify-plugin-lib 1.0.182-beta1 → 1.0.182-beta3
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugin/plugin.js +1 -1
- package/dist/pty/background-pty.js +1 -1
- package/dist/pty/seqeuntial-pty.js +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/internal-utils.d.ts +0 -6
- package/dist/utils/internal-utils.js +0 -12
- package/dist/utils/verbosity-level.d.ts +5 -0
- package/dist/utils/verbosity-level.js +9 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/plugin/plugin.ts +1 -1
- package/src/pty/background-pty.ts +1 -1
- package/src/pty/seqeuntial-pty.ts +2 -2
- package/src/utils/index.ts +4 -0
- package/src/utils/internal-utils.ts +0 -16
- package/src/utils/verbosity-level.ts +11 -0
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export * from './resource/resource.js';
|
|
|
11
11
|
export * from './resource/resource-settings.js';
|
|
12
12
|
export * from './stateful-parameter/stateful-parameter.js';
|
|
13
13
|
export * from './utils/index.js';
|
|
14
|
+
export * from './utils/verbosity-level.js';
|
|
14
15
|
export declare function runPlugin(plugin: Plugin): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './resource/resource.js';
|
|
|
11
11
|
export * from './resource/resource-settings.js';
|
|
12
12
|
export * from './stateful-parameter/stateful-parameter.js';
|
|
13
13
|
export * from './utils/index.js';
|
|
14
|
+
export * from './utils/verbosity-level.js';
|
|
14
15
|
export async function runPlugin(plugin) {
|
|
15
16
|
const messageHandler = new MessageHandler(plugin);
|
|
16
17
|
process.on('message', (message) => messageHandler.onMessage(message));
|
package/dist/plugin/plugin.js
CHANGED
|
@@ -4,8 +4,8 @@ import { BackgroundPty } from '../pty/background-pty.js';
|
|
|
4
4
|
import { getPty } from '../pty/index.js';
|
|
5
5
|
import { SequentialPty } from '../pty/seqeuntial-pty.js';
|
|
6
6
|
import { ResourceController } from '../resource/resource-controller.js';
|
|
7
|
-
import { VerbosityLevel } from '../utils/internal-utils.js';
|
|
8
7
|
import { ptyLocalStorage } from '../utils/pty-local-storage.js';
|
|
8
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
9
9
|
export class Plugin {
|
|
10
10
|
name;
|
|
11
11
|
resourceControllers;
|
|
@@ -6,7 +6,7 @@ import * as fs from 'node:fs/promises';
|
|
|
6
6
|
import stripAnsi from 'strip-ansi';
|
|
7
7
|
import { debugLog } from '../utils/debug.js';
|
|
8
8
|
import { Shell, Utils } from '../utils/index.js';
|
|
9
|
-
import { VerbosityLevel } from '../utils/
|
|
9
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
10
10
|
import { SpawnError } from './index.js';
|
|
11
11
|
import { PromiseQueue } from './promise-queue.js';
|
|
12
12
|
EventEmitter.defaultMaxListeners = 1000;
|
|
@@ -2,7 +2,7 @@ import pty from '@homebridge/node-pty-prebuilt-multiarch';
|
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import stripAnsi from 'strip-ansi';
|
|
4
4
|
import { Shell, Utils } from '../utils/index.js';
|
|
5
|
-
import { VerbosityLevel } from '../utils/
|
|
5
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
6
6
|
import { SpawnError, SpawnStatus } from './index.js';
|
|
7
7
|
EventEmitter.defaultMaxListeners = 1000;
|
|
8
8
|
/**
|
|
@@ -35,7 +35,7 @@ export class SequentialPty {
|
|
|
35
35
|
// Initial terminal dimensions
|
|
36
36
|
const initialCols = process.stdout.columns ?? 80;
|
|
37
37
|
const initialRows = process.stdout.rows ?? 24;
|
|
38
|
-
const args = (options?.interactive ??
|
|
38
|
+
const args = (options?.interactive ?? false) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`];
|
|
39
39
|
// Run the command in a pty for interactivity
|
|
40
40
|
const mPty = pty.spawn(this.getDefaultShell(), args, {
|
|
41
41
|
...options,
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
export function isDebug() {
|
|
4
|
+
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
5
|
+
}
|
|
3
6
|
export var Shell;
|
|
4
7
|
(function (Shell) {
|
|
5
8
|
Shell["ZSH"] = "zsh";
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { ResourceConfig, StringIndexedObject } from 'codify-schemas';
|
|
2
|
-
export declare const VerbosityLevel: {
|
|
3
|
-
level: number;
|
|
4
|
-
get(): number;
|
|
5
|
-
set(level: number): void;
|
|
6
|
-
};
|
|
7
|
-
export declare function isDebug(): boolean;
|
|
8
2
|
export declare function splitUserConfig<T extends StringIndexedObject>(config: ResourceConfig & T): {
|
|
9
3
|
parameters: T;
|
|
10
4
|
coreParameters: ResourceConfig;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
export const VerbosityLevel = new class {
|
|
4
|
-
level = 0;
|
|
5
|
-
get() {
|
|
6
|
-
return this.level;
|
|
7
|
-
}
|
|
8
|
-
set(level) {
|
|
9
|
-
this.level = level;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export function isDebug() {
|
|
13
|
-
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
14
|
-
}
|
|
15
3
|
export function splitUserConfig(config) {
|
|
16
4
|
const coreParameters = {
|
|
17
5
|
type: config.type,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './resource/resource.js'
|
|
|
13
13
|
export * from './resource/resource-settings.js'
|
|
14
14
|
export * from './stateful-parameter/stateful-parameter.js'
|
|
15
15
|
export * from './utils/index.js'
|
|
16
|
+
export * from './utils/verbosity-level.js'
|
|
16
17
|
|
|
17
18
|
export async function runPlugin(plugin: Plugin) {
|
|
18
19
|
const messageHandler = new MessageHandler(plugin);
|
package/src/plugin/plugin.ts
CHANGED
|
@@ -24,8 +24,8 @@ import { getPty } from '../pty/index.js';
|
|
|
24
24
|
import { SequentialPty } from '../pty/seqeuntial-pty.js';
|
|
25
25
|
import { Resource } from '../resource/resource.js';
|
|
26
26
|
import { ResourceController } from '../resource/resource-controller.js';
|
|
27
|
-
import { VerbosityLevel } from '../utils/internal-utils.js';
|
|
28
27
|
import { ptyLocalStorage } from '../utils/pty-local-storage.js';
|
|
28
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
29
29
|
|
|
30
30
|
export class Plugin {
|
|
31
31
|
planStorage: Map<string, Plan<any>>;
|
|
@@ -7,7 +7,7 @@ import stripAnsi from 'strip-ansi';
|
|
|
7
7
|
|
|
8
8
|
import { debugLog } from '../utils/debug.js';
|
|
9
9
|
import { Shell, Utils } from '../utils/index.js';
|
|
10
|
-
import { VerbosityLevel } from '../utils/
|
|
10
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
11
11
|
import { IPty, SpawnError, SpawnOptions, SpawnResult } from './index.js';
|
|
12
12
|
import { PromiseQueue } from './promise-queue.js';
|
|
13
13
|
|
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import stripAnsi from 'strip-ansi';
|
|
4
4
|
|
|
5
5
|
import { Shell, Utils } from '../utils/index.js';
|
|
6
|
-
import { VerbosityLevel } from '../utils/
|
|
6
|
+
import { VerbosityLevel } from '../utils/verbosity-level.js';
|
|
7
7
|
import { IPty, SpawnError, SpawnOptions, SpawnResult, SpawnStatus } from './index.js';
|
|
8
8
|
|
|
9
9
|
EventEmitter.defaultMaxListeners = 1000;
|
|
@@ -46,7 +46,7 @@ export class SequentialPty implements IPty {
|
|
|
46
46
|
const initialCols = process.stdout.columns ?? 80;
|
|
47
47
|
const initialRows = process.stdout.rows ?? 24;
|
|
48
48
|
|
|
49
|
-
const args = (options?.interactive ??
|
|
49
|
+
const args = (options?.interactive ?? false) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`]
|
|
50
50
|
|
|
51
51
|
// Run the command in a pty for interactivity
|
|
52
52
|
const mPty = pty.spawn(this.getDefaultShell(), args, {
|
package/src/utils/index.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { OS } from 'codify-schemas';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
+
export function isDebug(): boolean {
|
|
6
|
+
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
export enum Shell {
|
|
6
10
|
ZSH = 'zsh',
|
|
7
11
|
BASH = 'bash',
|
|
@@ -2,22 +2,6 @@ import { ResourceConfig, StringIndexedObject } from 'codify-schemas';
|
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
-
export const VerbosityLevel = new class {
|
|
6
|
-
level = 0;
|
|
7
|
-
|
|
8
|
-
get() {
|
|
9
|
-
return this.level;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
set(level: number) {
|
|
13
|
-
this.level = level;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function isDebug(): boolean {
|
|
18
|
-
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
|
|
19
|
-
}
|
|
20
|
-
|
|
21
5
|
export function splitUserConfig<T extends StringIndexedObject>(
|
|
22
6
|
config: ResourceConfig & T
|
|
23
7
|
): { parameters: T; coreParameters: ResourceConfig } {
|