@adobe/create-ccweb-add-on 1.3.0 → 2.0.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/dist/app/WxpAddOnFactory.js +1 -1
- package/dist/commands/create.d.ts +0 -3
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -17
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -3
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/react-typescript/template/src/index.html +2 -2
- package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/swc-javascript/template/.babelrc +6 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-javascript}/template/README.md +3 -2
- package/dist/templates/swc-javascript/template/src/components/App.js +42 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-javascript}/template/src/index.html +2 -2
- package/dist/templates/swc-javascript/template/src/index.js +23 -0
- package/dist/templates/swc-javascript/template/tsconfig.json +14 -0
- package/dist/templates/swc-javascript/template/webpack.config.js +46 -0
- package/dist/templates/swc-javascript/template.json +24 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-javascript-with-document-sandbox}/template/src/sandbox/tsconfig.json +1 -1
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
- package/dist/templates/swc-javascript-with-document-sandbox/template.json +24 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript}/template/README.md +2 -1
- package/dist/templates/swc-typescript/template/gitignore +3 -0
- package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript}/template/src/index.html +2 -2
- package/dist/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
- package/dist/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
- package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/tsconfig.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/AddOnDirectoryValidator.d.ts.map +1 -1
- package/dist/validators/AddOnDirectoryValidator.js +2 -1
- package/package.json +78 -79
- package/src/app/WxpAddOnFactory.ts +1 -1
- package/src/commands/create.ts +2 -23
- package/src/constants.ts +6 -3
- package/src/test/app/WxpAddOnFactory.spec.ts +1 -1
- package/src/test/commands/create.spec.ts +2 -26
- package/src/test/validators/AddOnDirectoryValidator.spec.ts +6 -3
- package/src/validators/AddOnDirectoryValidator.ts +2 -1
- package/templates/javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/react-typescript/template/src/index.html +2 -2
- package/templates/react-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +1 -1
- package/templates/swc-javascript/template/.babelrc +6 -0
- package/templates/{typescript → swc-javascript}/template/README.md +3 -3
- package/templates/swc-javascript/template/gitignore +3 -0
- package/templates/swc-javascript/template/src/components/App.css.js +9 -0
- package/templates/swc-javascript/template/src/components/App.js +42 -0
- package/{dist/templates/typescript → templates/swc-javascript}/template/src/index.html +5 -2
- package/templates/swc-javascript/template/src/index.js +23 -0
- package/templates/swc-javascript/template/src/manifest.json +21 -0
- package/templates/swc-javascript/template/tsconfig.json +14 -0
- package/templates/swc-javascript/template/webpack.config.js +46 -0
- package/templates/swc-javascript/template.json +24 -0
- package/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
- package/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
- package/templates/swc-javascript-with-document-sandbox/template/gitignore +3 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/manifest.json +22 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.css.js +9 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
- package/templates/swc-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
- package/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
- package/templates/swc-javascript-with-document-sandbox/template.json +24 -0
- package/{dist/templates/typescript → templates/swc-typescript}/template/README.md +2 -2
- package/templates/swc-typescript/template/gitignore +3 -0
- package/templates/swc-typescript/template/src/components/App.css.ts +9 -0
- package/templates/{typescript → swc-typescript}/template/src/index.html +5 -2
- package/templates/swc-typescript/template/src/manifest.json +21 -0
- package/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/manifest.json +22 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +9 -0
- package/templates/swc-typescript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
- package/dist/templates/javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/react-typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/dist/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/dist/templates/typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-javascript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-javascript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/react-javascript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/react-typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/react-typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- package/templates/typescript/template/src/add-on-ui-sdk.d.ts +0 -7
- package/templates/typescript-with-document-sandbox/template/src/sandbox/add-on-sandbox-sdk.d.ts +0 -11
- package/templates/typescript-with-document-sandbox/template/src/ui/add-on-ui-sdk.d.ts +0 -7
- /package/{templates/typescript → dist/templates/swc-javascript}/template/gitignore +0 -0
- /package/dist/templates/{typescript/template/src/components/App.css.ts → swc-javascript/template/src/components/App.css.js} +0 -0
- /package/dist/templates/{typescript → swc-javascript}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript → swc-javascript-with-document-sandbox}/template/gitignore +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox/template/src/ui/components/App.css.ts → swc-javascript-with-document-sandbox/template/src/ui/components/App.css.js} +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
- /package/{templates/typescript → dist/templates/swc-typescript}/template/src/components/App.css.ts +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
- /package/{templates/typescript → dist/templates/swc-typescript}/template/src/manifest.json +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
- /package/dist/templates/{typescript → swc-typescript}/template.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/manifest.json +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/components/App.css.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
- /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
- /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template.json +0 -0
- /package/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
- /package/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
- /package/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
- /package/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
- /package/templates/{typescript → swc-typescript}/template.json +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
- /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template.json +0 -0
package/package.json
CHANGED
|
@@ -1,80 +1,79 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
2
|
+
"name": "@adobe/create-ccweb-add-on",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"author": "Adobe",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Create an Adobe Creative Cloud Web Add-on.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"adobe",
|
|
9
|
+
"creative cloud web",
|
|
10
|
+
"express",
|
|
11
|
+
"create",
|
|
12
|
+
"add-on",
|
|
13
|
+
"templates"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"create-ccweb-add-on": "./bin/run.js"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"url": "https://github.com/adobe/create-ccweb-add-on"
|
|
21
|
+
},
|
|
22
|
+
"oclif": {
|
|
23
|
+
"bin": "create-ccweb-add-on",
|
|
24
|
+
"default": "create",
|
|
25
|
+
"commands": "./dist/commands",
|
|
26
|
+
"plugins": [],
|
|
27
|
+
"topicSeparator": " "
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@oclif/core": "2.8.0",
|
|
31
|
+
"axios": "1.6.0",
|
|
32
|
+
"chalk": "4.1.1",
|
|
33
|
+
"fs-extra": "10.0.1",
|
|
34
|
+
"inversify": "6.0.1",
|
|
35
|
+
"os-name": "4.0.1",
|
|
36
|
+
"prompts": "2.4.2",
|
|
37
|
+
"reflect-metadata": "0.1.13",
|
|
38
|
+
"semver": "7.3.4",
|
|
39
|
+
"string-template": "1.0.0",
|
|
40
|
+
"tslib": "2.4.0",
|
|
41
|
+
"validate-npm-package-name": "3.0.0",
|
|
42
|
+
"@adobe/ccweb-add-on-analytics": "2.0.0",
|
|
43
|
+
"@adobe/ccweb-add-on-core": "2.0.0",
|
|
44
|
+
"@adobe/ccweb-add-on-scaffolder": "2.0.0",
|
|
45
|
+
"@adobe/ccweb-add-on-manifest": "2.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/chai-as-promised": "7.1.3",
|
|
49
|
+
"@types/chai": "4.2.14",
|
|
50
|
+
"@types/fs-extra": "9.0.13",
|
|
51
|
+
"@types/mocha": "9.1.1",
|
|
52
|
+
"@types/node": "16.11.62",
|
|
53
|
+
"@types/prompts": "2.0.14",
|
|
54
|
+
"@types/semver": "7.3.4",
|
|
55
|
+
"@types/sinon": "9.0.8",
|
|
56
|
+
"@types/string-template": "1.0.2",
|
|
57
|
+
"@types/validate-npm-package-name": "3.0.3",
|
|
58
|
+
"c8": "7.7.2",
|
|
59
|
+
"chai-as-promised": "7.1.1",
|
|
60
|
+
"chai": "4.3.4",
|
|
61
|
+
"mocha": "10.0.0",
|
|
62
|
+
"oclif": "3.2.28",
|
|
63
|
+
"prettier": "2.8.0",
|
|
64
|
+
"regenerator-runtime": "0.13.9",
|
|
65
|
+
"rimraf": "3.0.2",
|
|
66
|
+
"sinon": "9.2.1",
|
|
67
|
+
"ts-node": "10.9.1",
|
|
68
|
+
"ts-sinon": "2.0.1",
|
|
69
|
+
"typescript": "4.8.4"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"clean": "rimraf dist coverage",
|
|
73
|
+
"_postbuild": "cp -R templates/ dist/templates",
|
|
74
|
+
"ibuild": "tsc",
|
|
75
|
+
"build": "rushx clean && rushx ibuild && rushx _postbuild",
|
|
76
|
+
"build:release": "rushx build",
|
|
77
|
+
"test": "c8 mocha && c8 check-coverage --lines 100 --functions 100 --branches 100"
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/commands/create.ts
CHANGED
|
@@ -25,8 +25,6 @@
|
|
|
25
25
|
import type { AnalyticsConsent, AnalyticsService } from "@adobe/ccweb-add-on-analytics";
|
|
26
26
|
import { CLIProgram, ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
|
|
27
27
|
import { UncaughtExceptionHandler } from "@adobe/ccweb-add-on-core";
|
|
28
|
-
import type { AccountService } from "@adobe/ccweb-add-on-developer-terms";
|
|
29
|
-
import { ITypes as IDeveloperTermsTypes } from "@adobe/ccweb-add-on-developer-terms";
|
|
30
28
|
import { EntrypointType } from "@adobe/ccweb-add-on-manifest";
|
|
31
29
|
import type { Config } from "@oclif/core";
|
|
32
30
|
import { Args, Command, Flags } from "@oclif/core";
|
|
@@ -41,8 +39,6 @@ import { CLIOptions } from "../models/CLIOptions.js";
|
|
|
41
39
|
* Implementation class of the create-ccweb-add-on command.
|
|
42
40
|
*/
|
|
43
41
|
export class CreateCCWebAddOn extends Command {
|
|
44
|
-
private readonly _accountService: AccountService;
|
|
45
|
-
|
|
46
42
|
private readonly _analyticsConsent: AnalyticsConsent;
|
|
47
43
|
private readonly _analyticsService: AnalyticsService;
|
|
48
44
|
|
|
@@ -66,12 +62,6 @@ export class CreateCCWebAddOn extends Command {
|
|
|
66
62
|
default: "",
|
|
67
63
|
required: false
|
|
68
64
|
}),
|
|
69
|
-
login: Flags.boolean({
|
|
70
|
-
char: "l",
|
|
71
|
-
description: "To force login",
|
|
72
|
-
required: false,
|
|
73
|
-
default: false
|
|
74
|
-
}),
|
|
75
65
|
analytics: Flags.string({
|
|
76
66
|
char: "a",
|
|
77
67
|
description: "Turn on/off sending analytics to Adobe.",
|
|
@@ -97,8 +87,6 @@ export class CreateCCWebAddOn extends Command {
|
|
|
97
87
|
constructor(argv: string[], config: Config) {
|
|
98
88
|
super(argv, config);
|
|
99
89
|
|
|
100
|
-
this._accountService = IContainer.get<AccountService>(IDeveloperTermsTypes.AccountService);
|
|
101
|
-
|
|
102
90
|
this._analyticsConsent = IContainer.get<AnalyticsConsent>(IAnalyticsTypes.AnalyticsConsent);
|
|
103
91
|
|
|
104
92
|
this._analyticsService = IContainer.get<AnalyticsService>(IAnalyticsTypes.AnalyticsService);
|
|
@@ -113,11 +101,9 @@ export class CreateCCWebAddOn extends Command {
|
|
|
113
101
|
|
|
114
102
|
const {
|
|
115
103
|
args: { addOnName },
|
|
116
|
-
flags: { kind, template,
|
|
104
|
+
flags: { kind, template, analytics, verbose }
|
|
117
105
|
} = await this.parse(CreateCCWebAddOn);
|
|
118
106
|
|
|
119
|
-
await this._seekTermsOfUseConsent(login, verbose);
|
|
120
|
-
|
|
121
107
|
await this._seekAnalyticsConsent(analytics);
|
|
122
108
|
|
|
123
109
|
console.log();
|
|
@@ -128,6 +114,7 @@ export class CreateCCWebAddOn extends Command {
|
|
|
128
114
|
template.toLowerCase(),
|
|
129
115
|
verbose
|
|
130
116
|
);
|
|
117
|
+
|
|
131
118
|
await this._addOnFactory.create(options);
|
|
132
119
|
}
|
|
133
120
|
|
|
@@ -136,14 +123,6 @@ export class CreateCCWebAddOn extends Command {
|
|
|
136
123
|
throw error;
|
|
137
124
|
}
|
|
138
125
|
|
|
139
|
-
private async _seekTermsOfUseConsent(login: boolean, verbose: boolean): Promise<void> {
|
|
140
|
-
if (login) {
|
|
141
|
-
await this._accountService.invalidateToken(verbose);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
await this._accountService.seekTermsOfUseConsent();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
126
|
private async _seekAnalyticsConsent(analytics: string | undefined): Promise<void> {
|
|
148
127
|
if (analytics === undefined) {
|
|
149
128
|
await this._analyticsConsent.get();
|
package/src/constants.ts
CHANGED
|
@@ -26,7 +26,8 @@ export const PROGRAM_NAME = "create-ccweb-add-on";
|
|
|
26
26
|
|
|
27
27
|
export const ADD_ON_TEMPLATES = new Map<string, string>([
|
|
28
28
|
["javascript", "Get started with Add-on development using JavaScript"],
|
|
29
|
-
["
|
|
29
|
+
["swc-javascript", "Get started with Add-on development using using Spectrum Web Components and JavaScript"],
|
|
30
|
+
["swc-typescript", "Get started with Add-on development using using Spectrum Web Components and TypeScript"],
|
|
30
31
|
["react-javascript", "Get started with Add-on development using React and JavaScript"],
|
|
31
32
|
["react-typescript", "Get started with Add-on development using React and TypeScript"]
|
|
32
33
|
]);
|
|
@@ -37,11 +38,13 @@ export const WITH_DOCUMENT_SANDBOX = "with-document-sandbox";
|
|
|
37
38
|
|
|
38
39
|
export const AVAILABLE_ADD_ON_TEMPLATES = [
|
|
39
40
|
"javascript",
|
|
40
|
-
"
|
|
41
|
+
"swc-javascript",
|
|
42
|
+
"swc-typescript",
|
|
41
43
|
"react-javascript",
|
|
42
44
|
"react-typescript",
|
|
43
45
|
`javascript-${WITH_DOCUMENT_SANDBOX}`,
|
|
44
|
-
`
|
|
46
|
+
`swc-javascript-${WITH_DOCUMENT_SANDBOX}`,
|
|
47
|
+
`swc-typescript-${WITH_DOCUMENT_SANDBOX}`,
|
|
45
48
|
`react-javascript-${WITH_DOCUMENT_SANDBOX}`,
|
|
46
49
|
`react-typescript-${WITH_DOCUMENT_SANDBOX}`
|
|
47
50
|
];
|
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
import type { AnalyticsConsent, AnalyticsService } from "@adobe/ccweb-add-on-analytics";
|
|
26
26
|
import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
|
|
27
|
-
import type { AccountService } from "@adobe/ccweb-add-on-developer-terms";
|
|
28
|
-
import { ITypes as IDeveloperTermsTypes } from "@adobe/ccweb-add-on-developer-terms";
|
|
29
27
|
import { EntrypointType } from "@adobe/ccweb-add-on-manifest";
|
|
30
28
|
import { Config } from "@oclif/core";
|
|
31
29
|
import chai, { assert, expect } from "chai";
|
|
@@ -49,8 +47,6 @@ describe("CreateCCWebAddOn", () => {
|
|
|
49
47
|
|
|
50
48
|
let addOnFactory: StubbedInstance<AddOnFactory>;
|
|
51
49
|
|
|
52
|
-
let accountService: StubbedInstance<AccountService>;
|
|
53
|
-
|
|
54
50
|
let analyticsConsent: StubbedInstance<AnalyticsConsent>;
|
|
55
51
|
let analyticsService: StubbedInstance<AnalyticsService>;
|
|
56
52
|
|
|
@@ -60,18 +56,12 @@ describe("CreateCCWebAddOn", () => {
|
|
|
60
56
|
addOnFactory = stubInterface();
|
|
61
57
|
addOnFactory.create.resolves();
|
|
62
58
|
|
|
63
|
-
accountService = stubInterface();
|
|
64
|
-
accountService.invalidateToken.resolves();
|
|
65
|
-
accountService.seekTermsOfUseConsent.resolves();
|
|
66
|
-
|
|
67
59
|
analyticsConsent = stubInterface();
|
|
68
60
|
analyticsService = stubInterface();
|
|
69
61
|
|
|
70
62
|
container = sandbox.stub(IContainer, "get");
|
|
71
63
|
container.withArgs(ITypes.AddOnFactory).returns(addOnFactory);
|
|
72
64
|
|
|
73
|
-
container.withArgs(IDeveloperTermsTypes.AccountService).returns(accountService);
|
|
74
|
-
|
|
75
65
|
container.withArgs(IAnalyticsTypes.AnalyticsConsent).returns(analyticsConsent);
|
|
76
66
|
container.withArgs(IAnalyticsTypes.AnalyticsService).returns(analyticsService);
|
|
77
67
|
});
|
|
@@ -85,15 +75,12 @@ describe("CreateCCWebAddOn", () => {
|
|
|
85
75
|
analyticsConsent.get.resolves(true);
|
|
86
76
|
|
|
87
77
|
const createCCWebAddOn = new CreateCCWebAddOn(
|
|
88
|
-
["hello-world", "--kind=panel", "--template=react-javascript", "--
|
|
78
|
+
["hello-world", "--kind=panel", "--template=react-javascript", "--verbose"],
|
|
89
79
|
new Config({ root: "." })
|
|
90
80
|
);
|
|
91
81
|
|
|
92
82
|
await createCCWebAddOn.run();
|
|
93
83
|
|
|
94
|
-
assert.equal(accountService.invalidateToken.callCount, 1);
|
|
95
|
-
assert.equal(accountService.seekTermsOfUseConsent.callCount, 1);
|
|
96
|
-
|
|
97
84
|
assert.equal(analyticsConsent.get.callCount, 1);
|
|
98
85
|
|
|
99
86
|
const options = new CLIOptions(EntrypointType.PANEL, "hello-world", "react-javascript", true);
|
|
@@ -105,22 +92,12 @@ describe("CreateCCWebAddOn", () => {
|
|
|
105
92
|
analyticsConsent.set.withArgs(false).resolves();
|
|
106
93
|
|
|
107
94
|
const createCCWebAddOn = new CreateCCWebAddOn(
|
|
108
|
-
[
|
|
109
|
-
"hello-world",
|
|
110
|
-
"--kind=panel",
|
|
111
|
-
"--template=react-javascript",
|
|
112
|
-
"--login",
|
|
113
|
-
"--analytics=off",
|
|
114
|
-
"--verbose"
|
|
115
|
-
],
|
|
95
|
+
["hello-world", "--kind=panel", "--template=react-javascript", "--analytics=off", "--verbose"],
|
|
116
96
|
new Config({ root: "." })
|
|
117
97
|
);
|
|
118
98
|
|
|
119
99
|
await createCCWebAddOn.run();
|
|
120
100
|
|
|
121
|
-
assert.equal(accountService.invalidateToken.callCount, 1);
|
|
122
|
-
assert.equal(accountService.seekTermsOfUseConsent.callCount, 1);
|
|
123
|
-
|
|
124
101
|
assert.equal(analyticsConsent.set.calledOnceWith(false), true);
|
|
125
102
|
|
|
126
103
|
const options = new CLIOptions(EntrypointType.PANEL, "hello-world", "react-javascript", true);
|
|
@@ -133,7 +110,6 @@ describe("CreateCCWebAddOn", () => {
|
|
|
133
110
|
const createCCWebAddOn = new CreateCCWebAddOn(["--incorrect-flag"], new Config({ root: "." }));
|
|
134
111
|
|
|
135
112
|
const error = new Error("Nonexistent flag: --incorrect-flag\nSee more help with --help");
|
|
136
|
-
|
|
137
113
|
await expect(createCCWebAddOn.catch(error)).to.be.rejectedWith();
|
|
138
114
|
|
|
139
115
|
assert.equal(
|
|
@@ -93,7 +93,8 @@ describe("AddOnDirectoryValidator", () => {
|
|
|
93
93
|
assert.equal(logger.information.callCount, 1);
|
|
94
94
|
assert.equal(
|
|
95
95
|
logger.information.calledWith(`${PROGRAM_NAME} my-add-on --kind panel --template javascript`, {
|
|
96
|
-
prefix: " "
|
|
96
|
+
prefix: " ",
|
|
97
|
+
postfix: "\n"
|
|
97
98
|
}),
|
|
98
99
|
true
|
|
99
100
|
);
|
|
@@ -146,7 +147,8 @@ describe("AddOnDirectoryValidator", () => {
|
|
|
146
147
|
assert.equal(logger.information.callCount, 1);
|
|
147
148
|
assert.equal(
|
|
148
149
|
logger.information.calledWith(`${PROGRAM_NAME} my-add-on --kind panel --template javascript`, {
|
|
149
|
-
prefix: " "
|
|
150
|
+
prefix: " ",
|
|
151
|
+
postfix: "\n"
|
|
150
152
|
}),
|
|
151
153
|
true
|
|
152
154
|
);
|
|
@@ -206,7 +208,8 @@ describe("AddOnDirectoryValidator", () => {
|
|
|
206
208
|
assert.equal(logger.information.callCount, 1);
|
|
207
209
|
assert.equal(
|
|
208
210
|
logger.information.calledWith(`${PROGRAM_NAME} my-add-on --kind panel --template javascript`, {
|
|
209
|
-
prefix: " "
|
|
211
|
+
prefix: " ",
|
|
212
|
+
postfix: "\n"
|
|
210
213
|
}),
|
|
211
214
|
true
|
|
212
215
|
);
|
|
@@ -181,7 +181,8 @@ export class AddOnDirectoryValidator implements DirectoryValidator {
|
|
|
181
181
|
this._logger.warning(format(LOGS.executeProgram, { PROGRAM_NAME }), { prefix: LOGS.tab });
|
|
182
182
|
this._logger.message(LOGS.forExample, { prefix: LOGS.newLine });
|
|
183
183
|
this._logger.information(format(LOGS.executeProgramExample, { PROGRAM_NAME }), {
|
|
184
|
-
prefix: LOGS.tab
|
|
184
|
+
prefix: LOGS.tab,
|
|
185
|
+
postfix: LOGS.newLine
|
|
185
186
|
});
|
|
186
187
|
}
|
|
187
188
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="description" content="Get started with Add-on development using React and
|
|
6
|
-
<meta name="keywords" content="Adobe, Express, Add-On, React,
|
|
5
|
+
<meta name="description" content="Get started with Add-on development using React and TypeScript" />
|
|
6
|
+
<meta name="keywords" content="Adobe, Express, Add-On, React, TypeScript" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>Hello World</title>
|
|
9
9
|
</head>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
## About
|
|
2
2
|
|
|
3
|
-
This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using
|
|
3
|
+
This project has been created with _@adobe/create-ccweb-add-on_. As an example, this Add-on demonstrates how to get started with Add-on development using Spectrum Web Components and JavaScript.
|
|
4
4
|
|
|
5
5
|
## Tools
|
|
6
6
|
|
|
7
7
|
- HTML
|
|
8
8
|
- CSS
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- Spectrum Web Components
|
|
10
|
+
- JavaScript
|
|
11
11
|
|
|
12
12
|
## Setup
|
|
13
13
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// To support: theme="express" scale="medium" color="light"
|
|
2
|
+
// import these spectrum web components modules:
|
|
3
|
+
import "@spectrum-web-components/theme/express/scale-medium.js";
|
|
4
|
+
import "@spectrum-web-components/theme/express/theme-light.js";
|
|
5
|
+
import "@spectrum-web-components/theme/scale-medium.js";
|
|
6
|
+
import "@spectrum-web-components/theme/theme-light.js";
|
|
7
|
+
|
|
8
|
+
// To learn more about using "spectrum web components" visit:
|
|
9
|
+
// https://opensource.adobe.com/spectrum-web-components/
|
|
10
|
+
import "@spectrum-web-components/button/sp-button.js";
|
|
11
|
+
import "@spectrum-web-components/theme/sp-theme.js";
|
|
12
|
+
|
|
13
|
+
import { LitElement, html } from "lit";
|
|
14
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
15
|
+
import { style } from "./App.css";
|
|
16
|
+
|
|
17
|
+
@customElement("add-on-app")
|
|
18
|
+
export class App extends LitElement {
|
|
19
|
+
@property({ type: Object })
|
|
20
|
+
addOnUISdk;
|
|
21
|
+
|
|
22
|
+
@state()
|
|
23
|
+
_buttonLabel = "Click me";
|
|
24
|
+
|
|
25
|
+
static get styles() {
|
|
26
|
+
return style;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_handleClick() {
|
|
30
|
+
this._buttonLabel = "Clicked";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
// Please note that the below "<sp-theme>" component does not react to theme changes in Express.
|
|
35
|
+
// You may use "this.addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
|
|
36
|
+
return html` <sp-theme theme="express" color="light" scale="medium">
|
|
37
|
+
<div class="container">
|
|
38
|
+
<sp-button size="m" @click=${this._handleClick}>${this._buttonLabel}</sp-button>
|
|
39
|
+
</div>
|
|
40
|
+
</sp-theme>`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<meta
|
|
6
|
-
|
|
5
|
+
<meta
|
|
6
|
+
name="description"
|
|
7
|
+
content="Get started with Add-on development using Spectrum Web Components and JavaScript"
|
|
8
|
+
/>
|
|
9
|
+
<meta name="keywords" content="Adobe, Express, Add-On, Spectrum Web Components, JavaScript" />
|
|
7
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
11
|
<title>Get Started</title>
|
|
9
12
|
</head>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
2
|
+
import { customElement, state } from "lit/decorators.js";
|
|
3
|
+
import { until } from "lit/directives/until.js";
|
|
4
|
+
import "./components/App";
|
|
5
|
+
|
|
6
|
+
import addOnUISdk from "https://new.express.adobe.com/static/add-on-sdk/sdk.js";
|
|
7
|
+
|
|
8
|
+
@customElement("add-on-root")
|
|
9
|
+
export class Root extends LitElement {
|
|
10
|
+
@state()
|
|
11
|
+
_isAddOnUISdkReady = addOnUISdk.ready;
|
|
12
|
+
|
|
13
|
+
render() {
|
|
14
|
+
return html`
|
|
15
|
+
${until(
|
|
16
|
+
this._isAddOnUISdkReady.then(() => {
|
|
17
|
+
console.log("addOnUISdk is ready for use.");
|
|
18
|
+
return html`<add-on-app .addOnUISdk=${addOnUISdk}></add-on-app>`;
|
|
19
|
+
})
|
|
20
|
+
)}
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"testId": "",
|
|
3
|
+
"name": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"manifestVersion": 2,
|
|
6
|
+
"requirements": {
|
|
7
|
+
"apps": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Express",
|
|
10
|
+
"apiVersion": 1
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"entryPoints": [
|
|
15
|
+
{
|
|
16
|
+
"type": "panel",
|
|
17
|
+
"id": "panel1",
|
|
18
|
+
"main": "index.html"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"experimentalDecorators": true,
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"useDefineForClassFields": false
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["node_modules"],
|
|
13
|
+
"include": ["src/**/*"]
|
|
14
|
+
}
|