Skip to content
This repository has been archived by the owner on Sep 4, 2022. It is now read-only.

Commit

Permalink
npm scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpeiris committed May 11, 2019
1 parent 496720f commit 5ee2cdb
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .browser-sync.config.js
@@ -0,0 +1,6 @@
module.exports = {
open: false,
notify: false,
ghostMode: false,
server: { directory: false }
};
5 changes: 4 additions & 1 deletion .eslintrc.js
Expand Up @@ -3,5 +3,8 @@ module.exports = {
env: { browser: true, es6: true, node: true },
plugins: ["prettier"],
extends: ["prettier", "eslint:recommended"],
rules: { "prettier/prettier": "error" }
rules: {
"prettier/prettier": "error",
"no-console": "off"
}
};
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
# TowerDefenseECS

TowerDefenseECS aims to compare the API and performance characteristics of ECS libraries.

## Development

- Install: `npm ci`
- Run all libraries: `npm start`
- Run a single library: `npm start <library>`

Load http://localhost:3000/
5 changes: 5 additions & 0 deletions package.json
@@ -1,5 +1,10 @@
{
"name": "towerdefenseecs",
"private": true,
"scripts": {
"install": "node ./scripts/install.js",
"start": "node ./scripts/start.js"
},
"dependencies": {
"rstatsjs": "^1.0.1",
"three": "^0.101.1"
Expand Down
7 changes: 7 additions & 0 deletions scripts/install.js
@@ -0,0 +1,7 @@
const fs = require("fs");
const cp = require("child_process");

const libraries = "src/libraries";
for (const dir of fs.readdirSync(libraries)) {
console.log(cp.execSync("npm ci", { cwd: `${libraries}/${dir}` }).toString());
}
15 changes: 0 additions & 15 deletions scripts/install.sh

This file was deleted.

28 changes: 28 additions & 0 deletions scripts/start.js
@@ -0,0 +1,28 @@
const fs = require("fs");
const cp = require("child_process");

const libraries = "src/libraries";

const singleLibrary = process.argv[2];
if (singleLibrary) {
runLibrary(singleLibrary);
} else {
fs.readdirSync(libraries).forEach(runLibrary);
}

logOutput(
cp.exec(
`npx browser-sync start --config .browser-sync.config.js --files "*.html" --files "${libraries}/*/dist/main.js"`
)
);

function runLibrary(library) {
const libraryDir = `${libraries}/${library}`;
console.log("BPDEBUG libraryDir", libraryDir);
logOutput(cp.exec(`npx webpack "${libraryDir}/main.js" -o "${libraryDir}/dist/main.js" --mode development -w`));
}

function logOutput(process) {
process.stdout.on("data", console.log);
process.stderr.on("data", console.error);
}
20 changes: 0 additions & 20 deletions scripts/start.sh

This file was deleted.

0 comments on commit 5ee2cdb

Please sign in to comment.