-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reliverse→@reliverse/cli, fix all issues, etc
- Loading branch information
Showing
85 changed files
with
4,425 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
dist/ | ||
output/ | ||
.venv/ | ||
dist-jsr/ | ||
dist-npm/ | ||
.DS_Store | ||
merged.txt | ||
.eslintcache | ||
node_modules/ | ||
addons/premium/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"recommendations": [ | ||
"aaron-bond.better-comments", | ||
"astro-build.houston", | ||
"biomejs.biome", | ||
"bradlc.vscode-tailwindcss", | ||
"charliermarsh.ruff", | ||
"chunsen.bracket-select", | ||
"davidanson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"fabiospampinato.vscode-open-multiple-files", | ||
"github.github-vscode-theme", | ||
"lokalise.i18n-ally", | ||
"mikekscholz.pop-icon-theme", | ||
"ms-python.python", | ||
"neptunedesign.vs-sequential-number", | ||
"streetsidesoftware.code-spell-checker", | ||
"unifiedjs.vscode-mdx", | ||
"usernamehw.errorlens", | ||
"usernamehw.remove-empty-lines", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import relinka from "@reliverse/relinka"; | ||
import { execa } from "execa"; | ||
import fs from "fs-extra"; | ||
import mri from "mri"; | ||
|
||
function showHelp() { | ||
relinka.info(`Usage: bun build.publish.ts [options] | ||
Options: | ||
no options Publish to npm registry | ||
--jsr Publish to JSR registry | ||
--dry-run Perform a dry run of the publish process | ||
-h, --help Show help | ||
`); | ||
} | ||
|
||
const argv = mri(process.argv.slice(2), { | ||
alias: { | ||
h: "help", | ||
}, | ||
boolean: ["jsr", "dry-run", "help"], | ||
default: { | ||
jsr: false, | ||
"dry-run": false, | ||
help: false, | ||
}, | ||
}); | ||
|
||
// If help flag is present, display help and exit | ||
if (argv.help) { | ||
showHelp(); | ||
process.exit(0); | ||
} | ||
|
||
// Handle flags | ||
const validFlags = ["jsr", "dry-run", "help", "h"]; | ||
const unknownFlags = Object.keys(argv).filter( | ||
(key) => !validFlags.includes(key) && key !== "_", | ||
); | ||
|
||
if (unknownFlags.length > 0) { | ||
relinka.error(`❌ Unknown flag(s): ${unknownFlags.join(", ")}`); | ||
showHelp(); | ||
process.exit(1); | ||
} | ||
|
||
async function publishNpm(dryRun: boolean) { | ||
try { | ||
if (dryRun) { | ||
await execa("bun publish --dry-run", { stdio: "inherit" }); | ||
} else { | ||
await execa("bun build:npm", { stdio: "inherit" }); | ||
await execa("bun publish", { stdio: "inherit" }); | ||
} | ||
relinka.success("Published to npm successfully."); | ||
} catch (error) { | ||
relinka.error("❌ Failed to publish to npm:", error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
async function publishJsr(dryRun: boolean) { | ||
try { | ||
if (dryRun) { | ||
await execa( | ||
"bunx jsr publish --allow-slow-types --allow-dirty --dry-run", | ||
{ stdio: "inherit" }, | ||
); | ||
} else { | ||
await execa("bun build:jsr", { stdio: "inherit" }); | ||
await execa("bunx jsr publish --allow-slow-types --allow-dirty", { | ||
stdio: "inherit", | ||
}); | ||
} | ||
relinka.success("Published to JSR successfully."); | ||
} catch (error) { | ||
relinka.error("❌ Failed to publish to JSR:", error); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
async function bumpJsrVersion(disable?: boolean) { | ||
if (disable) { | ||
return; | ||
} | ||
const pkg = JSON.parse(await fs.readFile("package.json", "utf-8")); | ||
const jsrConfig = JSON.parse(await fs.readFile("jsr.jsonc", "utf-8")); | ||
// @ts-expect-error TODO: fix ts | ||
jsrConfig.version = pkg.version; | ||
await fs.writeFile("jsr.jsonc", JSON.stringify(jsrConfig, null, 2)); | ||
} | ||
|
||
async function bumpNpmVersion() { | ||
await execa("bun bumpp", { stdio: "inherit" }); | ||
} | ||
|
||
async function main() { | ||
const { jsr, "dry-run": dryRun } = argv; | ||
if (jsr) { | ||
// await bumpJsrVersion(); | ||
await publishJsr(dryRun); | ||
} else { | ||
// await bumpNpmVersion(); | ||
await publishNpm(dryRun); | ||
} | ||
} | ||
|
||
main().catch((error) => { | ||
relinka.error("❌ An unexpected error occurred:", error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from "bumpp"; | ||
|
||
export default defineConfig({ | ||
push: false, | ||
commit: false, | ||
}); |
Oops, something went wrong.