bs-build-tool
v1.0.1
Published
A build tool for copying and renaming HTML files
Downloads
6
Readme
🛠️ BS Build Tool
A simple and efficient build tool for copying and renaming HTML files from your dist folder
📋 Overview
BS Build Tool is a lightweight Node.js utility that simplifies the process of copying HTML files from your dist directory and organizing them in a separate bsdist folder with custom naming to load onto a brightsign player without using the BrightAuthor software. Perfect for build workflows where you need to process built assets for brightsign.
✨ Features
- 🚀 Auto-configuration: Automatically adds scripts and config to your existing
package.json - 📁 Smart file handling: Copies files from
disttobsdistwith custom renaming - ⚙️ Configurable: Customize source filename, destination filename, and build commands
- 🔧 Build integration: Optional build command execution before file processing
- 🛡️ Error handling: Graceful handling of missing files and build failures
- 📦 Zero dependencies: Lightweight with no external dependencies
🚀 Installation
Install the package in your project:
npm install bs-build-toolOr use it directly with npx:
npx bs-build-tool📖 Usage
Basic Usage
After installation, run the tool in your project directory:
npx bs-buildOn first run, the tool will automatically:
- Add a
bs-buildscript to yourpackage.json - Add configuration options to your
package.json. You MUST include the correct destination file name before running the package. - Copy and rename your file according to the configuration
Using the Added Script
After the initial setup, you can use the script that was added to your package.json:
npm run bs-buildCommand Line Options
Skip the build step entirely:
npx bs-build --skip-build
# or
npx bs-build -s⚙️ Configuration
The tool automatically adds a config section to your package.json. You can customize these settings:
{
"config": {
"filename": "index.html",
"newfile": "bs",
"buildCommand": ""
}
}📁 File Structure
The tool works with this file structure:
your-project/
├── dist/
│ └── index.html # Source file
├── bsdist/ # Created by the tool
│ └── bs # Renamed output file
└── package.json # Auto-configured🔄 Workflow
- Build Phase (optional): Runs the configured build command
- Copy Phase: Copies the specified file from
dist/folder - Rename Phase: Renames the file to the configured new filename
- Output: File is available in
bsdist/folder
🚨 Requirements
- Node.js (any recent version)
- An existing
package.jsonin your project - A
distfolder with the source file
🐛 Troubleshooting
Common Issues
"No package.json found"
- Make sure you're running the command in a directory with a
package.jsonfile
"Source file does not exist"
- Check that your
distfolder contains the specified filename - Verify the
filenameconfig matches your actual file
"Build command failed"
- The tool will continue with file copying even if the build fails
- Set
buildCommandto""to skip the build step entirely
Debug Mode
Run with more verbose output:
DEBUG=* npx bs-build📝 Example
Here's a complete example of using bs-build-tool in a Vite project:
{
"name": "my-project",
"scripts": {
"build": "vite build",
"bs-build": "node node_modules/bs-build-tool/index.js"
},
"config": {
"filename": "index.html",
"newfile": "production",
"buildCommand": ""
}
}Run the tool:
npm run bs-buildResult:
- Copies
dist/index.html→bsdist/production
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Jackb
Made with ❤️ for the people who have the unfortunate task of designing AV ui's that run on a BrightSign player.
