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 +1 -1
- package/dist/src/utils/__tests__/index.test.js +15 -12
- package/dist/src/utils/index.js +6 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -67,6 +67,6 @@ Options:
|
|
|
67
67
|
|
|
68
68
|
## Contact
|
|
69
69
|
|
|
70
|
+
[](https://github.com/sabertazimi)
|
|
70
71
|
[](mailto:sabertazimi@gmail.com)
|
|
71
72
|
[](https://x.com/sabertazimi)
|
|
72
|
-
[](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(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
});
|
package/dist/src/utils/index.js
CHANGED
|
@@ -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 =
|
|
11
|
+
const packageManager = PNPM_USER_AGENT_RE.test(userAgent)
|
|
9
12
|
? 'pnpm'
|
|
10
|
-
:
|
|
13
|
+
: YARN_USER_AGENT_RE.test(userAgent)
|
|
11
14
|
? 'yarn'
|
|
12
|
-
:
|
|
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.
|
|
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.
|
|
56
|
+
"@inquirer/prompts": "^8.4.2",
|
|
57
57
|
"chalk": "^4.1.2",
|
|
58
|
-
"commander": "^14.0.
|
|
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.
|
|
68
|
-
"rimraf": "^6.1.
|
|
67
|
+
"ci-info": "^4.4.0",
|
|
68
|
+
"rimraf": "^6.1.3",
|
|
69
69
|
"tsx": "^4.21.0",
|
|
70
|
-
"type-fest": "^5.
|
|
70
|
+
"type-fest": "^5.6.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6025c645150d6f4e1e65c03698fefe66fc383517"
|
|
73
73
|
}
|