extension-create 4.1.22 → 4.1.23
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/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const NEVER_SCAFFOLDED_DIRS: string[];
|
|
1
2
|
export declare function copyDirectoryWithSymlinks(source: string, destination: string): Promise<void>;
|
|
2
3
|
export declare function moveDirectoryContents(source: string, destination: string): Promise<void>;
|
|
3
4
|
export declare function getInstallCommand(): Promise<"bun" | "npm" | "pnpm" | "yarn">;
|
|
@@ -6,3 +7,4 @@ export declare function isDirectoryWriteable(directory: string, logger: {
|
|
|
6
7
|
error(...args: unknown[]): void;
|
|
7
8
|
}): Promise<boolean>;
|
|
8
9
|
export declare function isTypeScriptTemplate(templateName: string): boolean;
|
|
10
|
+
export declare function scaffoldNeedsTypeDefinitions(projectPath: string, templateName: string): Promise<boolean>;
|
package/dist/module.cjs
CHANGED
|
@@ -69,6 +69,10 @@ function prefix(type) {
|
|
|
69
69
|
if ('debug' === type) return external_pintor_default().dim(external_pintor_default().gray(DEBUG_GLYPH));
|
|
70
70
|
return external_pintor_default().gray(GLYPH);
|
|
71
71
|
}
|
|
72
|
+
const ANSI_PATTERN = /\[[0-9;]*m/g;
|
|
73
|
+
function hasChannelPrefix(text) {
|
|
74
|
+
return String(text || '').replace(ANSI_PATTERN, '').trimStart().startsWith(GLYPH);
|
|
75
|
+
}
|
|
72
76
|
new Set([
|
|
73
77
|
'json',
|
|
74
78
|
'ndjson'
|
|
@@ -87,7 +91,8 @@ const fmt = {
|
|
|
87
91
|
truncate (input, max = 800) {
|
|
88
92
|
const s = (()=>{
|
|
89
93
|
try {
|
|
90
|
-
|
|
94
|
+
if ('string' == typeof input) return input;
|
|
95
|
+
return JSON.stringify(input) ?? String(input);
|
|
91
96
|
} catch {
|
|
92
97
|
return String(input);
|
|
93
98
|
}
|
|
@@ -367,6 +372,11 @@ function isUrlProjectName(projectNameInput) {
|
|
|
367
372
|
return /^https?:\/\//i.test(projectNameInput.trim());
|
|
368
373
|
}
|
|
369
374
|
const promises_namespaceObject = require("node:fs/promises");
|
|
375
|
+
const NEVER_SCAFFOLDED_DIRS = [
|
|
376
|
+
'dist',
|
|
377
|
+
'node_modules',
|
|
378
|
+
'.extension-js'
|
|
379
|
+
];
|
|
370
380
|
async function copyDirectoryWithSymlinks(source, destination) {
|
|
371
381
|
const entries = await promises_namespaceObject.readdir(source, {
|
|
372
382
|
withFileTypes: true
|
|
@@ -377,8 +387,10 @@ async function copyDirectoryWithSymlinks(source, destination) {
|
|
|
377
387
|
for (const entry of entries){
|
|
378
388
|
const sourcePath = external_node_path_namespaceObject.join(source, entry.name);
|
|
379
389
|
const destPath = external_node_path_namespaceObject.join(destination, entry.name);
|
|
380
|
-
if (entry.isDirectory())
|
|
381
|
-
|
|
390
|
+
if (entry.isDirectory()) {
|
|
391
|
+
if (NEVER_SCAFFOLDED_DIRS.includes(entry.name)) continue;
|
|
392
|
+
await copyDirectoryWithSymlinks(sourcePath, destPath);
|
|
393
|
+
} else if (entry.isSymbolicLink()) try {
|
|
382
394
|
const target = await promises_namespaceObject.readlink(sourcePath);
|
|
383
395
|
await promises_namespaceObject.symlink(target, destPath);
|
|
384
396
|
} catch (caught) {
|
|
@@ -450,6 +462,15 @@ async function isDirectoryWriteable(directory, logger) {
|
|
|
450
462
|
function isTypeScriptTemplate(templateName) {
|
|
451
463
|
return templateName.includes("typescript") || templateName.includes('react') || templateName.includes('preact') || templateName.includes('svelte') || templateName.includes('solid');
|
|
452
464
|
}
|
|
465
|
+
async function scaffoldNeedsTypeDefinitions(projectPath, templateName) {
|
|
466
|
+
if (isTypeScriptTemplate(templateName)) return true;
|
|
467
|
+
try {
|
|
468
|
+
await promises_namespaceObject.access(external_node_path_namespaceObject.join(projectPath, 'tsconfig.json'));
|
|
469
|
+
return true;
|
|
470
|
+
} catch {
|
|
471
|
+
return false;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
453
474
|
const allowlist = [
|
|
454
475
|
'LICENSE',
|
|
455
476
|
'node_modules'
|
|
@@ -477,6 +498,7 @@ async function createDirectory(projectPath, projectName, logger) {
|
|
|
477
498
|
}
|
|
478
499
|
for (const hidden of HIDDEN_FILES_TEMPLATES_SHIP)if (currentDir.includes(hidden)) logger.log(keepingExistingGitignore(projectName));
|
|
479
500
|
} catch (error) {
|
|
501
|
+
if (hasChannelPrefix(String(error?.message ?? error))) throw error;
|
|
480
502
|
throw new Error(createDirectoryError(projectName, error));
|
|
481
503
|
}
|
|
482
504
|
return {
|
|
@@ -2204,7 +2226,7 @@ async function extensionCreate(projectNameInput, { cliVersion, template, install
|
|
|
2204
2226
|
await writeStoreMetadata(projectPath, projectName, templateManifestName, logger);
|
|
2205
2227
|
await writeGitignore(projectPath, logger);
|
|
2206
2228
|
await setupBuiltInTests(projectPath, logger);
|
|
2207
|
-
if (
|
|
2229
|
+
if (await scaffoldNeedsTypeDefinitions(projectPath, scaffoldedTemplate)) await generateExtensionTypes(projectPath, projectName, logger);
|
|
2208
2230
|
await initializeGitRepository(projectPath, projectName, templateProvenance?.template, logger);
|
|
2209
2231
|
const readyMessage = await scaffoldReady(projectPath, projectName, Boolean(install), packageManager);
|
|
2210
2232
|
logger.log(readyMessage);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"createdWith": "extension-create@4.1.
|
|
2
|
+
"createdWith": "extension-create@4.1.22",
|
|
3
3
|
"template": "typescript",
|
|
4
4
|
"source": "https://codeload.github.com/extension-js/examples/zip/f8087f012cf195cba9aa2e3c32fd5a6729da33f0",
|
|
5
5
|
"ref": "f8087f012cf195cba9aa2e3c32fd5a6729da33f0"
|
|
@@ -9,7 +9,7 @@ Packaging your extension is local and free. Submitting the result to a
|
|
|
9
9
|
store is what [extension.dev](https://docs.extension.dev/publish/overview?utm_source=store-md)
|
|
10
10
|
does, and it sponsors Extension.js.
|
|
11
11
|
|
|
12
|
-
Last updated: 2026-09-
|
|
12
|
+
Last updated: 2026-09-18
|
|
13
13
|
|
|
14
14
|
## Listing
|
|
15
15
|
|