@adobe/ccweb-add-on-core 2.5.0 → 3.1.0

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.
Files changed (62) hide show
  1. package/.c8rc.json +7 -1
  2. package/.mocharc.json +6 -1
  3. package/dist/config/inversify.config.d.ts.map +1 -1
  4. package/dist/config/inversify.config.js +4 -2
  5. package/dist/config/inversify.types.d.ts +1 -2
  6. package/dist/config/inversify.types.d.ts.map +1 -1
  7. package/dist/config/inversify.types.js +1 -2
  8. package/dist/constants.d.ts.map +1 -1
  9. package/{src/utilities/Preferences.ts → dist/models/AddOnListingData.d.ts} +19 -22
  10. package/dist/models/AddOnListingData.d.ts.map +1 -0
  11. package/dist/{utilities/Preferences.js → models/AddOnListingData.js} +2 -2
  12. package/dist/models/PackageJson.js +1 -1
  13. package/dist/models/PreferenceJson.js +1 -1
  14. package/dist/models/index.d.ts +1 -1
  15. package/dist/models/index.d.ts.map +1 -1
  16. package/dist/models/index.js +0 -1
  17. package/dist/tsconfig.tsbuildinfo +1 -1
  18. package/dist/utilities/CLIProcess.d.ts +1 -3
  19. package/dist/utilities/CLIProcess.d.ts.map +1 -1
  20. package/dist/utilities/ConsoleLogger.d.ts +1 -2
  21. package/dist/utilities/ConsoleLogger.d.ts.map +1 -1
  22. package/dist/utilities/Extensions.d.ts +1 -1
  23. package/dist/utilities/Extensions.d.ts.map +1 -1
  24. package/dist/utilities/Logger.d.ts +13 -1
  25. package/dist/utilities/Logger.d.ts.map +1 -1
  26. package/dist/utilities/Process.d.ts +21 -2
  27. package/dist/utilities/Process.d.ts.map +1 -1
  28. package/dist/utilities/UncaughtExceptionHandler.d.ts.map +1 -1
  29. package/dist/utilities/{CLIPreferences.d.ts → UserPreferences.d.ts} +2 -3
  30. package/dist/utilities/UserPreferences.d.ts.map +1 -0
  31. package/dist/utilities/{CLIPreferences.js → UserPreferences.js} +5 -5
  32. package/dist/utilities/index.d.ts +3 -4
  33. package/dist/utilities/index.d.ts.map +1 -1
  34. package/dist/utilities/index.js +1 -4
  35. package/package.json +10 -10
  36. package/src/config/inversify.config.ts +7 -4
  37. package/src/config/inversify.types.ts +6 -3
  38. package/src/constants.ts +2 -2
  39. package/{dist/models/Types.js → src/models/AddOnListingData.ts} +23 -5
  40. package/src/models/PackageJson.ts +1 -1
  41. package/src/models/PreferenceJson.ts +1 -1
  42. package/src/models/index.ts +1 -1
  43. package/src/test/models/TemplateJson.spec.ts +1 -1
  44. package/src/test/utilities/CLIProcess.spec.ts +3 -3
  45. package/src/test/utilities/ConsoleLogger.spec.ts +2 -2
  46. package/src/test/utilities/UncaughtExceptionHandler.spec.ts +1 -1
  47. package/src/test/utilities/{CLIPreferences.spec.ts → UserPreferences.spec.ts} +14 -15
  48. package/src/utilities/CLIProcess.ts +1 -2
  49. package/src/utilities/ConsoleLogger.ts +1 -2
  50. package/src/utilities/Extensions.ts +1 -1
  51. package/src/utilities/Logger.ts +14 -1
  52. package/src/utilities/Process.ts +25 -1
  53. package/src/utilities/UncaughtExceptionHandler.ts +2 -2
  54. package/src/utilities/{CLIPreferences.ts → UserPreferences.ts} +1 -2
  55. package/src/utilities/index.ts +3 -4
  56. package/tsconfig.json +3 -1
  57. package/dist/models/Types.d.ts +0 -77
  58. package/dist/models/Types.d.ts.map +0 -1
  59. package/dist/utilities/CLIPreferences.d.ts.map +0 -1
  60. package/dist/utilities/Preferences.d.ts +0 -41
  61. package/dist/utilities/Preferences.d.ts.map +0 -1
  62. package/src/models/Types.ts +0 -86
@@ -1 +1 @@
1
- {"version":3,"file":"Process.d.ts","sourceRoot":"","sources":["../../src/utilities/Process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9F;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC;IAEzF;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAElC;;;;;OAKG;IACH,WAAW,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClE"}
1
+ {"version":3,"file":"Process.d.ts","sourceRoot":"","sources":["../../src/utilities/Process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB;;;;;;;OAOG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9F;;;;;;;OAOG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,eAAe,CAAC;IAEzF;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAElC;;;;;OAKG;IACH,WAAW,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClE"}
@@ -1 +1 @@
1
- {"version":3,"file":"UncaughtExceptionHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/UncaughtExceptionHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAMlF;;GAEG;AACH,qBAAa,wBAAwB;IACjC;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,WAAW,EAAE,MAAM;IAInD;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;CAK1E"}
1
+ {"version":3,"file":"UncaughtExceptionHandler.d.ts","sourceRoot":"","sources":["../../src/utilities/UncaughtExceptionHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAMlF;;GAEG;AACH,qBAAa,wBAAwB;IACjC;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI1D;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;CAK1E"}
@@ -23,11 +23,10 @@
23
23
  ********************************************************************************/
24
24
  import "reflect-metadata";
25
25
  import { PreferenceJson } from "../models/PreferenceJson.js";
26
- import type { Preferences } from "./Preferences.js";
27
26
  /**
28
27
  * Implementation class for configuring CCWeb Add-on CLI related preferences.
29
28
  */
30
- export declare class CLIPreferences implements Preferences {
29
+ export declare class UserPreferences {
31
30
  private _cachedPreference?;
32
31
  /**
33
32
  * Get the CCWeb Add-on CLI related user preferences.
@@ -42,4 +41,4 @@ export declare class CLIPreferences implements Preferences {
42
41
  set(preferenceJson: PreferenceJson): void;
43
42
  private get _preferenceFilePath();
44
43
  }
45
- //# sourceMappingURL=CLIPreferences.d.ts.map
44
+ //# sourceMappingURL=UserPreferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserPreferences.d.ts","sourceRoot":"","sources":["../../src/utilities/UserPreferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAQlF,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AACH,qBACa,eAAe;IACxB,OAAO,CAAC,iBAAiB,CAAC,CAAiB;IAE3C;;;;OAIG;IACH,GAAG,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,cAAc;IAwBxC;;;OAGG;IACH,GAAG,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAKzC,OAAO,KAAK,mBAAmB,GAE9B;CACJ"}
@@ -34,7 +34,7 @@ import { PreferenceJson } from "../models/PreferenceJson.js";
34
34
  /**
35
35
  * Implementation class for configuring CCWeb Add-on CLI related preferences.
36
36
  */
37
- let CLIPreferences = class CLIPreferences {
37
+ let UserPreferences = class UserPreferences {
38
38
  _cachedPreference;
39
39
  /**
40
40
  * Get the CCWeb Add-on CLI related user preferences.
@@ -73,8 +73,8 @@ let CLIPreferences = class CLIPreferences {
73
73
  return path.join(applicationConfigPath(CCWEB_ADDON_DIRECTORY), ADD_ON_PREFERENCES_FILE);
74
74
  }
75
75
  };
76
- CLIPreferences = __decorate([
76
+ UserPreferences = __decorate([
77
77
  injectable()
78
- ], CLIPreferences);
79
- export { CLIPreferences };
80
- //# sourceMappingURL=CLIPreferences.js.map
78
+ ], UserPreferences);
79
+ export { UserPreferences };
80
+ //# sourceMappingURL=UserPreferences.js.map
@@ -21,12 +21,11 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
- export * from "./CLIPreferences.js";
25
24
  export * from "./CLIProcess.js";
26
25
  export * from "./ConsoleLogger.js";
27
26
  export * from "./Extensions.js";
28
- export * from "./Logger.js";
29
- export * from "./Preferences.js";
30
- export * from "./Process.js";
27
+ export type * from "./Logger.js";
28
+ export type * from "./Process.js";
31
29
  export * from "./UncaughtExceptionHandler.js";
30
+ export * from "./UserPreferences.js";
32
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,cAAc,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC"}
@@ -21,12 +21,9 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
- export * from "./CLIPreferences.js";
25
24
  export * from "./CLIProcess.js";
26
25
  export * from "./ConsoleLogger.js";
27
26
  export * from "./Extensions.js";
28
- export * from "./Logger.js";
29
- export * from "./Preferences.js";
30
- export * from "./Process.js";
31
27
  export * from "./UncaughtExceptionHandler.js";
28
+ export * from "./UserPreferences.js";
32
29
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/ccweb-add-on-core",
3
- "version": "2.5.0",
3
+ "version": "3.1.0",
4
4
  "author": "Adobe",
5
5
  "license": "MIT",
6
6
  "description": "Core libraries for Adobe Creative Cloud Web Add-on.",
@@ -17,28 +17,28 @@
17
17
  "url": "https://github.com/adobe/create-ccweb-add-on"
18
18
  },
19
19
  "dependencies": {
20
+ "@swc/helpers": "0.5.17",
20
21
  "application-config-path": "0.1.0",
21
22
  "chalk": "4.1.1",
22
- "cross-spawn": "7.0.3",
23
+ "cross-spawn": "7.0.6",
23
24
  "fs-extra": "10.0.1",
24
25
  "hjson": "3.2.2",
25
26
  "inversify": "6.0.1",
26
27
  "reflect-metadata": "0.1.13",
27
28
  "string-template": "1.0.0",
28
- "tslib": "2.6.2",
29
- "@swc/helpers": "0.5.12",
30
- "@adobe/ccweb-add-on-manifest": "2.5.0"
29
+ "tslib": "2.7.0",
30
+ "@adobe/ccweb-add-on-manifest": "3.1.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/chai": "4.2.14",
34
- "@types/cross-spawn": "6.0.2",
34
+ "@types/cross-spawn": "6.0.6",
35
35
  "@types/fs-extra": "9.0.13",
36
36
  "@types/hjson": "2.4.3",
37
37
  "@types/mocha": "9.1.1",
38
- "@types/node": "16.18.36",
38
+ "@types/node": "18.18.2",
39
39
  "@types/sinon": "9.0.8",
40
40
  "@types/string-template": "1.0.2",
41
- "c8": "7.7.2",
41
+ "c8": "10.1.3",
42
42
  "chai": "4.3.4",
43
43
  "mocha": "10.0.0",
44
44
  "prettier": "2.8.0",
@@ -47,13 +47,13 @@
47
47
  "sinon": "9.2.1",
48
48
  "ts-node": "10.9.2",
49
49
  "ts-sinon": "2.0.1",
50
- "typescript": "5.4.5"
50
+ "typescript": "5.7.3"
51
51
  },
52
52
  "scripts": {
53
53
  "clean": "rimraf dist coverage",
54
54
  "ibuild": "tsc",
55
55
  "build": "rushx clean && rushx ibuild",
56
56
  "build:release": "rushx build",
57
- "test": "c8 mocha && c8 check-coverage --lines 100 --functions 100 --branches 100"
57
+ "test": "c8 mocha && c8 check-coverage"
58
58
  }
59
59
  }
@@ -24,16 +24,19 @@
24
24
 
25
25
  import { Container } from "inversify";
26
26
  import "reflect-metadata";
27
- import type { Logger, Preferences, Process } from "../utilities/index.js";
28
- import { CLIPreferences, CLIProcess, ConsoleLogger } from "../utilities/index.js";
27
+ import { CLIProcess } from "../utilities/CLIProcess.js";
28
+ import { ConsoleLogger } from "../utilities/ConsoleLogger.js";
29
+ import type { Logger } from "../utilities/Logger.js";
30
+ import type { Process } from "../utilities/Process.js";
31
+ import { UserPreferences } from "../utilities/UserPreferences.js";
29
32
  import { ITypes } from "./inversify.types.js";
30
33
 
31
- const container = new Container();
34
+ const container: Container = new Container();
32
35
 
33
36
  container.bind<Logger>(ITypes.Logger).to(ConsoleLogger).inTransientScope();
34
37
 
35
38
  container.bind<Process>(ITypes.Process).to(CLIProcess).inSingletonScope();
36
39
 
37
- container.bind<Preferences>(ITypes.Preferences).to(CLIPreferences).inSingletonScope();
40
+ container.bind<UserPreferences>(ITypes.UserPreferences).to(UserPreferences).inSingletonScope();
38
41
 
39
42
  export { container as IContainer };
@@ -22,9 +22,12 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
- export const ITypes = {
25
+ export const ITypes: {
26
+ Logger: symbol;
27
+ Process: symbol;
28
+ UserPreferences: symbol;
29
+ } = {
26
30
  Logger: Symbol.for("Logger"),
27
31
  Process: Symbol.for("Process"),
28
- Preferences: Symbol.for("Preferences"),
29
- AccountService: Symbol.for("AccountService")
32
+ UserPreferences: Symbol.for("UserPreferences")
30
33
  };
package/src/constants.ts CHANGED
@@ -30,7 +30,7 @@ export const DEFAULT_ADD_ON_VERSION = "1.0.0";
30
30
  export const DEFAULT_SRC_DIRECTORY = "src";
31
31
  export const DEFAULT_OUTPUT_DIRECTORY = "dist";
32
32
 
33
- export const CCWEB_ADDON_DIRECTORY = path.join("Adobe", "CCWebAddOn");
33
+ export const CCWEB_ADDON_DIRECTORY: string = path.join("Adobe", "CCWebAddOn");
34
34
  export const ADD_ON_PREFERENCES_FILE = "add-on-preferences.json";
35
35
  export const ADDITIONAL_ADD_ON_INFO = {
36
36
  sourceId: "developerSource",
@@ -38,4 +38,4 @@ export const ADDITIONAL_ADD_ON_INFO = {
38
38
  isDeveloperAddOn: true
39
39
  };
40
40
 
41
- export const ALLOWED_HOSTNAMES = /[a-zA-Z]\.adobe.com$/;
41
+ export const ALLOWED_HOSTNAMES: RegExp = /[a-zA-Z]\.adobe.com$/;
@@ -1,7 +1,7 @@
1
1
  /********************************************************************************
2
2
  * MIT License
3
3
 
4
- * © Copyright 2023 Adobe. All rights reserved.
4
+ * © Copyright 2025 Adobe. All rights reserved.
5
5
 
6
6
  * Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  * of this software and associated documentation files (the "Software"), to deal
@@ -9,10 +9,10 @@
9
9
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
10
  * copies of the Software, and to permit persons to whom the Software is
11
11
  * furnished to do so, subject to the following conditions:
12
- *
12
+ *
13
13
  * The above copyright notice and this permission notice shall be included in all
14
14
  * copies or substantial portions of the Software.
15
- *
15
+ *
16
16
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
17
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
18
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -21,5 +21,23 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
- export {};
25
- //# sourceMappingURL=Types.js.map
24
+
25
+ import type { ManifestEntrypoint } from "@adobe/ccweb-add-on-manifest";
26
+
27
+ export interface AddOnMetaData {
28
+ name: string;
29
+ }
30
+
31
+ export interface AddOnDetails {
32
+ localizedMetadata: AddOnMetaData;
33
+ }
34
+
35
+ export interface AddOnListingData {
36
+ addonId: string;
37
+ versionString: string;
38
+ supportedLanguages: string[];
39
+ supportedApps: string[];
40
+ downloadUrl: string;
41
+ addon: AddOnDetails;
42
+ entryPoints: ManifestEntrypoint[];
43
+ }
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
- import { getJSONString } from "../utilities/index.js";
25
+ import { getJSONString } from "../utilities/Extensions.js";
26
26
  import { TemplateJson } from "./TemplateJson.js";
27
27
 
28
28
  /**
@@ -23,7 +23,7 @@
23
23
  ********************************************************************************/
24
24
 
25
25
  import { DEFAULT_HOST_NAME } from "../constants.js";
26
- import { getJSONString, isNullOrWhiteSpace, isObject } from "../utilities/index.js";
26
+ import { getJSONString, isNullOrWhiteSpace, isObject } from "../utilities/Extensions.js";
27
27
 
28
28
  /**
29
29
  * SSL related settings.
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
+ export type * from "./AddOnListingData.js";
25
26
  export * from "./PackageJson.js";
26
27
  export * from "./PreferenceJson.js";
27
28
  export * from "./TemplateJson.js";
28
- export * from "./Types.js";
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { assert } from "chai";
26
26
  import "mocha";
27
- import { TemplateJson } from "../../models/index.js";
27
+ import { TemplateJson } from "../../models/TemplateJson.js";
28
28
 
29
29
  describe("TemplateJson", () => {
30
30
  describe("constructor ...", () => {
@@ -36,9 +36,9 @@ import type { SinonSandbox } from "sinon";
36
36
  import sinon from "sinon";
37
37
  import type { StubbedInstance } from "ts-sinon";
38
38
  import { stubInterface } from "ts-sinon";
39
- import type { ExecutionResult } from "../../models/Types.js";
40
- import type { Logger, Process } from "../../utilities/index.js";
41
- import { CLIProcess } from "../../utilities/index.js";
39
+ import { CLIProcess } from "../../utilities/CLIProcess.js";
40
+ import type { Logger } from "../../utilities/Logger.js";
41
+ import type { ExecutionResult, Process } from "../../utilities/Process.js";
42
42
 
43
43
  describe("CLIProcess", () => {
44
44
  let sandbox: SinonSandbox;
@@ -27,8 +27,8 @@ import chalk from "chalk";
27
27
  import "mocha";
28
28
  import type { SinonSandbox } from "sinon";
29
29
  import sinon from "sinon";
30
- import type { Logger } from "../../utilities/index.js";
31
- import { ConsoleLogger } from "../../utilities/index.js";
30
+ import { ConsoleLogger } from "../../utilities/ConsoleLogger.js";
31
+ import type { Logger } from "../../utilities/Logger.js";
32
32
 
33
33
  describe("ConsoleLogger", () => {
34
34
  let sandbox: SinonSandbox;
@@ -31,7 +31,7 @@ import type { StubbedInstance } from "ts-sinon";
31
31
  import { stubInterface } from "ts-sinon";
32
32
  import { IContainer, ITypes } from "../../config/index.js";
33
33
  import type { Logger } from "../../utilities/Logger.js";
34
- import { UncaughtExceptionHandler } from "../../utilities/index.js";
34
+ import { UncaughtExceptionHandler } from "../../utilities/UncaughtExceptionHandler.js";
35
35
 
36
36
  describe("UncaughtExceptionHandler", () => {
37
37
  let sandbox: SinonSandbox;
@@ -32,16 +32,15 @@ import type { SinonSandbox } from "sinon";
32
32
  import sinon from "sinon";
33
33
  import { ADD_ON_PREFERENCES_FILE, CCWEB_ADDON_DIRECTORY } from "../../constants.js";
34
34
  import { PreferenceJson } from "../../models/PreferenceJson.js";
35
- import type { Preferences } from "../../utilities/index.js";
36
- import { CLIPreferences } from "../../utilities/index.js";
35
+ import { UserPreferences } from "../../utilities/UserPreferences.js";
37
36
 
38
- describe("CLIPreferences", () => {
37
+ describe("UserPreferences", () => {
39
38
  let sandbox: SinonSandbox;
40
- let cliPreferences: Preferences;
39
+ let preferences: UserPreferences;
41
40
 
42
41
  beforeEach(() => {
43
42
  sandbox = sinon.createSandbox();
44
- cliPreferences = new CLIPreferences();
43
+ preferences = new UserPreferences();
45
44
  });
46
45
 
47
46
  afterEach(() => {
@@ -65,9 +64,9 @@ describe("CLIPreferences", () => {
65
64
  const writeFileStub = sandbox.stub(fs, "writeFileSync");
66
65
  writeFileStub.withArgs(preferenceFilePath, JSON.stringify({}, undefined, 4) + os.EOL).returns();
67
66
 
68
- const preferences = cliPreferences.get();
67
+ const preferenceJson = preferences.get();
69
68
 
70
- assert.deepEqual(new PreferenceJson({}), preferences);
69
+ assert.deepEqual(new PreferenceJson({}), preferenceJson);
71
70
  assert.equal(ensureFileStub.calledOnceWith(preferenceFilePath), true);
72
71
  assert.equal(
73
72
  writeFileStub.calledOnceWith(preferenceFilePath, JSON.stringify({}, undefined, 4) + os.EOL),
@@ -87,8 +86,8 @@ describe("CLIPreferences", () => {
87
86
 
88
87
  sandbox.stub(fs, "readFileSync").withArgs(preferenceFilePath, "utf-8").returns("");
89
88
 
90
- const preferences = cliPreferences.get();
91
- assert.deepEqual(new PreferenceJson({}), preferences);
89
+ const preferenceJson = preferences.get();
90
+ assert.deepEqual(new PreferenceJson({}), preferenceJson);
92
91
  });
93
92
 
94
93
  it(`should return empty preferences if any error is encountered while reading '${ADD_ON_PREFERENCES_FILE}'.`, () => {
@@ -106,8 +105,8 @@ describe("CLIPreferences", () => {
106
105
  .withArgs(preferenceFilePath, "utf-8")
107
106
  .throws(new Error("Unexpected error"));
108
107
 
109
- const preferences = cliPreferences.get();
110
- assert.deepEqual(new PreferenceJson({}), preferences);
108
+ const preferenceJson = preferences.get();
109
+ assert.deepEqual(new PreferenceJson({}), preferenceJson);
111
110
  });
112
111
 
113
112
  it(`should return preferences with values if '${ADD_ON_PREFERENCES_FILE}' exits and has data.`, () => {
@@ -138,13 +137,13 @@ describe("CLIPreferences", () => {
138
137
  const readFileStub = sandbox.stub(fs, "readFileSync");
139
138
  readFileStub.withArgs(preferenceFilePath, "utf-8").returns(JSON.stringify(expectedPreference));
140
139
 
141
- const actualPreference = cliPreferences.get();
140
+ const actualPreference = preferences.get();
142
141
 
143
142
  assert.equal(actualPreference.hasTelemetryConsent, expectedPreference.hasTelemetryConsent);
144
143
  assert.equal(actualPreference.clientId, expectedPreference.clientId);
145
144
  assert.deepEqual(actualPreference.ssl, new Map(Object.entries(expectedPreference.ssl)));
146
145
 
147
- const cachedPreference = cliPreferences.get(true);
146
+ const cachedPreference = preferences.get(true);
148
147
 
149
148
  assert.deepEqual(cachedPreference, actualPreference);
150
149
  assert.equal(fileExistsStub.callCount, 1);
@@ -179,13 +178,13 @@ describe("CLIPreferences", () => {
179
178
 
180
179
  sandbox.stub(fs, "readFileSync").withArgs(preferenceFilePath, "utf-8").returns(JSON.stringify(preference));
181
180
 
182
- const preferenceJson = cliPreferences.get();
181
+ const preferenceJson = preferences.get();
183
182
  preferenceJson.clientId = 123456789;
184
183
 
185
184
  const writeFileStub = sandbox.stub(fs, "writeFileSync");
186
185
  writeFileStub.withArgs(preferenceFilePath, preferenceJson.toJSON() + os.EOL).returns();
187
186
 
188
- cliPreferences.set(preferenceJson);
187
+ preferences.set(preferenceJson);
189
188
 
190
189
  assert.equal(writeFileStub.calledOnceWith(preferenceFilePath, preferenceJson.toJSON() + os.EOL), true);
191
190
  });
@@ -31,9 +31,8 @@ import process from "process";
31
31
  import "reflect-metadata";
32
32
  import format from "string-template";
33
33
  import { ITypes } from "../config/inversify.types.js";
34
- import type { ExecutionResult } from "../models/index.js";
35
34
  import type { Logger } from "./Logger.js";
36
- import type { Process } from "./Process.js";
35
+ import type { ExecutionResult, Process } from "./Process.js";
37
36
 
38
37
  /**
39
38
  * CLI Process implementation class for managing execution of commands.
@@ -25,8 +25,7 @@
25
25
  import type { Chalk } from "chalk";
26
26
  import chalk from "chalk";
27
27
  import { injectable } from "inversify";
28
- import type { LoggerOptions } from "../models/index.js";
29
- import type { Logger } from "./Logger.js";
28
+ import type { Logger, LoggerOptions } from "./Logger.js";
30
29
 
31
30
  /**
32
31
  * Console logger implementation class to handle logging of different levels.
@@ -48,7 +48,7 @@ export function isNullOrWhiteSpace(value: string | null | undefined): boolean {
48
48
  * @param value - Value to check.
49
49
  * @returns Boolean value representing whether the value is an object.
50
50
  */
51
- export function isObject(value: unknown) {
51
+ export function isObject(value: unknown): value is object {
52
52
  return typeof value === "object" && value !== null;
53
53
  }
54
54
 
@@ -22,7 +22,20 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
- import type { LoggerOptions } from "../models/index.js";
25
+ /**
26
+ * Logger options.
27
+ */
28
+ export type LoggerOptions = {
29
+ /**
30
+ * Prefix string.
31
+ */
32
+ prefix?: string;
33
+
34
+ /**
35
+ * Postfix string.
36
+ */
37
+ postfix?: string;
38
+ };
26
39
 
27
40
  /**
28
41
  * Logger interface to handle logging of different levels.
@@ -23,7 +23,31 @@
23
23
  ********************************************************************************/
24
24
 
25
25
  import type { ExecSyncOptions } from "child_process";
26
- import type { ExecutionResult } from "../models/index.js";
26
+
27
+ /**
28
+ * Execution result.
29
+ */
30
+ export type ExecutionResult = {
31
+ /**
32
+ * Command which was executed.
33
+ */
34
+ command: string;
35
+
36
+ /**
37
+ * Whether the execution is successful.
38
+ */
39
+ isSuccessful: boolean;
40
+
41
+ /**
42
+ * Data returned from the execution, if any.
43
+ */
44
+ data?: string;
45
+
46
+ /**
47
+ * Error thrown during the execution, if any.
48
+ */
49
+ error?: unknown;
50
+ };
27
51
 
28
52
  /**
29
53
  * Process interface for managing execution of commands.
@@ -24,7 +24,7 @@
24
24
 
25
25
  import process from "process";
26
26
  import { IContainer, ITypes } from "../config/index.js";
27
- import { type Logger } from "./Logger.js";
27
+ import type { Logger } from "./Logger.js";
28
28
 
29
29
  /**
30
30
  * Uncaught exception handler.
@@ -34,7 +34,7 @@ export class UncaughtExceptionHandler {
34
34
  * Register handler for catching any uncaught exception.
35
35
  * @param programName - Program from where the exception could be thrown.
36
36
  */
37
- static registerExceptionHandler(programName: string) {
37
+ static registerExceptionHandler(programName: string): void {
38
38
  process.on("uncaughtException", error => this.handleUncaughtException(programName, error));
39
39
  }
40
40
 
@@ -31,13 +31,12 @@ import path from "path";
31
31
  import "reflect-metadata";
32
32
  import { ADD_ON_PREFERENCES_FILE, CCWEB_ADDON_DIRECTORY } from "../constants.js";
33
33
  import { PreferenceJson } from "../models/PreferenceJson.js";
34
- import type { Preferences } from "./Preferences.js";
35
34
 
36
35
  /**
37
36
  * Implementation class for configuring CCWeb Add-on CLI related preferences.
38
37
  */
39
38
  @injectable()
40
- export class CLIPreferences implements Preferences {
39
+ export class UserPreferences {
41
40
  private _cachedPreference?: PreferenceJson;
42
41
 
43
42
  /**
@@ -22,11 +22,10 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
- export * from "./CLIPreferences.js";
26
25
  export * from "./CLIProcess.js";
27
26
  export * from "./ConsoleLogger.js";
28
27
  export * from "./Extensions.js";
29
- export * from "./Logger.js";
30
- export * from "./Preferences.js";
31
- export * from "./Process.js";
28
+ export type * from "./Logger.js";
29
+ export type * from "./Process.js";
32
30
  export * from "./UncaughtExceptionHandler.js";
31
+ export * from "./UserPreferences.js";
package/tsconfig.json CHANGED
@@ -17,11 +17,13 @@
17
17
  "outDir": "dist",
18
18
  "preserveConstEnums": true,
19
19
  "resolveJsonModule": true,
20
+ "skipLibCheck": true,
20
21
  "sourceMap": true,
21
22
  "strict": true,
22
23
  "target": "ESNext",
23
24
  "types": ["reflect-metadata"],
24
- "useUnknownInCatchVariables": false
25
+ "useUnknownInCatchVariables": false,
26
+ "isolatedDeclarations": true
25
27
  },
26
28
  "exclude": ["node_modules", "src/test/**/*"],
27
29
  "include": ["src/**/*"],