@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.
Files changed (136) hide show
  1. package/.c8rc.json +4 -1
  2. package/.mocharc.json +9 -2
  3. package/README.md +2 -2
  4. package/bin/run.js +2 -2
  5. package/dist/app/AddOnFactory.d.ts +30 -3
  6. package/dist/app/AddOnFactory.d.ts.map +1 -1
  7. package/dist/app/AddOnFactory.js +140 -1
  8. package/dist/app/{AddOnManager.d.ts → PackageManager.d.ts} +4 -4
  9. package/dist/app/PackageManager.d.ts.map +1 -0
  10. package/dist/app/{AddOnManager.js → PackageManager.js} +5 -6
  11. package/dist/app/TemplateSelector.d.ts +20 -4
  12. package/dist/app/TemplateSelector.d.ts.map +1 -1
  13. package/dist/app/TemplateSelector.js +142 -1
  14. package/dist/app/index.d.ts +1 -3
  15. package/dist/app/index.d.ts.map +1 -1
  16. package/dist/app/index.js +1 -3
  17. package/dist/commands/create.d.ts +6 -10
  18. package/dist/commands/create.d.ts.map +1 -1
  19. package/dist/commands/create.js +11 -37
  20. package/dist/config/inversify.config.d.ts +2 -1
  21. package/dist/config/inversify.config.d.ts.map +1 -1
  22. package/dist/config/inversify.config.js +8 -6
  23. package/dist/config/inversify.types.d.ts.map +1 -1
  24. package/dist/constants.d.ts.map +1 -1
  25. package/dist/index.d.ts +25 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +25 -0
  28. package/dist/models/CLIOptions.d.ts +4 -4
  29. package/dist/models/CLIOptions.d.ts.map +1 -1
  30. package/dist/models/CLIOptions.js +5 -5
  31. package/dist/templates/react-javascript/template/src/components/App.jsx +2 -2
  32. package/dist/templates/react-javascript/template/webpack.config.js +1 -0
  33. package/dist/templates/react-javascript/template.json +4 -4
  34. package/dist/templates/react-javascript-with-document-sandbox/template/src/ui/components/App.jsx +2 -2
  35. package/dist/templates/react-javascript-with-document-sandbox/template/webpack.config.js +1 -0
  36. package/dist/templates/react-javascript-with-document-sandbox/template.json +4 -4
  37. package/dist/templates/react-typescript/template/src/components/App.tsx +2 -2
  38. package/dist/templates/react-typescript/template/webpack.config.js +1 -0
  39. package/dist/templates/react-typescript/template.json +4 -4
  40. package/dist/templates/react-typescript-with-document-sandbox/template/src/ui/components/App.tsx +2 -2
  41. package/dist/templates/react-typescript-with-document-sandbox/template/webpack.config.js +1 -0
  42. package/dist/templates/react-typescript-with-document-sandbox/template.json +4 -4
  43. package/dist/templates/swc-javascript/template/src/components/App.js +2 -2
  44. package/dist/templates/swc-javascript/template/webpack.config.js +1 -0
  45. package/dist/templates/swc-javascript/template.json +4 -4
  46. package/dist/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +2 -2
  47. package/dist/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +1 -0
  48. package/dist/templates/swc-javascript-with-document-sandbox/template.json +4 -4
  49. package/dist/templates/swc-typescript/template/src/components/App.css.ts +2 -2
  50. package/dist/templates/swc-typescript/template/src/components/App.ts +4 -4
  51. package/dist/templates/swc-typescript/template/src/index.ts +2 -2
  52. package/dist/templates/swc-typescript/template/webpack.config.js +1 -0
  53. package/dist/templates/swc-typescript/template.json +4 -4
  54. package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +2 -2
  55. package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.ts +4 -4
  56. package/dist/templates/swc-typescript-with-document-sandbox/template/src/ui/index.ts +2 -2
  57. package/dist/templates/swc-typescript-with-document-sandbox/template/webpack.config.js +1 -0
  58. package/dist/templates/swc-typescript-with-document-sandbox/template.json +4 -4
  59. package/dist/tsconfig.tsbuildinfo +1 -1
  60. package/dist/validators/DirectoryValidator.d.ts +22 -11
  61. package/dist/validators/DirectoryValidator.d.ts.map +1 -1
  62. package/dist/validators/DirectoryValidator.js +152 -1
  63. package/dist/validators/EnvironmentValidator.d.ts +17 -2
  64. package/dist/validators/EnvironmentValidator.d.ts.map +1 -1
  65. package/dist/validators/EnvironmentValidator.js +149 -1
  66. package/dist/validators/index.d.ts +0 -2
  67. package/dist/validators/index.d.ts.map +1 -1
  68. package/dist/validators/index.js +0 -2
  69. package/package.json +26 -20
  70. package/src/app/AddOnFactory.ts +164 -4
  71. package/src/app/{AddOnManager.ts → PackageManager.ts} +4 -6
  72. package/src/app/TemplateSelector.ts +157 -5
  73. package/src/app/index.ts +1 -3
  74. package/src/commands/create.ts +24 -48
  75. package/src/config/inversify.config.ts +11 -9
  76. package/src/config/inversify.types.ts +7 -1
  77. package/src/constants.ts +2 -2
  78. package/src/index.ts +25 -0
  79. package/src/models/CLIOptions.ts +5 -5
  80. package/src/test/app/{WxpAddOnFactory.spec.ts → AddOnFactory.spec.ts} +18 -17
  81. package/src/test/app/{AddOnManager.spec.ts → PackageManager.spec.ts} +6 -6
  82. package/src/test/app/{AddOnTemplateSelector.spec.ts → TemplateSelector.spec.ts} +57 -26
  83. package/src/test/commands/command.spec.ts +80 -0
  84. package/src/test/commands/create.spec.ts +44 -18
  85. package/src/test/models/CLIOptions.spec.ts +4 -4
  86. package/src/test/validators/{AddOnDirectoryValidator.spec.ts → DirectoryValidator.spec.ts} +29 -21
  87. package/src/test/validators/{NodeEnvironmentValidator.spec.ts → EnvironmentValidator.spec.ts} +11 -24
  88. package/src/validators/DirectoryValidator.ts +172 -11
  89. package/src/validators/EnvironmentValidator.ts +157 -5
  90. package/src/validators/index.ts +0 -2
  91. package/templates/react-javascript/template/src/components/App.jsx +2 -2
  92. package/templates/react-javascript/template/webpack.config.js +1 -0
  93. package/templates/react-javascript/template.json +4 -4
  94. package/templates/react-javascript-with-document-sandbox/template/src/ui/components/App.jsx +2 -2
  95. package/templates/react-javascript-with-document-sandbox/template/webpack.config.js +1 -0
  96. package/templates/react-javascript-with-document-sandbox/template.json +4 -4
  97. package/templates/react-typescript/template/src/components/App.tsx +2 -2
  98. package/templates/react-typescript/template/webpack.config.js +1 -0
  99. package/templates/react-typescript/template.json +4 -4
  100. package/templates/react-typescript-with-document-sandbox/template/src/ui/components/App.tsx +2 -2
  101. package/templates/react-typescript-with-document-sandbox/template/webpack.config.js +1 -0
  102. package/templates/react-typescript-with-document-sandbox/template.json +4 -4
  103. package/templates/swc-javascript/template/src/components/App.js +2 -2
  104. package/templates/swc-javascript/template/webpack.config.js +1 -0
  105. package/templates/swc-javascript/template.json +4 -4
  106. package/templates/swc-javascript-with-document-sandbox/template/src/ui/components/App.js +2 -2
  107. package/templates/swc-javascript-with-document-sandbox/template/webpack.config.js +1 -0
  108. package/templates/swc-javascript-with-document-sandbox/template.json +4 -4
  109. package/templates/swc-typescript/template/src/components/App.css.ts +2 -2
  110. package/templates/swc-typescript/template/src/components/App.ts +4 -4
  111. package/templates/swc-typescript/template/src/index.ts +2 -2
  112. package/templates/swc-typescript/template/webpack.config.js +1 -0
  113. package/templates/swc-typescript/template.json +4 -4
  114. package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.css.ts +2 -2
  115. package/templates/swc-typescript-with-document-sandbox/template/src/ui/components/App.ts +4 -4
  116. package/templates/swc-typescript-with-document-sandbox/template/src/ui/index.ts +2 -2
  117. package/templates/swc-typescript-with-document-sandbox/template/webpack.config.js +1 -0
  118. package/templates/swc-typescript-with-document-sandbox/template.json +4 -4
  119. package/tsconfig.json +3 -1
  120. package/dist/app/AddOnManager.d.ts.map +0 -1
  121. package/dist/app/AddOnTemplateSelector.d.ts +0 -54
  122. package/dist/app/AddOnTemplateSelector.d.ts.map +0 -1
  123. package/dist/app/AddOnTemplateSelector.js +0 -168
  124. package/dist/app/WxpAddOnFactory.d.ts +0 -62
  125. package/dist/app/WxpAddOnFactory.d.ts.map +0 -1
  126. package/dist/app/WxpAddOnFactory.js +0 -159
  127. package/dist/validators/AddOnDirectoryValidator.d.ts +0 -55
  128. package/dist/validators/AddOnDirectoryValidator.d.ts.map +0 -1
  129. package/dist/validators/AddOnDirectoryValidator.js +0 -176
  130. package/dist/validators/NodeEnvironmentValidator.d.ts +0 -58
  131. package/dist/validators/NodeEnvironmentValidator.d.ts.map +0 -1
  132. package/dist/validators/NodeEnvironmentValidator.js +0 -173
  133. package/src/app/AddOnTemplateSelector.ts +0 -193
  134. package/src/app/WxpAddOnFactory.ts +0 -196
  135. package/src/validators/AddOnDirectoryValidator.ts +0 -207
  136. package/src/validators/NodeEnvironmentValidator.ts +0 -197
@@ -22,23 +22,184 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
+ import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
26
+ import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
27
+ import type { Logger } from "@adobe/ccweb-add-on-core";
28
+ import { ITypes as ICoreTypes, isNullOrWhiteSpace } from "@adobe/ccweb-add-on-core";
29
+ import fs from "fs-extra";
30
+ import { inject, injectable } from "inversify";
31
+ import path from "path";
32
+ import process from "process";
33
+ import "reflect-metadata";
34
+ import format from "string-template";
35
+ import validate from "validate-npm-package-name";
36
+ import { AnalyticsErrorMarkers } from "../AnalyticsMarkers.js";
37
+ import { PROGRAM_NAME } from "../constants.js";
38
+
25
39
  /**
26
- * Directory validator interface to validate
40
+ * Directory validator implementation class to validate
27
41
  * whether the directory can be used to create the add-on project.
28
42
  */
29
- export interface DirectoryValidator {
43
+ @injectable()
44
+ export class DirectoryValidator {
45
+ private readonly _logger: Logger;
46
+ private readonly _analyticsService: AnalyticsService;
47
+
30
48
  /**
31
- * Validate the app name.
32
- *
33
- * @param appName - Name of the app.
49
+ * Instantiate {@link DirectoryValidator}.
50
+ * @param logger - {@link Logger} reference.
51
+ * @param analyticsService - {@link AnalyticsService} reference.
52
+ * @returns Reference to a new {@link DirectoryValidator} instance.
34
53
  */
35
- validateAddOnName(appName: string): Promise<void>;
54
+ constructor(
55
+ @inject(ICoreTypes.Logger) logger: Logger,
56
+ @inject(IAnalyticsTypes.AnalyticsService) analyticsService: AnalyticsService
57
+ ) {
58
+ this._logger = logger;
59
+ this._analyticsService = analyticsService;
60
+ }
36
61
 
37
62
  /**
38
- * Validate the app directory.
39
- *
40
- * @param appDirectory - Root directory of the app.
41
- * @param appName - Name of the app.
63
+ * Validate the Add-on name.
64
+ * @param addOnName - Name of the Add-on.
42
65
  */
43
- validateAddOnDirectory(appDirectory: string, appName: string): Promise<void>;
66
+ async validateAddOnName(addOnName: string): Promise<void> {
67
+ if (isNullOrWhiteSpace(addOnName)) {
68
+ this._logger.warning(LOGS.specifyAddOnName);
69
+ this._chooseDifferentAddOnName();
70
+ await this._analyticsService.postEvent(
71
+ AnalyticsErrorMarkers.ERROR_NO_ADD_ON_NAME,
72
+ LOGS.analyticsNoAddOnName,
73
+ false
74
+ );
75
+ return process.exit(0);
76
+ }
77
+
78
+ const isValid = validate(addOnName).validForNewPackages;
79
+ if (!isValid) {
80
+ this._logger.warning(format(LOGS.npmNamingRestriction, { addOnName }));
81
+ this._chooseDifferentAddOnName();
82
+ await this._analyticsService.postEvent(
83
+ AnalyticsErrorMarkers.ERROR_INVALID_NAME_NPM,
84
+ LOGS.analyticsInvalidAddOnNameNPM,
85
+ false
86
+ );
87
+ return process.exit(0);
88
+ }
89
+
90
+ const dependencies = new Set([
91
+ "@adobe/create-ccweb-add-on",
92
+ "create-ccweb-add-on",
93
+ "@adobe/ccweb-add-on-scripts",
94
+ "ccweb-add-on-scripts",
95
+ "@adobe/ccweb-add-on-scaffolder",
96
+ "ccweb-add-on-scaffolder"
97
+ ]);
98
+ if (dependencies.has(addOnName)) {
99
+ this._logger.warning(format(LOGS.dependencyNamingRestriction, { addOnName }));
100
+ this._chooseDifferentAddOnName();
101
+ await this._analyticsService.postEvent(
102
+ AnalyticsErrorMarkers.ERROR_INVALID_NAME_DEP,
103
+ LOGS.analyticsInvalidAddOnNameDependency,
104
+ false
105
+ );
106
+ return process.exit(0);
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Validate the addOn directory.
112
+ * @param addOnDirectory - Root directory of the addOn.
113
+ * @param addOnName - Name of the addOn.
114
+ */
115
+ async validateAddOnDirectory(addOnDirectory: string, addOnName: string): Promise<void> {
116
+ fs.ensureDirSync(addOnName);
117
+
118
+ const validFiles = [
119
+ ".DS_Store",
120
+ ".git",
121
+ ".gitattributes",
122
+ ".gitignore",
123
+ ".gitlab-ci.yml",
124
+ ".hg",
125
+ ".hgcheck",
126
+ ".hgignore",
127
+ ".idea",
128
+ ".npmignore",
129
+ ".travis.yml",
130
+ "docs",
131
+ "LICENSE",
132
+ "README.md",
133
+ "mkdocs.yml",
134
+ "Thumbs.db"
135
+ ];
136
+
137
+ const errorLogFilePatterns = ["npm-debug.log"];
138
+
139
+ const isErrorLog = (file: string) => {
140
+ return errorLogFilePatterns.some(pattern => file.startsWith(pattern));
141
+ };
142
+
143
+ const existingFiles = fs.readdirSync(addOnDirectory, { withFileTypes: true });
144
+ const conflictingFiles = existingFiles
145
+ .filter(file => !validFiles.includes(file.name))
146
+ .filter(file => !/\.iml$/.test(file.name))
147
+ .filter(file => !isErrorLog(file.name));
148
+
149
+ if (conflictingFiles.length === 0) {
150
+ return;
151
+ }
152
+
153
+ this._logger.warning(format(LOGS.directoryContainsFiles, { addOnName }), {
154
+ postfix: LOGS.newLine
155
+ });
156
+
157
+ for (const file of conflictingFiles) {
158
+ try {
159
+ if (fs.lstatSync(path.join(addOnDirectory, file.name)).isDirectory()) {
160
+ this._logger.warning(`${file.name}/`, { prefix: LOGS.tab });
161
+ } else {
162
+ this._logger.warning(`${file.name}`, { prefix: LOGS.tab });
163
+ }
164
+ } catch {
165
+ this._logger.warning(`${file.name}`, { prefix: LOGS.tab });
166
+ }
167
+ }
168
+
169
+ this._logger.information(LOGS.newAddOnOrRemoveFiles, { prefix: LOGS.newLine });
170
+ await this._analyticsService.postEvent(
171
+ AnalyticsErrorMarkers.ERROR_INVALID_NAME_DIR,
172
+ LOGS.analyticsInvalidAddOnDir,
173
+ false
174
+ );
175
+ return process.exit(0);
176
+ }
177
+
178
+ private _chooseDifferentAddOnName() {
179
+ this._logger.warning(format(LOGS.executeProgram, { PROGRAM_NAME }), { prefix: LOGS.tab });
180
+ this._logger.message(LOGS.forExample, { prefix: LOGS.newLine });
181
+ this._logger.information(format(LOGS.executeProgramExample, { PROGRAM_NAME }), {
182
+ prefix: LOGS.tab,
183
+ postfix: LOGS.newLine
184
+ });
185
+ }
44
186
  }
187
+
188
+ const LOGS = {
189
+ newLine: "\n",
190
+ tab: " ",
191
+ specifyAddOnName: "Please specify an Add-on name",
192
+ executeProgram: "{PROGRAM_NAME} <add-on-name> --entrypoint <panel> --template <javascript>",
193
+ executeProgramExample: "{PROGRAM_NAME} my-add-on --entrypoint panel --template javascript",
194
+ forExample: "For example:",
195
+ npmNamingRestriction: "Cannot create a project named {addOnName} because of NPM naming restrictions.",
196
+ dependencyNamingRestriction:
197
+ "Cannot create a project named {addOnName} because a dependency with the same name exists.",
198
+ chooseDifferentAddOnName: "Please choose a different Add-on name:",
199
+ directoryContainsFiles: "The directory {addOnName} contains files that could conflict:",
200
+ newAddOnOrRemoveFiles: "Either try using a new Add-on name, or remove the files listed above.",
201
+ analyticsNoAddOnName: "Add-on name was not specified",
202
+ analyticsInvalidAddOnNameNPM: "Invalid Add-on name. Npm name check failed",
203
+ analyticsInvalidAddOnNameDependency: "Invalid Add-on name. Dependency with same name exists",
204
+ analyticsInvalidAddOnDir: "Invalid Add-on name. Conflicting directory with same name exists"
205
+ };
@@ -22,23 +22,175 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
+ import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
26
+ import { ITypes as IAnalyticsTypes } from "@adobe/ccweb-add-on-analytics";
27
+ import type { Logger, Process } from "@adobe/ccweb-add-on-core";
28
+ import { ITypes as ICoreTypes } from "@adobe/ccweb-add-on-core";
29
+ import { inject, injectable } from "inversify";
30
+ import process from "process";
31
+ import "reflect-metadata";
32
+ import semver from "semver";
33
+ import format from "string-template";
34
+ import { AnalyticsErrorMarkers } from "../AnalyticsMarkers.js";
35
+ import { PROGRAM_NAME } from "../constants.js";
36
+
25
37
  /**
26
- * Environment validator interface to validate
38
+ * Environment validator implementation class to validate
27
39
  * the system requirements required for running the app.
28
40
  */
29
- export interface EnvironmentValidator {
41
+ @injectable()
42
+ export class EnvironmentValidator {
43
+ private readonly _process: Process;
44
+ private readonly _logger: Logger;
45
+ private readonly _analyticsService: AnalyticsService;
46
+ /**
47
+ * Instantiate {@link EnvironmentValidator}.
48
+ *
49
+ * @param processHandler - {@link Process} reference.
50
+ * @param logger - {@link Logger} reference.
51
+ * @param analyticsService - {@link AnalyticsService} reference.
52
+ * @returns Reference to a new {@link EnvironmentValidator} instance.
53
+ */
54
+ constructor(
55
+ @inject(ICoreTypes.Process) processHandler: Process,
56
+ @inject(ICoreTypes.Logger) logger: Logger,
57
+ @inject(IAnalyticsTypes.AnalyticsService) analyticsService: AnalyticsService
58
+ ) {
59
+ this._process = processHandler;
60
+ this._logger = logger;
61
+ this._analyticsService = analyticsService;
62
+ }
63
+
30
64
  /**
31
65
  * Validate the node version in the user's system.
32
66
  */
33
- validateNodeVersion(): Promise<void>;
67
+ async validateNodeVersion(): Promise<void> {
68
+ const minNode = "18.0.0";
69
+ try {
70
+ const result = this._process.executeSync("node", ["--version"]);
71
+ const nodeVersion = String(result?.data)?.trim();
72
+ const hasMinNode = semver.gte(nodeVersion, minNode);
73
+ if (!hasMinNode) {
74
+ this._logger.warning(format(LOGS.usingNodeVersion, { nodeVersion }));
75
+ this._logger.information(
76
+ format(LOGS.requiresHigherNode, {
77
+ PROGRAM_NAME,
78
+ minNode
79
+ })
80
+ );
81
+ this._logger.information(LOGS.updateNodeVersion);
82
+ await this._analyticsService.postEvent(
83
+ AnalyticsErrorMarkers.ERROR_INVALID_NODE,
84
+ format(LOGS.analyticsInvalidNode, { nodeVersion }),
85
+ false
86
+ );
87
+ return process.exit(0);
88
+ }
89
+ } catch (error) {
90
+ this._process.handleError(error);
91
+ }
92
+ }
34
93
 
35
94
  /**
36
95
  * Validate the npm version in the user's system.
37
96
  */
38
- validateNpmVersion(): Promise<void>;
97
+ async validateNpmVersion(): Promise<void> {
98
+ const minNpm = "10.0.0";
99
+ try {
100
+ const result = this._process.executeSync("npm", ["--version"]);
101
+ const npmVersion = result.data ? String(result.data)?.trim() : undefined;
102
+ if (!npmVersion) {
103
+ this._logger.warning(LOGS.notUsingNpm);
104
+ this._logger.information(
105
+ format(LOGS.requiresHigherNpm, {
106
+ PROGRAM_NAME,
107
+ minNpm
108
+ })
109
+ );
110
+ this._logger.information(LOGS.installNpm);
111
+ await this._analyticsService.postEvent(AnalyticsErrorMarkers.ERROR_NO_NPM, LOGS.analyticsNoNpm, false);
112
+ return process.exit(0);
113
+ }
114
+
115
+ const hasMinNpm = semver.gte(npmVersion, minNpm);
116
+ if (!hasMinNpm) {
117
+ this._logger.warning(format(LOGS.usingNpmVersion, { npmVersion }));
118
+ this._logger.information(
119
+ format(LOGS.requiresHigherNpm, {
120
+ PROGRAM_NAME,
121
+ minNpm
122
+ })
123
+ );
124
+ this._logger.information(LOGS.updateNpm);
125
+ await this._analyticsService.postEvent(
126
+ AnalyticsErrorMarkers.ERROR_INVALID_NPM,
127
+ format(LOGS.analyticsInvalidNpm, { npmVersion }),
128
+ false
129
+ );
130
+ return process.exit(0);
131
+ }
132
+ } catch (error) {
133
+ this._process.handleError(error);
134
+ }
135
+ }
39
136
 
40
137
  /**
41
138
  * Validate the npm configuration in the user's system.
42
139
  */
43
- validateNpmConfiguration(): Promise<void>;
140
+ async validateNpmConfiguration(): Promise<void> {
141
+ try {
142
+ const cwd = process.cwd();
143
+ const configList = this._process.executeSync("npm", ["config", "list"])?.data;
144
+ if (!configList) {
145
+ return;
146
+ }
147
+
148
+ const prefix = "; cwd = ";
149
+ const configLines = configList.split("\n");
150
+ const cwdLine = configLines.find(line => line.startsWith(prefix));
151
+ if (!cwdLine) {
152
+ return;
153
+ }
154
+
155
+ const npmCWD = cwdLine.substring(prefix.length);
156
+ if (npmCWD === cwd) {
157
+ return;
158
+ }
159
+
160
+ this._logger.warning(LOGS.couldNotStartNpmProcess);
161
+ this._logger.information(format(LOGS.currentDirectory, { cwd }));
162
+ this._logger.information(format(LOGS.newNpmProcessRunsIn, { npmCWD }));
163
+ this._logger.information(LOGS.misconfiguredTerminalShell);
164
+
165
+ await this._analyticsService.postEvent(
166
+ AnalyticsErrorMarkers.ERROR_NPM_NOT_STARTED,
167
+ LOGS.analyticsNotStartNpm,
168
+ false
169
+ );
170
+ return process.exit(0);
171
+ } catch (error) {
172
+ return;
173
+ }
174
+ }
44
175
  }
176
+
177
+ const LOGS = {
178
+ newLine: "\n",
179
+ tab: " ",
180
+ usingNodeVersion: "You are using node {nodeVersion}.",
181
+ requiresHigherNode: "{PROGRAM_NAME} requires node {minNode} or higher.",
182
+ updateNodeVersion: "Please update your version of node.",
183
+ notUsingNpm: "You are not using npm.",
184
+ requiresHigherNpm: "{PROGRAM_NAME} requires npm {minNpm} or higher.",
185
+ installNpm: "Please install npm.",
186
+ usingNpmVersion: "You are using npm {npmVersion}.",
187
+ updateNpm: "Please update your version of npm.",
188
+ couldNotStartNpmProcess: "Could not start an npm process in the right directory.",
189
+ currentDirectory: "The current directory is: {cwd}",
190
+ newNpmProcessRunsIn: "However, a newly started npm process runs in: {npmCWD}",
191
+ misconfiguredTerminalShell: "This is probably caused by a misconfigured system terminal shell.",
192
+ analyticsInvalidNode: "Invalid node version: {nodeVersion}",
193
+ analyticsNoNpm: "npm is not present",
194
+ analyticsInvalidNpm: "Invalid npm version: {npmVersion}",
195
+ analyticsNotStartNpm: "npm process could not be started"
196
+ };
@@ -22,7 +22,5 @@
22
22
  * SOFTWARE.
23
23
  ********************************************************************************/
24
24
 
25
- export * from "./AddOnDirectoryValidator.js";
26
25
  export * from "./DirectoryValidator.js";
27
26
  export * from "./EnvironmentValidator.js";
28
- export * from "./NodeEnvironmentValidator.js";
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -20,7 +20,7 @@ const App = ({ addOnUISdk }) => {
20
20
  return (
21
21
  // Please note that the below "<Theme>" component does not react to theme changes in Express.
22
22
  // You may use "addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
23
- <Theme theme="express" scale="medium" color="light">
23
+ <Theme system="express" scale="medium" color="light">
24
24
  <div className="container">
25
25
  <Button size="m" onClick={handleClick}>
26
26
  {buttonLabel}
@@ -12,6 +12,7 @@ module.exports = {
12
12
  outputModule: true
13
13
  },
14
14
  output: {
15
+ pathinfo: !isEnvProduction,
15
16
  path: path.resolve(__dirname, "dist"),
16
17
  module: true,
17
18
  filename: "index.js"
@@ -6,8 +6,8 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@swc-react/button": "0.39.4",
10
- "@swc-react/theme": "0.39.4",
9
+ "@swc-react/button": "1.7.0",
10
+ "@swc-react/theme": "1.7.0",
11
11
  "react-dom": "18.2.0",
12
12
  "react": "18.2.0"
13
13
  },
@@ -20,7 +20,7 @@
20
20
  "css-loader": "6.8.1",
21
21
  "html-webpack-plugin": "5.5.3",
22
22
  "style-loader": "3.3.3",
23
- "webpack-cli": "5.1.4",
24
- "webpack": "5.89.0"
23
+ "webpack-cli": "6.0.1",
24
+ "webpack": "5.98.0"
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -18,7 +18,7 @@ const App = ({ addOnUISdk, sandboxProxy }) => {
18
18
  return (
19
19
  // Please note that the below "<Theme>" component does not react to theme changes in Express.
20
20
  // You may use "addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
21
- <Theme theme="express" scale="medium" color="light">
21
+ <Theme system="express" scale="medium" color="light">
22
22
  <div className="container">
23
23
  <Button size="m" onClick={handleClick}>
24
24
  Create Rectangle
@@ -15,6 +15,7 @@ module.exports = {
15
15
  outputModule: true
16
16
  },
17
17
  output: {
18
+ pathinfo: !isEnvProduction,
18
19
  path: path.resolve(__dirname, "dist"),
19
20
  module: true,
20
21
  filename: "[name].js"
@@ -6,8 +6,8 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@swc-react/button": "0.39.4",
10
- "@swc-react/theme": "0.39.4",
9
+ "@swc-react/button": "1.7.0",
10
+ "@swc-react/theme": "1.7.0",
11
11
  "react-dom": "18.2.0",
12
12
  "react": "18.2.0"
13
13
  },
@@ -20,7 +20,7 @@
20
20
  "css-loader": "6.8.1",
21
21
  "html-webpack-plugin": "5.5.3",
22
22
  "style-loader": "3.3.3",
23
- "webpack-cli": "5.1.4",
24
- "webpack": "5.89.0"
23
+ "webpack-cli": "6.0.1",
24
+ "webpack": "5.98.0"
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -22,7 +22,7 @@ const App = ({ addOnUISdk }: { addOnUISdk: AddOnSDKAPI }) => {
22
22
  return (
23
23
  // Please note that the below "<Theme>" component does not react to theme changes in Express.
24
24
  // You may use "addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
25
- <Theme theme="express" scale="medium" color="light">
25
+ <Theme system="express" scale="medium" color="light">
26
26
  <div className="container">
27
27
  <Button size="m" onClick={handleClick}>
28
28
  {buttonLabel}
@@ -12,6 +12,7 @@ module.exports = {
12
12
  outputModule: true
13
13
  },
14
14
  output: {
15
+ pathinfo: !isEnvProduction,
15
16
  path: path.resolve(__dirname, "dist"),
16
17
  module: true,
17
18
  filename: "index.js"
@@ -6,8 +6,8 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@swc-react/button": "0.39.4",
10
- "@swc-react/theme": "0.39.4",
9
+ "@swc-react/button": "1.7.0",
10
+ "@swc-react/theme": "1.7.0",
11
11
  "react-dom": "18.2.0",
12
12
  "react": "18.2.0"
13
13
  },
@@ -20,7 +20,7 @@
20
20
  "style-loader": "3.3.3",
21
21
  "ts-loader": "9.5.1",
22
22
  "typescript": "5.3.2",
23
- "webpack-cli": "5.1.4",
24
- "webpack": "5.89.0"
23
+ "webpack-cli": "6.0.1",
24
+ "webpack": "5.98.0"
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -21,7 +21,7 @@ const App = ({ addOnUISdk, sandboxProxy }: { addOnUISdk: AddOnSDKAPI; sandboxPro
21
21
  return (
22
22
  // Please note that the below "<Theme>" component does not react to theme changes in Express.
23
23
  // You may use "addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
24
- <Theme theme="express" scale="medium" color="light">
24
+ <Theme system="express" scale="medium" color="light">
25
25
  <div className="container">
26
26
  <Button size="m" onClick={handleClick}>
27
27
  Create Rectangle
@@ -18,6 +18,7 @@ module.exports = {
18
18
  outputModule: true
19
19
  },
20
20
  output: {
21
+ pathinfo: !isEnvProduction,
21
22
  path: path.resolve(__dirname, "dist"),
22
23
  module: true,
23
24
  filename: "[name].js"
@@ -6,8 +6,8 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@swc-react/button": "0.39.4",
10
- "@swc-react/theme": "0.39.4",
9
+ "@swc-react/button": "1.7.0",
10
+ "@swc-react/theme": "1.7.0",
11
11
  "react-dom": "18.2.0",
12
12
  "react": "18.2.0"
13
13
  },
@@ -20,7 +20,7 @@
20
20
  "style-loader": "3.3.3",
21
21
  "ts-loader": "9.5.1",
22
22
  "typescript": "5.3.2",
23
- "webpack-cli": "5.1.4",
24
- "webpack": "5.89.0"
23
+ "webpack-cli": "6.0.1",
24
+ "webpack": "5.98.0"
25
25
  }
26
26
  }
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -33,7 +33,7 @@ export class App extends LitElement {
33
33
  render() {
34
34
  // Please note that the below "<sp-theme>" component does not react to theme changes in Express.
35
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">
36
+ return html` <sp-theme system="express" color="light" scale="medium">
37
37
  <div class="container">
38
38
  <sp-button size="m" @click=${this._handleClick}>${this._buttonLabel}</sp-button>
39
39
  </div>
@@ -12,6 +12,7 @@ module.exports = {
12
12
  outputModule: true
13
13
  },
14
14
  output: {
15
+ pathinfo: !isEnvProduction,
15
16
  path: path.resolve(__dirname, "dist"),
16
17
  module: true,
17
18
  filename: "index.js"
@@ -6,8 +6,8 @@
6
6
  "package": "ccweb-add-on-scripts package --use webpack"
7
7
  },
8
8
  "dependencies": {
9
- "@spectrum-web-components/button": "0.39.4",
10
- "@spectrum-web-components/theme": "0.39.4",
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": "5.1.4",
22
- "webpack": "5.89.0"
21
+ "webpack-cli": "6.0.1",
22
+ "webpack": "5.98.0"
23
23
  }
24
24
  }
@@ -1,4 +1,4 @@
1
- // To support: theme="express" scale="medium" color="light"
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";
@@ -45,7 +45,7 @@ export class App extends LitElement {
45
45
  render() {
46
46
  // Please note that the below "<sp-theme>" component does not react to theme changes in Express.
47
47
  // You may use "this.addOnUISdk.app.ui.theme" to get the current theme and react accordingly.
48
- return html` <sp-theme theme="express" color="light" scale="medium">
48
+ return html` <sp-theme system="express" color="light" scale="medium">
49
49
  <div class="container">
50
50
  <sp-button size="m" @click=${this._handleClick}>Create Rectangle</sp-button>
51
51
  </div>
@@ -15,6 +15,7 @@ module.exports = {
15
15
  outputModule: true
16
16
  },
17
17
  output: {
18
+ pathinfo: !isEnvProduction,
18
19
  path: path.resolve(__dirname, "dist"),
19
20
  module: true,
20
21
  filename: "[name].js"