@dk/hipp 0.1.27 → 0.1.29

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.
Files changed (3) hide show
  1. package/README.md +8 -7
  2. package/hipp.js +27 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -110,7 +110,8 @@ npx @dk/hipp -- --access public --tag beta
110
110
  HIPP provides out-of-band verification to prove package integrity:
111
111
 
112
112
  ```bash
113
- npx @dk/hipp verify # verifies latest @dk/hipp
113
+ npx @dk/hipp verify # auto-detect: local hipp repo → published version, else @dk/hipp
114
+ npx @dk/hipp verify --self # always verifies @dk/hipp itself
114
115
  npx @dk/hipp verify @scope/package # verifies latest of a package
115
116
  npx @dk/hipp verify @scope/package@1.0.0 # verifies specific version
116
117
  ```
@@ -240,20 +241,20 @@ PERFORMANCE OF THIS SOFTWARE.
240
241
  Verify this package with [@dk/hipp](https://www.npmjs.com/package/@dk/hipp):
241
242
 
242
243
  ```bash
243
- npx @dk/hipp verify @dk/hipp@0.1.27
244
+ npx @dk/hipp verify @dk/hipp@0.1.29
244
245
  ```
245
246
 
246
247
  ```json
247
248
  {
248
249
  "origin": "git@github.com:dmytri/hipp.git",
249
- "tag": "v0.1.27",
250
- "revision": "528a1ce0c415b335f118ec006e50b464c75efd9a",
251
- "hash": "8738b992f6546c2aa6509c43aa95dc4a8206582d2cc511e8b30f5e35c6e2eb3a",
252
- "signature": "80nbN79+QNiEVMKsY520VXcWBY1s5R2Yq9kpi/EUW5Hrs8KKBRPH3tQ6JSeBGGi5ZzWDi3UEi9s/AN55c5hdAg==",
250
+ "tag": "v0.1.29",
251
+ "revision": "33bc07a3b6621daa7220a3febde75ef5d3416518",
252
+ "hash": "af235d18cbc26f9bff5dac57a101b9722687dc7d8360c590aa81c96e23178654",
253
+ "signature": "Q5UmtBUV1DbII/oNmFcnWXzyLXndcVCGxpy4kKsnSHs+YZYyt69qg71fhHR+uy9ggzBCi3sc3nwtbEHEX+TXBg==",
253
254
  "name": "Dmytri Kleiner",
254
255
  "email": "dev@dmytri.to",
255
256
  "npm": "11.12.1",
256
257
  "node": "v25.8.2",
257
- "hipp": "0.1.27"
258
+ "hipp": "0.1.29"
258
259
  }
259
260
  ```
package/hipp.js CHANGED
@@ -751,25 +751,40 @@ const verifyIndex = process.argv.indexOf('verify');
751
751
  const packageSpec = verifyIndex !== -1 ? process.argv[verifyIndex + 1] : null;
752
752
 
753
753
  if (isVerify) {
754
- const specToVerify = packageSpec;
755
- if (specToVerify) {
756
- runVerify(specToVerify);
757
- } else {
758
- const hippPkgPath = path.join(path.dirname(process.argv[1]), 'package.json');
759
- const hippPkg = JSON.parse(fs.readFileSync(hippPkgPath, 'utf8'));
760
- const spec = hippPkg.version === '0.0.0'
761
- ? hippPkg.name
762
- : `${hippPkg.name}@${hippPkg.version}`;
763
- runVerify(spec);
764
- }
754
+ const hasSelf = process.argv.includes('--self');
755
+ if (!hasSelf) {
756
+ try {
757
+ const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
758
+ if (pkg.version === '0.0.0') {
759
+ const rawTag = git(['describe', '--tags', '--exact-match', 'HEAD']);
760
+ if (rawTag.startsWith('v')) {
761
+ const tagVersion = semver.clean(rawTag);
762
+ if (tagVersion) {
763
+ runVerify(`${pkg.name}@${tagVersion}`);
764
+ return;
765
+ }
766
+ }
767
+ }
768
+ } catch {}
769
+ }
770
+ const hippModuleDir = path.dirname(require.resolve('@dk/hipp/package.json'));
771
+ const hippPkg = JSON.parse(fs.readFileSync(path.join(hippModuleDir, 'package.json'), 'utf8'));
772
+ const spec = hippPkg.version === '0.0.0'
773
+ ? hippPkg.name
774
+ : `${hippPkg.name}@${hippPkg.version}`;
775
+ runVerify(spec);
765
776
  } else if (process.argv.includes('--help') || process.argv.includes('-h')) {
766
777
  console.log(`\x1b[36mHIPP - High Integrity Package Publisher\x1b[0m
767
778
 
768
779
  Usage:
769
780
  npx hipp [options] [-- npm-options]
770
781
  npx hipp verify [@package[@version]]
782
+ npx hipp verify --self
771
783
 
772
- Without arguments, verifies the installed hipp version.
784
+ Without arguments: in a hipp repo (package.json version 0.0.0 with a
785
+ semver tag on HEAD), verifies the published package at that version.
786
+ Otherwise verifies @dk/hipp itself.
787
+ --self: always verifies @dk/hipp.
773
788
 
774
789
  Options:
775
790
  -y, --yes Skip confirmation prompt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dk/hipp",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "High Integrity Package Publisher",
5
5
  "main": "hipp.js",
6
6
  "bin": {