Toolchain set up complete

Gulp is the task runner with Composer for API dependencies. All initial
dependencies are installed. Ready for work.
This commit is contained in:
Matthew Ross 2016-04-20 20:20:04 -04:00
parent 42daa15063
commit 27c1710ebf
7 changed files with 691 additions and 5 deletions

13
.gitignore vendored
View File

@ -1,5 +1,8 @@
api/taskboard.db
api/uploads/*
tags
.idea/*
vendor/
.sass-cache
.coverrun
.coverdata
node_modules
dist
src/api/vendor
coverage.html

184
gulpfile.js Normal file
View File

@ -0,0 +1,184 @@
'use strict';
let gulp = require('gulp'),
fs = require('fs'),
del = require('del'),
merge = require('merge-stream'),
concat = require('gulp-concat'),
composer = require('gulp-composer'),
tsc = require('gulp-typescript'),
jsMinify = require('gulp-uglify'),
mocha = require('gulp-mocha'),
coverage = require('gulp-coverage'),
scsslint = require('gulp-scss-lint'),
sass = require('gulp-sass'),
cssPrefixer = require('gulp-autoprefixer'),
cssMinify = require('gulp-cssnano'),
imageMin = require('gulp-imagemin'),
node,
spawn = require('child_process').spawn,
paths = {
bourbon: 'node_modules/bourbon/app',
neat: 'node_modules/bourbon-neat/app',
scss_base: 'node_modules/scss-base/src',
tsconfig: 'src/app/tsconfig.json',
ts: 'src/app/**/*.ts',
tests: 'test/**/*.spec.js',
html: [
'src/**/*.html',
'src/.htaccess'
],
images: 'src/images/**/*.*',
scss: 'src/scss/**/*.scss',
scssmain: 'src/scss/main.scss',
api: [
'src/api/**/*.*',
'src/api/.htaccess',
'!src/api/composer.*'
],
vendor: [
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/es6-shim/es6-shim.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/rxjs/bundles/Rx.js',
'node_modules/angular2/bundles/angular2.dev.js',
'node_modules/angular2/bundles/router.dev.js',
'node_modules/angular2/bundles/http.dev.js'
]
};
gulp.task('clean', () => {
return del('dist');
});
gulp.task('html', () => {
return gulp.src(paths.html)
.pipe(gulp.dest('dist/'));
});
gulp.task('images', () => {
return gulp.src(paths.images)
.pipe(imageMin())
.pipe(gulp.dest('dist/images/'));
});
gulp.task('lintScss', () => {
return gulp.src(paths.scss)
.pipe(scsslint({ config: 'lint.yml' }));
});
gulp.task('styles', () => {
return gulp.src(paths.scssmain)
.pipe(sass({
precision: 10,
includePaths: [
paths.bourbon,
paths.neat,
paths.scss_base
]
}))
.pipe(concat('styles.css'))
.pipe(cssPrefixer())
.pipe(gulp.dest('dist/css/'));
});
gulp.task('tsc', () => {
let tsProject = tsc.createProject(paths.tsconfig),
tsResult = tsProject.src()
.pipe(tsc(tsProject));
return tsResult.js
.pipe(gulp.dest('dist/app/'));
});
gulp.task('vendor', () => {
return gulp.src(paths.vendor)
.pipe(concat('vendor.js'))
.pipe(gulp.dest('dist/js/'));
});
gulp.task('minify', () => {
let js = gulp.src('dist/js/vendor.js')
.pipe(jsMinify())
.pipe(gulp.dest('dist/js/'));
let styles = gulp.src('dist/css/styles.css')
.pipe(cssMinify())
.pipe(gulp.dest('dist/css/'));
return merge(js, styles);
});
gulp.task('composer', () => {
return composer({
'working-dir': 'src/api'
});
});
gulp.task('api', () => {
return gulp.src(paths.api)
.pipe(gulp.dest('dist/api/'));
});
gulp.task('test', ['tsc', 'vendor'], () => {
return gulp.src('test/**/*.spec.js')
.pipe(mocha());
});
gulp.task('coverage', ['tsc', 'vendor'], () => {
return gulp.src('test/**/*.spec.js')
.pipe(coverage.instrument({
pattern: ['dist/app/**/*.js']
}))
.pipe(mocha())
.pipe(coverage.gather())
.pipe(coverage.format())
.pipe(gulp.dest('./'));
});
gulp.task('fb-flo', () => {
if (node) {
node.kill();
}
node = spawn('node', ['flo.js'], { stdio: 'inherit' });
node.on('close', () => {
console.log('Exiting fb-flo.');
});
});
gulp.task('watch', () => {
let watchTs = gulp.watch(paths.ts, ['tsc']),
watchScss = gulp.watch(paths.scss, ['lintScss', 'styles']),
watchHtml = gulp.watch(paths.html, ['html']),
watchImages = gulp.watch(paths.images, ['images']),
watchApi = gulp.watch(paths.api, ['api']),
onChanged = (event) => {
console.log('File ' + event.path + ' was ' + event.type + '. Running tasks...');
};
gulp.start('fb-flo');
watchTs.on('change', onChanged);
watchScss.on('change', onChanged);
watchHtml.on('change', onChanged);
watchImages.on('change', onChanged);
watchApi.on('change', onChanged);
});
gulp.task('watchtests', () => {
let watchTests =gulp.watch(paths.tests, ['test']),
watchTs = gulp.watch(paths.ts, ['test']),
onChanged = (event) => {
console.log('File ' + event.path + ' was ' + event.type + '. Running tasks...');
};
watchTests.on('change', onChanged);
watchTs.on('change', onChanged);
});
gulp.task('default', ['tsc', 'vendor', 'html', 'images', 'lintScss', 'styles', 'api'], () => {
fs.chmod('dist/api', '0777');
});

9
lint.yml Normal file
View File

@ -0,0 +1,9 @@
linters:
Indentation:
width: 4
NestingDepth:
max_depth: 4
SelectorDepth:
max_depth: 4

59
package.json Normal file
View File

@ -0,0 +1,59 @@
{
"name": "taskboard",
"version": "1.0.0",
"description": "A Kanban-inspired app for keeping track of things that need to get done.",
"main": "index.js",
"private": true,
"scripts": {
"test": "gulp test",
"postinstall": "gulp composer"
},
"repository": {
"type": "git",
"url": "git+https://kiswa@github.com/kiswa/TaskBoard.git"
},
"keywords": [
"Kanban",
"board",
"kanban",
"board",
"task",
"task",
"board",
"taskboard"
],
"author": "Matthew Ross <root@matthewross.me> (https://matthewross.me)",
"license": "MIT",
"bugs": {
"url": "https://github.com/kiswa/TaskBoard/issues"
},
"homepage": "https://github.com/kiswa/TaskBoard#readme",
"devDependencies": {
"angular2": "^2.0.0-beta.15",
"bourbon": "^4.2.7",
"bourbon-neat": "^1.7.4",
"chai": "^3.5.0",
"del": "^2.2.0",
"es6-shim": "^0.35.0",
"fb-flo": "^0.5.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-chmod": "^1.3.0",
"gulp-composer": "^0.4.0",
"gulp-concat": "^2.6.0",
"gulp-coverage": "^0.3.38",
"gulp-cssnano": "^2.1.2",
"gulp-imagemin": "^2.4.0",
"gulp-mocha": "^2.2.0",
"gulp-sass": "^2.2.0",
"gulp-scss-lint": "^0.3.9",
"gulp-typescript": "^2.13.0",
"gulp-uglify": "^1.5.3",
"merge-stream": "^1.0.0",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.2",
"scss-base": "^1.0.0",
"systemjs": "^0.19.26",
"zone.js": "^0.6.12"
}
}

10
src/api/composer.json Normal file
View File

@ -0,0 +1,10 @@
{
"require": {
"monolog/monolog": "^1.18",
"gabordemooij/redbean": "^4.3",
"slim/slim": "^3.3"
},
"autoload": {
"classmap": [ "controllers", "models" ]
}
}

408
src/api/composer.lock generated Normal file
View File

@ -0,0 +1,408 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "0ad3a462d8daa76553b194d3c9f07435",
"content-hash": "8bd7c11037505b9b9a6440a2c1b50fc6",
"packages": [
{
"name": "container-interop/container-interop",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/container-interop/container-interop.git",
"reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e",
"reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Interop\\Container\\": "src/Interop/Container/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
"time": "2014-12-30 15:22:37"
},
{
"name": "gabordemooij/redbean",
"version": "v4.3.1",
"source": {
"type": "git",
"url": "https://github.com/gabordemooij/redbean.git",
"reference": "f1f572ddac226d047d730444927794321ee9aca6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/gabordemooij/redbean/zipball/f1f572ddac226d047d730444927794321ee9aca6",
"reference": "f1f572ddac226d047d730444927794321ee9aca6",
"shasum": ""
},
"require": {
"php": ">=5.3.4"
},
"type": "library",
"autoload": {
"psr-4": {
"RedBeanPHP\\": "RedBeanPHP"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"New BSD and GPLv2"
],
"authors": [
{
"name": "Gabor de Mooij",
"email": "gabor@redbeanphp.com",
"homepage": "http://redbeanphp.com"
}
],
"description": "RedBeanPHP ORM",
"homepage": "http://redbeanphp.com/",
"keywords": [
"orm"
],
"time": "2015-12-28 19:46:34"
},
{
"name": "monolog/monolog",
"version": "1.19.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf",
"reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"provide": {
"psr/log-implementation": "1.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"jakub-onderka/php-parallel-lint": "0.9",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
"phpunit/phpunit": "~4.5",
"phpunit/phpunit-mock-objects": "2.3.0",
"raven/raven": "^0.13",
"ruflin/elastica": ">=0.90 <3.0",
"swiftmailer/swiftmailer": "~5.3"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"raven/raven": "Allow sending log messages to a Sentry server",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "http://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"time": "2016-04-12 18:29:35"
},
{
"name": "nikic/fast-route",
"version": "v0.6.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/FastRoute.git",
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/FastRoute/zipball/31fa86924556b80735f98b294a7ffdfb26789f22",
"reference": "31fa86924556b80735f98b294a7ffdfb26789f22",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"psr-4": {
"FastRoute\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov",
"email": "nikic@php.net"
}
],
"description": "Fast request router for PHP",
"keywords": [
"router",
"routing"
],
"time": "2015-06-18 19:15:47"
},
{
"name": "pimple/pimple",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a",
"reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Pimple": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Pimple, a simple Dependency Injection Container",
"homepage": "http://pimple.sensiolabs.org",
"keywords": [
"container",
"dependency injection"
],
"time": "2015-09-11 15:10:35"
},
{
"name": "psr/http-message",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2015-05-04 20:22:00"
},
{
"name": "psr/log",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-0": {
"Psr\\Log\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2012-12-21 11:40:51"
},
{
"name": "slim/slim",
"version": "3.3.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "939f2e85d57508de9cff241d10091cd972f221c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/939f2e85d57508de9cff241d10091cd972f221c3",
"reference": "939f2e85d57508de9cff241d10091cd972f221c3",
"shasum": ""
},
"require": {
"container-interop/container-interop": "^1.1",
"nikic/fast-route": "^0.6",
"php": ">=5.5.0",
"pimple/pimple": "^3.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0",
"squizlabs/php_codesniffer": "^2.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Slim\\": "Slim"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Allen",
"email": "rob@akrabat.com",
"homepage": "http://akrabat.com"
},
{
"name": "Josh Lockhart",
"email": "hello@joshlockhart.com",
"homepage": "https://joshlockhart.com"
},
{
"name": "Gabriel Manricks",
"email": "gmanricks@me.com",
"homepage": "http://gabrielmanricks.com"
},
{
"name": "Andrew Smith",
"email": "a.smith@silentworks.co.uk",
"homepage": "http://silentworks.co.uk"
}
],
"description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs",
"homepage": "http://slimframework.com",
"keywords": [
"api",
"framework",
"micro",
"router"
],
"time": "2016-03-10 21:37:40"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

13
src/app/tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}