@coast/qrcode-svg

中文文档
1.0.9发布于 2026/07/29ISCTypeScriptCommonJS近 30 天下载 8653

Generates a QRCode in SVG with an integrated Coast logo at the bottom.

原始使用文档
文档目录15 节
  1. Generating Quest PDFs
  2. Expected CSV format
  3. Generate command
  4. Troubleshooting
  5. Usage
  6. Props:
  7. Publishing
  8. Development
  9. Testing
  10. Heroku
  11. Dyno size
  12. App configuration
  13. Watch app logs
  14. Clear app cache
  15. Restart app

createQRCode

Generates a QRCode in SVG with an integrated Coast logo at the bottom.

Generating Quest PDFs

Append the /upload path to the base app URL to upload the CSV file.

Due to upload constraints (bandwidth and 30 second request timeout), the app will only process 350 rows at a time.

Expected CSV format

The CSV MUST include the following columns:

  • Asset Details URL
  • Service Request URL

The CSV can OPTIONALLY include the following columns:

  • Manufacturer
  • Model
  • Serial Number
  • Coast ID
  • Acquired Year

All other columns will be ignored.

Generate command

Run yarn generate:pdfs path/to/data.csv.

PDFs will be output in the top-level pdfs folder, as numbered files. Note: any existing files in this folder will be removed when the script is run.

Troubleshooting

If the CSV format is incorrect, the app will say that it processed the file, but it will not display an error nor generate/display a link to a zip file containing the PDFs. You will need to follow the instructions in the section further down to tail the Heroku logs to see any error messages.

Usage

import { createQRCode } from '@coast/qrcode-svg';

const url = 'https://shared.coastapp.com/r/d634c3d2-4708-42f3-8dbe-a987696a8bb3';
const width = 400;
const showBorder = true;
const svg = createQRCode({ url, width, showBorder });

Props:

  • url: string
  • width?: number - if omitted, SVG will be size-agnostic / responsive
  • showBorder?: boolean - defaults to false
  • showLogo?: boolean - defaults to true

Publishing

  • Run yarn build && git add dist && git commit -m "Update distribution"
  • Bump the version via npm version (this will create a vXXX tag)
  • Merge your changes to the main branch
  • Push up the new version tag via git push --tags
  • Update the the reference in the package that uses this library to point at the new version tag

Development

This project includes a dev environment for modifying the output of the createQRCode SVG generator. It uses a SvelteKit server to show the rendered SVG in a browser.

Run the app

yarn
yarn dev

Then open http://localhost:5173

Testing

Tests run in vitest.

yarn test

Note: the SVG fixtures are read in as files at the beginning of the test run, so any changes to the fixtures will require restarting the tests. (Press R while in watch mode.)

Heroku

Access at https://dashboard.heroku.com/apps/qrcode-svg

Install the Heroku CLI and sign in by running heroku login

Dyno size

At the moment the primary app constraint is memory. We are currently limited to using a 2x dyno size with 1 GB memory. After we have an invoice for at least $30 for a month, we can use larger dyno sizes with more memory.

https://dashboard.heroku.com/apps/qrcode-svg/resources

App configuration

Config vars

PUPPETEER_EXECUTABLE_PATH: /app/.chrome-for-testing/chrome-linux64/chrome
NODE_ENV: production

Buildpacks

Add heroku-community/chrome-for-testing

Watch app logs

heroku logs -a qrcode-svg --tail

Clear app cache

heroku builds:cache:purge -a qrcode-svg

Restart app

heroku ps:restart -a qrcode-svg

版本与发布记录

@coast/qrcode-svg 共发布 3 个版本,首次发布于 2024/12/13;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.0.9latest2026/07/293 个月前
1.0.82026/07/293 个月前
1.0.72024/12/131.9 年前

关于 @coast/qrcode-svg 的常见问题

@coast/qrcode-svg 是什么?

Generates a QRCode in SVG with an integrated Coast logo at the bottom.

如何安装 @coast/qrcode-svg?

在项目目录运行 npm install @coast/qrcode-svg,或使用 pnpm add / yarn add / bun add。

@coast/qrcode-svg 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@coast/qrcode-svg 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@coast/qrcode-svg 可以商用吗?

@coast/qrcode-svg 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@coast/qrcode-svg 的下载量有多少?

根据 npm 官方下载统计,@coast/qrcode-svg 在 2026/10/10 – 2026/11/08 这 30 天内被下载 8,653 次,日均约 288 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@coast/qrcode-svg 还在维护吗?

最新版本 1.0.9 发布于 2026/07/29(3 个月前);至今共发布 3 个版本,其中过去 12 个月发布了 2 个;首次发布于 2024/12/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。