@thisismanta/semantic-version 1.0.0 → 1.0.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.
@@ -25,11 +25,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const fs = __importStar(require("fs/promises"));
27
27
  const fp = __importStar(require("path"));
28
+ const execa_1 = require("execa");
28
29
  main();
29
30
  async function main() {
30
- const huskyDirectoryPath = fp.resolve(process.cwd(), '.husky');
31
+ const currentDirectoryPath = process.cwd();
32
+ if (fp.basename(fp.dirname(currentDirectoryPath)) !== 'node_modules') {
33
+ console.log('Do nothing when running this on semantic-version repository.');
34
+ return;
35
+ }
36
+ console.log('Installing Husky');
37
+ await (0, execa_1.execaCommand)('npx husky install');
38
+ // Up 3 levels because of `node_modules/@thisismanta/semantic-version`
39
+ const huskyDirectoryPath = fp.resolve(currentDirectoryPath, '../../..', '.husky');
40
+ await fs.access(huskyDirectoryPath);
41
+ console.log('Found', huskyDirectoryPath);
31
42
  await upsert(fp.join(huskyDirectoryPath, 'commit-msg'), 'npx lint-commit-message ${1}');
32
43
  await upsert(fp.join(huskyDirectoryPath, 'post-commit'), 'npx auto-npm-version');
44
+ console.log('Done adding Git hooks.');
33
45
  }
34
46
  async function upsert(filePath, text) {
35
47
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisismanta/semantic-version",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "author": "Anantachai Saothong <thisismanta@gmail.com>",
5
5
  "license": "ISC",
6
6
  "engines": {
@@ -22,8 +22,7 @@
22
22
  "preversion": "npm run test && npm run build && git add lib/*",
23
23
  "version": "npm publish --access public",
24
24
  "postversion": "git push --tags origin master",
25
- "postinstall": "husky install && node ./lib/install-git-hooks.js",
26
- "prepare": "husky uninstall && rm -rf .husky"
25
+ "postinstall": "node ./lib/install-git-hooks.js"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@types/jest": "^29.4.0",