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", "name": "@flashwave/assproc",
"version": "0.2.0", "version": "0.0.1",
"description": "Personal frontend asset processing tool", "description": "Personal frontend asset processing tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View file

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