travis artifacts

This commit is contained in:
sinclairzx81
2017-08-19 20:13:43 +12:00
parent 21bdaff41b
commit 5b9b4f274c
8 changed files with 78 additions and 34 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
node_modules/
target/
index.js
test.js
+2
View File
@@ -0,0 +1,2 @@
src/
test/
+5
View File
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "7"
before_script:
- npm install
+17 -7
View File
@@ -1,17 +1,27 @@
{
"name": "typebox",
"version": "0.9.0",
"description": "A runtime type system for javascript.",
"main": "./target/index.js",
"test": "node ./target/test.js",
"name": "project-name",
"version": "1.0.0",
"description": "project-name",
"test": "node test",
"scripts": {
"clean": "node tasks clean",
"start": "node tasks start",
"build": "node tasks build",
"test": "node tasks test"
},
"repository": {
"type": "git",
"url": "https://github.com/sinclairzx81/typebox"
"url": "https://github.com/sinclairzx81/project-name"
},
"author": "sinclairzx81",
"license": "MIT",
"devDependencies": {
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.7"
"@types/node": "^8.0.7",
"fsrun": "^0.9.4",
"mocha": "^3.5.0",
"shx": "^0.2.2",
"typescript": "^2.4.2",
"typescript-bundle": "^0.8.6"
}
}
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module" : "amd",
"outFile" : "../index.js",
"removeComments": true,
"lib" : ["es2015","dom"]
}, "files" : [
"index.ts"
]
}
+29 -25
View File
@@ -1,6 +1,7 @@
//------------------------------------------------------
// task helper scripts:
//------------------------------------------------------
const shell = (command) => new Promise((resolve, reject) => {
const { spawn } = require('child_process')
const windows = /^win/.test(process.platform)
@@ -10,6 +11,7 @@ const shell = (command) => new Promise((resolve, reject) => {
ls.stderr.pipe(process.stderr)
ls.on('close', (code) => resolve(code))
})
const watch = (directory, func) => new Promise((resolve, reject) => {
const fs = require("fs")
const path = require("path")
@@ -19,6 +21,7 @@ const watch = (directory, func) => new Promise((resolve, reject) => {
const dirs = stats.filter(stat => stat.stat.isDirectory())
return Promise.all([dirs.map(dir => watch(dir.path, func))])
})
const cli = async (args, tasks) => {
const task = (args.length === 3) ? args[2] : "none"
const func = (tasks[task]) ? tasks[task] : () => {
@@ -30,47 +33,48 @@ const cli = async (args, tasks) => {
//------------------------------------------------------
// constants:
//------------------------------------------------------
const TYPESCRIPT_INDEX = "tsc-bundle ./src/index.ts ./target/index.js --lib es2015,dom --removeComments"
const TYPESCRIPT_TEST = "tsc-bundle ./test/index.ts ./target/test.js --lib es2015,dom --removeComments"
const TYPESCRIPT_SOURCE = "tsc-bundle --project ./src/tsconfig.json"
const TYPESCRIPT_TEST = "tsc-bundle --project ./test/tsconfig.json"
//------------------------------------------------------
// tasks:
//------------------------------------------------------
const clean = async () => {
await shell("shx rm -rf ./node_modules"),
await shell("shx rm -rf ./target")
await shell("shx rm -rf ./index.js")
await shell("shx rm -rf ./test.js")
await shell("shx rm -rf ./node_modules")
}
const install = async () => {
await shell("npm install shx -g")
await shell("npm install typescript -g")
await shell("npm install typescript-bundle -g")
await shell("npm install fsrun -g")
await shell("npm install mocha -g")
const start = async () => {
await shell("npm install")
await shell(`${TYPESCRIPT_SOURCE}`)
await Promise.all([
shell(`${TYPESCRIPT_SOURCE} --watch > /dev/null`),
shell("fsrun ./index.js [node index.js]")
])
}
const test = async () => {
await shell("npm install")
await shell(`${TYPESCRIPT_TEST}`)
await shell(`${TYPESCRIPT_SOURCE}`)
await shell("mocha ./test.js")
await clean()
}
const build = async () => {
await shell("npm install")
await shell("shx mkdir -p ./target")
await shell(`${TYPESCRIPT_INDEX}`)
}
const run = async () => {
await shell("npm install")
await shell("shx mkdir -p ./target")
await shell(`${TYPESCRIPT_TEST}`)
await Promise.all([
shell(`${TYPESCRIPT_TEST} --watch > /dev/null`),
shell("fsrun ./target [mocha target/test]")
])
await shell(`${TYPESCRIPT_SOURCE}`)
}
//------------------------------------------------------
// cli:
//------------------------------------------------------
cli(process.argv, {
install,
clean,
build,
run,
start,
test,
build
}).catch(console.log)
+3 -1
View File
@@ -26,6 +26,8 @@ THE SOFTWARE.
---------------------------------------------------------------------------*/
import * as typebox from "../src/index"
//-------------------------------
// tests
//-------------------------------
@@ -36,7 +38,7 @@ import "./tests/reflect"
import "./tests/infer"
import "./tests/check"
import * as typebox from "../src/index"
+10
View File
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module" : "amd",
"outFile" : "../test.js",
"removeComments": true,
"lib" : ["es2015","dom"]
}, "files" : [
"index.ts"
]
}