Skip to content
Draft
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
3 changes: 3 additions & 0 deletions javascript/packages/cli/bin/herb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

import("../dist/index.mjs")
47 changes: 47 additions & 0 deletions javascript/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@herb-tools/cli",
"version": "0.7.5",
"description": "Unified CLI for Herb HTML+ERB tools",
"license": "MIT",
"homepage": "https://herb-tools.dev",
"bugs": "https://github.com/marcoroth/herb/issues/new?title=Package%20%60@herb-tools/cli%60:%20",
"repository": {
"type": "git",
"url": "https://github.com/marcoroth/herb.git",
"directory": "javascript/packages/cli"
},
"bin": {
"herb": "./bin/herb"
},
"scripts": {
"clean": "rimraf dist",
"build": "yarn clean && tsup-node && yarn bundle:playground",
"bundle:playground": "node scripts/bundle-playground.mjs",
"watch": "tsup-node --watch",
"test": "vitest run",
"test:watch": "vitest --watch",
"prepublishOnly": "yarn clean && yarn build && yarn test"
},
"dependencies": {
"@herb-tools/config": "0.7.5",
"@herb-tools/formatter": "0.7.5",
"@herb-tools/highlighter": "0.7.5",
"@herb-tools/language-server": "0.7.5",
"@herb-tools/linter": "0.7.5",
"@herb-tools/node-wasm": "0.7.5",
"@herb-tools/printer": "0.7.5",
"@herb-tools/tailwind-class-sorter": "0.7.5",
"glob": "^11.0.3",
"lz-string": "^1.5.0",
"mri": "^1.2.0",
"open": "^10.2.0",
"picocolors": "^1.1.1",
"stimulus-lint": "0.1.5"
},
"files": [
"package.json",
"README.md",
"bin/",
"dist/"
]
}
55 changes: 55 additions & 0 deletions javascript/packages/cli/scripts/bundle-playground.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env node

import fs from "fs/promises"
import path from "path"
import { fileURLToPath } from "url"

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

async function copyDir(src, dest) {
await fs.mkdir(dest, { recursive: true })
const entries = await fs.readdir(src, { withFileTypes: true })

for (const entry of entries) {
const srcPath = path.join(src, entry.name)
const destPath = path.join(dest, entry.name)

if (entry.isDirectory()) {
await copyDir(srcPath, destPath)
} else {
await fs.copyFile(srcPath, destPath)
}
}
}

async function main() {
const playgroundSrc = path.join(__dirname, "../../../../playground/dist")
const playgroundDest = path.join(__dirname, "../dist/playground")

try {
await fs.access(playgroundSrc)

console.log("Bundling playground into CLI package...")

try {
await fs.rm(playgroundDest, { recursive: true, force: true })
} catch (error) {
// Ignore
}

await copyDir(playgroundSrc, playgroundDest)

console.log("✓ Playground bundled successfully")
} catch (error) {
console.warn("⚠ Warning: Could not bundle playground")
console.warn(" Playground dist not found at:", playgroundSrc)
console.warn(" Run 'cd playground && yarn build' to build the playground first")
console.warn(" The CLI will still work for other commands")
}
}

main().catch((error) => {
console.error("Error bundling playground:", error)
process.exit(1)
})
Loading
Loading