0.2.8 • Published 1 year ago
launchpack-assemble v0.2.8
LaunchPack Assemble
A TypeScript assembly engine for LaunchPack.
Inspired by Fabricator and Fabricator Assemble
Usage
const { LaunchPackAssembler } = require('launchpack-assemble');
const assembler = new LaunchPackAssembler(options);
assembler.assemble();
Options
Default Object
{
layout: 'default',
layouts: ['src/views/layouts/*'],
layoutIncludes: ['src/views/layouts/includes/*'],
views: ['src/views/**/*', '!src/views/+(layouts)/**'],
materials: ['src/materials/**/*'],
data: ['src/data/**/*.{json,yml}'],
docs: ['src/docs/**/*.md'],
keys: {
materials: 'materials',
views: 'views',
docs: 'docs',
},
dest: 'dist',
onError: undefined,
logErrors: false,
baseUrl: '',
GLOBAL: {},
helpers: {},
}
Option | Type | Default | Description |
---|---|---|---|
baseUrl | string | '' | Changes the baseurl path. |
data | string[] | ['src/data/**/*.{json,yml}'] | Paths to get data for views written in JSON or YAML. |
dest | string | 'dist' | Name of the destination folder of compiled files. |
docs | string[] | ['src/docs/**/*.md'] | Paths to markdown files containing documentation. |
GLOBAL | object | {} | Holds global values to use across the instance. Example: {{ GLOBAL.MY_VARIABLE }} |
helpers | object | {} | Custom handlebars helpers. Example: { hello: () => 'world' } |
keys | object | { materials: 'materials', views: 'views', docs: 'docs' } | Defines the names views will use when accessing different components. |
layout | string | 'default' | Name of the default layout template. |
layouts | string[] | ['src/views/layouts/*'] | Paths to files that are used as layout templates. |
layoutIncludes | string[] | ['src/views/layouts/includes/*'] | Paths to includes for layout templates. |
logErrors | boolean | false | If the assembler will log errors to the console instead of exiting. |
materials | string[] | ['src/materials/**/*'] | Paths to the materials to build your design system. |
onError | function | undefined | Function to run if there is an error. Takes an Error parameter. |
views | string[] | ['src/views/**/*', '!src/views/+(layouts)/**'] | Paths to pages to pass through the assembler. |
Development
Commands
npm run build
- Builds the project
npm run commit
- Runs commitizen to create a commit
npm run prettier:check
- Checks if all the files conform to the Prettier settings
npm run prettier:write
- Checks and fixes files to conform to the Prettier settings
npm run release
- Runs Standard Version to automate versioning
npm run test
- Runs all tests
npm run validate
- Runs all commands to validate files and tests
Committing Changes
This project uses the Conventional Commits Specification. Follow this process when committing changes:
- Run
git add .
to stage all files. Or add files individually - Run
npm run commit
instead to initialize the commit - Follow the prompts to ensure the commit stays under the specification
- If there are any errors, fix them and start back at step 1
Releases
- Run
npm run release
to auto-version the project based on commits and push to master
Definitions
- Layouts: Templates to wrap pages
- Views: Individual pages
- Materials: Components to be added to views
- Data: Data to be used in views
- Docs: Markdown files created for documentation