@adobe/ccweb-add-on-core 0.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.
- package/.c8rc.json +14 -0
- package/.mocharc.json +5 -0
- package/CODE_OF_CONDUCT.md +79 -0
- package/CONTRIBUTING.md +47 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/config/index.d.ts +26 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +26 -0
- package/dist/config/inversify.config.d.ts +28 -0
- package/dist/config/inversify.config.d.ts.map +1 -0
- package/dist/config/inversify.config.js +33 -0
- package/dist/config/inversify.types.d.ts +30 -0
- package/dist/config/inversify.types.d.ts.map +1 -0
- package/dist/config/inversify.types.js +30 -0
- package/dist/constants.d.ts +37 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +38 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/models/PackageJson.d.ts +61 -0
- package/dist/models/PackageJson.d.ts.map +1 -0
- package/dist/models/PackageJson.js +76 -0
- package/dist/models/PreferenceJson.d.ts +79 -0
- package/dist/models/PreferenceJson.d.ts.map +1 -0
- package/dist/models/PreferenceJson.js +88 -0
- package/dist/models/TemplateJson.d.ts +53 -0
- package/dist/models/TemplateJson.d.ts.map +1 -0
- package/dist/models/TemplateJson.js +112 -0
- package/dist/models/Types.d.ts +72 -0
- package/dist/models/Types.d.ts.map +1 -0
- package/dist/models/Types.js +25 -0
- package/dist/models/index.d.ts +28 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +28 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utilities/CLIPreferences.d.ts +45 -0
- package/dist/utilities/CLIPreferences.d.ts.map +1 -0
- package/dist/utilities/CLIPreferences.js +80 -0
- package/dist/utilities/CLIProcess.d.ts +74 -0
- package/dist/utilities/CLIProcess.d.ts.map +1 -0
- package/dist/utilities/CLIProcess.js +190 -0
- package/dist/utilities/ConsoleLogger.d.ts +64 -0
- package/dist/utilities/ConsoleLogger.d.ts.map +1 -0
- package/dist/utilities/ConsoleLogger.js +103 -0
- package/dist/utilities/Extensions.d.ts +67 -0
- package/dist/utilities/Extensions.d.ts.map +1 -0
- package/dist/utilities/Extensions.js +92 -0
- package/dist/utilities/Logger.d.ts +65 -0
- package/dist/utilities/Logger.d.ts.map +1 -0
- package/dist/utilities/Logger.js +25 -0
- package/dist/utilities/Preferences.d.ts +41 -0
- package/dist/utilities/Preferences.d.ts.map +1 -0
- package/dist/utilities/Preferences.js +25 -0
- package/dist/utilities/Process.d.ts +63 -0
- package/dist/utilities/Process.d.ts.map +1 -0
- package/dist/utilities/Process.js +25 -0
- package/dist/utilities/UncaughtExceptionHandler.d.ts +40 -0
- package/dist/utilities/UncaughtExceptionHandler.d.ts.map +1 -0
- package/dist/utilities/UncaughtExceptionHandler.js +51 -0
- package/dist/utilities/index.d.ts +32 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +32 -0
- package/package.json +51 -0
- package/src/config/index.ts +26 -0
- package/src/config/inversify.config.ts +39 -0
- package/src/config/inversify.types.ts +30 -0
- package/src/constants.ts +41 -0
- package/src/index.ts +28 -0
- package/src/models/PackageJson.ts +83 -0
- package/src/models/PreferenceJson.ts +112 -0
- package/src/models/TemplateJson.ts +121 -0
- package/src/models/Types.ts +80 -0
- package/src/models/index.ts +28 -0
- package/src/test/models/PackageJson.spec.ts +198 -0
- package/src/test/models/PreferenceJson.spec.ts +184 -0
- package/src/test/models/TemplateJson.spec.ts +179 -0
- package/src/test/utilities/CLIPreferences.spec.ts +208 -0
- package/src/test/utilities/CLIProcess.spec.ts +363 -0
- package/src/test/utilities/ConsoleLogger.spec.ts +165 -0
- package/src/test/utilities/Extensions.spec.ts +240 -0
- package/src/test/utilities/UncaughtExceptionHandler.spec.ts +83 -0
- package/src/types/applicationConfigPath.d.ts +1 -0
- package/src/utilities/CLIPreferences.ts +84 -0
- package/src/utilities/CLIProcess.ts +200 -0
- package/src/utilities/ConsoleLogger.ts +111 -0
- package/src/utilities/Extensions.ts +98 -0
- package/src/utilities/Logger.ts +70 -0
- package/src/utilities/Preferences.ts +43 -0
- package/src/utilities/Process.ts +66 -0
- package/src/utilities/UncaughtExceptionHandler.ts +55 -0
- package/src/utilities/index.ts +32 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
export * from "./CLIPreferences.js";
|
|
25
|
+
export * from "./CLIProcess.js";
|
|
26
|
+
export * from "./ConsoleLogger.js";
|
|
27
|
+
export * from "./Extensions.js";
|
|
28
|
+
export * from "./Logger.js";
|
|
29
|
+
export * from "./Preferences.js";
|
|
30
|
+
export * from "./Process.js";
|
|
31
|
+
export * from "./UncaughtExceptionHandler.js";
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adobe/ccweb-add-on-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"author": "Adobe",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Core libraries for Adobe Creative Cloud Web Add-on.",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"url": "https://github.com/adobe/create-ccweb-add-on"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@adobe/ccweb-add-on-manifest": "0.1.0",
|
|
14
|
+
"application-config-path": "0.1.0",
|
|
15
|
+
"chalk": "4.1.1",
|
|
16
|
+
"cross-spawn": "7.0.3",
|
|
17
|
+
"fs-extra": "10.0.1",
|
|
18
|
+
"hjson": "3.2.2",
|
|
19
|
+
"inversify": "6.0.1",
|
|
20
|
+
"reflect-metadata": "0.1.13",
|
|
21
|
+
"string-template": "1.0.0",
|
|
22
|
+
"tslib": "2.4.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/chai": "4.2.14",
|
|
26
|
+
"@types/cross-spawn": "6.0.2",
|
|
27
|
+
"@types/fs-extra": "9.0.13",
|
|
28
|
+
"@types/hjson": "2.4.3",
|
|
29
|
+
"@types/mocha": "9.1.1",
|
|
30
|
+
"@types/node": "16.11.62",
|
|
31
|
+
"@types/sinon": "9.0.8",
|
|
32
|
+
"@types/string-template": "1.0.2",
|
|
33
|
+
"c8": "7.7.2",
|
|
34
|
+
"chai": "4.3.4",
|
|
35
|
+
"mocha": "10.0.0",
|
|
36
|
+
"prettier": "2.8.0",
|
|
37
|
+
"regenerator-runtime": "0.13.9",
|
|
38
|
+
"rimraf": "3.0.2",
|
|
39
|
+
"sinon": "9.2.1",
|
|
40
|
+
"ts-node": "10.9.1",
|
|
41
|
+
"ts-sinon": "2.0.1",
|
|
42
|
+
"typescript": "4.8.4"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"clean": "rimraf dist coverage",
|
|
46
|
+
"ibuild": "tsc",
|
|
47
|
+
"build": "rushx clean && rushx ibuild",
|
|
48
|
+
"build:release": "rushx build",
|
|
49
|
+
"test": "c8 mocha && c8 check-coverage --lines 100 --functions 100 --branches 100"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export * from "./inversify.config.js";
|
|
26
|
+
export * from "./inversify.types.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import { Container } from "inversify";
|
|
26
|
+
import "reflect-metadata";
|
|
27
|
+
import type { Logger, Preferences, Process } from "../utilities/index.js";
|
|
28
|
+
import { CLIPreferences, CLIProcess, ConsoleLogger } from "../utilities/index.js";
|
|
29
|
+
import { ITypes } from "./inversify.types.js";
|
|
30
|
+
|
|
31
|
+
const container = new Container();
|
|
32
|
+
|
|
33
|
+
container.bind<Logger>(ITypes.Logger).to(ConsoleLogger).inTransientScope();
|
|
34
|
+
|
|
35
|
+
container.bind<Process>(ITypes.Process).to(CLIProcess).inSingletonScope();
|
|
36
|
+
|
|
37
|
+
container.bind<Preferences>(ITypes.Preferences).to(CLIPreferences).inSingletonScope();
|
|
38
|
+
|
|
39
|
+
export { container as IContainer };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export const ITypes = {
|
|
26
|
+
Logger: Symbol.for("Logger"),
|
|
27
|
+
Process: Symbol.for("Process"),
|
|
28
|
+
Preferences: Symbol.for("Preferences"),
|
|
29
|
+
AccountService: Symbol.for("AccountService")
|
|
30
|
+
};
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import path from "path";
|
|
26
|
+
|
|
27
|
+
export const DEFAULT_HOST_NAME = "localhost";
|
|
28
|
+
export const DEFAULT_PORT = "5241";
|
|
29
|
+
export const DEFAULT_ADD_ON_VERSION = "1.0.0";
|
|
30
|
+
export const DEFAULT_SRC_DIRECTORY = "src";
|
|
31
|
+
export const DEFAULT_OUTPUT_DIRECTORY = "dist";
|
|
32
|
+
|
|
33
|
+
export const CCWEB_ADDON_DIRECTORY = path.join("Adobe", "CCWebAddOn");
|
|
34
|
+
export const ADD_ON_PREFERENCES_FILE = "add-on-preferences.json";
|
|
35
|
+
export const ADDITIONAL_ADD_ON_INFO = {
|
|
36
|
+
sourceId: "developerSource",
|
|
37
|
+
privileged: false,
|
|
38
|
+
isDeveloperAddOn: true
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const ALLOWED_HOSTNAMES = /[a-zA-Z]\.adobe.com$/;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export * from "./config/index.js";
|
|
26
|
+
export * from "./constants.js";
|
|
27
|
+
export * from "./models/index.js";
|
|
28
|
+
export * from "./utilities/index.js";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import { getJSONString } from "../utilities/index.js";
|
|
26
|
+
import { TemplateJson } from "./TemplateJson.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Class representing package.json.
|
|
30
|
+
*/
|
|
31
|
+
export class PackageJson extends TemplateJson {
|
|
32
|
+
/**
|
|
33
|
+
* name property.
|
|
34
|
+
*/
|
|
35
|
+
name?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* version property.
|
|
39
|
+
*/
|
|
40
|
+
version?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* description property.
|
|
44
|
+
*/
|
|
45
|
+
description?: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* keywords property.
|
|
49
|
+
*/
|
|
50
|
+
keywords?: string[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Instantiate {@link PackageJson}.
|
|
54
|
+
*
|
|
55
|
+
* @param content - package.json content.
|
|
56
|
+
* @returns Reference to a new {@link PackageJson} instance.
|
|
57
|
+
*/
|
|
58
|
+
constructor(content: { [k: string]: unknown }) {
|
|
59
|
+
super(content);
|
|
60
|
+
|
|
61
|
+
this.name = content.name as string;
|
|
62
|
+
this.version = content.version as string;
|
|
63
|
+
this.description = content.description as string;
|
|
64
|
+
this.keywords = content.keywords as string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get JSON representation of this {@link PackageJson} reference.
|
|
69
|
+
*
|
|
70
|
+
* @returns JSON representation as string.
|
|
71
|
+
*/
|
|
72
|
+
toJSON(): string {
|
|
73
|
+
return getJSONString({
|
|
74
|
+
name: this.name,
|
|
75
|
+
version: this.version,
|
|
76
|
+
description: this.description,
|
|
77
|
+
scripts: this.scripts ? Object.fromEntries(this.scripts) : undefined,
|
|
78
|
+
keywords: this.keywords,
|
|
79
|
+
dependencies: this.dependencies ? Object.fromEntries(this.dependencies) : undefined,
|
|
80
|
+
devDependencies: this.devDependencies ? Object.fromEntries(this.devDependencies) : undefined
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
import { DEFAULT_HOST_NAME } from "../constants.js";
|
|
26
|
+
import { getJSONString, isNullOrWhiteSpace, isObject } from "../utilities/index.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* SSL related settings.
|
|
30
|
+
*/
|
|
31
|
+
export interface SSLSettings {
|
|
32
|
+
/**
|
|
33
|
+
* Path of the SSL certificate file.
|
|
34
|
+
*/
|
|
35
|
+
certificatePath: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Path of the SSL key file.
|
|
39
|
+
*/
|
|
40
|
+
keyPath: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Class representing CCWeb Add-on CLI related preferences.
|
|
45
|
+
*/
|
|
46
|
+
export class PreferenceJson {
|
|
47
|
+
/**
|
|
48
|
+
* stores user consent to collect telemetry data
|
|
49
|
+
*/
|
|
50
|
+
hasTelemetryConsent?: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* stores the auth_token and refresh_token
|
|
54
|
+
*/
|
|
55
|
+
ims?: { [k: string]: unknown };
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* stores the clientId used to identify client while sending analytics
|
|
59
|
+
*/
|
|
60
|
+
clientId?: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Map of SSL settings corresponding to a unique hostname.
|
|
64
|
+
*/
|
|
65
|
+
ssl?: Map<string, SSLSettings>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Instantiate {@link PreferenceJson}.
|
|
69
|
+
* @param content - JSON file content.
|
|
70
|
+
* @returns Reference to a new {@link PreferenceJson} instance.
|
|
71
|
+
*/
|
|
72
|
+
constructor(content: { [k: string]: unknown }) {
|
|
73
|
+
this.ssl = this._getSSL(content);
|
|
74
|
+
this.hasTelemetryConsent = content.hasTelemetryConsent as boolean;
|
|
75
|
+
this.ims = content.ims as { [k: string]: unknown };
|
|
76
|
+
this.clientId = content.clientId as number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get JSON representation of this {@link PreferenceJson} reference.
|
|
81
|
+
* @returns JSON representation as string.
|
|
82
|
+
*/
|
|
83
|
+
toJSON(): string {
|
|
84
|
+
return getJSONString({
|
|
85
|
+
hasTelemetryConsent: this.hasTelemetryConsent,
|
|
86
|
+
ims: this.ims,
|
|
87
|
+
clientId: this.clientId,
|
|
88
|
+
ssl: this.ssl ? Object.fromEntries(this.ssl) : undefined
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Support V1 and V2 of SSL contract.
|
|
94
|
+
* @param content - JSON file content.
|
|
95
|
+
* @returns Map of SSL settings corresponding to a unique hostname.
|
|
96
|
+
*/
|
|
97
|
+
private _getSSL(content: { [k: string]: unknown }): Map<string, SSLSettings> | undefined {
|
|
98
|
+
if (isObject(content.ssl)) {
|
|
99
|
+
return new Map(Object.entries(content.ssl!));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Backward compatibility for `sslCertPath` and `sslKeyPath`
|
|
103
|
+
// which mapped to `localhost` hostname in manually configured SSL.
|
|
104
|
+
const certificatePath = content.sslCertPath as string;
|
|
105
|
+
const keyPath = content.sslKeyPath as string;
|
|
106
|
+
if (!isNullOrWhiteSpace(certificatePath) && !isNullOrWhiteSpace(keyPath)) {
|
|
107
|
+
return new Map([[DEFAULT_HOST_NAME, { certificatePath, keyPath }]]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Class representing template.json.
|
|
27
|
+
*/
|
|
28
|
+
export class TemplateJson {
|
|
29
|
+
/**
|
|
30
|
+
* dependencies property.
|
|
31
|
+
*/
|
|
32
|
+
dependencies?: Map<string, string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* devDependencies property.
|
|
36
|
+
*/
|
|
37
|
+
devDependencies?: Map<string, string>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* scripts property.
|
|
41
|
+
*/
|
|
42
|
+
scripts?: Map<string, string>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Instantiate {@link TemplateJson}.
|
|
46
|
+
*
|
|
47
|
+
* @param content - template.json content.
|
|
48
|
+
* @returns Reference to a new {@link TemplateJson} instance.
|
|
49
|
+
*/
|
|
50
|
+
constructor(content: { [k: string]: unknown }) {
|
|
51
|
+
this._setDependencies(content);
|
|
52
|
+
this._setDevDependencies(content);
|
|
53
|
+
this._setScripts(content);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private _setDependencies(content: { [k: string]: unknown }) {
|
|
57
|
+
if (content.dependencies) {
|
|
58
|
+
if (content.dependencies instanceof Map) {
|
|
59
|
+
content.dependencies.forEach((value: string, key: string) => {
|
|
60
|
+
if (!this.dependencies) {
|
|
61
|
+
this.dependencies = new Map<string, string>();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.dependencies.set(key, value);
|
|
65
|
+
});
|
|
66
|
+
} else if (content.dependencies instanceof Object) {
|
|
67
|
+
for (const [key, value] of Object.entries(content.dependencies)) {
|
|
68
|
+
if (!this.dependencies) {
|
|
69
|
+
this.dependencies = new Map<string, string>();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.dependencies.set(key, value.toString());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private _setDevDependencies(content: { [k: string]: unknown }) {
|
|
79
|
+
if (content.devDependencies) {
|
|
80
|
+
if (content.devDependencies instanceof Map) {
|
|
81
|
+
content.devDependencies.forEach((value: string, key: string) => {
|
|
82
|
+
if (!this.devDependencies) {
|
|
83
|
+
this.devDependencies = new Map<string, string>();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.devDependencies.set(key, value);
|
|
87
|
+
});
|
|
88
|
+
} else if (content.devDependencies instanceof Object) {
|
|
89
|
+
for (const [key, value] of Object.entries(content.devDependencies)) {
|
|
90
|
+
if (!this.devDependencies) {
|
|
91
|
+
this.devDependencies = new Map<string, string>();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.devDependencies.set(key, value.toString());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private _setScripts(content: { [k: string]: unknown }) {
|
|
101
|
+
if (content.scripts) {
|
|
102
|
+
if (content.scripts instanceof Map) {
|
|
103
|
+
content.scripts.forEach((value: string, key: string) => {
|
|
104
|
+
if (!this.scripts) {
|
|
105
|
+
this.scripts = new Map<string, string>();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.scripts.set(key, value);
|
|
109
|
+
});
|
|
110
|
+
} else if (content.scripts instanceof Object) {
|
|
111
|
+
for (const [key, value] of Object.entries(content.scripts)) {
|
|
112
|
+
if (!this.scripts) {
|
|
113
|
+
this.scripts = new Map<string, string>();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.scripts.set(key, value.toString());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Execution result.
|
|
27
|
+
*/
|
|
28
|
+
export type ExecutionResult = {
|
|
29
|
+
/**
|
|
30
|
+
* Command which was executed.
|
|
31
|
+
*/
|
|
32
|
+
command: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether the execution is successful.
|
|
36
|
+
*/
|
|
37
|
+
isSuccessful: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Data returned from the execution, if any.
|
|
41
|
+
*/
|
|
42
|
+
data?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Error thrown during the execution, if any.
|
|
46
|
+
*/
|
|
47
|
+
error?: unknown;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Logger options.
|
|
52
|
+
*/
|
|
53
|
+
export type LoggerOptions = {
|
|
54
|
+
/**
|
|
55
|
+
* Prefix string.
|
|
56
|
+
*/
|
|
57
|
+
prefix?: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Postfix string.
|
|
61
|
+
*/
|
|
62
|
+
postfix?: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type AddOnMetaData = {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type AddOn = {
|
|
70
|
+
localizedMetadata: AddOnMetaData;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type Schema = {
|
|
74
|
+
addonId: string;
|
|
75
|
+
versionString: string;
|
|
76
|
+
supportedLanguages: string[];
|
|
77
|
+
supportedApps: string[];
|
|
78
|
+
downloadUrl: string;
|
|
79
|
+
addon: AddOn;
|
|
80
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* MIT License
|
|
3
|
+
|
|
4
|
+
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
+
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
********************************************************************************/
|
|
24
|
+
|
|
25
|
+
export * from "./PackageJson.js";
|
|
26
|
+
export * from "./PreferenceJson.js";
|
|
27
|
+
export * from "./TemplateJson.js";
|
|
28
|
+
export * from "./Types.js";
|