embed-asset-tool
v1.0.0
Published
Embed asset folders as C++ byte-array headers for Arduino and other embedded projects.
Maintainers
Readme
Embed Asset Tool
Embed files from assets/ and assets_* folders as C++ byte-array headers for Arduino and other embedded projects.
This package extracts the asset embedding behavior of the Arduino CLI Wrapper VS Code extension. Existing .assetsconfig and .assetsignore files remain supported; this standalone package is the source of truth for future behavior.
Requires Node.js 18 or later.
CLI
# Build every assets bundle directly below a sketch directory
npx embed-asset-tool build ./MySketch
# Build one bundle
npx embed-asset-tool build ./MySketch/assets_wifi
# Verify committed outputs without writing
npx embed-asset-tool build ./MySketch --check
# Show effective configuration and input files
npx embed-asset-tool inspect ./MySketch/assets
# Create a commented .assetsconfig without overwriting an existing file
npx embed-asset-tool init ./MySketchRun embed-asset-tool --help for all options.
Configuration
The .assetsconfig INI sections are compatible with Arduino CLI Wrapper 1.9.5:
[general]:dir,header_name,prefix[minify]: HTML, CSS, and JavaScript lightweight minification[gzip]: glob selection, minimum size, and suffix[stamp]: ISO and Unix timestamps[hash]: SHA-256, SHA-1, and MD5
.assetsignore supports comments, *, **, ?, directory rules, and ! re-inclusion. Both control files are excluded automatically.
See README.ja.md for the complete configuration example and compatibility notes.
init creates a short English-commented template with representative settings left commented out. Pass a sketch directory to create assets/.assetsconfig, or pass an assets/assets_* directory directly. Existing configuration files are never changed.
JavaScript API
import { embedSketchAssets } from 'embed-asset-tool';
const results = await embedSketchAssets('/path/to/MySketch', {
createDirIfMissing: true,
});The VS Code extension can use this API directly and retain only its commands, notifications, diagnostics, and pre-build hook. CommonJS extensions can load it with await import('embed-asset-tool').
Development
npm install
npm run checkRelease
Verify the project and package contents from a clean, committed worktree:
npm run check
npm pack --dry-run
git statusThen log in, select the appropriate semantic-version increment, publish, and push the version commit and tag:
npm login
npm version patch # patch, minor, major, or an explicit version such as 1.2.3
npm publish --access public
git push --follow-tagsRecord pending changes under ## Unreleased in CHANGELOG.md as paired (EN) and (JA) lines. npm version runs all checks, verifies those entries, updates package.json and package-lock.json, creates the new changelog version section, and then creates the version commit and Git tag. Follow npm's prompt if it requires a one-time password or browser authentication.
MIT licensed.
