Compare commits
10 commits
b25e0d7390
...
36414468dc
Author | SHA1 | Date | |
---|---|---|---|
36414468dc | |||
90f80a8ecd | |||
5f7df9e5b0 | |||
338b200246 | |||
11bed96f9d | |||
4d7162fea1 | |||
d0c17dc7f2 | |||
299150e57a | |||
e4871feca2 | |||
69d4572635 |
6 changed files with 15 additions and 9 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@flashwave/assproc",
|
||||
"version": "0.6.0",
|
||||
"version": "0.11.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@flashwave/assproc",
|
||||
"version": "0.6.0",
|
||||
"version": "0.11.0",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@swc/core": "^1.5.25",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@flashwave/assproc",
|
||||
"version": "0.6.0",
|
||||
"version": "0.11.0",
|
||||
"description": "Personal frontend asset processing tool",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -27,7 +27,7 @@ module.exports = function(env) {
|
|||
|
||||
return {
|
||||
process: async (task, vars) => {
|
||||
const srcPath = path.join(env.source, task.source);
|
||||
const srcPath = pathJoin(env.source, task.source);
|
||||
|
||||
const output = await pcss.process(
|
||||
await combine.folder(srcPath, {
|
||||
|
|
|
@ -22,16 +22,16 @@ module.exports = function(env) {
|
|||
|
||||
return {
|
||||
process: async (task, vars) => {
|
||||
let { stdout, stderr } = await exec(strtr(env.twig?.cmdFormat ?? ':command :path', {
|
||||
':command': env.twig?.cmdPathFull ?? pathJoin(env.root, env.twig?.cmdPath ?? 'tools/render-tpl'),
|
||||
':path': task.source,
|
||||
let { stdout, stderr } = await exec(strtr(env.twig?.cmdFormat ?? '{command} {path}', {
|
||||
'command': env.twig?.cmdPathFull ?? pathJoin(env.root, env.twig?.cmdPath ?? 'tools/render-tpl'),
|
||||
'path': task.source,
|
||||
}));
|
||||
|
||||
if(stdout.trim() === '')
|
||||
throw stderr;
|
||||
|
||||
if(!env.debug)
|
||||
stdout = await htmlminify(stdout, htmlMinifyOptions);
|
||||
stdout = await htmlminify(stdout, MINIFY_OPTS);
|
||||
|
||||
const path = pathJoin(
|
||||
task.target ?? '',
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = function(env) {
|
|||
body = { ...body, ...task.body };
|
||||
|
||||
if(typeof task.icons === 'string') {
|
||||
const iconsDir = path.join(env.public, task.icons);
|
||||
const iconsDir = pathJoin(env.public, task.icons);
|
||||
|
||||
if(fs.existsSync(iconsDir)) {
|
||||
const files = (await fs.promises.readdir(iconsDir)).sort((a, b) => a.localeCompare(b, undefined, {
|
||||
|
|
|
@ -33,9 +33,15 @@ module.exports.process = async (env, tasks) => {
|
|||
const files = {};
|
||||
|
||||
for(const type of order) {
|
||||
if(!types.hasOwnProperty(type))
|
||||
continue;
|
||||
|
||||
if(!(type in types))
|
||||
throw `${type} is not a supported build task type`;
|
||||
|
||||
if(!(type in tasks))
|
||||
continue;
|
||||
|
||||
const typeTasks = tasks[type];
|
||||
if(!Array.isArray(typeTasks))
|
||||
throw 'children of the tasks object must be arrays';
|
||||
|
|
Loading…
Reference in a new issue