@adobe/create-ccweb-add-on 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.
- package/.c8rc.json +4 -1
- package/.mocharc.json +9 -2
- package/README.md +2 -2
- package/bin/run.js +2 -2
- package/dist/app/AddOnFactory.d.ts +30 -3
- package/dist/app/AddOnFactory.d.ts.map +1 -1
- package/dist/app/AddOnFactory.js +140 -1
- package/dist/app/{AddOnManager.d.ts → PackageManager.d.ts} +4 -4
- package/dist/app/PackageManager.d.ts.map +1 -0
- package/dist/app/{AddOnManager.js → PackageManager.js} +5 -6
- package/dist/app/TemplateSelector.d.ts +20 -4
- package/dist/app/TemplateSelector.d.ts.map +1 -1
- package/dist/app/TemplateSelector.js +142 -1
- package/dist/app/index.d.ts +1 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -3
- package/dist/commands/create.d.ts +6 -10
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +11 -37
- package/dist/config/inversify.config.d.ts +2 -1
- package/dist/config/inversify.config.d.ts.map +1 -1
- package/dist/config/inversify.config.js +8 -6
- package/dist/config/inversify.types.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/models/CLIOptions.d.ts +4 -4
- package/dist/models/CLIOptions.d.ts.map +1 -1
- package/dist/models/CLIOptions.js +5 -5
- package/dist/templates/react-javascript/template/src/components/App.jsx +2 -2
- package/dist/templates/react-javascript/template/webpack.config.js +1 -0
- package/dist/templates/react-javascript/template.json +4 -4
- package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/components/App.jsx +2 -2
- package/dist/templates/react-javascript-with-document-sandbox/template/webpack.config.js +1 -0
- package/dist/templates/react-javascript-with-document-sandbox/template.json +4 -4
- package/dist/templates/react-typescript/template/src/components/App.tsx +2 -2
- package/dist/templates/react-typescript/template/webpack.config.js +1 -0
- package/dist/templates/react-typescript/template.json +4 -4
- package/dist/templates/react-typescript-with-document-sandbox/template/src/ui/components/App.tsx +2 -2
- package/dist/templates/react-typescript-with-document-sandbox/template/webpack.config.js +1 -0
- package/dist/templates/react-typescript-with-document-sandbox/template.json +4 -4
- package/dist/templates/swc-javascript/template/src/components/App.js +2 -2
- package/dist/templates/swc-javascript/template/webpack.config.js +1 -0
- package/dist/templates/swc-javascript/template.json +4 -4
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +2 -2
- package/dist/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +1 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template.json +4 -4
- package/dist/templates/swc-typescript/template/src/components/App.css.ts +2 -2
- package/dist/templates/swc-typescript/template/src/components/App.ts +4 -4
- package/dist/templates/swc-typescript/template/src/index.ts +2 -2
- package/dist/templates/swc-typescript/template/webpack.config.js +1 -0
- package/dist/templates/swc-typescript/template.json +4 -4
- package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +2 -2
- package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.ts +4 -4
- package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/index.ts +2 -2
- package/dist/templates/swc-typescript-with-document-sandbox/template/webpack.config.js +1 -0
- package/dist/templates/swc-typescript-with-document-sandbox/template.json +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/DirectoryValidator.d.ts +22 -11
- package/dist/validators/DirectoryValidator.d.ts.map +1 -1
- package/dist/validators/DirectoryValidator.js +152 -1
- package/dist/validators/EnvironmentValidator.d.ts +17 -2
- package/dist/validators/EnvironmentValidator.d.ts.map +1 -1
- package/dist/validators/EnvironmentValidator.js +149 -1
- package/dist/validators/index.d.ts +0 -2
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +0 -2
- package/package.json +26 -20
- package/src/app/AddOnFactory.ts +164 -4
- package/src/app/{AddOnManager.ts → PackageManager.ts} +4 -6
- package/src/app/TemplateSelector.ts +157 -5
- package/src/app/index.ts +1 -3
- package/src/commands/create.ts +24 -48
- package/src/config/inversify.config.ts +11 -9
- package/src/config/inversify.types.ts +7 -1
- package/src/constants.ts +2 -2
- package/src/index.ts +25 -0
- package/src/models/CLIOptions.ts +5 -5
- package/src/test/app/{WxpAddOnFactory.spec.ts → AddOnFactory.spec.ts} +18 -17
- package/src/test/app/{AddOnManager.spec.ts → PackageManager.spec.ts} +6 -6
- package/src/test/app/{AddOnTemplateSelector.spec.ts → TemplateSelector.spec.ts} +57 -26
- package/src/test/commands/command.spec.ts +80 -0
- package/src/test/commands/create.spec.ts +44 -18
- package/src/test/models/CLIOptions.spec.ts +4 -4
- package/src/test/validators/{AddOnDirectoryValidator.spec.ts → DirectoryValidator.spec.ts} +29 -21
- package/src/test/validators/{NodeEnvironmentValidator.spec.ts → EnvironmentValidator.spec.ts} +11 -24
- package/src/validators/DirectoryValidator.ts +172 -11
- package/src/validators/EnvironmentValidator.ts +157 -5
- package/src/validators/index.ts +0 -2
- package/templates/react-javascript/template/src/components/App.jsx +2 -2
- package/templates/react-javascript/template/webpack.config.js +1 -0
- package/templates/react-javascript/template.json +4 -4
- package/templates/react-javascript-with-document-sandbox/template/src/ui/components/App.jsx +2 -2
- package/templates/react-javascript-with-document-sandbox/template/webpack.config.js +1 -0
- package/templates/react-javascript-with-document-sandbox/template.json +4 -4
- package/templates/react-typescript/template/src/components/App.tsx +2 -2
- package/templates/react-typescript/template/webpack.config.js +1 -0
- package/templates/react-typescript/template.json +4 -4
- package/templates/react-typescript-with-document-sandbox/template/src/ui/components/App.tsx +2 -2
- package/templates/react-typescript-with-document-sandbox/template/webpack.config.js +1 -0
- package/templates/react-typescript-with-document-sandbox/template.json +4 -4
- package/templates/swc-javascript/template/src/components/App.js +2 -2
- package/templates/swc-javascript/template/webpack.config.js +1 -0
- package/templates/swc-javascript/template.json +4 -4
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +2 -2
- package/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +1 -0
- package/templates/swc-javascript-with-document-sandbox/template.json +4 -4
- package/templates/swc-typescript/template/src/components/App.css.ts +2 -2
- package/templates/swc-typescript/template/src/components/App.ts +4 -4
- package/templates/swc-typescript/template/src/index.ts +2 -2
- package/templates/swc-typescript/template/webpack.config.js +1 -0
- package/templates/swc-typescript/template.json +4 -4
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +2 -2
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.ts +4 -4
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/index.ts +2 -2
- package/templates/swc-typescript-with-document-sandbox/template/webpack.config.js +1 -0
- package/templates/swc-typescript-with-document-sandbox/template.json +4 -4
- package/tsconfig.json +3 -1
- package/dist/app/AddOnManager.d.ts.map +0 -1
- package/dist/app/AddOnTemplateSelector.d.ts +0 -54
- package/dist/app/AddOnTemplateSelector.d.ts.map +0 -1
- package/dist/app/AddOnTemplateSelector.js +0 -168
- package/dist/app/WxpAddOnFactory.d.ts +0 -62
- package/dist/app/WxpAddOnFactory.d.ts.map +0 -1
- package/dist/app/WxpAddOnFactory.js +0 -159
- package/dist/validators/AddOnDirectoryValidator.d.ts +0 -55
- package/dist/validators/AddOnDirectoryValidator.d.ts.map +0 -1
- package/dist/validators/AddOnDirectoryValidator.js +0 -176
- package/dist/validators/NodeEnvironmentValidator.d.ts +0 -58
- package/dist/validators/NodeEnvironmentValidator.d.ts.map +0 -1
- package/dist/validators/NodeEnvironmentValidator.js +0 -173
- package/src/app/AddOnTemplateSelector.ts +0 -193
- package/src/app/WxpAddOnFactory.ts +0 -196
- package/src/validators/AddOnDirectoryValidator.ts +0 -207
- package/src/validators/NodeEnvironmentValidator.ts +0 -197
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "
|
|
10
|
-
"@spectrum-web-components/theme": "
|
|
9
|
+
"@spectrum-web-components/button": "1.7.0",
|
|
10
|
+
"@spectrum-web-components/theme": "1.7.0",
|
|
11
11
|
"lit": "2.8.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"css-loader": "6.8.1",
|
|
19
19
|
"html-webpack-plugin": "5.5.3",
|
|
20
20
|
"style-loader": "3.3.3",
|
|
21
|
-
"webpack-cli": "
|
|
22
|
-
"webpack": "5.
|
|
21
|
+
"webpack-cli": "6.0.1",
|
|
22
|
+
"webpack": "5.98.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// To support:
|
|
1
|
+
// To support: system="express" scale="medium" color="light"
|
|
2
2
|
// import these spectrum web components modules:
|
|
3
3
|
import "@spectrum-web-components/theme/express/scale-medium.js";
|
|
4
4
|
import "@spectrum-web-components/theme/express/theme-light.js";
|
|
@@ -10,7 +10,7 @@ import "@spectrum-web-components/theme/theme-light.js";
|
|
|
10
10
|
import "@spectrum-web-components/button/sp-button.js";
|
|
11
11
|
import "@spectrum-web-components/theme/sp-theme.js";
|
|
12
12
|
|
|
13
|
-
import { LitElement, html } from "lit";
|
|
13
|
+
import { LitElement, TemplateResult, html } from "lit";
|
|
14
14
|
import { customElement, property, state } from "lit/decorators.js";
|
|
15
15
|
import { style } from "./App.css";
|
|
16
16
|
|
|
@@ -32,10 +32,10 @@ export class App extends LitElement {
|
|
|
32
32
|
this._buttonLabel = "Clicked";
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
render() {
|
|
35
|
+
render(): TemplateResult {
|
|
36
36
|
// Please note that the below "<sp-theme>" component does not react to theme changes in Express.
|
|
37
37
|
// You may use "this.addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
|
|
38
|
-
return html` <sp-theme
|
|
38
|
+
return html` <sp-theme system="express" color="light" scale="medium">
|
|
39
39
|
<div class="container">
|
|
40
40
|
<sp-button size="m" @click=${this._handleClick}>${this._buttonLabel}</sp-button>
|
|
41
41
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
1
|
+
import { LitElement, TemplateResult, html } from "lit";
|
|
2
2
|
import { customElement, state } from "lit/decorators.js";
|
|
3
3
|
import { until } from "lit/directives/until.js";
|
|
4
4
|
import "./components/App";
|
|
@@ -10,7 +10,7 @@ export class Root extends LitElement {
|
|
|
10
10
|
@state()
|
|
11
11
|
private _isAddOnUISdkReady = addOnUISdk.ready;
|
|
12
12
|
|
|
13
|
-
render() {
|
|
13
|
+
render(): TemplateResult {
|
|
14
14
|
return html`
|
|
15
15
|
${until(
|
|
16
16
|
this._isAddOnUISdkReady.then(() => {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "
|
|
10
|
-
"@spectrum-web-components/theme": "
|
|
9
|
+
"@spectrum-web-components/button": "1.7.0",
|
|
10
|
+
"@spectrum-web-components/theme": "1.7.0",
|
|
11
11
|
"lit": "2.8.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"style-loader": "3.3.3",
|
|
18
18
|
"ts-loader": "9.5.1",
|
|
19
19
|
"typescript": "5.3.2",
|
|
20
|
-
"webpack-cli": "
|
|
21
|
-
"webpack": "5.
|
|
20
|
+
"webpack-cli": "6.0.1",
|
|
21
|
+
"webpack": "5.98.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// To support:
|
|
1
|
+
// To support: system="express" scale="medium" color="light"
|
|
2
2
|
// import these spectrum web components modules:
|
|
3
3
|
import "@spectrum-web-components/theme/express/scale-medium.js";
|
|
4
4
|
import "@spectrum-web-components/theme/express/theme-light.js";
|
|
@@ -10,7 +10,7 @@ import "@spectrum-web-components/theme/theme-light.js";
|
|
|
10
10
|
import "@spectrum-web-components/button/sp-button.js";
|
|
11
11
|
import "@spectrum-web-components/theme/sp-theme.js";
|
|
12
12
|
|
|
13
|
-
import { LitElement, html } from "lit";
|
|
13
|
+
import { LitElement, TemplateResult, html } from "lit";
|
|
14
14
|
import { customElement, property, state } from "lit/decorators.js";
|
|
15
15
|
import { DocumentSandboxApi } from "../../models/DocumentSandboxApi";
|
|
16
16
|
import { style } from "./App.css";
|
|
@@ -43,10 +43,10 @@ export class App extends LitElement {
|
|
|
43
43
|
this._sandboxProxy.createRectangle();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
render() {
|
|
46
|
+
render(): TemplateResult {
|
|
47
47
|
// Please note that the below "<sp-theme>" component does not react to theme changes in Express.
|
|
48
48
|
// You may use "this.addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
|
|
49
|
-
return html` <sp-theme
|
|
49
|
+
return html` <sp-theme system="express" color="light" scale="medium">
|
|
50
50
|
<div class="container">
|
|
51
51
|
<sp-button size="m" @click=${this._handleClick}>Create Rectangle</sp-button>
|
|
52
52
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, html } from "lit";
|
|
1
|
+
import { LitElement, TemplateResult, html } from "lit";
|
|
2
2
|
import { customElement, state } from "lit/decorators.js";
|
|
3
3
|
import { until } from "lit/directives/until.js";
|
|
4
4
|
import "./components/App";
|
|
@@ -10,7 +10,7 @@ export class Root extends LitElement {
|
|
|
10
10
|
@state()
|
|
11
11
|
private _isAddOnUISdkReady = addOnUISdk.ready;
|
|
12
12
|
|
|
13
|
-
render() {
|
|
13
|
+
render(): TemplateResult {
|
|
14
14
|
return html`
|
|
15
15
|
${until(
|
|
16
16
|
this._isAddOnUISdkReady.then(async () => {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "
|
|
10
|
-
"@spectrum-web-components/theme": "
|
|
9
|
+
"@spectrum-web-components/button": "1.7.0",
|
|
10
|
+
"@spectrum-web-components/theme": "1.7.0",
|
|
11
11
|
"lit": "2.8.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"style-loader": "3.3.3",
|
|
18
18
|
"ts-loader": "9.5.1",
|
|
19
19
|
"typescript": "5.3.2",
|
|
20
|
-
"webpack-cli": "
|
|
21
|
-
"webpack": "5.
|
|
20
|
+
"webpack-cli": "6.0.1",
|
|
21
|
+
"webpack": "5.98.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
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/**/*"],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddOnManager.d.ts","sourceRoot":"","sources":["../../src/app/AddOnManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,qBAAa,YAAY;IACrB;;;;;OAKG;IAGH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW;CAanF"}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
|
|
25
|
-
import type { Logger } from "@adobe/ccweb-add-on-core";
|
|
26
|
-
import "reflect-metadata";
|
|
27
|
-
import type { CLIOptions } from "../models/index.js";
|
|
28
|
-
import type { TemplateSelector } from "./TemplateSelector.js";
|
|
29
|
-
export declare class AddOnTemplateSelector implements TemplateSelector {
|
|
30
|
-
private readonly _logger;
|
|
31
|
-
private readonly _analyticsService;
|
|
32
|
-
/**
|
|
33
|
-
* Instantiate {@link AddOnTemplateSelector}.
|
|
34
|
-
* @param logger - {@link Logger} reference.
|
|
35
|
-
* @param analyticsService - {@link AnalyticsService} reference.
|
|
36
|
-
* @returns Reference to a new {@link AddOnTemplateSelector} instance.
|
|
37
|
-
*/
|
|
38
|
-
constructor(logger: Logger, analyticsService: AnalyticsService);
|
|
39
|
-
/**
|
|
40
|
-
* Sets up a template, as selected/provided by the user
|
|
41
|
-
* for scaffolding the add-on project.
|
|
42
|
-
* @param options - {@link CLIOptions}.
|
|
43
|
-
* @returns User selected/provided template name.
|
|
44
|
-
*/
|
|
45
|
-
setupTemplate(options: CLIOptions): Promise<string>;
|
|
46
|
-
private _promptMessage;
|
|
47
|
-
private _promptMessageOption;
|
|
48
|
-
/**
|
|
49
|
-
* Validate whether addOnKind is valid or not.
|
|
50
|
-
* @param addOnKind - Kind of Add-on. For example: panel.
|
|
51
|
-
*/
|
|
52
|
-
private _validateAddOnKind;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=AddOnTemplateSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddOnTemplateSelector.d.ts","sourceRoot":"","sources":["../../src/app/AddOnTemplateSelector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAMvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBACa,qBAAsB,YAAW,gBAAgB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;OAKG;gBAE4B,MAAM,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB;IAMhF;;;;;OAKG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAsEzD,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;IAO5B;;;OAGG;YACW,kBAAkB;CA6BnC"}
|
|
@@ -1,168 +0,0 @@
|
|
|
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
|
-
import { __decorate, __metadata, __param } from "tslib";
|
|
25
|
-
import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
|
|
26
|
-
import { ITypes as ICoreTypes, isNullOrWhiteSpace } from "@adobe/ccweb-add-on-core";
|
|
27
|
-
import { EntrypointType } from "@adobe/ccweb-add-on-manifest";
|
|
28
|
-
import chalk from "chalk";
|
|
29
|
-
import { inject, injectable } from "inversify";
|
|
30
|
-
import prompts from "prompts";
|
|
31
|
-
import "reflect-metadata";
|
|
32
|
-
import format from "string-template";
|
|
33
|
-
import { AnalyticsErrorMarkers } from "../AnalyticsMarkers.js";
|
|
34
|
-
import { ADD_ON_TEMPLATES, AVAILABLE_ADD_ON_TEMPLATES, PROGRAM_NAME, WITH_DOCUMENT_SANDBOX } from "../constants.js";
|
|
35
|
-
let AddOnTemplateSelector = class AddOnTemplateSelector {
|
|
36
|
-
_logger;
|
|
37
|
-
_analyticsService;
|
|
38
|
-
/**
|
|
39
|
-
* Instantiate {@link AddOnTemplateSelector}.
|
|
40
|
-
* @param logger - {@link Logger} reference.
|
|
41
|
-
* @param analyticsService - {@link AnalyticsService} reference.
|
|
42
|
-
* @returns Reference to a new {@link AddOnTemplateSelector} instance.
|
|
43
|
-
*/
|
|
44
|
-
constructor(logger, analyticsService) {
|
|
45
|
-
this._logger = logger;
|
|
46
|
-
this._analyticsService = analyticsService;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sets up a template, as selected/provided by the user
|
|
50
|
-
* for scaffolding the add-on project.
|
|
51
|
-
* @param options - {@link CLIOptions}.
|
|
52
|
-
* @returns User selected/provided template name.
|
|
53
|
-
*/
|
|
54
|
-
async setupTemplate(options) {
|
|
55
|
-
await this._validateAddOnKind(options.addOnKind);
|
|
56
|
-
if (!isNullOrWhiteSpace(options.templateName)) {
|
|
57
|
-
if (AVAILABLE_ADD_ON_TEMPLATES.includes(options.templateName)) {
|
|
58
|
-
return options.templateName;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this._logger.warning(LOGS.chooseValidTemplate, { prefix: LOGS.newLine });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
// Add a line break for better log readability.
|
|
65
|
-
console.log();
|
|
66
|
-
const templateChoices = [];
|
|
67
|
-
for (const [templateName, description] of ADD_ON_TEMPLATES.entries()) {
|
|
68
|
-
templateChoices.push({
|
|
69
|
-
title: this._promptMessageOption(templateName, description),
|
|
70
|
-
value: templateName
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const templateResponse = await prompts.prompt({
|
|
74
|
-
type: "select",
|
|
75
|
-
name: "selectedTemplate",
|
|
76
|
-
message: this._promptMessage(LOGS.setupTemplate),
|
|
77
|
-
choices: templateChoices,
|
|
78
|
-
initial: 0
|
|
79
|
-
});
|
|
80
|
-
if (!templateResponse || !templateResponse.selectedTemplate) {
|
|
81
|
-
console.log();
|
|
82
|
-
return process.exit(0);
|
|
83
|
-
}
|
|
84
|
-
/* c8 ignore next 4 */
|
|
85
|
-
/* All templates are currently available. */
|
|
86
|
-
if (!AVAILABLE_ADD_ON_TEMPLATES.includes(`${templateResponse.selectedTemplate}-${WITH_DOCUMENT_SANDBOX}`)) {
|
|
87
|
-
return templateResponse.selectedTemplate;
|
|
88
|
-
}
|
|
89
|
-
const documentSandboxChoices = [
|
|
90
|
-
{
|
|
91
|
-
title: this._promptMessageOption(LOGS.no),
|
|
92
|
-
value: false
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
title: this._promptMessageOption(LOGS.yes),
|
|
96
|
-
value: true
|
|
97
|
-
}
|
|
98
|
-
];
|
|
99
|
-
const documentSandboxResponse = await prompts.prompt({
|
|
100
|
-
type: "select",
|
|
101
|
-
name: "includeDocumentSandbox",
|
|
102
|
-
message: this._promptMessage(LOGS.includeDocumentSandbox),
|
|
103
|
-
choices: documentSandboxChoices,
|
|
104
|
-
initial: 0
|
|
105
|
-
});
|
|
106
|
-
if (!documentSandboxResponse || documentSandboxResponse.includeDocumentSandbox === undefined) {
|
|
107
|
-
console.log();
|
|
108
|
-
return process.exit(0);
|
|
109
|
-
}
|
|
110
|
-
// Append `with-document-sandbox` to the template name if user wants to include document sandbox
|
|
111
|
-
return documentSandboxResponse.includeDocumentSandbox
|
|
112
|
-
? `${templateResponse.selectedTemplate}-${WITH_DOCUMENT_SANDBOX}`
|
|
113
|
-
: templateResponse.selectedTemplate;
|
|
114
|
-
}
|
|
115
|
-
_promptMessage(message) {
|
|
116
|
-
return chalk.cyan(message);
|
|
117
|
-
}
|
|
118
|
-
_promptMessageOption(option, description) {
|
|
119
|
-
if (description) {
|
|
120
|
-
return `${chalk.hex("#E59400").bold(`[${option}]:`)} ${chalk.green(description)}`;
|
|
121
|
-
}
|
|
122
|
-
return chalk.green.bold(option);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Validate whether addOnKind is valid or not.
|
|
126
|
-
* @param addOnKind - Kind of Add-on. For example: panel.
|
|
127
|
-
*/
|
|
128
|
-
async _validateAddOnKind(addOnKind) {
|
|
129
|
-
if (addOnKind !== EntrypointType.PANEL) {
|
|
130
|
-
this._logger.warning(LOGS.chooseValidKind);
|
|
131
|
-
this._logger.warning(format(LOGS.executeProgramWithValidKind, {
|
|
132
|
-
PROGRAM_NAME
|
|
133
|
-
}), {
|
|
134
|
-
prefix: LOGS.tab
|
|
135
|
-
});
|
|
136
|
-
this._logger.message(LOGS.forExample, { prefix: LOGS.newLine });
|
|
137
|
-
this._logger.information(format(LOGS.executeProgramWithValidKindExample, {
|
|
138
|
-
PROGRAM_NAME
|
|
139
|
-
}), {
|
|
140
|
-
prefix: LOGS.tab
|
|
141
|
-
});
|
|
142
|
-
await this._analyticsService.postEvent(AnalyticsErrorMarkers.ERROR_INVALID_KIND, LOGS.analyticsInvalidKind, false);
|
|
143
|
-
return process.exit(0);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
AddOnTemplateSelector = __decorate([
|
|
148
|
-
injectable(),
|
|
149
|
-
__param(0, inject(ICoreTypes.Logger)),
|
|
150
|
-
__param(1, inject(IAnalyticsTypes.AnalyticsService)),
|
|
151
|
-
__metadata("design:paramtypes", [Object, Object])
|
|
152
|
-
], AddOnTemplateSelector);
|
|
153
|
-
export { AddOnTemplateSelector };
|
|
154
|
-
const LOGS = {
|
|
155
|
-
newLine: "\n",
|
|
156
|
-
tab: " ",
|
|
157
|
-
setupTemplate: "Please select a template which you want to scaffold the Add-on project with",
|
|
158
|
-
chooseValidKind: "Please choose a valid Add-on kind (valid kind: panel)",
|
|
159
|
-
executeProgramWithValidKind: "{PROGRAM_NAME} <add-on-name> --kind <panel>",
|
|
160
|
-
executeProgramWithValidKindExample: "{PROGRAM_NAME} my-add-on --kind panel",
|
|
161
|
-
chooseValidTemplate: "You have chosen an invalid template.",
|
|
162
|
-
forExample: "For example:",
|
|
163
|
-
analyticsInvalidKind: "Invalid Add-on kind specified",
|
|
164
|
-
includeDocumentSandbox: "Do you want to include document sandbox runtime?",
|
|
165
|
-
yes: "Yes",
|
|
166
|
-
no: "No"
|
|
167
|
-
};
|
|
168
|
-
//# sourceMappingURL=AddOnTemplateSelector.js.map
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
|
|
25
|
-
import type { Logger, Process } from "@adobe/ccweb-add-on-core";
|
|
26
|
-
import type { AddOnScaffolder } from "@adobe/ccweb-add-on-scaffolder";
|
|
27
|
-
import "reflect-metadata";
|
|
28
|
-
import type { CLIOptions } from "../models/CLIOptions.js";
|
|
29
|
-
import type { DirectoryValidator, EnvironmentValidator } from "../validators/index.js";
|
|
30
|
-
import type { AddOnFactory } from "./AddOnFactory.js";
|
|
31
|
-
import type { TemplateSelector } from "./TemplateSelector.js";
|
|
32
|
-
/**
|
|
33
|
-
* AddOn factory implementation class.
|
|
34
|
-
*/
|
|
35
|
-
export declare class WxpAddOnFactory implements AddOnFactory {
|
|
36
|
-
private readonly _directoryValidator;
|
|
37
|
-
private readonly _environmentValidator;
|
|
38
|
-
private readonly _templateSelector;
|
|
39
|
-
private readonly _scaffolder;
|
|
40
|
-
private readonly _process;
|
|
41
|
-
private readonly _logger;
|
|
42
|
-
private readonly _analyticsService;
|
|
43
|
-
/**
|
|
44
|
-
* Instantiate {@link WxpAddOnFactory}.
|
|
45
|
-
* @param directoryValidator - {@link DirectoryValidator} reference.
|
|
46
|
-
* @param environmentValidator - {@link EnvironmentValidator} reference.
|
|
47
|
-
* @param templateSelector - {@link TemplateSelector} reference.
|
|
48
|
-
* @param scaffolder - {@link AddOnScaffolder} reference.
|
|
49
|
-
* @param cliProcess - {@link Process} reference.
|
|
50
|
-
* @param logger - {@link Logger} reference.
|
|
51
|
-
* @param analyticsService - {@link AnalyticsService} reference.
|
|
52
|
-
* @returns Reference to a new {@link WxpAddOnFactory} instance.
|
|
53
|
-
*/
|
|
54
|
-
constructor(directoryValidator: DirectoryValidator, environmentValidator: EnvironmentValidator, templateSelector: TemplateSelector, scaffolder: AddOnScaffolder, cliProcess: Process, logger: Logger, analyticsService: AnalyticsService);
|
|
55
|
-
/**
|
|
56
|
-
* Create the Add-on project.
|
|
57
|
-
* @param options - {@link CLIOptions}.
|
|
58
|
-
*/
|
|
59
|
-
create(options: CLIOptions): Promise<void>;
|
|
60
|
-
private _copyTemplateFiles;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=WxpAddOnFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WxpAddOnFactory.d.ts","sourceRoot":"","sources":["../../src/app/WxpAddOnFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE,OAAO,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,qBACa,eAAgB,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAuB;IAC7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAE9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;;;;;;OAUG;gBAEoC,kBAAkB,EAAE,kBAAkB,EACpC,oBAAoB,EAAE,oBAAoB,EAC9C,gBAAgB,EAAE,gBAAgB,EACzB,UAAU,EAAE,eAAe,EACzC,UAAU,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB;IAchF;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA0EhD,OAAO,CAAC,kBAAkB;CAa7B"}
|