Skip to content

Commit 31a73a0

Browse files
committed
Added dist build Node.js script
1 parent 7fa21ef commit 31a73a0

File tree

6 files changed

+329
-5
lines changed

6 files changed

+329
-5
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ sysinfo.txt
3434
*.apk
3535
*.unitypackage
3636
/Logs/Packages-Update.log
37+
38+
# Node.js
39+
node_modules
40+
dist
File renamed without changes.

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ https://www.youtube.com/watch?v=YCMvUCxzWz8
105105
+ [Custom Conditions](#custom-conditions)
106106
+ [Custom Composites](#custom-composites)
107107
+ [Custom Decorators](#custom-decorators)
108+
* [Development Environment](#development-environment)
108109
* [Submitting your own actions, conditions, ect](#submitting-code-to-this-project)
109110

110111
## Example Scene
@@ -558,11 +559,18 @@ public static class BehaviorTreeBuilderExtensions {
558559
}
559560
```
560561

562+
## Development Environment
563+
564+
If you wish to run to run the development environment you'll need to install [node.js](#). Then run the following from the root once.
565+
566+
`npm install`
567+
568+
If you wish to create a build run `npm run build` from the root and it will populate the `dist` folder.
569+
561570
## Submitting code to this project
562571

563-
Please fill out the following details if you'd like to contribute new code to this project.
572+
Please do the following if you wish to contribute code to this project.
564573

565-
1. Clone this project for the core code with tests
566-
2. Put your new code in a separate branch
567-
3. Make sure your new code is reasonably tested to demonstrate it works (see `*Test.cs` files)
568-
4. Submit a pull request to the `develop` branch
574+
1. Create your feature in a `feature` branch off of `develop`
575+
2. Make sure your new code is reasonably tested to demonstrate it works (see `*Test.cs` files)
576+
3. Submit a pull request to the `develop` branch

create-dist.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const del = require('del');
2+
const copyDir = require('copy-dir');
3+
const fs = require('fs');
4+
5+
const OUTPUT = 'dist';
6+
const SOURCE = 'Assets/FluidBehaviorTree';
7+
const COPY_FILES = [
8+
'README.md',
9+
'CHANGELOG.md',
10+
'LICENSE.md',
11+
];
12+
13+
async function init () {
14+
await del([OUTPUT]);
15+
16+
copyFiles();
17+
updateVersionNumber();
18+
}
19+
20+
function copyFiles() {
21+
copyDir.sync(SOURCE, OUTPUT, {});
22+
COPY_FILES.forEach((file) => {
23+
if (!fs.existsSync(file)) return;
24+
fs.copyFileSync(file, `${OUTPUT}/${file}`);
25+
});
26+
}
27+
28+
function updateVersionNumber() {
29+
const npmPackage = JSON.parse(fs.readFileSync('package.json').toString());
30+
const unityPackage = JSON.parse(fs.readFileSync(`${SOURCE}/package.json`).toString());
31+
unityPackage.version = npmPackage.version;
32+
fs.writeFileSync(`${OUTPUT}/package.json`, JSON.stringify(unityPackage, null, 2));
33+
}
34+
35+
init();

package-lock.json

Lines changed: 254 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "com.fluid.behavior-tree",
3+
"version": "1.0.0",
4+
"description": "Light distribution scripting for cloud support with Fluid Behaivor Tree",
5+
"main": "create-dist.js",
6+
"scripts": {
7+
"build": "node create-dist.js"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/ashblue/fluid-behavior-tree.git"
12+
},
13+
"author": "Ash Blue (twitter: @AshBlueWD)",
14+
"license": "ISC",
15+
"bugs": {
16+
"url": "https://github.com/ashblue/fluid-behavior-tree/issues"
17+
},
18+
"homepage": "https://github.com/ashblue/fluid-behavior-tree#readme",
19+
"devDependencies": {
20+
"copy-dir": "^1.1.0",
21+
"del": "^4.1.1"
22+
}
23+
}

0 commit comments

Comments
 (0)