extension-create 4.1.21 → 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.
@@ -1,6 +1,7 @@
1
1
  export type Channel = 'info' | 'success' | 'warn' | 'error' | 'debug';
2
2
  export declare function isDebug(): boolean;
3
3
  export declare function prefix(type: Channel): string;
4
+ export declare function hasChannelPrefix(text: string): boolean;
4
5
  export declare function isMachineOutput(): boolean;
5
6
  export declare function humanLine(...parts: unknown[]): void;
6
7
  export declare function humanWarn(...parts: unknown[]): void;
@@ -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
- return 'string' == typeof input ? input : JSON.stringify(input);
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()) await copyDirectoryWithSymlinks(sourcePath, destPath);
381
- else if (entry.isSymbolicLink()) try {
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 {
@@ -617,7 +639,7 @@ const NETWORK_TIMEOUT_MS = (()=>{
617
639
  return Number.isFinite(raw) && raw > 0 ? raw : 60000;
618
640
  })();
619
641
  const CODELOAD_BASE = 'https://codeload.github.com/extension-js/examples/zip';
620
- const DEFAULT_TEMPLATES_REF = '06d33e35894516a460409dca06d1614e291e6252';
642
+ const DEFAULT_TEMPLATES_REF = 'f8087f012cf195cba9aa2e3c32fd5a6729da33f0';
621
643
  const BUNDLED_TEMPLATES = [
622
644
  "javascript"
623
645
  ];
@@ -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 (isTypeScriptTemplate(scaffoldedTemplate)) await generateExtensionTypes(projectPath, projectName, logger);
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,4 +1,4 @@
1
- export declare const DEFAULT_TEMPLATES_REF = "06d33e35894516a460409dca06d1614e291e6252";
1
+ export declare const DEFAULT_TEMPLATES_REF = "f8087f012cf195cba9aa2e3c32fd5a6729da33f0";
2
2
  export declare const BUNDLED_TEMPLATES: readonly string[];
3
3
  export declare const DEFAULT_TEMPLATE_NAME = "typescript";
4
4
  export declare const OFFLINE_FALLBACK_TEMPLATE = "javascript";
@@ -1,6 +1,6 @@
1
1
  {
2
- "createdWith": "extension-create@4.1.20",
2
+ "createdWith": "extension-create@4.1.22",
3
3
  "template": "typescript",
4
- "source": "https://codeload.github.com/extension-js/examples/zip/06d33e35894516a460409dca06d1614e291e6252",
5
- "ref": "06d33e35894516a460409dca06d1614e291e6252"
4
+ "source": "https://codeload.github.com/extension-js/examples/zip/f8087f012cf195cba9aa2e3c32fd5a6729da33f0",
5
+ "ref": "f8087f012cf195cba9aa2e3c32fd5a6729da33f0"
6
6
  }
@@ -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-17
12
+ Last updated: 2026-09-18
13
13
 
14
14
  ## Listing
15
15
 
@@ -8,7 +8,7 @@
8
8
  "devDependencies": {
9
9
  "@types/chrome": "^0.0.287",
10
10
  "typescript": "7.0.2",
11
- "extension": "^4.1.20"
11
+ "extension": "^4.1.22"
12
12
  },
13
13
  "scripts": {
14
14
  "dev": "extension dev",
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "templates"
26
26
  ],
27
27
  "name": "extension-create",
28
- "version": "4.1.21",
28
+ "version": "4.1.23",
29
29
  "description": "The standalone extension creation engine for Extension.js",
30
30
  "author": {
31
31
  "name": "Cezar Augusto",