extension-create 4.0.21 → 4.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib/messages.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare function destinationNotWriteable(workingDir: string): string;
|
|
|
2
2
|
export declare function directoryHasConflicts(projectPath: string, conflictingFiles: string[]): Promise<string>;
|
|
3
3
|
export declare function noProjectName(): string;
|
|
4
4
|
export declare function noUrlAllowed(): string;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function scaffoldReady(projectPath: string, projectName: string, depsInstalled: boolean): Promise<string>;
|
|
6
6
|
export declare function startingNewExtension(projectName: string): string;
|
|
7
7
|
export declare function createDirectoryError(projectName: string, error: unknown): string;
|
|
8
8
|
export declare function writingTypeDefinitions(projectName: string): string;
|
package/dist/module.cjs
CHANGED
|
@@ -120,13 +120,13 @@ function resolveScaffoldPackageManager() {
|
|
|
120
120
|
}
|
|
121
121
|
function destinationNotWriteable(workingDir) {
|
|
122
122
|
const workingDirFolder = external_node_path_namespaceObject.basename(workingDir);
|
|
123
|
-
return `${prefix('error')} Couldn't write to the destination directory.\n${external_pintor_default().red('Choose a writable path, or update the folder permissions.')}
|
|
123
|
+
return `${prefix('error')} Couldn't write to the destination directory.\n${fmt.label('PATH')} ${fmt.val(workingDirFolder)}\n${external_pintor_default().red('Choose a writable path, or update the folder permissions.')}`;
|
|
124
124
|
}
|
|
125
125
|
async function directoryHasConflicts(projectPath, conflictingFiles) {
|
|
126
126
|
const projectName = external_node_path_namespaceObject.basename(projectPath);
|
|
127
|
-
let message = `${prefix('error')} ${external_pintor_default().blue(projectName)} already contains files that would be overwritten.\n${
|
|
127
|
+
let message = `${prefix('error')} ${external_pintor_default().blue(projectName)} already contains files that would be overwritten.\n${fmt.label('PATH')} ${fmt.val(projectPath)}\n`;
|
|
128
128
|
for (const file of conflictingFiles)message += ` ${external_pintor_default().yellow('-')} ${external_pintor_default().yellow(file)}\n`;
|
|
129
|
-
message +=
|
|
129
|
+
message += `${external_pintor_default().red('Remove or rename them, or choose a different directory name.')}`;
|
|
130
130
|
return message;
|
|
131
131
|
}
|
|
132
132
|
function noProjectName() {
|
|
@@ -135,7 +135,7 @@ function noProjectName() {
|
|
|
135
135
|
function noUrlAllowed() {
|
|
136
136
|
return `${prefix('error')} A URL is not a valid project path.\n${external_pintor_default().red('Pass a project name or a local directory path.')}`;
|
|
137
137
|
}
|
|
138
|
-
async function
|
|
138
|
+
async function scaffoldReady(projectPath, projectName, depsInstalled) {
|
|
139
139
|
const relativePath = external_node_path_namespaceObject.relative(process.cwd(), projectPath);
|
|
140
140
|
const pm = resolveScaffoldPackageManager();
|
|
141
141
|
let command = 'npm run dev';
|
|
@@ -166,87 +166,87 @@ async function successfullInstall(projectPath, projectName, depsInstalled) {
|
|
|
166
166
|
return `${prefix('success')} ${external_pintor_default().blue(projectName)} is ready.\n\nNext steps:\n` + steps;
|
|
167
167
|
}
|
|
168
168
|
function startingNewExtension(projectName) {
|
|
169
|
-
return `${prefix('info')}
|
|
169
|
+
return `${prefix('info')} Creating the extension ${external_pintor_default().blue(projectName)}…`;
|
|
170
170
|
}
|
|
171
171
|
function createDirectoryError(projectName, error) {
|
|
172
|
-
return `${prefix('error')} Couldn't create the directory ${external_pintor_default().blue(projectName)}.\n${external_pintor_default().red('Check the path and its permissions, then try again.')}
|
|
172
|
+
return `${prefix('error')} Couldn't create the directory ${external_pintor_default().blue(projectName)}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the path and its permissions, then try again.')}`;
|
|
173
173
|
}
|
|
174
174
|
function writingTypeDefinitions(projectName) {
|
|
175
175
|
return `${prefix('debug')} create types name=${projectName}`;
|
|
176
176
|
}
|
|
177
177
|
function writingTypeDefinitionsError(error) {
|
|
178
|
-
return `${prefix('error')} Couldn't write the extension type definitions.\n${external_pintor_default().red('Check the file permissions, then try again.')}
|
|
178
|
+
return `${prefix('error')} Couldn't write the extension type definitions.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the file permissions, then try again.')}`;
|
|
179
179
|
}
|
|
180
180
|
function installingFromTemplate(projectName, templateName) {
|
|
181
|
-
if ('init' === templateName || "javascript" === templateName) return `${prefix('info')}
|
|
182
|
-
return `${prefix('info')}
|
|
181
|
+
if ('init' === templateName || "javascript" === templateName) return `${prefix('info')} Copying the template files…`;
|
|
182
|
+
return `${prefix('info')} Copying the template ${external_pintor_default().blue(templateName)}…`;
|
|
183
183
|
}
|
|
184
184
|
function installingFromTemplateError(template, error) {
|
|
185
|
-
return `${prefix('error')} Couldn't find the template ${external_pintor_default().
|
|
185
|
+
return `${prefix('error')} Couldn't find the template ${external_pintor_default().blue(template)}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Choose a template name from')} ${external_pintor_default().blue('extension create --help')}${external_pintor_default().red(', or pass a GitHub URL.')}`;
|
|
186
186
|
}
|
|
187
187
|
function templateFetchTimedOut(templateName, ms) {
|
|
188
|
-
return `${prefix('error')}
|
|
188
|
+
return `${prefix('error')} Couldn't fetch the template ${external_pintor_default().blue(templateName)} within ${Math.round(ms / 1000)}s.\n${external_pintor_default().red('- Check your network connection.')}\n${external_pintor_default().red('- Set')} ${external_pintor_default().blue('EXTENSION_CREATE_TIMEOUT_MS')} ${external_pintor_default().red('to allow more time.')}`;
|
|
189
189
|
}
|
|
190
190
|
function templateNotFoundInCatalog(templateName, error) {
|
|
191
|
-
return `${prefix('error')} The template ${external_pintor_default().
|
|
191
|
+
return `${prefix('error')} The template ${external_pintor_default().blue(templateName)} is not in the extension-js/examples catalog.\n` + (error ? `${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n` : '') + `${external_pintor_default().red('- Run')} ${external_pintor_default().blue('extension create --help')} ${external_pintor_default().red('to list the valid template names.')}\n` + `${external_pintor_default().red('- Pass a GitHub URL to use a template from anywhere.')}`;
|
|
192
192
|
}
|
|
193
193
|
function templateDownloadFailed(templateName, error) {
|
|
194
|
-
return `${prefix('error')} Couldn't download the template ${external_pintor_default().
|
|
194
|
+
return `${prefix('error')} Couldn't download the template ${external_pintor_default().blue(templateName)} from ${fmt.val('github.com/extension-js/examples')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error?.message || error)))}\n${external_pintor_default().red('- Check your network connection and any GitHub rate limit, then try again.')}\n${external_pintor_default().red('- Set')} ${external_pintor_default().blue('EXTENSION_CREATE_TIMEOUT_MS')} ${external_pintor_default().red('to allow more time.')}`;
|
|
195
195
|
}
|
|
196
196
|
function initializingGitForRepository(projectName) {
|
|
197
197
|
return `${prefix('debug')} create git init name=${projectName}`;
|
|
198
198
|
}
|
|
199
199
|
function initializingGitSkipped(projectName, reason) {
|
|
200
|
-
return `${prefix('warn')}
|
|
200
|
+
return `${prefix('warn')} Skipping the git init for ${external_pintor_default().blue(projectName)}.\n${fmt.label('REASON')} ${fmt.val(reason)}\nRun ${external_pintor_default().blue('git init')} yourself if you want version control.`;
|
|
201
201
|
}
|
|
202
202
|
function installingDependencies() {
|
|
203
|
-
return `${prefix('info')}
|
|
203
|
+
return `${prefix('info')} Installing the dependencies…\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
204
204
|
}
|
|
205
205
|
function foundSpecializedDependencies(count) {
|
|
206
206
|
return `${prefix('debug')} create integrations count=${count}`;
|
|
207
207
|
}
|
|
208
208
|
function installingProjectIntegrations(integrations) {
|
|
209
|
-
if (0 === integrations.length) return `${prefix('info')}
|
|
209
|
+
if (0 === integrations.length) return `${prefix('info')} Installing the dependencies for the project tooling…\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
210
210
|
const formatList = (items)=>{
|
|
211
211
|
if (1 === items.length) return items[0];
|
|
212
212
|
if (2 === items.length) return `${items[0]} and ${items[1]}`;
|
|
213
213
|
return `${items.slice(0, -1).join(', ')}, and ${items[items.length - 1]}`;
|
|
214
214
|
};
|
|
215
|
-
const tools = formatList(integrations.map((name)=>external_pintor_default().
|
|
216
|
-
return `${prefix('info')}
|
|
215
|
+
const tools = formatList(integrations.map((name)=>external_pintor_default().blue(name)));
|
|
216
|
+
return `${prefix('info')} Installing the dependencies for ${tools}…\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
217
217
|
}
|
|
218
218
|
function installingDependenciesFailed(pmCommand, pmArgs, code) {
|
|
219
|
-
return `${prefix('error')} The command ${external_pintor_default().
|
|
219
|
+
return `${prefix('error')} The command ${external_pintor_default().blue(`${pmCommand} ${pmArgs.join(' ')}`)} failed with exit code ${String(code)}.\n${external_pintor_default().red('Run it yourself to see the full error.')}`;
|
|
220
220
|
}
|
|
221
221
|
function installingDependenciesProcessError(projectName, error) {
|
|
222
|
-
return `${prefix('error')} The install process for ${external_pintor_default().blue(projectName)} exited unexpectedly.\n${external_pintor_default().red('Run the install command yourself to see the full error.')}
|
|
222
|
+
return `${prefix('error')} The install process for ${external_pintor_default().blue(projectName)} exited unexpectedly.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Run the install command yourself to see the full error.')}`;
|
|
223
223
|
}
|
|
224
224
|
function cantInstallDependencies(projectName, error) {
|
|
225
|
-
return `${prefix('error')} Couldn't install the dependencies for ${external_pintor_default().blue(projectName)}.\n${external_pintor_default().red('Check your package manager settings, then try again.')}
|
|
225
|
+
return `${prefix('error')} Couldn't install the dependencies for ${external_pintor_default().blue(projectName)}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error?.message || error)))}\n${external_pintor_default().red('Check your package manager settings, then try again.')}`;
|
|
226
226
|
}
|
|
227
227
|
function writingPackageJsonMetadata() {
|
|
228
228
|
return `${prefix('debug')} create write file=package.json`;
|
|
229
229
|
}
|
|
230
230
|
function writingPackageJsonMetadataError(error) {
|
|
231
|
-
return `${prefix('error')} Couldn't write ${external_pintor_default().
|
|
231
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().blue('package.json')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the file permissions, then try again.')}`;
|
|
232
232
|
}
|
|
233
233
|
function writingDenoJsonc() {
|
|
234
234
|
return `${prefix('debug')} create write file=deno.jsonc`;
|
|
235
235
|
}
|
|
236
236
|
function writingDenoJsoncError(error) {
|
|
237
|
-
return `${prefix('error')} Couldn't write ${external_pintor_default().
|
|
237
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().blue('deno.jsonc')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the file permissions, then try again.')}`;
|
|
238
238
|
}
|
|
239
239
|
function writingTemplateProvenance() {
|
|
240
240
|
return `${prefix('debug')} create write file=.extension-create.json`;
|
|
241
241
|
}
|
|
242
242
|
function writingTemplateProvenanceError(error) {
|
|
243
|
-
return `${prefix('warn')} Couldn't write ${external_pintor_default().
|
|
243
|
+
return `${prefix('warn')} Couldn't write ${external_pintor_default().blue('.extension-create.json')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\nThe project is fine. Only the template provenance record is missing.`;
|
|
244
244
|
}
|
|
245
245
|
function writingManifestJsonMetadata() {
|
|
246
246
|
return `${prefix('debug')} create write file=manifest.json`;
|
|
247
247
|
}
|
|
248
248
|
function writingManifestJsonMetadataError(error) {
|
|
249
|
-
return `${prefix('error')} Couldn't write ${external_pintor_default().
|
|
249
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().blue('manifest.json')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the file permissions, then try again.')}`;
|
|
250
250
|
}
|
|
251
251
|
function writingReadmeMetaData() {
|
|
252
252
|
return `${prefix('debug')} create write file=README.md`;
|
|
@@ -255,13 +255,13 @@ function writingGitIgnore() {
|
|
|
255
255
|
return `${prefix('debug')} create write file=.gitignore`;
|
|
256
256
|
}
|
|
257
257
|
function writingReadmeMetaDataError(error) {
|
|
258
|
-
return `${prefix('error')} Couldn't write ${external_pintor_default().
|
|
258
|
+
return `${prefix('error')} Couldn't write ${external_pintor_default().blue('README.md')}.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the file permissions, then try again.')}`;
|
|
259
259
|
}
|
|
260
260
|
function writingDirectoryError(error) {
|
|
261
|
-
return `${prefix('error')} Couldn't check whether the directory is writable.\n${external_pintor_default().red('Check the path and its permissions, then try again.')}
|
|
261
|
+
return `${prefix('error')} Couldn't check whether the directory is writable.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('Check the path and its permissions, then try again.')}`;
|
|
262
262
|
}
|
|
263
263
|
function cantSetupBuiltInTests(error) {
|
|
264
|
-
return `${prefix('error')} Couldn't set up the built-in tests.\n${external_pintor_default().red('The extension itself is fine. Re-run create, or skip the tests.')}
|
|
264
|
+
return `${prefix('error')} Couldn't set up the built-in tests.\n${fmt.label('REASON')} ${fmt.val(fmt.truncate(String(error)))}\n${external_pintor_default().red('The extension itself is fine. Re-run')} ${external_pintor_default().blue('extension create')}${external_pintor_default().red(', or skip the tests.')}`;
|
|
265
265
|
}
|
|
266
266
|
const promises_namespaceObject = require("node:fs/promises");
|
|
267
267
|
async function copyDirectoryWithSymlinks(source, destination) {
|
|
@@ -1632,8 +1632,8 @@ async function extensionCreate(projectNameInput, { cliVersion, template = "javas
|
|
|
1632
1632
|
await writeGitignore(projectPath, logger);
|
|
1633
1633
|
await setupBuiltInTests(projectPath, logger);
|
|
1634
1634
|
if (isTypeScriptTemplate(template)) await generateExtensionTypes(projectPath, projectName, logger);
|
|
1635
|
-
const
|
|
1636
|
-
logger.log(
|
|
1635
|
+
const readyMessage = await scaffoldReady(projectPath, projectName, Boolean(install));
|
|
1636
|
+
logger.log(readyMessage);
|
|
1637
1637
|
return {
|
|
1638
1638
|
projectPath,
|
|
1639
1639
|
projectName,
|