extension-create 3.18.4 → 3.18.5-canary.local-34c11c8f

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,4 +1 @@
1
- type PackageManagerName = 'pnpm' | 'yarn' | 'bun' | 'npm';
2
- export declare function detectPackageManagerFromEnv(): PackageManagerName;
3
- export declare function getPackageManagerSpecFromEnv(): string | null;
4
- export {};
1
+ export { detectPackageManagerFromEnv, getPackageManagerSpec as getPackageManagerSpecFromEnv } from 'prefers-yarn';
@@ -1,6 +1,6 @@
1
1
  export declare function copyDirectoryWithSymlinks(source: string, destination: string): Promise<void>;
2
2
  export declare function moveDirectoryContents(source: string, destination: string): Promise<void>;
3
- export declare function getInstallCommand(): Promise<"pnpm" | "yarn" | "bun" | "npm">;
3
+ export declare function getInstallCommand(): Promise<import("prefers-yarn").PackageManagerName>;
4
4
  export declare function isDirectoryWriteable(directory: string, projectName: string, logger: {
5
5
  log(...args: any[]): void;
6
6
  error(...args: any[]): void;
package/dist/module.cjs CHANGED
@@ -42,29 +42,7 @@ const external_path_namespaceObject = require("path");
42
42
  const external_fs_namespaceObject = require("fs");
43
43
  const external_pintor_namespaceObject = require("pintor");
44
44
  var external_pintor_default = /*#__PURE__*/ __webpack_require__.n(external_pintor_namespaceObject);
45
- const userAgentPattern = /(pnpm|yarn|bun|npm)\/([0-9]+\.[0-9]+\.[0-9]+[^ ]*)/i;
46
- function detectPackageManagerFromEnv() {
47
- const userAgent = (process.env.npm_config_user_agent || '').toLowerCase();
48
- if (userAgent.includes('pnpm')) return 'pnpm';
49
- if (userAgent.includes('yarn')) return 'yarn';
50
- if (userAgent.includes('bun')) return 'bun';
51
- if (userAgent.includes('npm')) return 'npm';
52
- const execPath = (process.env.npm_execpath || process.env.NPM_EXEC_PATH || process.env.BUN_INSTALL || '').toLowerCase();
53
- if (execPath.includes('pnpm')) return 'pnpm';
54
- if (execPath.includes('yarn')) return 'yarn';
55
- if (execPath.includes('bun')) return 'bun';
56
- execPath.includes('npm');
57
- return 'npm';
58
- }
59
- function getPackageManagerSpecFromEnv() {
60
- const userAgent = process.env.npm_config_user_agent || '';
61
- const match = userAgent.match(userAgentPattern);
62
- if (!match) return null;
63
- const name = match[1];
64
- const version = match[2];
65
- if (!name || !version) return null;
66
- return `${name}@${version}`;
67
- }
45
+ const external_prefers_yarn_namespaceObject = require("prefers-yarn");
68
46
  const statusPrefix = external_pintor_default().brightBlue('⏵⏵⏵');
69
47
  function destinationNotWriteable(workingDir) {
70
48
  const workingDirFolder = external_path_namespaceObject.basename(workingDir);
@@ -88,7 +66,7 @@ function noUrlAllowed() {
88
66
  }
89
67
  async function successfullInstall(projectPath, projectName, depsInstalled) {
90
68
  const relativePath = external_path_namespaceObject.relative(process.cwd(), projectPath);
91
- const pm = detectPackageManagerFromEnv();
69
+ const pm = (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
92
70
  let command = 'npm run';
93
71
  let installCmd = 'npm install';
94
72
  switch(pm){
@@ -262,7 +240,7 @@ async function moveDirectoryContents(source, destination) {
262
240
  });
263
241
  }
264
242
  async function getInstallCommand() {
265
- return detectPackageManagerFromEnv();
243
+ return (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
266
244
  }
267
245
  async function isDirectoryWriteable(directory, projectName, logger) {
268
246
  try {
@@ -495,7 +473,7 @@ async function overridePackageJson(projectPath, projectName, { template = "javas
495
473
  ...packageJson.devDependencies || {},
496
474
  extension: 'development' === process.env.EXTENSION_ENV ? '*' : resolveExtensionDevDependencyVersion(cliVersion)
497
475
  };
498
- const packageManagerSpec = packageJson.packageManager || getPackageManagerSpecFromEnv();
476
+ const packageManagerSpec = packageJson.packageManager || (0, external_prefers_yarn_namespaceObject.getPackageManagerSpec)();
499
477
  const packageMetadata = {
500
478
  ...packageJson,
501
479
  name: external_path_namespaceObject.basename(projectPath),
@@ -1046,7 +1024,7 @@ function resolveMissingOptionalDeps(developRoot, projectPath) {
1046
1024
  }
1047
1025
  async function installOptionalDependencies(developRoot, projectPath, plan, logger) {
1048
1026
  if (0 === plan.dependencies.length) return;
1049
- const pm = detectPackageManagerFromEnv();
1027
+ const pm = (0, external_prefers_yarn_namespaceObject.detectPackageManagerFromEnv)();
1050
1028
  const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1051
1029
  logger.log(foundSpecializedDependencies(plan.integrations.length));
1052
1030
  for (const [index, integration] of plan.integrations.entries()){
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "templates"
26
26
  ],
27
27
  "name": "extension-create",
28
- "version": "3.18.4",
28
+ "version": "3.18.5-canary.local-34c11c8f",
29
29
  "description": "The standalone extension creation engine for Extension.js",
30
30
  "author": {
31
31
  "name": "Cezar Augusto",
@@ -40,16 +40,6 @@
40
40
  "access": "public",
41
41
  "registry": "https://registry.npmjs.org"
42
42
  },
43
- "scripts": {
44
- "clean": "rm -rf dist",
45
- "watch": "rslib build --watch",
46
- "compile": "rslib build",
47
- "format": "biome format --write .",
48
- "lint": "biome lint .",
49
- "pretest:create": "pnpm compile",
50
- "test:create": "vitest run",
51
- "test:coverage": "vitest run --coverage"
52
- },
53
43
  "keywords": [
54
44
  "webextension",
55
45
  "browser-extension",
@@ -77,7 +67,8 @@
77
67
  "axios": "^1.16.0",
78
68
  "cross-spawn": "^7.0.6",
79
69
  "go-git-it": "^5.1.5",
80
- "pintor": "0.3.0"
70
+ "pintor": "0.3.0",
71
+ "prefers-yarn": "2.0.1"
81
72
  },
82
73
  "devDependencies": {
83
74
  "@biomejs/biome": "^2.2.4",
@@ -93,5 +84,15 @@
93
84
  "typescript": "6.0.2",
94
85
  "vitest": "^4.1.3",
95
86
  "webextension-polyfill": "^0.12.0"
87
+ },
88
+ "scripts": {
89
+ "clean": "rm -rf dist",
90
+ "watch": "rslib build --watch",
91
+ "compile": "rslib build",
92
+ "format": "biome format --write .",
93
+ "lint": "biome lint .",
94
+ "pretest:create": "pnpm compile",
95
+ "test:create": "vitest run",
96
+ "test:coverage": "vitest run --coverage"
96
97
  }
97
- }
98
+ }