codify-plugin-lib 1.0.182-beta64 → 1.0.182-beta65

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.
@@ -46,6 +46,7 @@ export class Plugin {
46
46
  type: r.typeId,
47
47
  sensitiveParameters,
48
48
  operatingSystems: r.settings.operatingSystems,
49
+ linuxDistros: r.settings.linuxDistros,
49
50
  };
50
51
  })
51
52
  };
@@ -84,6 +85,7 @@ export class Plugin {
84
85
  requiredParameters: requiredPropertyNames,
85
86
  },
86
87
  operatingSystems: resource.settings.operatingSystems,
88
+ linuxDistros: resource.settings.linuxDistros,
87
89
  sensitiveParameters,
88
90
  allowMultiple
89
91
  };
@@ -1,5 +1,5 @@
1
1
  import { JSONSchemaType } from 'ajv';
2
- import { OS, StringIndexedObject } from 'codify-schemas';
2
+ import { LinuxDistro, OS, StringIndexedObject } from 'codify-schemas';
3
3
  import { StatefulParameterController } from '../stateful-parameter/stateful-parameter-controller.js';
4
4
  import { ArrayParameterSetting, DefaultParameterSetting, InputTransformation, ResourceSettings } from './resource-settings.js';
5
5
  export interface ParsedStatefulParameterSetting extends DefaultParameterSetting {
@@ -29,6 +29,7 @@ export declare class ParsedResourceSettings<T extends StringIndexedObject> imple
29
29
  dependencies?: string[] | undefined;
30
30
  transformation?: InputTransformation;
31
31
  operatingSystems: Array<OS>;
32
+ linuxDistros?: Array<LinuxDistro>;
32
33
  isSensitive?: boolean;
33
34
  private settings;
34
35
  constructor(settings: ResourceSettings<T>);
@@ -11,6 +11,7 @@ export class ParsedResourceSettings {
11
11
  dependencies;
12
12
  transformation;
13
13
  operatingSystems;
14
+ linuxDistros;
14
15
  isSensitive;
15
16
  settings;
16
17
  constructor(settings) {
@@ -1,5 +1,5 @@
1
1
  import { JSONSchemaType } from 'ajv';
2
- import { OS, StringIndexedObject } from 'codify-schemas';
2
+ import { LinuxDistro, OS, StringIndexedObject } from 'codify-schemas';
3
3
  import { ZodObject } from 'zod';
4
4
  import { ArrayStatefulParameter, StatefulParameter } from '../stateful-parameter/stateful-parameter.js';
5
5
  import { ParsedResourceSettings } from './parsed-resource-settings.js';
@@ -20,6 +20,10 @@ export interface ResourceSettings<T extends StringIndexedObject> {
20
20
  * List of supported operating systems
21
21
  */
22
22
  operatingSystems: Array<OS>;
23
+ /**
24
+ * List of supported linux distros
25
+ */
26
+ linuxDistros?: Array<LinuxDistro>;
23
27
  /**
24
28
  * Schema to validate user configs with. Must be in the format JSON Schema draft07
25
29
  */
@@ -1,4 +1,4 @@
1
- import { OS } from 'codify-schemas';
1
+ import { LinuxDistro, OS } from 'codify-schemas';
2
2
  export declare function isDebug(): boolean;
3
3
  export declare enum Shell {
4
4
  ZSH = "zsh",
@@ -8,25 +8,6 @@ export declare enum Shell {
8
8
  CSH = "csh",
9
9
  FISH = "fish"
10
10
  }
11
- export declare enum LinuxDistro {
12
- ARCH = "arch",
13
- CENTOS = "centos",
14
- DEBIAN = "debian",
15
- FEDORA = "fedora",
16
- RHEL = "rhel",
17
- UBUNTU = "ubuntu",
18
- ALPINE = "alpine",
19
- AMAZON_LINUX = "amzn",
20
- OPENSUSE = "opensuse",
21
- SUSE = "sles",
22
- MANJARO = "manjaro",
23
- MINT = "linuxmint",
24
- POP_OS = "pop",
25
- ELEMENTARY_OS = "elementary",
26
- KALI = "kali",
27
- GENTOO = "gentoo",
28
- SLACKWARE = "slackware"
29
- }
30
11
  export interface SystemInfo {
31
12
  os: OS;
32
13
  shell: Shell;
@@ -60,4 +41,6 @@ export declare const Utils: {
60
41
  isCentOS(): Promise<boolean>;
61
42
  isFedora(): Promise<boolean>;
62
43
  isRHEL(): Promise<boolean>;
44
+ isDebianBased(): boolean;
45
+ isRPMBased(): boolean;
63
46
  };
@@ -1,7 +1,9 @@
1
+ import { LinuxDistro } from 'codify-schemas';
1
2
  import * as fs from 'node:fs/promises';
2
3
  import os from 'node:os';
3
4
  import path from 'node:path';
4
5
  import { SpawnStatus, getPty } from '../pty/index.js';
6
+ import * as fsSync from 'node:fs';
5
7
  export function isDebug() {
6
8
  return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
7
9
  }
@@ -14,26 +16,6 @@ export var Shell;
14
16
  Shell["CSH"] = "csh";
15
17
  Shell["FISH"] = "fish";
16
18
  })(Shell || (Shell = {}));
17
- export var LinuxDistro;
18
- (function (LinuxDistro) {
19
- LinuxDistro["ARCH"] = "arch";
20
- LinuxDistro["CENTOS"] = "centos";
21
- LinuxDistro["DEBIAN"] = "debian";
22
- LinuxDistro["FEDORA"] = "fedora";
23
- LinuxDistro["RHEL"] = "rhel";
24
- LinuxDistro["UBUNTU"] = "ubuntu";
25
- LinuxDistro["ALPINE"] = "alpine";
26
- LinuxDistro["AMAZON_LINUX"] = "amzn";
27
- LinuxDistro["OPENSUSE"] = "opensuse";
28
- LinuxDistro["SUSE"] = "sles";
29
- LinuxDistro["MANJARO"] = "manjaro";
30
- LinuxDistro["MINT"] = "linuxmint";
31
- LinuxDistro["POP_OS"] = "pop";
32
- LinuxDistro["ELEMENTARY_OS"] = "elementary";
33
- LinuxDistro["KALI"] = "kali";
34
- LinuxDistro["GENTOO"] = "gentoo";
35
- LinuxDistro["SLACKWARE"] = "slackware";
36
- })(LinuxDistro || (LinuxDistro = {}));
37
19
  export const Utils = {
38
20
  getUser() {
39
21
  return os.userInfo().username;
@@ -268,4 +250,10 @@ Brew can be installed using Codify:
268
250
  async isRHEL() {
269
251
  return (await this.getLinuxDistro()) === LinuxDistro.RHEL;
270
252
  },
253
+ isDebianBased() {
254
+ return fsSync.existsSync('/etc/debian_version');
255
+ },
256
+ isRPMBased() {
257
+ return fsSync.existsSync('/etc/redhat-release');
258
+ }
271
259
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codify-plugin-lib",
3
- "version": "1.0.182-beta64",
3
+ "version": "1.0.182-beta65",
4
4
  "description": "Library plugin library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "ajv": "^8.12.0",
23
23
  "ajv-formats": "^2.1.1",
24
24
  "clean-deep": "^3.4.0",
25
- "codify-schemas": "1.0.86-beta10",
25
+ "codify-schemas": "1.0.86-beta11",
26
26
  "lodash.isequal": "^4.5.0",
27
27
  "nanoid": "^5.0.9",
28
28
  "strip-ansi": "^7.1.0",
@@ -77,6 +77,7 @@ export class Plugin {
77
77
  type: r.typeId,
78
78
  sensitiveParameters,
79
79
  operatingSystems: r.settings.operatingSystems,
80
+ linuxDistros: r.settings.linuxDistros,
80
81
  }
81
82
  })
82
83
  }
@@ -124,6 +125,7 @@ export class Plugin {
124
125
  requiredParameters: requiredPropertyNames,
125
126
  },
126
127
  operatingSystems: resource.settings.operatingSystems,
128
+ linuxDistros: resource.settings.linuxDistros,
127
129
  sensitiveParameters,
128
130
  allowMultiple
129
131
  }
@@ -1,5 +1,5 @@
1
1
  import { JSONSchemaType } from 'ajv';
2
- import { OS, StringIndexedObject } from 'codify-schemas';
2
+ import { LinuxDistro, OS, StringIndexedObject } from 'codify-schemas';
3
3
  import { ZodObject, z } from 'zod';
4
4
 
5
5
  import { StatefulParameterController } from '../stateful-parameter/stateful-parameter-controller.js';
@@ -52,6 +52,8 @@ export class ParsedResourceSettings<T extends StringIndexedObject> implements Re
52
52
  transformation?: InputTransformation;
53
53
 
54
54
  operatingSystems!: Array<OS>;
55
+ linuxDistros?: Array<LinuxDistro>;
56
+
55
57
  isSensitive?: boolean;
56
58
 
57
59
  private settings: ResourceSettings<T>;
@@ -1,5 +1,5 @@
1
1
  import { JSONSchemaType } from 'ajv';
2
- import { OS, StringIndexedObject } from 'codify-schemas';
2
+ import { LinuxDistro, OS, StringIndexedObject } from 'codify-schemas';
3
3
  import isObjectsEqual from 'lodash.isequal'
4
4
  import path from 'node:path';
5
5
  import { ZodObject } from 'zod';
@@ -35,6 +35,11 @@ export interface ResourceSettings<T extends StringIndexedObject> {
35
35
  */
36
36
  operatingSystems: Array<OS>;
37
37
 
38
+ /**
39
+ * List of supported linux distros
40
+ */
41
+ linuxDistros?: Array<LinuxDistro>;
42
+
38
43
  /**
39
44
  * Schema to validate user configs with. Must be in the format JSON Schema draft07
40
45
  */
@@ -1,9 +1,10 @@
1
- import { OS } from 'codify-schemas';
1
+ import { LinuxDistro, OS } from 'codify-schemas';
2
2
  import * as fs from 'node:fs/promises';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
 
6
6
  import { SpawnStatus, getPty } from '../pty/index.js';
7
+ import * as fsSync from 'node:fs';
7
8
 
8
9
  export function isDebug(): boolean {
9
10
  return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
@@ -18,26 +19,6 @@ export enum Shell {
18
19
  FISH = 'fish',
19
20
  }
20
21
 
21
- export enum LinuxDistro {
22
- ARCH = 'arch',
23
- CENTOS = 'centos',
24
- DEBIAN = 'debian',
25
- FEDORA = 'fedora',
26
- RHEL = 'rhel',
27
- UBUNTU = 'ubuntu',
28
- ALPINE = 'alpine',
29
- AMAZON_LINUX = 'amzn',
30
- OPENSUSE = 'opensuse',
31
- SUSE = 'sles',
32
- MANJARO = 'manjaro',
33
- MINT = 'linuxmint',
34
- POP_OS = 'pop',
35
- ELEMENTARY_OS = 'elementary',
36
- KALI = 'kali',
37
- GENTOO = 'gentoo',
38
- SLACKWARE = 'slackware',
39
- }
40
-
41
22
  export interface SystemInfo {
42
23
  os: OS;
43
24
  shell: Shell;
@@ -333,6 +314,14 @@ Brew can be installed using Codify:
333
314
  async isRHEL(): Promise<boolean> {
334
315
  return (await this.getLinuxDistro()) === LinuxDistro.RHEL;
335
316
  },
317
+
318
+ isDebianBased(): boolean {
319
+ return fsSync.existsSync('/etc/debian_version');
320
+ },
321
+
322
+ isRPMBased(): boolean {
323
+ return fsSync.existsSync('/etc/redhat-release');
324
+ }
336
325
  };
337
326
 
338
327