Browse Source
* feat: publish js libs to npm * changed license type * updated readme * added id * added exclusion for web and deno packages * update comment * updating env varpull/705/head
committed by
GitHub
20 changed files with 317 additions and 78 deletions
@ -1,37 +0,0 @@ |
|||
name: Pull Request |
|||
|
|||
on: |
|||
push: |
|||
paths: |
|||
- "packages/core" |
|||
- "packages/transport-deno" |
|||
- "packages/transport-http" |
|||
- "packages/transport-web-bluetooth" |
|||
- "packages/transport-web-serial" |
|||
branches: |
|||
- main |
|||
|
|||
jobs: |
|||
build: |
|||
runs-on: ubuntu-latest |
|||
|
|||
permissions: |
|||
contents: read |
|||
id-token: write |
|||
|
|||
steps: |
|||
- name: Checkout code |
|||
uses: actions/checkout@v4 |
|||
|
|||
- uses: denoland/setup-deno@v2 |
|||
with: |
|||
deno-version: v2.x |
|||
|
|||
- name: Check formatting |
|||
run: deno fmt --check |
|||
|
|||
- name: Check types |
|||
run: deno lint |
|||
|
|||
- name: Publish to JSR |
|||
run: npx jsr publish |
|||
@ -1,9 +1,25 @@ |
|||
{ |
|||
"version": "5", |
|||
"specifiers": { |
|||
"jsr:@david/code-block-writer@^13.0.2": "13.0.3", |
|||
"jsr:@deno/[email protected]": "0.20.1", |
|||
"jsr:@deno/dnt@~0.42.1": "0.42.1", |
|||
"jsr:@deno/[email protected]": "0.86.9", |
|||
"jsr:@meshtastic/protobufs@^2.7.0": "2.7.0", |
|||
"jsr:@std/bytes@^1.0.5": "1.0.6", |
|||
"jsr:@std/fmt@1": "1.0.8", |
|||
"jsr:@std/fmt@^1.0.3": "1.0.8", |
|||
"jsr:@std/fs@1": "1.0.19", |
|||
"jsr:@std/fs@^1.0.6": "1.0.19", |
|||
"jsr:@std/internal@^1.0.9": "1.0.9", |
|||
"jsr:@std/[email protected]": "0.225.2", |
|||
"jsr:@std/path@*": "1.1.1", |
|||
"jsr:@std/path@1": "1.1.1", |
|||
"jsr:@std/path@^1.0.8": "1.1.1", |
|||
"jsr:@std/path@^1.1.0": "1.1.1", |
|||
"jsr:@std/path@^1.1.1": "1.1.1", |
|||
"jsr:@ts-morph/[email protected]": "0.25.0", |
|||
"jsr:@ts-morph/[email protected]": "0.25.0", |
|||
"npm:@bufbuild/protobuf@^2.2.3": "2.6.0", |
|||
"npm:@bufbuild/protobuf@^2.6.0": "2.6.0", |
|||
"npm:@hookform/resolvers@^5.1.1": "[email protected][email protected][email protected]", |
|||
@ -30,11 +46,11 @@ |
|||
"npm:@radix-ui/react-toggle-group@^1.1.10": "1.1.10_@[email protected]_@[email protected]__@[email protected][email protected][email protected][email protected]", |
|||
"npm:@radix-ui/react-tooltip@^1.2.7": "1.2.7_@[email protected]_@[email protected]__@[email protected][email protected][email protected][email protected]", |
|||
"npm:@tailwindcss/postcss@^4.1.11": "4.1.11", |
|||
"npm:@tanstack/react-router-devtools@^1.125.4": "1.125.4_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]", |
|||
"npm:@tanstack/react-router@^1.125.4": "1.125.4[email protected][email protected][email protected]", |
|||
"npm:@tanstack/react-router-devtools@^1.125.4": "1.125.6_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]", |
|||
"npm:@tanstack/react-router@^1.125.4": "1.125.6[email protected][email protected][email protected]", |
|||
"npm:@tanstack/router-cli@^1.125.4": "1.125.4", |
|||
"npm:@tanstack/router-devtools@^1.125.4": "1.125.4_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]", |
|||
"npm:@tanstack/router-plugin@^1.125.5": "1.125.5_@[email protected][email protected][email protected][email protected][email protected]__@[email protected][email protected]_@[email protected][email protected][email protected][email protected]_@[email protected]", |
|||
"npm:@tanstack/router-devtools@^1.125.4": "1.125.6_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]", |
|||
"npm:@tanstack/router-plugin@^1.125.5": "1.125.6_@[email protected][email protected][email protected][email protected][email protected]__@[email protected][email protected]_@[email protected][email protected][email protected][email protected]_@[email protected]", |
|||
"npm:@testing-library/jest-dom@^6.6.3": "6.6.3", |
|||
"npm:@testing-library/react@^16.3.0": "16.3.0_@[email protected]_@[email protected]_@[email protected]__@[email protected][email protected][email protected][email protected]", |
|||
"npm:@testing-library/user-event@^14.6.1": "14.6.1_@[email protected]", |
|||
@ -94,20 +110,79 @@ |
|||
"npm:[email protected]": "5.0.6_@[email protected][email protected][email protected]" |
|||
}, |
|||
"jsr": { |
|||
"@david/[email protected]": { |
|||
"integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f" |
|||
}, |
|||
"@deno/[email protected]": { |
|||
"integrity": "dc4f3add14307f3ff3b712441ea4acabcbfc9a13f67c5adc78c3aac16ac5e2a0", |
|||
"dependencies": [ |
|||
"jsr:@deno/graph", |
|||
"jsr:@std/fmt@^1.0.3", |
|||
"jsr:@std/fs@^1.0.6", |
|||
"jsr:@std/io", |
|||
"jsr:@std/path@^1.0.8" |
|||
] |
|||
}, |
|||
"@deno/[email protected]": { |
|||
"integrity": "85322b38eb40d4e8c5216d62536152c35b1bda9dc47c8c60860610397b960223", |
|||
"dependencies": [ |
|||
"jsr:@david/code-block-writer", |
|||
"jsr:@deno/cache-dir", |
|||
"jsr:@std/fmt@1", |
|||
"jsr:@std/fs@1", |
|||
"jsr:@std/path@1", |
|||
"jsr:@ts-morph/bootstrap" |
|||
] |
|||
}, |
|||
"@deno/[email protected]": { |
|||
"integrity": "c4f353a695bcc5246c099602977dabc6534eacea9999a35a8cb24e807192e6a1" |
|||
}, |
|||
"@meshtastic/[email protected]": { |
|||
"integrity": "38357241bd8a7431c87366dbe12ce9e69f204ebb6ec23da12f7682765b6c8376", |
|||
"dependencies": [ |
|||
"npm:@bufbuild/protobuf@^2.2.3" |
|||
] |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "f6ac6adbd8ccd99314045f5703e23af0a68d7f7e58364b47d2c7f408aeb5820a" |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06", |
|||
"dependencies": [ |
|||
"jsr:@std/internal", |
|||
"jsr:@std/path@^1.1.1" |
|||
] |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "bdfb97f83e4db7a13e8faab26fb1958d1b80cc64366501af78a0aee151696eb8" |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "3c740cd4ee4c082e6cfc86458f47e2ab7cb353dc6234d5e9b1f91a2de5f4d6c7", |
|||
"dependencies": [ |
|||
"jsr:@std/bytes" |
|||
] |
|||
}, |
|||
"@std/[email protected]": { |
|||
"integrity": "fe00026bd3a7e6a27f73709b83c607798be40e20c81dde655ce34052fd82ec76", |
|||
"dependencies": [ |
|||
"jsr:@std/internal" |
|||
] |
|||
}, |
|||
"@ts-morph/[email protected]": { |
|||
"integrity": "3cd33ee80ac0aab8e5d2660c639a02187f0c8abfe454636ce86c00eb7e8407db", |
|||
"dependencies": [ |
|||
"jsr:@ts-morph/common" |
|||
] |
|||
}, |
|||
"@ts-morph/[email protected]": { |
|||
"integrity": "e3ed1771e2fb61fbc3d2cb39ebbc4f89cd686d6d9bc6d91a71372be055ac1967", |
|||
"dependencies": [ |
|||
"jsr:@std/fs@1", |
|||
"jsr:@std/path@1" |
|||
] |
|||
} |
|||
}, |
|||
"npm": { |
|||
@ -1681,8 +1756,8 @@ |
|||
"@tanstack/[email protected]": { |
|||
"integrity": "sha512-YL8dGi5ZU+xvtav2boRlw4zrRghkY6hvdcmHhA0RGSJ/CBgzv+cbADW9eYJLx74XMZvIQ1pp6VMbrpXnnM5gHA==" |
|||
}, |
|||
"@tanstack/[email protected].4_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]": { |
|||
"integrity": "sha512-eRg6Ht6bLno+Eo2Gps3cfjp++Mvy0brc6qs81At4beKZsCkS7jlmqHgrq6pXdH3l2bAQ/Dhr8J9zXvzxvRxf/g==", |
|||
"@tanstack/[email protected].6_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]": { |
|||
"integrity": "sha512-3+Np/HPQ1jpdai58xY6fScnjJz08iIG6aKhCVVy8tfPC76jTyXc+ygqM9wtUt3kJYy9/Lf7j3dAJlbtxF+TIXg==", |
|||
"dependencies": [ |
|||
"@tanstack/react-router", |
|||
"@tanstack/router-devtools-core", |
|||
@ -1690,8 +1765,8 @@ |
|||
"react-dom" |
|||
] |
|||
}, |
|||
"@tanstack/[email protected].4[email protected][email protected][email protected]": { |
|||
"integrity": "sha512-IIlDiFCR+RN/17dWtYKMYiJvH38tmtgTyciHkeZvr8vSWhThAeuwjzKneF4mQl3B//YHYcrFm7rZM59c24As/A==", |
|||
"@tanstack/[email protected].6[email protected][email protected][email protected]": { |
|||
"integrity": "sha512-znyUGTq+WRhXwToNTYiluUBLjMdQVxz+ZQ9Ep2PBuS9O+3Qm3kaM7n64hA84ISoCtLqMwTo7Ofw0W4WeLdjpYg==", |
|||
"dependencies": [ |
|||
"@tanstack/history", |
|||
"@tanstack/react-store", |
|||
@ -1743,8 +1818,8 @@ |
|||
"tiny-invariant" |
|||
] |
|||
}, |
|||
"@tanstack/[email protected].4_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]": { |
|||
"integrity": "sha512-VpCxC80C+t+HNt8xuRGoXDwV+0c1LFDNzOdL/dPlYSuTZWLd8zwOEi49oMaNSLeGJFLwgQx7FLP020UvQO6pMg==", |
|||
"@tanstack/[email protected].6_@[email protected][email protected][email protected][email protected][email protected][email protected][email protected]": { |
|||
"integrity": "sha512-Orlf0+5wANehVq5ocxfe3YyJnEtvc5tcNN/ldX20fOKyYeIhVQzR8Oa6RO3Jk2sY31grMwi6q199MTAJ7XshLQ==", |
|||
"dependencies": [ |
|||
"@tanstack/react-router", |
|||
"@tanstack/react-router-devtools", |
|||
@ -1767,8 +1842,8 @@ |
|||
"zod" |
|||
] |
|||
}, |
|||
"@tanstack/[email protected].5_@[email protected][email protected][email protected][email protected][email protected]__@[email protected][email protected]_@[email protected][email protected][email protected][email protected]_@[email protected]": { |
|||
"integrity": "sha512-blik4+pgwv0PEGYTtkVy6USQBwbPVex1WOBBfRudOaBf8vnGe7lBoEHZi6fora8QlmdTsEVhqX6IHDXuf3pWaQ==", |
|||
"@tanstack/[email protected].6_@[email protected][email protected][email protected][email protected][email protected]__@[email protected][email protected]_@[email protected][email protected][email protected][email protected]_@[email protected]": { |
|||
"integrity": "sha512-SWfp++tkjb0grVqa/Xdvi9QAs93e9/fZMBZ6q0fvvQruMyciCmjWyE/qV3tS/Qh0WZdzIRP6yl8Gha2Lin4q1w==", |
|||
"dependencies": [ |
|||
"@babel/core", |
|||
"@babel/plugin-syntax-jsx", |
|||
@ -3742,8 +3817,8 @@ |
|||
"[email protected]": { |
|||
"integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw==" |
|||
}, |
|||
"[email protected]79": { |
|||
"integrity": "sha512-UWKi/EbBopgfFsc5k61wFpV7WrnnSlSzW/e2XcBmS6qKYTivZlLtoll5/rdqRTxGglGHkmkW0j0pFNJG10EUIQ==" |
|||
"[email protected]80": { |
|||
"integrity": "sha512-ED+GEyEh3kYMwt2faNmgMB0b8O5qtATGgR4RmRsIp4T6p7B8vdMbIedYndnvZfsaXvSzegtpfqRMDNCjjiSduA==" |
|||
}, |
|||
"[email protected]": { |
|||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" |
|||
@ -5105,6 +5180,7 @@ |
|||
}, |
|||
"workspace": { |
|||
"dependencies": [ |
|||
"jsr:@deno/dnt@~0.42.1", |
|||
"jsr:@meshtastic/protobufs@^2.7.0", |
|||
"npm:@bufbuild/protobuf@^2.2.3", |
|||
"npm:@types/node@^22.13.10", |
|||
|
|||
@ -0,0 +1,101 @@ |
|||
import { build, emptyDir } from "@deno/dnt"; |
|||
import { join } from "jsr:@std/path@1/join"; |
|||
|
|||
interface DenoJsonConfig { |
|||
name: string; |
|||
version: string; |
|||
description: string; |
|||
imports?: Record<string, string>; |
|||
exports?: Record<string, string>; |
|||
} |
|||
|
|||
async function getJson(filePath: string) { |
|||
try { |
|||
return JSON.parse(await Deno.readTextFile(filePath)); |
|||
} catch (e) { |
|||
if (e instanceof Error) { |
|||
throw new Error(`Error reading or parsing ${filePath}: ${e.message}`); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if (Deno.args.length !== 1) { |
|||
console.error("Usage: deno task build:npm <path-to-package>"); |
|||
console.error( |
|||
"Example: deno task build:npm packages/core", |
|||
); |
|||
Deno.exit(1); |
|||
} |
|||
|
|||
const packagePath = Deno.args[0]; |
|||
const denoJsonPath = join(packagePath, "deno.json"); |
|||
const outDir = join(packagePath, "npm"); |
|||
|
|||
// Read the deno.json file to get the package metadata.
|
|||
let jsonContent: DenoJsonConfig; |
|||
|
|||
try { |
|||
jsonContent = await getJson(denoJsonPath); |
|||
} catch (error) { |
|||
console.log(`Error reading or parsing ${denoJsonPath}:`, error); |
|||
|
|||
if (error instanceof Deno.errors.NotFound) { |
|||
console.error(`Error: Config file not found at ${denoJsonPath}`); |
|||
} else { |
|||
console.error(`Error reading or parsing ${denoJsonPath}:`, error); |
|||
} |
|||
Deno.exit(1); |
|||
} |
|||
|
|||
const { name, version, description } = jsonContent; |
|||
|
|||
if (!name || !version || !description) { |
|||
console.error( |
|||
`Error: 'name', 'version', and 'description' must be defined in ${denoJsonPath}`, |
|||
); |
|||
Deno.exit(1); |
|||
} |
|||
|
|||
console.log(`Building ${name}@${version} from ${packagePath}...`); |
|||
|
|||
// Clean the output directory before building.
|
|||
await emptyDir(outDir); |
|||
|
|||
try { |
|||
await build({ |
|||
entryPoints: [join(packagePath, "mod.ts")], |
|||
outDir, |
|||
test: false, |
|||
shims: { |
|||
deno: true, |
|||
}, |
|||
package: { |
|||
name, |
|||
version, |
|||
description, |
|||
license: "GPL-3.0-only", |
|||
repository: { |
|||
type: "git", |
|||
url: "git+https://github.com/meshtastic/web.git", |
|||
}, |
|||
bugs: { |
|||
url: "https://github.com/meshtastic/web/issues", |
|||
}, |
|||
}, |
|||
compilerOptions: { |
|||
lib: ["DOM", "ESNext"], |
|||
}, |
|||
postBuild() { |
|||
Deno.copyFileSync("LICENSE", join(outDir, "LICENSE")); |
|||
Deno.copyFileSync( |
|||
join(packagePath, "README.md"), |
|||
join(outDir, "README.md"), |
|||
); |
|||
}, |
|||
}); |
|||
} catch (error) { |
|||
console.error(`Error building ${name}@${version}:`, error); |
|||
Deno.exit(1); |
|||
} |
|||
|
|||
console.log(`✅ Successfully built ${name}@${version} to ${outDir}`); |
|||
Loading…
Reference in new issue