kiss-express projects smarter dts2hx handling. Close #164
This commit is contained in:
19
kiss/build-scripts/dts2hx-externs/KillVersionReqs.hx
Normal file
19
kiss/build-scripts/dts2hx-externs/KillVersionReqs.hx
Normal file
@@ -0,0 +1,19 @@
|
||||
package;
|
||||
|
||||
import sys.io.File;
|
||||
import sys.FileSystem;
|
||||
import haxe.Json;
|
||||
|
||||
class KillVersionReqs {
|
||||
static function main() {
|
||||
var libs = FileSystem.readDirectory("libs");
|
||||
for (lib in libs) {
|
||||
var haxelib = 'libs/$lib/$lib/haxelib.json';
|
||||
var json = Json.parse(File.getContent(haxelib));
|
||||
for (dependency => version in (json.dependencies : haxe.DynamicAccess<String>)) {
|
||||
json.dependencies[dependency] = "";
|
||||
}
|
||||
File.saveContent(haxelib, Json.stringify(json));
|
||||
}
|
||||
}
|
||||
}
|
33
kiss/build-scripts/dts2hx-externs/regenerate.sh
Normal file
33
kiss/build-scripts/dts2hx-externs/regenerate.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ -d libs ]; then
|
||||
rm -rf libs
|
||||
fi
|
||||
|
||||
if [ -d .haxelib ]; then
|
||||
rm -rf .haxelib
|
||||
fi
|
||||
|
||||
mkdir libs
|
||||
npm install .
|
||||
|
||||
cd .haxelib
|
||||
|
||||
libs=*
|
||||
for lib in $libs; do
|
||||
mv $lib ../libs/$lib
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf .haxelib
|
||||
|
||||
cd libs
|
||||
libs=*
|
||||
for lib in $libs; do
|
||||
mv $lib/**/ $lib/$lib
|
||||
haxelib dev $lib $lib/$lib/
|
||||
done
|
||||
cd ..
|
||||
cp $(haxelib libpath kiss)/build-scripts/dts2hx-externs/KillVersionReqs.hx ./
|
||||
haxe --main KillVersionReqs --interp
|
||||
rm KillVersionReqs.hx
|
@@ -181,7 +181,7 @@ class Main {
|
||||
}
|
||||
|
||||
static function newExpressProject(args:Array<String>) {
|
||||
var title = promptFor("title");
|
||||
var title = promptFor("title (lower-case!)").toLowerCase();
|
||||
var pkg = title.replace("-", "_");
|
||||
var kissExpressLibPath = new Process("haxelib", ["libpath", "kiss-express"]).stdout.readAll().toString().trim();
|
||||
var workingDir = Sys.args().pop();
|
||||
|
1
projects/kiss-cli-tests/.gitignore
vendored
1
projects/kiss-cli-tests/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
TestNewProject/
|
||||
TestNewExpressProject/
|
||||
|
1
projects/kiss-cli-tests/new-express-project-input.txt
Normal file
1
projects/kiss-cli-tests/new-express-project-input.txt
Normal file
@@ -0,0 +1 @@
|
||||
TestNewExpressProject
|
@@ -1,6 +1,15 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Test kiss new-project command
|
||||
if [ -d TestNewProject ]; then
|
||||
rm -rf TestNewProject
|
||||
fi
|
||||
cat new-project-input.txt | haxelib run kiss new-project && (cd TestNewProject && sh test.sh)
|
||||
|
||||
# Test kiss new-express-project command
|
||||
if [ -d testnewexpressproject ]; then
|
||||
rm -rf testnewexpressproject
|
||||
fi
|
||||
cat new-express-project-input.txt | haxelib run kiss new-express-project && (cd testnewexpressproject && sh test.sh)
|
||||
|
||||
# TODO test other kiss project templates
|
||||
|
1
projects/kiss-express/template/.gitignore
vendored
1
projects/kiss-express/template/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
.haxelib/
|
||||
libs/
|
||||
index.js
|
@@ -1,5 +1,6 @@
|
||||
(let [app (Express.call)
|
||||
port 3000]
|
||||
(app.get "/" ->[req res next] (res.send "Hello World!"))
|
||||
(app.listen port ->(print "kiss-express listening at http://localhost:$port")))
|
||||
(#unless test
|
||||
(app.listen port ->(print "kiss-express listening at http://localhost:$port"))))
|
||||
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
npm install .
|
||||
haxe build.hxml
|
||||
if [ ! -d node_modules ]; then
|
||||
$(haxelib libpath kiss)/build-scripts/dts2hx-externs/regenerate.sh
|
||||
fi
|
||||
|
||||
haxe -D test build.hxml
|
3
projects/nat-globelet-playground/.gitignore
vendored
3
projects/nat-globelet-playground/.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
.haxelib/
|
||||
index.js
|
||||
libs/
|
||||
index.js
|
||||
|
@@ -10,8 +10,8 @@
|
||||
"devDependencies": {
|
||||
"dts2hx": "^0.19.0"
|
||||
},
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"postinstall": "dts2hx --all"
|
||||
}
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
@@ -1,24 +1,7 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ ! -d node_modules ]; then
|
||||
npm install .
|
||||
$(haxelib libpath kiss)/build-scripts/dts2hx-externs/regenerate.sh
|
||||
fi
|
||||
# npm install creates a .haxelib folder which needs to be pointed to the dependencies
|
||||
if [ ! -d .haxelib/kiss ]; then
|
||||
cp .haxelib/express/.current .haxelib/express/.current.tmp
|
||||
(cp ../../kiss/build-scripts/common-args.hxml ./ && haxelib install all --always && rm common-args.hxml)
|
||||
# install all introduces an out-of-date express haxelib
|
||||
mv .haxelib/express/.current.tmp .haxelib/express/.current
|
||||
|
||||
haxelib dev kiss ../../kiss
|
||||
projects=$(ls ..)
|
||||
for project in $projects
|
||||
do
|
||||
if [ -e ../${project}/haxelib.json ]
|
||||
then
|
||||
haxelib dev $project ../$project
|
||||
# the word project has lost all meaning at this point
|
||||
fi
|
||||
done
|
||||
fi
|
||||
haxe -D test build.hxml
|
Reference in New Issue
Block a user