bod 6.1.0 → 6.1.2

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/README.md CHANGED
@@ -67,6 +67,6 @@ Options:
67
67
 
68
68
  ## Contact
69
69
 
70
+ [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sabertazimi)
70
71
  [![Email](https://img.shields.io/badge/-Gmail-ea4335?style=for-the-badge&logo=gmail&logoColor=white)](mailto:sabertazimi@gmail.com)
71
72
  [![X](https://img.shields.io/badge/-X.com-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/sabertazimi)
72
- [![GitHub](https://img.shields.io/badge/-GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sabertazimi)
@@ -1,7 +1,11 @@
1
1
  import process from 'node:process';
2
- import { describe, expect, it, vi } from 'vitest';
2
+ import { afterEach, describe, expect, it, vi } from 'vitest';
3
3
  import { color, findPackageManager, program } from '../index.js';
4
4
  describe('utils', () => {
5
+ const originalUserAgent = process.env.npm_config_user_agent;
6
+ afterEach(() => {
7
+ process.env.npm_config_user_agent = originalUserAgent;
8
+ });
5
9
  it('should execute chalk correctly', () => {
6
10
  expect(color('raw text')).toStrictEqual('raw text');
7
11
  });
@@ -10,16 +14,15 @@ describe('utils', () => {
10
14
  expect(process.env.__BOD__).toStrictEqual('__BOD__');
11
15
  mockParse.mockRestore();
12
16
  });
13
- it('should return correct package manager', () => {
14
- process.env.npm_config_user_agent = 'pnpm/8.15.0';
15
- expect(findPackageManager()).toStrictEqual('pnpm');
16
- process.env.npm_config_user_agent = 'yarn/1.22.22';
17
- expect(findPackageManager()).toStrictEqual('yarn');
18
- process.env.npm_config_user_agent = 'yarn/4.2.0';
19
- expect(findPackageManager()).toStrictEqual('yarn');
20
- process.env.npm_config_user_agent = 'bun/0.1.0';
21
- expect(findPackageManager()).toStrictEqual('bun');
22
- process.env.npm_config_user_agent = 'npm/10.0.0';
23
- expect(findPackageManager()).toStrictEqual('npm');
17
+ it.each([
18
+ ['pnpm/8.15.0', 'pnpm'],
19
+ ['yarn/1.22.22', 'yarn'],
20
+ ['yarn/4.2.0', 'yarn'],
21
+ ['bun/0.1.0', 'bun'],
22
+ ['npm/10.0.0', 'npm'],
23
+ [undefined, 'npm'],
24
+ ])('should return %s for user agent %s', (userAgent, packageManager) => {
25
+ process.env.npm_config_user_agent = userAgent;
26
+ expect(findPackageManager()).toStrictEqual(packageManager);
24
27
  });
25
28
  });
@@ -2,14 +2,17 @@ import process from 'node:process';
2
2
  import { color, printer } from './console.js';
3
3
  import { program, select } from './core.js';
4
4
  import { envinfo, spawn } from './os.js';
5
+ const PNPM_USER_AGENT_RE = /pnpm/;
6
+ const YARN_USER_AGENT_RE = /yarn/;
7
+ const BUN_USER_AGENT_RE = /bun/;
5
8
  function findPackageManager() {
6
9
  var _a;
7
10
  const userAgent = (_a = process.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : '';
8
- const packageManager = /pnpm/.test(userAgent)
11
+ const packageManager = PNPM_USER_AGENT_RE.test(userAgent)
9
12
  ? 'pnpm'
10
- : /yarn/.test(userAgent)
13
+ : YARN_USER_AGENT_RE.test(userAgent)
11
14
  ? 'yarn'
12
- : /bun/.test(userAgent)
15
+ : BUN_USER_AGENT_RE.test(userAgent)
13
16
  ? 'bun'
14
17
  : 'npm';
15
18
  return packageManager;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bod",
3
3
  "type": "module",
4
- "version": "6.1.0",
4
+ "version": "6.1.2",
5
5
  "description": "Boilerplate CLI App",
6
6
  "author": "sabertazimi <sabertazimi@gmail.com>",
7
7
  "license": "MIT",
@@ -53,9 +53,9 @@
53
53
  "start": "pnpm dev"
54
54
  },
55
55
  "dependencies": {
56
- "@inquirer/prompts": "^8.1.0",
56
+ "@inquirer/prompts": "^8.4.2",
57
57
  "chalk": "^4.1.2",
58
- "commander": "^14.0.2",
58
+ "commander": "^14.0.3",
59
59
  "consola": "^3.4.2",
60
60
  "cross-spawn": "^7.0.6",
61
61
  "envinfo": "^7.21.0",
@@ -64,10 +64,10 @@
64
64
  "devDependencies": {
65
65
  "@types/cross-spawn": "^6.0.6",
66
66
  "@types/envinfo": "^7.8.4",
67
- "ci-info": "^4.3.1",
68
- "rimraf": "^6.1.2",
67
+ "ci-info": "^4.4.0",
68
+ "rimraf": "^6.1.3",
69
69
  "tsx": "^4.21.0",
70
- "type-fest": "^5.3.1"
70
+ "type-fest": "^5.6.0"
71
71
  },
72
- "gitHead": "6a7723d64ab1a869cec85bf8c9f11fdb1e200ec9"
72
+ "gitHead": "6025c645150d6f4e1e65c03698fefe66fc383517"
73
73
  }