@pob/root 9.4.0 → 9.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.4.2](https://github.com/christophehurpeau/pob/compare/@pob/root@9.4.1...@pob/root@9.4.2) (2024-05-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * improve bun support ([bab80e5](https://github.com/christophehurpeau/pob/commit/bab80e5257b753b7c28031b1e75681766edf4c5f))
12
+
13
+
14
+
15
+
16
+ ## [9.4.1](https://github.com/christophehurpeau/pob/compare/@pob/root@9.4.0...@pob/root@9.4.1) (2024-05-04)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * fix bun command to install ([5585fa3](https://github.com/christophehurpeau/pob/commit/5585fa3aa073a0194891677e4a33d7d71b96588b))
22
+
23
+
24
+
25
+
6
26
  ## [9.4.0](https://github.com/christophehurpeau/pob/compare/@pob/root@9.3.2...@pob/root@9.4.0) (2024-05-04)
7
27
 
8
28
 
@@ -28,7 +28,7 @@ if (!pm) {
28
28
  process.exit(1);
29
29
  }
30
30
 
31
- if (pm.name !== 'yarn' && pm.name !== 'npm') {
31
+ if (pm.name !== 'yarn' && pm.name !== 'npm' && pm.name !== 'bun') {
32
32
  console.error(
33
33
  `Package manager not supported: ${pm.name}. Please run with yarn or npm!`,
34
34
  );
@@ -67,7 +67,37 @@ export default function installHusky({ pkg, pm }) {
67
67
  fs.mkdirSync(path.resolve('.husky'));
68
68
  } catch {}
69
69
 
70
- const pmExec = pm.name === 'npm' ? 'npx --no-install' : pm.name;
70
+ const { lockfile, pmExec, installOnDiffCommand } = (() => {
71
+ if (pm.name === 'yarn') {
72
+ return {
73
+ lockfile: 'yarn.lock',
74
+ pmExec: 'yarn',
75
+ installOnDiffCommand: `yarn install ${
76
+ isYarnBerry
77
+ ? '--immutable'
78
+ : '--prefer-offline --pure-lockfile --ignore-optional'
79
+ }`,
80
+ };
81
+ }
82
+ if (pm.name === 'npm') {
83
+ return {
84
+ lockfile: 'package-lock.json',
85
+ pmExec: 'npx --no-install',
86
+ installOnDiffCommand: 'npm i',
87
+ };
88
+ }
89
+ if (pm.name === 'bun') {
90
+ return {
91
+ lockfile: 'bun.lockb',
92
+ pmExec: 'bun run',
93
+ installOnDiffCommand: 'bun i',
94
+ };
95
+ }
96
+
97
+ throw new Error(
98
+ `Package manager not supported: ${pm.name}. Please run with yarn, npm or bun !`,
99
+ );
100
+ })();
71
101
 
72
102
  writeHook('commit-msg', `${pmExec} commitlint --edit $1`);
73
103
  writeHook('pre-commit', `${pmExec} pob-root-lint-staged`);
@@ -77,19 +107,17 @@ export default function installHusky({ pkg, pm }) {
77
107
  ensureHookDeleted('post-merge');
78
108
  ensureHookDeleted('post-rewrite');
79
109
  } else {
80
- const runYarnInstallOnDiff = `
81
- if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- yarn.lock)" ]; then
82
- yarn install ${
83
- isYarnBerry
84
- ? '--immutable'
85
- : '--prefer-offline --pure-lockfile --ignore-optional'
86
- } || true
110
+ const runInstallOnDiff = (() => {
111
+ return `
112
+ if [ -n "$(git diff HEAD@{1}..HEAD@{0} -- ${lockfile})" ]; then
113
+ ${installOnDiffCommand} || true
87
114
  fi`;
115
+ })();
88
116
 
89
117
  // https://yarnpkg.com/features/zero-installs
90
- writeHook('post-checkout', runYarnInstallOnDiff);
91
- writeHook('post-merge', runYarnInstallOnDiff);
92
- writeHook('post-rewrite', runYarnInstallOnDiff);
118
+ writeHook('post-checkout', runInstallOnDiff);
119
+ writeHook('post-merge', runInstallOnDiff);
120
+ writeHook('post-rewrite', runInstallOnDiff);
93
121
  }
94
122
 
95
123
  const prePushHook = [];
@@ -112,7 +140,7 @@ fi`;
112
140
  }
113
141
  return 'test';
114
142
  };
115
- prePushHook.push(`${pm.name} ${getTestCommand()}`);
143
+ prePushHook.push(`${pmExec} ${getTestCommand()}`);
116
144
  }
117
145
 
118
146
  if (prePushHook.length > 0) {
@@ -26,7 +26,7 @@ const { lockfile, installAndDedupe } = (() => {
26
26
  if (pm.name === 'bun') {
27
27
  return {
28
28
  lockfile: 'bun.lockb',
29
- installAndDedupe: ['bun'],
29
+ installAndDedupe: ['bun i'],
30
30
  };
31
31
  }
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "9.4.0",
3
+ "version": "9.4.2",
4
4
  "description": "root package",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",