@onceforall/webpack-utils-plugin
v2.0.2
Published
Bibliothèque de plugins Webpack utilitaires pour les projets OFA
Downloads
99
Maintainers
Readme
@onceforall/webpack-utils-plugin
Webpack utility plugins library for OFA projects.
Currently includes:
- VersionJsonPlugin: Generates a
version.jsonfile with build info (date, git hash, version, branch).
Installation
# Via GitHub (recommended for internal projects)
npm install github:AttestationLegale/webpack-utils-plugin#v1.0.0
# Or via npm if published
npm install @onceforall/webpack-utils-pluginAvailable plugins
VersionJsonPlugin
Automatically generates a version.json file containing build information:
buildDate: ISO string of the build datehash: current git commit hash (or 'unknown' if not available)version: from yourpackage.json(or '0.0.0' if not found)branch: current git branch (or 'unknown' if not available)
Usage
const { VersionJsonPlugin } = require('@onceforall/webpack-utils-plugin');
module.exports = {
plugins: [
new VersionJsonPlugin(),
// ...other plugins
]
};Available options
You can override detected values by passing options if you already have them:
| Option | Type | Default | Description |
|----------|--------|-----------------|------------------------------------|
| hash | string | auto-detected | Git commit hash |
| version| string | from package.json| Project version |
| branch | string | auto-detected | Git branch name |
Example with custom values
new VersionJsonPlugin({
hash: 'custom-hash',
version: '1.2.3',
branch: 'main'
})Output format
The generated version.json will look like:
{
"buildDate": "2025-12-15T12:34:56.000Z",
"hash": "abc123def456",
"version": "1.5.4",
"branch": "feature/simplify-version-json-plugin"
}Extensibility
This library is ready to include more utility plugins in the future. You can import them from the same package as they are added.
Publishing and deployment
You can install via GitHub (recommended for internal projects):
npm install github:AttestationLegale/webpack-utils-plugin#v1.0.0Or add to your package.json:
{
"devDependencies": {
"@onceforall/webpack-utils-plugin": "github:AttestationLegale/webpack-utils-plugin#v1.0.0"
}
}Compatibility
- ✅ Webpack 4+
- ✅ Webpack 5
- ✅ Single-SPA
- ✅ React
- ✅ All types of JavaScript projects
