{"_id":"@block-style-cms/sdk","name":"@block-style-cms/sdk","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@block-style-cms/sdk","version":"0.0.1","description":"Node.js SDK for Block Style CMS","authors":[{"name":"Biscuit Zhou","email":"biscuit_zhou@outlook.com"}],"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","lint":"biome check src test","publish:sample":"npm run build && node test/publish_sample_article.mjs"},"engines":{"node":">=18"},"license":"MIT","devDependencies":{"@types/node":"^24","typescript":"^5","vitest":"^4.1.10"},"publishConfig":{"access":"public"},"gitHead":"5e52261d761376be374ade4057ad59ad8d75d9e7","_id":"@block-style-cms/sdk@0.0.1","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-jEc1uUee1F0zxDLSW15p9pBBlAAbTkNjAf6VfsnppHd9N4hhjHrFxQ6eAvYGJHWRuCdwCCMajEzr56SlJg7Z6Q==","shasum":"8df1e73f7f2e81cc869bac20bca0c7d94cee9529","tarball":"https://registry.npmjs.org/@block-style-cms/sdk/-/sdk-0.0.1.tgz","fileCount":16,"unpackedSize":19914,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIB9f4KzUou3BRJeCf8/Umm1EBQQohL2wLUtzD/GIWjaqAiEA2A2lL9XvZmXzDb45Ejr+CLdCvQaxt36QM8bvECwDLhQ="}]},"_npmUser":{"name":"biscuit_zhou","email":"biscuit_zhou@outlook.com"},"directories":{},"maintainers":[{"name":"biscuit_zhou","email":"biscuit_zhou@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.0.1_1787535400364_0.6839925221418837"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-24T01:36:40.037Z","0.0.1":"2026-08-24T01:36:40.507Z","modified":"2026-08-24T01:36:40.734Z"},"maintainers":[{"name":"biscuit_zhou","email":"biscuit_zhou@outlook.com"}],"description":"Node.js SDK for Block Style CMS","license":"MIT","readme":"# `@block-style-cms/sdk`\n\nNode.js / TypeScript SDK for [Block Style CMS](https://github.com/Byte-Biscuit/block-style-cms).\n\n## Install\n\n```bash\nnpm install @block-style-cms/sdk\n```\n\n## Auth\n\nCreate an API token in the CMS admin UI. Pass it when constructing the client:\n\n- Header: `x-api-key: <token>` (default), or\n- `Authorization: Bearer <token>`\n\n## Publish from Markdown\n\n1. Collect relative images from markdown (e.g. `./assets/foo.png`)\n2. Resolve files under the required `assetsDir`\n3. Upload via `POST /api/m/images`\n4. Rewrite paths to `/images/{filename}`\n5. Submit via `POST /api/m/articles/from-markdown`\n\n```ts\nimport { BlockStyleCmsClient } from \"@block-style-cms/sdk\";\n\nconst client = new BlockStyleCmsClient({\n  baseUrl: \"https://cms.example.com\",\n  apiKey: process.env.BSC_API_KEY!,\n});\n\nawait client.articles.publishFromMarkdown({\n  title: \"Hello\",\n  slug: \"hello-article-slug\",\n  summary: \"A short summary of at least ten chars\",\n  tags: [\"demo\"],\n  language: \"en-US\",\n  mdFile: \"./posts/hello.md\",\n  assetsDir: \"./posts/assets\",\n  published: false,\n});\n```\n\n## Content metadata\n\nBefore publishing, discover site configuration:\n\n- `GET /api/m/locales` — supported article languages (`zh-CN`, `zh-TW`, `en-US`)\n- `GET /api/m/channels` — site channels from CMS settings\n\n```ts\nconst locales = await client.content.listLocales();\nconst channels = await client.content.listChannels();\n```\n\n## Develop\n\nFrom the monorepo root:\n\n```bash\nnpm install\nnpm run build:js\n```\n\nRemote API check with the shared sample fixture ([`samples/`](../../samples/)):\n\n```bash\ncd packages/js\nBSC_BASE_URL=https://your-cms.example.com \\\nBSC_API_KEY=bsc_... \\\nnpm run publish:sample\n```\n\n## Release\n\n1. Bump `version` in [`package.json`](package.json).\n2. Tag `js-vX.Y.Z`, push, and **Publish** a GitHub Release for that tag.\n3. GitHub Actions publishes to npm (requires `NPM_TOKEN` secret).\n\nExample: version `0.0.1` → tag `js-v0.0.1` → GitHub Release → npm.\n","readmeFilename":"README.md","_rev":"1-791f43bcc316e1d263b451659efc00d6"}