extension-create 4.0.18 → 4.0.19
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 +7 -7
- package/dist/module.cjs +23 -23
- package/dist/steps/setup-built-in-tests.d.ts +1 -1
- package/dist/steps/write-deno-jsonc.d.ts +1 -1
- package/dist/steps/write-manifest-json.d.ts +1 -1
- package/dist/steps/write-package-json.d.ts +1 -1
- package/dist/test-template-javascript/.extension-create.json +1 -1
- package/dist/test-template-javascript/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/messages.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function createDirectoryError(projectName: string, error: unknown
|
|
|
8
8
|
export declare function writingTypeDefinitions(projectName: string): string;
|
|
9
9
|
export declare function writingTypeDefinitionsError(error: unknown): string;
|
|
10
10
|
export declare function installingFromTemplate(projectName: string, templateName: string): string;
|
|
11
|
-
export declare function installingFromTemplateError(
|
|
11
|
+
export declare function installingFromTemplateError(template: string, error: unknown): string;
|
|
12
12
|
export declare function templateFetchTimedOut(templateName: string, ms: number): string;
|
|
13
13
|
export declare function templateNotFoundInCatalog(templateName: string, error?: unknown): string;
|
|
14
14
|
export declare function templateDownloadFailed(templateName: string, error: unknown): string;
|
|
@@ -17,19 +17,19 @@ export declare function initializingGitSkipped(projectName: string, reason: stri
|
|
|
17
17
|
export declare function installingDependencies(): string;
|
|
18
18
|
export declare function foundSpecializedDependencies(count: number): string;
|
|
19
19
|
export declare function installingProjectIntegrations(integrations: string[]): string;
|
|
20
|
-
export declare function installingDependenciesFailed(
|
|
20
|
+
export declare function installingDependenciesFailed(pmCommand: string, pmArgs: string[], code: number | null): string;
|
|
21
21
|
export declare function installingDependenciesProcessError(projectName: string, error: unknown): string;
|
|
22
22
|
export declare function cantInstallDependencies(projectName: string, error: unknown): string;
|
|
23
23
|
export declare function writingPackageJsonMetadata(): string;
|
|
24
|
-
export declare function writingPackageJsonMetadataError(
|
|
24
|
+
export declare function writingPackageJsonMetadataError(error: unknown): string;
|
|
25
25
|
export declare function writingDenoJsonc(): string;
|
|
26
|
-
export declare function writingDenoJsoncError(
|
|
26
|
+
export declare function writingDenoJsoncError(error: unknown): string;
|
|
27
27
|
export declare function writingTemplateProvenance(): string;
|
|
28
28
|
export declare function writingTemplateProvenanceError(error: unknown): string;
|
|
29
29
|
export declare function writingManifestJsonMetadata(): string;
|
|
30
|
-
export declare function writingManifestJsonMetadataError(
|
|
30
|
+
export declare function writingManifestJsonMetadataError(error: unknown): string;
|
|
31
31
|
export declare function writingReadmeMetaData(): string;
|
|
32
32
|
export declare function writingGitIgnore(): string;
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function writingReadmeMetaDataError(error: unknown): string;
|
|
34
34
|
export declare function writingDirectoryError(error: unknown): string;
|
|
35
|
-
export declare function cantSetupBuiltInTests(
|
|
35
|
+
export declare function cantSetupBuiltInTests(error: unknown): string;
|
package/dist/module.cjs
CHANGED
|
@@ -181,7 +181,7 @@ function installingFromTemplate(projectName, templateName) {
|
|
|
181
181
|
if ('init' === templateName || "javascript" === templateName) return `${prefix('info')} Install ${external_pintor_default().blue(projectName)}.`;
|
|
182
182
|
return `${prefix('info')} Install ${external_pintor_default().blue(projectName)} from the template ${external_pintor_default().yellow(templateName)}.`;
|
|
183
183
|
}
|
|
184
|
-
function installingFromTemplateError(
|
|
184
|
+
function installingFromTemplateError(template, error) {
|
|
185
185
|
return `${prefix('error')} Couldn't find the template ${external_pintor_default().yellow(template)}.\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.')}\n${external_pintor_default().red(String(error))}`;
|
|
186
186
|
}
|
|
187
187
|
function templateFetchTimedOut(templateName, ms) {
|
|
@@ -215,8 +215,8 @@ function installingProjectIntegrations(integrations) {
|
|
|
215
215
|
const tools = formatList(integrations.map((name)=>external_pintor_default().yellow(name)));
|
|
216
216
|
return `${prefix('info')} Install the dependencies for ${tools}.\n${external_pintor_default().gray('This can take a moment.')}`;
|
|
217
217
|
}
|
|
218
|
-
function installingDependenciesFailed(
|
|
219
|
-
return `${prefix('error')} The command ${external_pintor_default().yellow(
|
|
218
|
+
function installingDependenciesFailed(pmCommand, pmArgs, code) {
|
|
219
|
+
return `${prefix('error')} The command ${external_pintor_default().yellow(pmCommand)} ${external_pintor_default().yellow(pmArgs.join(' '))} failed with exit code ${external_pintor_default().yellow(String(code))}.\n${external_pintor_default().red('Run it yourself to see the full error.')}`;
|
|
220
220
|
}
|
|
221
221
|
function installingDependenciesProcessError(projectName, error) {
|
|
222
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.')}\n${external_pintor_default().red(String(error))}`;
|
|
@@ -227,13 +227,13 @@ function cantInstallDependencies(projectName, error) {
|
|
|
227
227
|
function writingPackageJsonMetadata() {
|
|
228
228
|
return `${prefix('debug')} create write file=package.json`;
|
|
229
229
|
}
|
|
230
|
-
function writingPackageJsonMetadataError(
|
|
230
|
+
function writingPackageJsonMetadataError(error) {
|
|
231
231
|
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('package.json')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
232
232
|
}
|
|
233
233
|
function writingDenoJsonc() {
|
|
234
234
|
return `${prefix('debug')} create write file=deno.jsonc`;
|
|
235
235
|
}
|
|
236
|
-
function writingDenoJsoncError(
|
|
236
|
+
function writingDenoJsoncError(error) {
|
|
237
237
|
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('deno.jsonc')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
238
238
|
}
|
|
239
239
|
function writingTemplateProvenance() {
|
|
@@ -245,7 +245,7 @@ function writingTemplateProvenanceError(error) {
|
|
|
245
245
|
function writingManifestJsonMetadata() {
|
|
246
246
|
return `${prefix('debug')} create write file=manifest.json`;
|
|
247
247
|
}
|
|
248
|
-
function writingManifestJsonMetadataError(
|
|
248
|
+
function writingManifestJsonMetadataError(error) {
|
|
249
249
|
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('manifest.json')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
250
250
|
}
|
|
251
251
|
function writingReadmeMetaData() {
|
|
@@ -254,13 +254,13 @@ function writingReadmeMetaData() {
|
|
|
254
254
|
function writingGitIgnore() {
|
|
255
255
|
return `${prefix('debug')} create write file=.gitignore`;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function writingReadmeMetaDataError(error) {
|
|
258
258
|
return `${prefix('error')} Couldn't write ${external_pintor_default().yellow('README.md')}.\n${external_pintor_default().red('Check the file permissions, then try again.')}\n${external_pintor_default().red(String(error))}`;
|
|
259
259
|
}
|
|
260
260
|
function writingDirectoryError(error) {
|
|
261
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.')}\n${external_pintor_default().red(String(error))}`;
|
|
262
262
|
}
|
|
263
|
-
function cantSetupBuiltInTests(
|
|
263
|
+
function cantSetupBuiltInTests(error) {
|
|
264
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.')}\n${external_pintor_default().red(String(error))}`;
|
|
265
265
|
}
|
|
266
266
|
const promises_namespaceObject = require("node:fs/promises");
|
|
@@ -674,7 +674,7 @@ async function importExternalTemplate(projectPath, projectName, template, logger
|
|
|
674
674
|
} catch (error) {
|
|
675
675
|
if (error instanceof TemplateNotFoundError) logger.error(templateNotFoundInCatalog(templateName, error.cause));
|
|
676
676
|
else if (error instanceof TemplateDownloadError) logger.error(templateDownloadFailed(templateName, error));
|
|
677
|
-
else logger.error(installingFromTemplateError(
|
|
677
|
+
else logger.error(installingFromTemplateError(templateName, error));
|
|
678
678
|
await promises_namespaceObject.rm(projectPath, {
|
|
679
679
|
recursive: true,
|
|
680
680
|
force: true
|
|
@@ -1165,12 +1165,12 @@ async function installInternalDependencies(projectPath, logger) {
|
|
|
1165
1165
|
const optionalPlan = resolveMissingOptionalDeps(developRoot, projectPath);
|
|
1166
1166
|
if (optionalPlan.dependencies.length > 0) await installOptionalDependencies(developRoot, projectPath, optionalPlan, logger);
|
|
1167
1167
|
}
|
|
1168
|
-
async function setupBuiltInTests(projectPath,
|
|
1168
|
+
async function setupBuiltInTests(projectPath, logger) {
|
|
1169
1169
|
try {
|
|
1170
1170
|
const testSpecPath = external_node_path_namespaceObject.join(projectPath, 'tests', 'templates.spec.ts');
|
|
1171
1171
|
if (external_node_fs_namespaceObject.existsSync(testSpecPath)) external_node_fs_namespaceObject.unlinkSync(testSpecPath);
|
|
1172
1172
|
} catch (error) {
|
|
1173
|
-
logger.error(cantSetupBuiltInTests(
|
|
1173
|
+
logger.error(cantSetupBuiltInTests(error));
|
|
1174
1174
|
throw error;
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
@@ -1242,7 +1242,7 @@ function resolveExtensionDevDependencyVersion(cliVersion) {
|
|
|
1242
1242
|
if (!resolved) return 'latest';
|
|
1243
1243
|
return resolved.includes('-') ? resolved : `^${resolved}`;
|
|
1244
1244
|
}
|
|
1245
|
-
async function overridePackageJson(projectPath,
|
|
1245
|
+
async function overridePackageJson(projectPath, { template = "javascript", cliVersion }, logger) {
|
|
1246
1246
|
const extensionBinary = await resolveExtensionBinary();
|
|
1247
1247
|
const candidatePath = external_node_path_namespaceObject.join(projectPath, 'package.json');
|
|
1248
1248
|
let packageJson = {};
|
|
@@ -1319,7 +1319,7 @@ async function overridePackageJson(projectPath, projectName, { template = "javas
|
|
|
1319
1319
|
if (isDebug()) logger.log(writingPackageJsonMetadata());
|
|
1320
1320
|
await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, 'package.json'), `${JSON.stringify(packageMetadata, null, 2)}\n`);
|
|
1321
1321
|
} catch (error) {
|
|
1322
|
-
logger.error(writingPackageJsonMetadataError(
|
|
1322
|
+
logger.error(writingPackageJsonMetadataError(error));
|
|
1323
1323
|
throw error;
|
|
1324
1324
|
}
|
|
1325
1325
|
}
|
|
@@ -1363,7 +1363,7 @@ async function collectTemplateImports(projectPath, cliVersion) {
|
|
|
1363
1363
|
imports.extension = `npm:extension@${extensionVersion}`;
|
|
1364
1364
|
return imports;
|
|
1365
1365
|
}
|
|
1366
|
-
async function writeDenoJsonc(projectPath,
|
|
1366
|
+
async function writeDenoJsonc(projectPath, { template = "javascript", cliVersion, primary = false }, logger) {
|
|
1367
1367
|
if (!isDenoRuntime()) return;
|
|
1368
1368
|
for (const existing of [
|
|
1369
1369
|
'deno.jsonc',
|
|
@@ -1379,7 +1379,7 @@ async function writeDenoJsonc(projectPath, projectName, { template = "javascript
|
|
|
1379
1379
|
force: true
|
|
1380
1380
|
});
|
|
1381
1381
|
} catch (error) {
|
|
1382
|
-
logger.error(writingDenoJsoncError(
|
|
1382
|
+
logger.error(writingDenoJsoncError(error));
|
|
1383
1383
|
throw error;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
@@ -1500,7 +1500,7 @@ async function findManifestJsonPath(projectPath) {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
throw new Error(`Could not locate manifest.json under ${projectPath}. Checked common paths and searched up to depth ${manifestSearchMaxDepth}.`);
|
|
1502
1502
|
}
|
|
1503
|
-
async function writeManifestJson(projectPath,
|
|
1503
|
+
async function writeManifestJson(projectPath, logger) {
|
|
1504
1504
|
const manifestJsonPath = await findManifestJsonPath(projectPath);
|
|
1505
1505
|
const manifestJsonContent = await promises_namespaceObject.readFile(manifestJsonPath);
|
|
1506
1506
|
const manifestJson = JSON.parse(manifestJsonContent.toString());
|
|
@@ -1513,7 +1513,7 @@ async function writeManifestJson(projectPath, projectName, logger) {
|
|
|
1513
1513
|
if (isDebug()) logger.log(writingManifestJsonMetadata());
|
|
1514
1514
|
await promises_namespaceObject.writeFile(manifestJsonPath, JSON.stringify(manifestMetadata, null, 2));
|
|
1515
1515
|
} catch (error) {
|
|
1516
|
-
logger.error(writingManifestJsonMetadataError(
|
|
1516
|
+
logger.error(writingManifestJsonMetadataError(error));
|
|
1517
1517
|
throw error;
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
@@ -1545,7 +1545,7 @@ async function writeReadmeFile(projectPath, projectName, logger) {
|
|
|
1545
1545
|
});
|
|
1546
1546
|
await promises_namespaceObject.writeFile(external_node_path_namespaceObject.join(projectPath, 'README.md'), readme);
|
|
1547
1547
|
} catch (error) {
|
|
1548
|
-
logger.error(
|
|
1548
|
+
logger.error(writingReadmeMetaDataError(error));
|
|
1549
1549
|
throw error;
|
|
1550
1550
|
}
|
|
1551
1551
|
}
|
|
@@ -1607,17 +1607,17 @@ async function extensionCreate(projectNameInput, { cliVersion, template = "javas
|
|
|
1607
1607
|
await createDirectory(projectPath, projectName, logger);
|
|
1608
1608
|
const templateProvenance = await importExternalTemplate(projectPath, projectName, template, logger);
|
|
1609
1609
|
const isMonorepoTemplate = String(template).toLowerCase().includes('monorepo');
|
|
1610
|
-
if (isDenoRuntime() && !isMonorepoTemplate) await writeDenoJsonc(projectPath,
|
|
1610
|
+
if (isDenoRuntime() && !isMonorepoTemplate) await writeDenoJsonc(projectPath, {
|
|
1611
1611
|
template,
|
|
1612
1612
|
cliVersion,
|
|
1613
1613
|
primary: true
|
|
1614
1614
|
}, logger);
|
|
1615
1615
|
else {
|
|
1616
|
-
await overridePackageJson(projectPath,
|
|
1616
|
+
await overridePackageJson(projectPath, {
|
|
1617
1617
|
template,
|
|
1618
1618
|
cliVersion
|
|
1619
1619
|
}, logger);
|
|
1620
|
-
await writeDenoJsonc(projectPath,
|
|
1620
|
+
await writeDenoJsonc(projectPath, {
|
|
1621
1621
|
template
|
|
1622
1622
|
}, logger);
|
|
1623
1623
|
}
|
|
@@ -1627,10 +1627,10 @@ async function extensionCreate(projectNameInput, { cliVersion, template = "javas
|
|
|
1627
1627
|
await installInternalDependencies(projectPath, logger);
|
|
1628
1628
|
}
|
|
1629
1629
|
await writeReadmeFile(projectPath, projectName, logger);
|
|
1630
|
-
await writeManifestJson(projectPath,
|
|
1630
|
+
await writeManifestJson(projectPath, logger);
|
|
1631
1631
|
await initializeGitRepository(projectPath, projectName, logger);
|
|
1632
1632
|
await writeGitignore(projectPath, logger);
|
|
1633
|
-
await setupBuiltInTests(projectPath,
|
|
1633
|
+
await setupBuiltInTests(projectPath, logger);
|
|
1634
1634
|
if (isTypeScriptTemplate(template)) await generateExtensionTypes(projectPath, projectName, logger);
|
|
1635
1635
|
const successfulInstall = await successfullInstall(projectPath, projectName, Boolean(install));
|
|
1636
1636
|
logger.log(successfulInstall);
|
|
@@ -3,7 +3,7 @@ interface WriteDenoJsoncOptions {
|
|
|
3
3
|
cliVersion?: string;
|
|
4
4
|
primary?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare function writeDenoJsonc(projectPath: string,
|
|
6
|
+
export declare function writeDenoJsonc(projectPath: string, { template, cliVersion, primary }: WriteDenoJsoncOptions, logger: {
|
|
7
7
|
log(...args: unknown[]): void;
|
|
8
8
|
error(...args: unknown[]): void;
|
|
9
9
|
}): Promise<void>;
|
|
@@ -6,7 +6,7 @@ interface OverridePackageJsonOptions {
|
|
|
6
6
|
cliVersion?: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function resolveExtensionDevDependencyVersion(cliVersion?: string): string;
|
|
9
|
-
export declare function overridePackageJson(projectPath: string,
|
|
9
|
+
export declare function overridePackageJson(projectPath: string, { template, cliVersion }: OverridePackageJsonOptions, logger: {
|
|
10
10
|
log(...args: unknown[]): void;
|
|
11
11
|
error(...args: unknown[]): void;
|
|
12
12
|
}): Promise<void>;
|