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

Commit

Permalink
fix(build): add build tasks back in
Browse files Browse the repository at this point in the history
Removing them from .gitignore as well
  • Loading branch information
plwalters committed Dec 30, 2015
1 parent 30221c6 commit 46b8c48
Show file tree
Hide file tree
Showing 15 changed files with 351 additions and 1 deletion.
Expand Up @@ -17,7 +17,6 @@
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
Expand Down
@@ -0,0 +1,13 @@
var yargs = require('yargs');

var argv = yargs.argv,
validBumpTypes = "major|minor|patch|prerelease".split("|"),
bump = (argv.bump || 'patch').toLowerCase();

if (validBumpTypes.indexOf(bump) === -1) {
throw new Error('Unrecognized bump "' + bump + '".');
}

module.exports = {
bump: bump
};
@@ -0,0 +1,36 @@
{
"bundles": {
"dist/app-build": {
"includes": [
"[*]",
"*.html!text",
"*.css!text"
],
"options": {
"inject": true,
"minify": true
}
},
"dist/aurelia": {
"includes": [
"aurelia-framework",
"aurelia-bootstrapper",
"aurelia-fetch-client",
"aurelia-router",
"aurelia-animator-css",
"aurelia-templating-binding",
"aurelia-templating-resources",
"aurelia-templating-router",
"aurelia-loader-default",
"aurelia-history-browser",
"aurelia-logging-console",
"bootstrap",
"bootstrap/css/bootstrap.css!text"
],
"options": {
"inject": true,
"minify": true
}
}
}
}
@@ -0,0 +1,16 @@
{
"list": [
"index.html",
"config.js",
"favicon.ico",
"LICENSE",
"jspm_packages/system.js",
"jspm_packages/system-polyfills.js",
"jspm_packages/system-csp-production.js",
"styles/styles.css",
"jspm_packages/npm/font-awesome@4.4.0/css/font-awesome.min.css",
"jspm_packages/npm/font-awesome@4.4.0/fonts/*",
"jspm_packages/github/github/fetch@0.9.0.js",
"jspm_packages/github/github/fetch@0.9.0/fetch.js"
]
}
@@ -0,0 +1,20 @@
var appRoot = 'src/';
var outputRoot = 'wwwroot/dist/';
var exporSrvtRoot = 'export/'

module.exports = {
root: appRoot,
source: appRoot + '**/*.ts',
html: appRoot + '**/*.html',
css: appRoot + '**/*.css',
style: 'styles/**/*.css',
output: outputRoot,
exportSrv: exporSrvtRoot,
doc: './doc',
e2eSpecsSrc: 'test/e2e/src/*.ts',
e2eSpecsDist: 'test/e2e/dist/',
dtsSrc: [
'typings/**/*.ts',
'./wwwroot/jspm_packages/**/*.d.ts'
]
}
@@ -0,0 +1,52 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var changed = require('gulp-changed');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var paths = require('../paths');
var assign = Object.assign || require('object.assign');
var notify = require("gulp-notify");
var typescript = require('gulp-typescript');
var tsc = require('typescript');

var tsProject = typescript.createProject('./tsconfig.json', { typescript: tsc });

// transpiles changed es6 files to SystemJS format
// the plumber() call prevents 'pipe breaking' caused
// by errors from other gulp plugins
// https://www.npmjs.com/package/gulp-plumber
gulp.task('build-system', function() {
return gulp.src(paths.dtsSrc.concat(paths.source))
.pipe(plumber())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(changed(paths.output, {extension: '.js'}))
.pipe(typescript(tsProject))
.pipe(sourcemaps.write({includeContent: true}))
.pipe(gulp.dest(paths.output));
});

// copies changed html files to the output directory
gulp.task('build-html', function() {
return gulp.src(paths.html)
.pipe(changed(paths.output, {extension: '.html'}))
.pipe(gulp.dest(paths.output));
});

// copies changed css files to the output directory
gulp.task('build-css', function() {
return gulp.src(paths.css)
.pipe(changed(paths.output, {extension: '.css'}))
.pipe(gulp.dest(paths.output));
});

// this task calls the clean task (located
// in ./clean.js), then runs the build-system
// and build-html tasks in parallel
// https://www.npmjs.com/package/gulp-run-sequence
gulp.task('build', function(callback) {
return runSequence(
'clean',
['build-system', 'build-html', 'build-css'],
callback
);
});
@@ -0,0 +1,17 @@
var gulp = require('gulp');
var bundler = require('aurelia-bundler');
var bundles = require('../bundles.json');

var config = {
force: true,
packagePath: '.',
bundles: bundles.bundles
};

gulp.task('bundle', function() {
return bundler.bundle(config);
});

gulp.task('unbundle', function() {
return bundler.unbundle(config);
});
@@ -0,0 +1,10 @@
var gulp = require('gulp');
var paths = require('../paths');
var del = require('del');
var vinylPaths = require('vinyl-paths');

// deletes all files in the output path
gulp.task('clean', function() {
return gulp.src([paths.output])
.pipe(vinylPaths(del));
});
@@ -0,0 +1,20 @@
var gulp = require('gulp');
var tools = require('aurelia-tools');

// source code for the tasks called in this file
// is located at: https://github.com/aurelia/tools/blob/master/src/dev.js

// updates dependencies in this folder
// from folders in the parent directory
gulp.task('update-own-deps', function() {
tools.updateOwnDependenciesFromLocalRepositories();
});

// quickly pulls in all of the aurelia
// github repos, placing them up one directory
// from where the command is executed,
// then runs `npm install`
// and `gulp build` for each repo
gulp.task('build-dev-env', function() {
tools.buildDevEnv();
});
@@ -0,0 +1,40 @@
var gulp = require('gulp');
var paths = require('../paths');
var plumber = require('gulp-plumber');
var webdriverUpdate = require('gulp-protractor').webdriver_update;
var webdriverStandalone = require("gulp-protractor").webdriver_standalone;
var protractor = require('gulp-protractor').protractor;
var typescript = require('gulp-typescript');
var tsc = require('typescript');

var tsProject = typescript.createProject('./tsconfig.json', {
typescript: tsc,
module: 'commonjs'
});

// for full documentation of gulp-protractor,
// please check https://github.com/mllrsohn/gulp-protractor
gulp.task('webdriver-update', webdriverUpdate);
gulp.task('webdriver-standalone', ['webdriver-update'], webdriverStandalone);

// transpiles files in
// /test/e2e/src/ from es6 to es5
// then copies them to test/e2e/dist/
gulp.task('build-e2e', function() {
return gulp.src(paths.dtsSrc.concat(paths.e2eSpecsSrc))
.pipe(typescript(tsProject))
.pipe(gulp.dest(paths.e2eSpecsDist));
});

// runs build-e2e task
// then runs end to end tasks
// using Protractor: http://angular.github.io/protractor/
gulp.task('e2e', ['build-e2e'], function(cb) {
return gulp.src(paths.e2eSpecsDist + '/*.js')
.pipe(protractor({
configFile: 'protractor.conf.js',
args: ['--baseUrl', 'http://localhost:9000']
}))
.on('end', function() { process.exit(); })
.on('error', function(e) { throw e; });
});
@@ -0,0 +1,40 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var del = require('del');
var vinylPaths = require('vinyl-paths');
var paths = require('../paths');
var bundles = require('../bundles.json');
var resources = require('../export.json');

// deletes all files in the output path
gulp.task('clean-export', function() {
return gulp.src([paths.exportSrv])
.pipe(vinylPaths(del));
});

function getBundles() {
var bl = [];
for (b in bundles.bundles) {
bl.push(b + '.js');
}
return bl;
}

function getExportList() {
return resources.list.concat(getBundles());
}

gulp.task('export-copy', function() {
return gulp.src(getExportList(), {base: "."})
.pipe(gulp.dest(paths.exportSrv));
});

// use after prepare-release
gulp.task('export', function(callback) {
return runSequence(
'bundle',
'clean-export',
'export-copy',
callback
);
});
@@ -0,0 +1,11 @@
var gulp = require('gulp');
var paths = require('../paths');
var tslint = require('gulp-tslint');

gulp.task('lint', function() {
return gulp.src(paths.source)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: false
}));
});
@@ -0,0 +1,40 @@
var gulp = require('gulp');
var runSequence = require('run-sequence');
var paths = require('../paths');
var changelog = require('conventional-changelog');
var fs = require('fs');
var bump = require('gulp-bump');
var args = require('../args');

// utilizes the bump plugin to bump the
// semver for the repo
gulp.task('bump-version', function() {
return gulp.src(['./package.json'])
.pipe(bump({type: args.bump})) //major|minor|patch|prerelease
.pipe(gulp.dest('./'));
});

// generates the CHANGELOG.md file based on commit
// from git commit messages
gulp.task('changelog', function(callback) {
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));

return changelog({
repository: pkg.repository.url,
version: pkg.version,
file: paths.doc + '/CHANGELOG.md'
}, function(err, log) {
fs.writeFileSync(paths.doc + '/CHANGELOG.md', log);
});
});

// calls the listed sequence of tasks in order
gulp.task('prepare-release', function(callback) {
return runSequence(
'build',
'lint',
'bump-version',
'changelog',
callback
);
});
@@ -0,0 +1,21 @@
var gulp = require('gulp');
var Karma = require('karma').Server;

/**
* Run test once and exit
*/
gulp.task('test', function (done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
}, done).start();
});

/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
new Karma({
configFile: __dirname + '/../../karma.conf.js'
}, done).start();
});
@@ -0,0 +1,15 @@
var gulp = require('gulp');
var paths = require('../paths');
var browserSync = require('browser-sync');

// outputs changes to files to the console
function reportChange(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
}

gulp.task('watch', function() {
gulp.watch(paths.source, ['build-system']).on('change', reportChange);
gulp.watch(paths.html, ['build-html']).on('change', reportChange);
gulp.watch(paths.css, ['build-css']).on('change', reportChange);
gulp.watch(paths.style).on('change', reportChange);
});

0 comments on commit 46b8c48

Please sign in to comment.