@adobe/create-ccweb-add-on 1.4.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.
Files changed (116) hide show
  1. package/dist/commands/create.d.ts +0 -3
  2. package/dist/commands/create.d.ts.map +1 -1
  3. package/dist/commands/create.js +1 -17
  4. package/dist/constants.d.ts.map +1 -1
  5. package/dist/constants.js +6 -3
  6. package/dist/templates/react-typescript/template/src/index.html +2 -2
  7. package/dist/templates/swc-javascript/template/.babelrc +6 -0
  8. package/dist/templates/{typescript → swc-javascript}/template/README.md +3 -3
  9. package/dist/templates/swc-javascript/template/src/components/App.js +42 -0
  10. package/{templates/typescript-with-document-sandbox → dist/templates/swc-javascript}/template/src/index.html +2 -2
  11. package/dist/templates/swc-javascript/template/src/index.js +23 -0
  12. package/dist/templates/swc-javascript/template/tsconfig.json +14 -0
  13. package/dist/templates/swc-javascript/template/webpack.config.js +46 -0
  14. package/dist/templates/swc-javascript/template.json +24 -0
  15. package/dist/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
  16. package/dist/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
  17. package/dist/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
  18. package/dist/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
  19. package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
  20. package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
  21. package/dist/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
  22. package/dist/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
  23. package/dist/templates/swc-javascript-with-document-sandbox/template.json +24 -0
  24. package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript}/template/README.md +2 -1
  25. package/dist/templates/swc-typescript/template/gitignore +3 -0
  26. package/dist/templates/{typescript-with-document-sandbox → swc-typescript}/template/src/index.html +2 -2
  27. package/dist/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
  28. package/dist/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/validators/AddOnDirectoryValidator.d.ts.map +1 -1
  31. package/dist/validators/AddOnDirectoryValidator.js +2 -1
  32. package/package.json +78 -79
  33. package/src/commands/create.ts +2 -23
  34. package/src/constants.ts +6 -3
  35. package/src/test/commands/create.spec.ts +2 -26
  36. package/src/test/validators/AddOnDirectoryValidator.spec.ts +6 -3
  37. package/src/validators/AddOnDirectoryValidator.ts +2 -1
  38. package/templates/react-typescript/template/src/index.html +2 -2
  39. package/templates/swc-javascript/template/.babelrc +6 -0
  40. package/templates/{typescript → swc-javascript}/template/README.md +3 -3
  41. package/templates/swc-javascript/template/gitignore +3 -0
  42. package/templates/swc-javascript/template/src/components/App.css.js +9 -0
  43. package/templates/swc-javascript/template/src/components/App.js +42 -0
  44. package/{dist/templates/typescript → templates/swc-javascript}/template/src/index.html +5 -2
  45. package/templates/swc-javascript/template/src/index.js +23 -0
  46. package/templates/swc-javascript/template/src/manifest.json +21 -0
  47. package/templates/swc-javascript/template/tsconfig.json +14 -0
  48. package/templates/swc-javascript/template/webpack.config.js +46 -0
  49. package/templates/swc-javascript/template.json +24 -0
  50. package/templates/swc-javascript-with-document-sandbox/template/.babelrc +6 -0
  51. package/templates/swc-javascript-with-document-sandbox/template/README.md +16 -0
  52. package/templates/swc-javascript-with-document-sandbox/template/gitignore +3 -0
  53. package/templates/swc-javascript-with-document-sandbox/template/src/index.html +19 -0
  54. package/templates/swc-javascript-with-document-sandbox/template/src/manifest.json +22 -0
  55. package/templates/swc-javascript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  56. package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/code.js +38 -0
  57. package/templates/swc-javascript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  58. package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.css.js +9 -0
  59. package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +54 -0
  60. package/templates/swc-javascript-with-document-sandbox/template/src/ui/index.js +23 -0
  61. package/templates/swc-javascript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  62. package/templates/swc-javascript-with-document-sandbox/template/tsconfig.json +14 -0
  63. package/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +54 -0
  64. package/templates/swc-javascript-with-document-sandbox/template.json +24 -0
  65. package/{dist/templates/typescript-with-document-sandbox → templates/swc-typescript}/template/README.md +2 -1
  66. package/templates/swc-typescript/template/gitignore +3 -0
  67. package/templates/swc-typescript/template/src/components/App.css.ts +9 -0
  68. package/templates/{typescript → swc-typescript}/template/src/index.html +5 -2
  69. package/templates/swc-typescript/template/src/manifest.json +21 -0
  70. package/templates/swc-typescript-with-document-sandbox/template/README.md +16 -0
  71. package/templates/swc-typescript-with-document-sandbox/template/src/index.html +19 -0
  72. package/templates/swc-typescript-with-document-sandbox/template/src/manifest.json +22 -0
  73. package/templates/swc-typescript-with-document-sandbox/template/src/models/DocumentSandboxApi.ts +4 -0
  74. package/templates/swc-typescript-with-document-sandbox/template/src/sandbox/tsconfig.json +10 -0
  75. package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +9 -0
  76. package/templates/swc-typescript-with-document-sandbox/template/src/ui/tsconfig.json +7 -0
  77. /package/{templates/typescript → dist/templates/swc-javascript}/template/gitignore +0 -0
  78. /package/dist/templates/{typescript/template/src/components/App.css.ts → swc-javascript/template/src/components/App.css.js} +0 -0
  79. /package/dist/templates/{typescript → swc-javascript}/template/src/manifest.json +0 -0
  80. /package/dist/templates/{typescript → swc-javascript-with-document-sandbox}/template/gitignore +0 -0
  81. /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/manifest.json +0 -0
  82. /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
  83. /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/sandbox/tsconfig.json +0 -0
  84. /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
  85. /package/dist/templates/{typescript-with-document-sandbox → swc-javascript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  86. /package/{templates/typescript → dist/templates/swc-typescript}/template/src/components/App.css.ts +0 -0
  87. /package/dist/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
  88. /package/dist/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
  89. /package/{templates/typescript → dist/templates/swc-typescript}/template/src/manifest.json +0 -0
  90. /package/dist/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
  91. /package/dist/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
  92. /package/dist/templates/{typescript → swc-typescript}/template.json +0 -0
  93. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
  94. /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/manifest.json +0 -0
  95. /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/models/DocumentSandboxApi.ts +0 -0
  96. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
  97. /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/sandbox/tsconfig.json +0 -0
  98. /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/components/App.css.ts +0 -0
  99. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
  100. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
  101. /package/{templates/typescript-with-document-sandbox → dist/templates/swc-typescript-with-document-sandbox}/template/src/ui/tsconfig.json +0 -0
  102. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
  103. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
  104. /package/dist/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template.json +0 -0
  105. /package/templates/{typescript → swc-typescript}/template/src/components/App.ts +0 -0
  106. /package/templates/{typescript → swc-typescript}/template/src/index.ts +0 -0
  107. /package/templates/{typescript → swc-typescript}/template/tsconfig.json +0 -0
  108. /package/templates/{typescript → swc-typescript}/template/webpack.config.js +0 -0
  109. /package/templates/{typescript → swc-typescript}/template.json +0 -0
  110. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/gitignore +0 -0
  111. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/sandbox/code.ts +0 -0
  112. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/components/App.ts +0 -0
  113. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/src/ui/index.ts +0 -0
  114. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/tsconfig.json +0 -0
  115. /package/templates/{typescript-with-document-sandbox → swc-typescript-with-document-sandbox}/template/webpack.config.js +0 -0
  116. /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
- "name": "@adobe/create-ccweb-add-on",
3
- "version": "1.4.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
- "@adobe/ccweb-add-on-analytics": "1.4.0",
31
- "@adobe/ccweb-add-on-core": "1.4.0",
32
- "@adobe/ccweb-add-on-developer-terms": "1.4.0",
33
- "@adobe/ccweb-add-on-manifest": "1.4.0",
34
- "@adobe/ccweb-add-on-scaffolder": "1.4.0",
35
- "@oclif/core": "2.8.0",
36
- "axios": "1.6.0",
37
- "chalk": "4.1.1",
38
- "fs-extra": "10.0.1",
39
- "inversify": "6.0.1",
40
- "os-name": "4.0.1",
41
- "prompts": "2.4.2",
42
- "reflect-metadata": "0.1.13",
43
- "semver": "7.3.4",
44
- "string-template": "1.0.0",
45
- "tslib": "2.4.0",
46
- "validate-npm-package-name": "3.0.0"
47
- },
48
- "devDependencies": {
49
- "@types/chai-as-promised": "7.1.3",
50
- "@types/chai": "4.2.14",
51
- "@types/fs-extra": "9.0.13",
52
- "@types/mocha": "9.1.1",
53
- "@types/node": "16.11.62",
54
- "@types/prompts": "2.0.14",
55
- "@types/semver": "7.3.4",
56
- "@types/sinon": "9.0.8",
57
- "@types/string-template": "1.0.2",
58
- "@types/validate-npm-package-name": "3.0.3",
59
- "c8": "7.7.2",
60
- "chai-as-promised": "7.1.1",
61
- "chai": "4.3.4",
62
- "mocha": "10.0.0",
63
- "oclif": "3.2.28",
64
- "prettier": "2.8.0",
65
- "regenerator-runtime": "0.13.9",
66
- "rimraf": "3.0.2",
67
- "sinon": "9.2.1",
68
- "ts-node": "10.9.1",
69
- "ts-sinon": "2.0.1",
70
- "typescript": "4.8.4"
71
- },
72
- "scripts": {
73
- "clean": "rimraf dist coverage",
74
- "_postbuild": "cp -R templates/ dist/templates",
75
- "ibuild": "tsc",
76
- "build": "rushx clean && rushx ibuild && rushx _postbuild",
77
- "build:release": "rushx build",
78
- "test": "c8 mocha && c8 check-coverage --lines 100 --functions 100 --branches 100"
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
+ }
@@ -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, login, analytics, verbose }
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
- ["typescript", "Get started with Add-on development using TypeScript"],
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
- "typescript",
41
+ "swc-javascript",
42
+ "swc-typescript",
41
43
  "react-javascript",
42
44
  "react-typescript",
43
45
  `javascript-${WITH_DOCUMENT_SANDBOX}`,
44
- `typescript-${WITH_DOCUMENT_SANDBOX}`,
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", "--login", "--verbose"],
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 JavaScript" />
6
- <meta name="keywords" content="Adobe, Express, Add-On, React, JavaScript" />
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>
@@ -0,0 +1,6 @@
1
+ {
2
+ "plugins": [
3
+ ["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
4
+ ["@babel/plugin-transform-class-properties"]
5
+ ]
6
+ }
@@ -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 React and TypeScript.
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
- - React
10
- - TypeScript
9
+ - Spectrum Web Components
10
+ - JavaScript
11
11
 
12
12
  ## Setup
13
13
 
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ dist/
3
+ node_modules/
@@ -0,0 +1,9 @@
1
+ import { css } from "lit";
2
+
3
+ export const style = css`
4
+ .container {
5
+ margin: 24px;
6
+ display: flex;
7
+ flex-direction: column;
8
+ }
9
+ `;
@@ -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 name="description" content="Get started with Add-on development using TypeScript" />
6
- <meta name="keywords" content="Adobe, Express, Add-On, TypeScript" />
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
+ }
@@ -0,0 +1,46 @@
1
+ const path = require("path");
2
+ const HtmlWebpackPlugin = require("html-webpack-plugin");
3
+ const CopyWebpackPlugin = require("copy-webpack-plugin");
4
+
5
+ const isEnvProduction = process.env.NODE_ENV === "production";
6
+
7
+ module.exports = {
8
+ mode: isEnvProduction ? "production" : "development",
9
+ devtool: isEnvProduction ? "source-map" : "eval-source-map",
10
+ entry: "./src/index.js",
11
+ experiments: {
12
+ outputModule: true
13
+ },
14
+ output: {
15
+ path: path.resolve(__dirname, "dist"),
16
+ module: true,
17
+ filename: "index.js"
18
+ },
19
+ externalsType: "module",
20
+ externalsPresets: { web: true },
21
+ plugins: [
22
+ new HtmlWebpackPlugin({
23
+ template: "src/index.html",
24
+ scriptLoading: "module"
25
+ }),
26
+ new CopyWebpackPlugin({
27
+ patterns: [{ from: "src/*.json", to: "[name][ext]" }]
28
+ })
29
+ ],
30
+ module: {
31
+ rules: [
32
+ {
33
+ test: /\.(js)$/,
34
+ exclude: /node_modules/,
35
+ use: ["babel-loader"]
36
+ },
37
+ {
38
+ test: /(\.css)$/,
39
+ use: ["style-loader", "css-loader"]
40
+ }
41
+ ]
42
+ },
43
+ resolve: {
44
+ extensions: [".js", ".css"]
45
+ }
46
+ };
@@ -0,0 +1,24 @@
1
+ {
2
+ "scripts": {
3
+ "clean": "ccweb-add-on-scripts clean",
4
+ "build": "ccweb-add-on-scripts build --use webpack",
5
+ "start": "ccweb-add-on-scripts start --use webpack",
6
+ "package": "ccweb-add-on-scripts package --use webpack"
7
+ },
8
+ "dependencies": {
9
+ "@spectrum-web-components/button": "0.39.4",
10
+ "@spectrum-web-components/theme": "0.39.4",
11
+ "lit": "2.8.0"
12
+ },
13
+ "devDependencies": {
14
+ "@babel/plugin-proposal-decorators": "7.24.1",
15
+ "@babel/plugin-transform-class-properties": "7.24.1",
16
+ "babel-loader": "9.1.3",
17
+ "copy-webpack-plugin": "11.0.0",
18
+ "css-loader": "6.8.1",
19
+ "html-webpack-plugin": "5.5.3",
20
+ "style-loader": "3.3.3",
21
+ "webpack-cli": "5.1.4",
22
+ "webpack": "5.89.0"
23
+ }
24
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "plugins": [
3
+ ["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
4
+ ["@babel/plugin-transform-class-properties"]
5
+ ]
6
+ }