Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ jobs:
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
run: |
mv -f package-main.json package.json
npx zx-semrel
run: npx zx-semrel
# run: |
# mv -f package-main.json package.json
# npx zx-semrel

- name: Push docs and coverage
env:
Expand Down
2 changes: 1 addition & 1 deletion .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"LICENSE",
"package-main.json"
],
"limit": "57.20 kB",
"limit": "57.25 kB",
"brotli": false,
"gzip": false
},
Expand Down
1 change: 1 addition & 0 deletions COHERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ Address | [`ip`](https://github.com/indutny/node-ip) | [`@webpod/ip`](https://gi
`012.1.2.3` | ✓ | n/a | ❌ | ❌ | invalid: octal-style IPv4
`000:0:0000::01` | ❌ | ✓ | ✓ | ✓ | valid: zero-compression
`::fFFf:127.255.255.256` | ✓ | n/a | n/a | ✓ | invalid: IPv4 overflow
`017700000001` | ✓ | n/a | ❌ | ❌ | octal 127.0.0.1
434 changes: 203 additions & 231 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,60 @@
"require": "./target/cjs/index.cjs"
}
},
"module": "target/esm/index.mjs",
"types": "target/dts/index.d.ts",
"files": [
"target/cjs",
"target/esm",
"target/dts",
"lib"
],
"scripts": {
"build": "concurrently 'npm:build:*'",
"build:js": "node ./src/scripts/build.mjs --entry='src/main/ts/core.ts:src/main/ts/index.ts'",
"build:dts": "tsc --emitDeclarationOnly --outDir target/dts",
"build:tests": "node ./src/scripts/build-tests.mjs",
"build:docs": "typedoc --options src/main/typedoc",
"build:stamp": "npx buildstamp",
"build:jsr": "node ./src/scripts/build-jsr.mjs",
"build:pkgjson": "node ./src/scripts/build-pkgjson.ts",
"test": "concurrently 'npm:test:*'",
"test:target": "git diff --exit-code --quiet || (echo 'Uncommitted changes' && exit 1)",
"test:size": "size-limit",
"_test:lint": "eslint -c src/test/lint/.eslintrc.json src",
"test:unit": "vitest run --coverage --config ./vitest.config.js",
"test:jsr": "jsr publish --dry-run",
"test:audit": "npm audit",
"_test:workflow": "zizmor .github/workflows -v -p --min-severity=medium",
"smoke:esm": "node ./src/test/smoke/node.test.mjs",
"smoke:cjs": "node src/test/smoke/node.test.cjs",
"smoke:browser": "npx vitest run --config src/test/smoke/vitest.browser.config.js",
"smoke:deno": "deno test ./src/test/smoke/deno.test.js --allow-read --allow-sys --allow-env --allow-run",
"prepack": "PKGJSON_PATH=package.json npm run build:pkgjson",
"_publish:draft": "npm run build && npm publish --no-git-tag-version",
"_postrelease": "node src/scripts/build-jsr.mjs && jsr publish --allow-dirty"
},
"devDependencies": {
"@size-limit/file": "^11.2.0",
"@types/node": "^24.5.2",
"@vitest/browser": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4",
"concurrently": "^9.2.1",
"esbuild": "^0.25.10",
"esbuild-node-externals": "^1.18.0",
"esbuild-plugin-entry-chunks": "^0.1.17",
"esbuild-plugin-extract-helpers": "^0.0.6",
"esbuild-plugin-transform-hook": "^0.2.0",
"esbuild-plugin-utils": "^0.1.0",
"fast-glob": "^3.3.3",
"jsr": "^0.13.5",
"minimist": "^1.2.8",
"playwright": "^1.55.0",
"size-limit": "^11.2.0",
"typedoc": "^0.28.13",
"typescript": "^5.9.2",
"vitest": "^3.2.4"
},
"keywords": [
"ip",
"ip-address",
Expand All @@ -38,6 +85,9 @@
"ipv6"
],
"homepage": "https://github.com/webpod/ip#readme",
"bugs": {
"url": "https://github.com/webpod/ip/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpod/ip.git"
Expand Down
1 change: 1 addition & 0 deletions src/scripts/build-coherence-md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const suites: {title: string, method: string, cases: [string, boolean, string][]
['0:0:0:0:0:ffff:127.0.0.1', true, '↑'],

// Invalid / malformed
['017700000001', false, 'octal 127.0.0.1'], // https://github.com/indutny/node-ip/issues/162
['01200034567', false, 'invalid: octal-style'],
['012.1.2.3', false, 'invalid: octal-style IPv4'],
['000:0:0000::01', true, 'valid: zero-compression'],
Expand Down
12 changes: 7 additions & 5 deletions src/scripts/build-pkgjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import path from 'node:path'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const root = path.resolve(__dirname, '../..')
const source = 'package.json'
const dest = 'package-main.json'
const dest = process.env.PKGJSON_PATH || 'package-main.json'
const _pkgJson = JSON.parse(fs.readFileSync(path.join(root, source), 'utf-8'))

const whitelist = new Set([
'name',
'version',
'description',
'type',
'module',
'main',
'types',
'typesVersions',
Expand All @@ -29,10 +30,11 @@ const whitelist = new Set([
'license',
])

const pkgJson = Object.fromEntries(
Object.entries(_pkgJson).filter(([k]) => whitelist.has(k))
)
const pkgJson =
Object.fromEntries(
Object.entries(_pkgJson)
.filter(([k]) => whitelist.has(k)))

fs.writeFileSync(path.resolve(root, dest), JSON.stringify(pkgJson, null, 2))
fs.writeFileSync(path.resolve(root, dest), JSON.stringify(pkgJson, null, 2) + '\n')

console.log(`${dest} prepared for npm`)