@adobe/create-ccweb-add-on 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.c8rc.json +4 -1
- package/bin/run.js +1 -2
- package/dist/app/AddOnFactory.d.ts +30 -3
- package/dist/app/AddOnFactory.d.ts.map +1 -1
- package/dist/app/AddOnFactory.js +140 -1
- package/dist/app/{AddOnPackageManager.d.ts → PackageManager.d.ts} +2 -2
- package/dist/app/PackageManager.d.ts.map +1 -0
- package/dist/app/{AddOnPackageManager.js → PackageManager.js} +2 -2
- package/dist/app/TemplateSelector.d.ts +20 -4
- package/dist/app/TemplateSelector.d.ts.map +1 -1
- package/dist/app/TemplateSelector.js +142 -1
- package/dist/app/index.d.ts +1 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -3
- package/dist/commands/create.d.ts +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/config/inversify.config.d.ts +1 -1
- package/dist/config/inversify.config.d.ts.map +1 -1
- package/dist/config/inversify.config.js +8 -6
- package/dist/templates/react-javascript/template.json +2 -2
- package/dist/templates/react-javascript-with-document-sandbox/template.json +2 -2
- package/dist/templates/react-typescript/template.json +2 -2
- package/dist/templates/react-typescript-with-document-sandbox/template.json +2 -2
- package/dist/templates/swc-javascript/template.json +2 -2
- package/dist/templates/swc-javascript-with-document-sandbox/template.json +2 -2
- package/dist/templates/swc-typescript/template.json +2 -2
- package/dist/templates/swc-typescript-with-document-sandbox/template.json +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/validators/DirectoryValidator.d.ts +22 -11
- package/dist/validators/DirectoryValidator.d.ts.map +1 -1
- package/dist/validators/DirectoryValidator.js +152 -1
- package/dist/validators/EnvironmentValidator.d.ts +17 -2
- package/dist/validators/EnvironmentValidator.d.ts.map +1 -1
- package/dist/validators/EnvironmentValidator.js +149 -1
- package/dist/validators/index.d.ts +0 -2
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +0 -2
- package/package.json +8 -8
- package/src/app/AddOnFactory.ts +164 -4
- package/src/app/{AddOnPackageManager.ts → PackageManager.ts} +1 -1
- package/src/app/TemplateSelector.ts +157 -5
- package/src/app/index.ts +1 -3
- package/src/commands/create.ts +1 -1
- package/src/config/inversify.config.ts +10 -9
- package/src/test/app/{WxpAddOnFactory.spec.ts → AddOnFactory.spec.ts} +7 -6
- package/src/test/app/{AddOnPackageManager.spec.ts → PackageManager.spec.ts} +3 -6
- package/src/test/app/{AddOnTemplateSelector.spec.ts → TemplateSelector.spec.ts} +27 -14
- package/src/test/commands/command.spec.ts +1 -1
- package/src/test/commands/create.spec.ts +2 -2
- package/src/test/models/CLIOptions.spec.ts +1 -1
- package/src/test/validators/{AddOnDirectoryValidator.spec.ts → DirectoryValidator.spec.ts} +5 -6
- package/src/test/validators/{NodeEnvironmentValidator.spec.ts → EnvironmentValidator.spec.ts} +6 -19
- package/src/validators/DirectoryValidator.ts +172 -11
- package/src/validators/EnvironmentValidator.ts +157 -5
- package/src/validators/index.ts +0 -2
- package/templates/react-javascript/template.json +2 -2
- package/templates/react-javascript-with-document-sandbox/template.json +2 -2
- package/templates/react-typescript/template.json +2 -2
- package/templates/react-typescript-with-document-sandbox/template.json +2 -2
- package/templates/swc-javascript/template.json +2 -2
- package/templates/swc-javascript-with-document-sandbox/template.json +2 -2
- package/templates/swc-typescript/template.json +2 -2
- package/templates/swc-typescript-with-document-sandbox/template.json +2 -2
- package/dist/app/AddOnPackageManager.d.ts.map +0 -1
- package/dist/app/AddOnTemplateSelector.d.ts +0 -54
- package/dist/app/AddOnTemplateSelector.d.ts.map +0 -1
- package/dist/app/AddOnTemplateSelector.js +0 -168
- package/dist/app/WxpAddOnFactory.d.ts +0 -62
- package/dist/app/WxpAddOnFactory.d.ts.map +0 -1
- package/dist/app/WxpAddOnFactory.js +0 -159
- package/dist/validators/AddOnDirectoryValidator.d.ts +0 -55
- package/dist/validators/AddOnDirectoryValidator.d.ts.map +0 -1
- package/dist/validators/AddOnDirectoryValidator.js +0 -176
- package/dist/validators/NodeEnvironmentValidator.d.ts +0 -58
- package/dist/validators/NodeEnvironmentValidator.d.ts.map +0 -1
- package/dist/validators/NodeEnvironmentValidator.js +0 -173
- package/src/app/AddOnTemplateSelector.ts +0 -193
- package/src/app/WxpAddOnFactory.ts +0 -196
- package/src/validators/AddOnDirectoryValidator.ts +0 -207
- package/src/validators/NodeEnvironmentValidator.ts +0 -197
|
@@ -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
|
|
40
|
+
* Directory validator implementation class to validate
|
|
27
41
|
* whether the directory can be used to create the add-on project.
|
|
28
42
|
*/
|
|
29
|
-
|
|
43
|
+
@injectable()
|
|
44
|
+
export class DirectoryValidator {
|
|
45
|
+
private readonly _logger: Logger;
|
|
46
|
+
private readonly _analyticsService: AnalyticsService;
|
|
47
|
+
|
|
30
48
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
38
|
+
* Environment validator implementation class to validate
|
|
27
39
|
* the system requirements required for running the app.
|
|
28
40
|
*/
|
|
29
|
-
|
|
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
|
+
};
|
package/src/validators/index.ts
CHANGED
|
@@ -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";
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@swc-react/button": "1.0
|
|
10
|
-
"@swc-react/theme": "1.0
|
|
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
|
},
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@swc-react/button": "1.0
|
|
10
|
-
"@swc-react/theme": "1.0
|
|
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
|
},
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@swc-react/button": "1.0
|
|
10
|
-
"@swc-react/theme": "1.0
|
|
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
|
},
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@swc-react/button": "1.0
|
|
10
|
-
"@swc-react/theme": "1.0
|
|
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
|
},
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "1.
|
|
10
|
-
"@spectrum-web-components/theme": "1.
|
|
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": {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "1.
|
|
10
|
-
"@spectrum-web-components/theme": "1.
|
|
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": {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "1.
|
|
10
|
-
"@spectrum-web-components/theme": "1.
|
|
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": {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"package": "ccweb-add-on-scripts package --use webpack"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@spectrum-web-components/button": "1.
|
|
10
|
-
"@spectrum-web-components/theme": "1.
|
|
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": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddOnPackageManager.d.ts","sourceRoot":"","sources":["../../src/app/AddOnPackageManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,qBAAa,mBAAmB;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW;CAaxF"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* MIT License
|
|
3
|
-
|
|
4
|
-
* © Copyright 2023 Adobe. All rights reserved.
|
|
5
|
-
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
********************************************************************************/
|
|
24
|
-
import type { AnalyticsService } from "@adobe/ccweb-add-on-analytics";
|
|
25
|
-
import type { Logger } from "@adobe/ccweb-add-on-core";
|
|
26
|
-
import "reflect-metadata";
|
|
27
|
-
import type { CLIOptions } from "../models/index.js";
|
|
28
|
-
import type { TemplateSelector } from "./TemplateSelector.js";
|
|
29
|
-
export declare class AddOnTemplateSelector implements TemplateSelector {
|
|
30
|
-
private readonly _logger;
|
|
31
|
-
private readonly _analyticsService;
|
|
32
|
-
/**
|
|
33
|
-
* Instantiate {@link AddOnTemplateSelector}.
|
|
34
|
-
* @param logger - {@link Logger} reference.
|
|
35
|
-
* @param analyticsService - {@link AnalyticsService} reference.
|
|
36
|
-
* @returns Reference to a new {@link AddOnTemplateSelector} instance.
|
|
37
|
-
*/
|
|
38
|
-
constructor(logger: Logger, analyticsService: AnalyticsService);
|
|
39
|
-
/**
|
|
40
|
-
* Sets up a template, as selected/provided by the user
|
|
41
|
-
* for scaffolding the add-on project.
|
|
42
|
-
* @param options - {@link CLIOptions}.
|
|
43
|
-
* @returns User selected/provided template name.
|
|
44
|
-
*/
|
|
45
|
-
setupTemplate(options: CLIOptions): Promise<string>;
|
|
46
|
-
private _promptMessage;
|
|
47
|
-
private _promptMessageOption;
|
|
48
|
-
/**
|
|
49
|
-
* Validate whether entrypointType is valid or not.
|
|
50
|
-
* @param entrypointType - Add-on entrypoint. For example: panel.
|
|
51
|
-
*/
|
|
52
|
-
private _validateAddOnEntrypoint;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=AddOnTemplateSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AddOnTemplateSelector.d.ts","sourceRoot":"","sources":["../../src/app/AddOnTemplateSelector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;kFAsBkF;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAMvD,OAAO,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBACa,qBAAsB,YAAW,gBAAgB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IAErD;;;;;OAKG;gBAE4B,MAAM,EAAE,MAAM,EACC,gBAAgB,EAAE,gBAAgB;IAMhF;;;;;OAKG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAsEzD,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;IAO5B;;;OAGG;YACW,wBAAwB;CA6BzC"}
|