gitignore cache, --index/cache work, local module relative pathing
parent
af55784d1a
commit
885275d352
|
|
@ -1 +1,2 @@
|
|||
node_modules
|
||||
.cache
|
||||
10
core/aqua.js
10
core/aqua.js
|
|
@ -5,6 +5,8 @@ const log = new Signale({
|
|||
});
|
||||
const interactive = new Signale({interactive: true});
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
require('yargs')
|
||||
.scriptName("aqua")
|
||||
.usage('$0 <cmd> [args]')
|
||||
|
|
@ -31,10 +33,12 @@ return;
|
|||
|
||||
/// this is the base compile function, that the CLI directly calls.
|
||||
async function cliCompile(args) {
|
||||
console.log('things')
|
||||
const {compile} = require('./compiler.js');
|
||||
if(!path.isAbsolute(args.index)) args.index = path.join(process.cwd(), 'index.js');
|
||||
if(!path.isAbsolute(args.cache)) args.cache = path.join(process.cwd(), '.cache');
|
||||
log.debug(path.isAbsolute(args.index));
|
||||
log.debug(args.index);
|
||||
log.debug(process.cwd());
|
||||
if(!path.isAbsolute(args.index)) args.index = path.join(process.cwd(), args.index);
|
||||
if(!path.isAbsolute(args.cache)) args.cache = path.join(process.cwd(), args.cache);
|
||||
|
||||
|
||||
let index = platformPrecompile(args);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ async function createCache({cache: cachePath, index}) {
|
|||
|
||||
for(const symbol in index.Entities) {
|
||||
const module = index.Entities[symbol];
|
||||
|
||||
let code = await retrieveModule(module.From, module.Name);
|
||||
// modules[module.Name] = code;
|
||||
cache.addEntity(module.Name, code);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ const fs = require('fs');
|
|||
module.exports.retrieveModule = retrieveModule;
|
||||
|
||||
function retrieveModule(source, name) {
|
||||
return new Promise (res => {
|
||||
return new Promise ((res, rej) => {
|
||||
fs.readFile(path.join(source, `${name}.js`), (err, data) => {
|
||||
res(data.toString());
|
||||
if(err) return rej(err);
|
||||
else res(data.toString());
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
|
||||
module.exports.entity = class module {
|
||||
async OnStart() {
|
||||
console.log('starting...');
|
||||
await new Promise(res => {
|
||||
setTimeout(_ => {
|
||||
console.log('done');
|
||||
res();
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"Name": "module",
|
||||
"From": "./../modules/",
|
||||
"Data": {
|
||||
"Thing": 5
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
const path = require('path');
|
||||
const {Signale} = require('signale');
|
||||
const log = new Signale({
|
||||
scope: 'CLI'
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
Parameters: {
|
||||
Source: './../modules/'
|
||||
Source: path.join(__dirname, './../modules/')
|
||||
},
|
||||
Entities: {
|
||||
Tester: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue