Skip to content

Commit

Permalink
domain constitution builder
Browse files Browse the repository at this point in the history
  • Loading branch information
asaccool committed Jul 22, 2019
1 parent 2f5a9d2 commit de676e7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,23 @@
"email": "[email protected]",
"url": "https://github.com/PrivateSky/pskruntime/issues"
},
"directories": {
"lib": "./lib"
},
"engines": {
"node": ">=0.10.0"
},
"main": "./lib/index.js",
"licenses": [
{
"type": "LGPL",
"url": "http://www.gnu.org/licenses/lgpl.html"
}, {
},
{
"type": "MIT"
}

],
"dependencies" : {
"dependencies": {
"browserify": "^16.3.0"
},
"scripts": {
"build": "node ./psknode/bin/scripts/pskbuild.js ./domain/build.json",
"watch": "node ./psknode/bin/scripts/watcher.js --watch ./ --run ./psknode/bin/scripts/psknode.js --ignore=\"/engine/pskbuildtemp/,/builds/devel/,/tests/,/bin/\"",
"start": " node ./psknode/bin/scripts/psknode.js",
"run-tests": "npm run build && node bin/scripts/testrunner.js",
"cmd": "node bin//terminal.js"
"cmd": "node bin//terminal.js",
"build": "node scripts/builder.js"
}
}
40 changes: 40 additions & 0 deletions scripts/builder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const child_process = require("child_process");
const path = require("path");
const fs = require("fs");

const pskBuildPath = path.resolve(path.join(__dirname, "..", "/psknode/bin/scripts/pskbuild.js"));

let domains = process.argv.slice(2);
console.log("Argument domain list: ", domains);

if(domains.length === 0){
let domainsDir = path.join(__dirname, "..", "domains");
console.log(`No domain specified. Directory "${domainsDir}" scan started...`);

let content = fs.readdirSync(domainsDir, {withFileTypes: true});
for(let i=0; i<content.length; i++){
let file = content[i];
if(file.isDirectory()){
domains.push(file.name);
}
}

console.log("Found next domains", domains);
}

for(let i=0; i<domains.length; i++){
let domain = domains[i];
let domainTargetsMap = path.resolve(path.join(__dirname, "..", "domains", domain, "build.json"));
let domainBundlesInput = path.join("bundles", "tmp");
let domainBundlesOutput = path.join("bundles");

console.log("Building domain", domain);
try{
let res = child_process.execSync(`node ${pskBuildPath} ${domainTargetsMap} `+
`--input="${domainBundlesInput}" `+
`--output="${domainBundlesOutput}"`, {cwd: path.resolve(path.join(__dirname, "..", "domains", domain))});
console.log(res.toString());
}catch(err){
console.log(err);
}
}
6 changes: 6 additions & 0 deletions scripts/deployer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require("path");
const fs = require("fs");

let setupCmds = ["pskadmin"];

let cmds = [""];

0 comments on commit de676e7

Please sign in to comment.