@dk/hipp 0.1.21 â 0.1.23
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 +27 -8
- package/hipp.js +32 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,10 +44,27 @@ stays clean, and your registry package is guaranteed to match your Git tag.
|
|
|
44
44
|
### Tag and Publish
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
+
git commit -m "Release"
|
|
47
48
|
git tag v1.0.0
|
|
49
|
+
git push origin main --tags
|
|
48
50
|
npx @dk/hipp
|
|
49
51
|
```
|
|
50
52
|
|
|
53
|
+
The tag and commit **must be pushed to origin** before running HIPP. HIPP verifies the
|
|
54
|
+
tag exists on the remote and that HEAD matches the upstream branch.
|
|
55
|
+
|
|
56
|
+
Use `-y` to skip confirmation (for CI):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx @dk/hipp --yes
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Pass npm options via `--`:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx @dk/hipp -- --access public --tag beta
|
|
66
|
+
```
|
|
67
|
+
|
|
51
68
|
HIPP will:
|
|
52
69
|
|
|
53
70
|
1. **Key Generation**: Generate Ed25519 signing keys if needed (`hipp.priv`, `hipp.pub`)
|
|
@@ -115,7 +132,8 @@ The manifest contains:
|
|
|
115
132
|
"name": "Jane Developer",
|
|
116
133
|
"email": "jane@example.com",
|
|
117
134
|
"npm": "10.2.4",
|
|
118
|
-
"node": "v20.11.0"
|
|
135
|
+
"node": "v20.11.0",
|
|
136
|
+
"hipp": "0.1.22"
|
|
119
137
|
}
|
|
120
138
|
```
|
|
121
139
|
|
|
@@ -220,19 +238,20 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
220
238
|
Verify this package with [@dk/hipp](https://www.npmjs.com/package/@dk/hipp):
|
|
221
239
|
|
|
222
240
|
```bash
|
|
223
|
-
npx @dk/hipp verify @dk/hipp@0.1.
|
|
241
|
+
npx @dk/hipp verify @dk/hipp@0.1.23
|
|
224
242
|
```
|
|
225
243
|
|
|
226
244
|
```json
|
|
227
245
|
{
|
|
228
|
-
"origin": "
|
|
229
|
-
"tag": "v0.1.
|
|
230
|
-
"revision": "
|
|
231
|
-
"hash": "
|
|
232
|
-
"signature": "
|
|
246
|
+
"origin": "git@github.com:dmytri/hipp.git",
|
|
247
|
+
"tag": "v0.1.23",
|
|
248
|
+
"revision": "5f94c47e1a6858a6e74ae10c0727cd481e22fb04",
|
|
249
|
+
"hash": "2945f93a1fb565f0806a4f924cfeb8509e5dd9714f814eaa22e763ac8d3d3935",
|
|
250
|
+
"signature": "KfyYgmbwMWesEXaTxRydY+9P96rjfCLU+H9B3bVmJ4to3oGsioYeVLDG2B4GYiJRRh49bSwh8MnRoHfpF/s8DA==",
|
|
233
251
|
"name": "Dmytri Kleiner",
|
|
234
252
|
"email": "dev@dmytri.to",
|
|
235
253
|
"npm": "11.12.1",
|
|
236
|
-
"node": "v25.8.2"
|
|
254
|
+
"node": "v25.8.2",
|
|
255
|
+
"hipp": "0.0.0"
|
|
237
256
|
}
|
|
238
257
|
```
|
package/hipp.js
CHANGED
|
@@ -41,6 +41,14 @@ function sshToHttpsUrl(sshUrl) {
|
|
|
41
41
|
return sshUrl;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function httpsToSshUrl(httpsUrl) {
|
|
45
|
+
const match = httpsUrl.match(/^https:\/\/([^/]+)\/(.+)$/);
|
|
46
|
+
if (match) {
|
|
47
|
+
return `git@${match[1]}:${match[2]}`;
|
|
48
|
+
}
|
|
49
|
+
return httpsUrl;
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
function runCmd(cmd, args, options = {}) {
|
|
45
53
|
const result = spawnSync(cmd, args, {
|
|
46
54
|
encoding: 'utf8',
|
|
@@ -475,14 +483,25 @@ async function runVerify(packageSpec) {
|
|
|
475
483
|
fail(`â Manifest not found or invalid in README`);
|
|
476
484
|
}
|
|
477
485
|
|
|
478
|
-
const { origin: originUrl, tag, revision, signature, name, email, npm: npmVer, node: nodeVer } = manifest;
|
|
486
|
+
const { origin: originUrl, tag, revision, signature, name, email, npm: npmVer, node: nodeVer, hipp: hippVer } = manifest;
|
|
479
487
|
|
|
480
488
|
log.info(`đŋ Cloning git origin at tag ${tag}...`);
|
|
481
489
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), `hipp-verify-git-`));
|
|
482
490
|
const stageDir = fs.mkdtempSync(path.join(os.tmpdir(), `hipp-verify-stage-`));
|
|
483
491
|
|
|
484
492
|
try {
|
|
485
|
-
|
|
493
|
+
let cloneResult;
|
|
494
|
+
try {
|
|
495
|
+
cloneResult = git(['clone', '--branch', tag, '--depth', '1', originUrl, tmpDir], { stdio: 'pipe' });
|
|
496
|
+
} catch (cloneErr) {
|
|
497
|
+
if (originUrl.startsWith('git@')) {
|
|
498
|
+
const httpsUrl = sshToHttpsUrl(originUrl);
|
|
499
|
+
log.info(`đŋ SSH clone failed, trying HTTPS: ${httpsUrl}...`);
|
|
500
|
+
cloneResult = git(['clone', '--branch', tag, '--depth', '1', httpsUrl, tmpDir], { stdio: 'pipe' });
|
|
501
|
+
} else {
|
|
502
|
+
throw cloneErr;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
486
505
|
|
|
487
506
|
const clonedRevision = git(['rev-parse', 'HEAD'], { cwd: tmpDir });
|
|
488
507
|
if (clonedRevision !== revision) {
|
|
@@ -554,8 +573,12 @@ async function runVerify(packageSpec) {
|
|
|
554
573
|
log.info(`đ Publisher: ${name} <${email}>`);
|
|
555
574
|
log.info(`đ Origin: ${originUrl}`);
|
|
556
575
|
log.info(`đ Tag: ${tag}`);
|
|
557
|
-
if (npmVer
|
|
558
|
-
|
|
576
|
+
if (npmVer || nodeVer || hippVer) {
|
|
577
|
+
const parts = [];
|
|
578
|
+
if (hippVer) parts.push(`hipp: ${hippVer}`);
|
|
579
|
+
if (npmVer) parts.push(`npm: ${npmVer}`);
|
|
580
|
+
if (nodeVer) parts.push(`node: ${nodeVer}`);
|
|
581
|
+
log.info(`âšī¸ ${parts.join(' | ')}`);
|
|
559
582
|
}
|
|
560
583
|
} finally {
|
|
561
584
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
@@ -658,7 +681,10 @@ async function run() {
|
|
|
658
681
|
const revision = refInfo.head;
|
|
659
682
|
const npmVersion = runCmd('npm', ['--version']).stdout.trim();
|
|
660
683
|
const nodeVersion = process.version;
|
|
661
|
-
const
|
|
684
|
+
const hippPkgPath = path.join(path.dirname(process.argv[1]), 'package.json');
|
|
685
|
+
const hippPkg = JSON.parse(fs.readFileSync(hippPkgPath, 'utf8'));
|
|
686
|
+
const hippVersion = hippPkg.version;
|
|
687
|
+
const originUrl = provenance.remoteUrl;
|
|
662
688
|
const dataToSign = buildSignData(tarballHash, originUrl, rawTag, revision, name, email);
|
|
663
689
|
const signature = signContent(dataToSign, privateKey);
|
|
664
690
|
|
|
@@ -672,6 +698,7 @@ async function run() {
|
|
|
672
698
|
email: email,
|
|
673
699
|
npm: npmVersion,
|
|
674
700
|
node: nodeVersion,
|
|
701
|
+
hipp: hippVersion,
|
|
675
702
|
};
|
|
676
703
|
|
|
677
704
|
stagedReadme = stagedReadme.trimEnd() + '\n\n## Verify\n\n' +
|