@kurohyou/k-scaffold
Version:
This framework simplifies the task of writing code for Roll20 character sheets. It aims to provide an easier interface between the html and sheetworkers with some minor css templates.
40 lines (35 loc) • 1.11 kB
JavaScript
import k from './index.js';
import path from 'path';
const [,,...args] = process.argv;
const baseDir = process.cwd();
const mConfigPath = path.resolve(baseDir,'./k.config.mjs');
const mConfigURL = new URL(mConfigPath, 'file:');
const jConfigPath = path.resolve(baseDir,'./k.config.js');
const jConfigURL = new URL(jConfigPath, 'file:');
const userOpts = {};
try{
const opts = (await import(mConfigURL.pathname.replace(/\\/g,'/')))?.default;
Object.assign(userOpts,opts);
}catch(err){
try{
const opts = (await import(jConfigURL.pathname.replace(/\\/g,'/')))?.default;
Object.assign(userOpts,opts);
}catch(err){
// Do nothing
}
}
// ['source','destination','testDestination'].forEach((prop) => {
// userOpts[prop] = userOpts[prop] ?
// path.resolve(baseDir,userOpts[prop]) :
// userOpts[prop];
// });
if(args.includes('--watch') || args.includes('--w')){
userOpts.watch = true;
}
process.argv[1] = mConfigPath;
k.all(userOpts);
// console.log('k',k);
// console.log('argv',process.argv);
// console.log(import.meta.url);
// console.log(process.cwd());