To build the library simply execute the command npm run build
which runs the script scripts/build.js
.
The script finds all components, components types and services files then build each file separately with Vue-CLI and when its done it creates the library index file main.js
that exports all the compiled files.
Vue-CLI was chosen due to providing the best support for Vue and its ability to do all the necessary build steps.
- Components: all files with the extension
.vue
in the pathsrc/components
(example:HdAlert.vue
) - Component Types: all files with the extension
.js
in the pathsrc/components
(example:HdAlertTypes.js
) - Services: all files with the extension
.js
in the pathsrc/services
(example:date.js
)
To ignore compilation of a certain file, add its name to the array blackListedFiles
in build.js#L14
For each compiled file the script outputs a minified UMD bundle for consuming directly in browsers or with AMD loaders.
Example: dist/HdAlert.umd.min.js
- All compiled services output file name case is converted to PascalCase and suffixed with
Service
to maintain the previous exported services naming pattern. Example:src/services/event-emitter.js
->dist/EventEmitterService.umd.min.js