Compare commits

..

No commits in common. "72230e07b020699bec70dcad6d9d3a6202714b27" and "a2c2a5f7b600dfb7652b08181dcc939499415a7c" have entirely different histories.

3 changed files with 2 additions and 26 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@flashwave/assproc",
"version": "0.2.0",
"version": "0.0.1",
"description": "Personal frontend asset processing tool",
"main": "index.js",
"scripts": {

View file

@ -3,7 +3,6 @@ import apHtml from './handlers/html.js';
import apJs from './handlers/js.js';
import apTwig from './handlers/twig.js';
import apWebManifest from './handlers/webmanifest.js';
import { housekeep } from './housekeep.js';
const DEFAULT_ENV = {
debug: false,
@ -11,7 +10,6 @@ const DEFAULT_ENV = {
public: undefined,
order: undefined,
vars: undefined,
housekeep: undefined,
swc: {
es: 'es2021',
jsx: '$er',
@ -51,8 +49,6 @@ const public = {
if(typeof vars !== 'object' || vars === null)
throw 'env.vars must be a non-null object';
const files = {};
for(const type of order) {
if(!(type in types))
throw `${type} is not a supported build task type`;
@ -61,35 +57,15 @@ const public = {
if(!Array.isArray(typeTasks))
throw 'children of the tasks object must be arrays';
console.info(`Building '${type}' assets...`);
const handler = types[type];
for(const task of typeTasks) {
console.info(` => ${task.source}...`);
const path = await handler.process(task, vars);
if(typeof task.varsName === 'string')
vars[task.varsGroup ?? ''][task.varsName] = path;
files[task.source] = path;
}
}
const hkDirs = env.housekeep ?? [];
if(!Array.isArray(hkDirs))
throw 'env.housekeep must be an array of folder paths';
if(hkDirs.length > 0) {
console.info(`Doing some housekeeping...`);
for(const path of hkDirs) {
console.info(` => ${path}...`);
housekeep(path);
}
}
return files;
},
};