diff --git a/build/args.js b/build/args.js index db342fc..b51187e 100644 --- a/build/args.js +++ b/build/args.js @@ -10,4 +10,4 @@ if(validBumpTypes.indexOf(bump) === -1) { module.exports = { bump: bump -}; +}; \ No newline at end of file diff --git a/build/babel-options.js b/build/babel-options.js index e667a4d..fb11694 100644 --- a/build/babel-options.js +++ b/build/babel-options.js @@ -1,3 +1,6 @@ +var path = require('path'); +var paths = require('./paths'); + module.exports = { filename: '', filenameRelative: '', @@ -5,7 +8,7 @@ module.exports = { sourceMap: true, sourceMapName: '', sourceRoot: '', - moduleRoot: '', + moduleRoot: path.resolve('src').replace(/\\/g, '/'), moduleIds: false, experimental: false, comments: false, @@ -16,5 +19,17 @@ module.exports = { optional: [ "es7.decorators", "es7.classProperties" - ] -}; + ], + plugins: [ + "babel-dts-generator" + ], + extra: { + dts: { + packageName: paths.packageName, + typings: '', + suppressModulePath: true, + suppressComments: false, + memberOutputFilter: /^_.*/ + } + } +}; \ No newline at end of file diff --git a/build/paths.js b/build/paths.js index 7e99344..47782f2 100644 --- a/build/paths.js +++ b/build/paths.js @@ -1,6 +1,8 @@ var path = require('path'); +var fs = require('fs'); var appRoot = 'src/'; +var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8')); module.exports = { root: appRoot, @@ -9,6 +11,8 @@ module.exports = { style: 'styles/**/*.css', output: 'dist/', doc:'./doc', + tests: 'test/**/*.js', e2eSpecsSrc: 'test/e2e/src/*.js', - e2eSpecsDist: 'test/e2e/dist/' -}; + e2eSpecsDist: 'test/e2e/dist/', + packageName: pkg.name +}; \ No newline at end of file diff --git a/build/tasks/build.js b/build/tasks/build.js index a5d0f40..d0a8913 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -4,34 +4,69 @@ var to5 = require('gulp-babel'); var paths = require('../paths'); var compilerOptions = require('../babel-options'); var assign = Object.assign || require('object.assign'); +var through2 = require('through2'); +var concat = require('gulp-concat'); +var insert = require('gulp-insert'); +var rename = require('gulp-rename'); +var tools = require('aurelia-tools'); + +var jsName = paths.packageName + '.js'; + +gulp.task('build-index', function(){ + var importsToAdd = []; -gulp.task('build-es6', function () { return gulp.src(paths.source) + .pipe(tools.sortFiles()) + .pipe(through2.obj(function(file, enc, callback) { + file.contents = new Buffer(tools.extractImports(file.contents.toString("utf8"), importsToAdd)); + this.push(file); + return callback(); + })) + .pipe(concat(jsName)) + .pipe(insert.transform(function(contents) { + return tools.createImportBlock(importsToAdd) + contents; + })) + .pipe(gulp.dest(paths.output)); +}); + +gulp.task('build-es6', function () { + return gulp.src(paths.output + jsName) .pipe(gulp.dest(paths.output + 'es6')); }); gulp.task('build-commonjs', function () { - return gulp.src(paths.source) + return gulp.src(paths.output + jsName) .pipe(to5(assign({}, compilerOptions, {modules:'common'}))) .pipe(gulp.dest(paths.output + 'commonjs')); }); gulp.task('build-amd', function () { - return gulp.src(paths.source) + return gulp.src(paths.output + jsName) .pipe(to5(assign({}, compilerOptions, {modules:'amd'}))) .pipe(gulp.dest(paths.output + 'amd')); }); gulp.task('build-system', function () { - return gulp.src(paths.source) + return gulp.src(paths.output + jsName) .pipe(to5(assign({}, compilerOptions, {modules:'system'}))) .pipe(gulp.dest(paths.output + 'system')); }); +gulp.task('build-dts', function(){ + return gulp.src(paths.output + paths.packageName + '.d.ts') + .pipe(rename(paths.packageName + '.d.ts')) + .pipe(gulp.dest(paths.output + 'es6')) + .pipe(gulp.dest(paths.output + 'commonjs')) + .pipe(gulp.dest(paths.output + 'amd')) + .pipe(gulp.dest(paths.output + 'system')); +}); + gulp.task('build', function(callback) { return runSequence( 'clean', + 'build-index', ['build-es6', 'build-commonjs', 'build-amd', 'build-system'], + 'build-dts', callback ); -}); +}); \ No newline at end of file diff --git a/build/tasks/dev.js b/build/tasks/dev.js index 2d8c619..2481714 100644 --- a/build/tasks/dev.js +++ b/build/tasks/dev.js @@ -7,4 +7,4 @@ gulp.task('update-own-deps', function(){ gulp.task('build-dev-env', function () { tools.buildDevEnv(); -}); +}); \ No newline at end of file diff --git a/build/tasks/doc.js b/build/tasks/doc.js index 4235bcb..6dac5ed 100644 --- a/build/tasks/doc.js +++ b/build/tasks/doc.js @@ -1,14 +1,33 @@ var gulp = require('gulp'); -var tools = require('aurelia-tools'); var paths = require('../paths'); -var yuidoc = require('gulp-yuidoc'); +var typedoc = require('gulp-typedoc'); +var typedocExtractor = require('gulp-typedoc-extractor'); +var runSequence = require('run-sequence'); gulp.task('doc-generate', function(){ - return gulp.src(paths.source) - .pipe(yuidoc.parser(null, 'api.json')) + return gulp.src([paths.output + '*.d.ts', paths.doc + '/core-js.d.ts', './jspm_packages/npm/*/*.d.ts']) + .pipe(typedoc({ + target: 'es6', + includeDeclarations: true, + json: paths.doc + '/api.json', + name: paths.packageName + '-docs', + mode: 'modules', + excludeExternals: true, + ignoreCompilerErrors: false, + version: true + })); +}); + +gulp.task('doc-extract', function(){ + return gulp.src([paths.doc + '/api.json']) + .pipe(typedocExtractor(paths.packageName)) .pipe(gulp.dest(paths.doc)); }); -gulp.task('doc', ['doc-generate'], function(){ - tools.transformAPIModel(paths.doc); -}) +gulp.task('doc', function(callback){ + return runSequence( + 'doc-generate', + 'doc-extract', + callback + ); +}); \ No newline at end of file diff --git a/build/tasks/lint.js b/build/tasks/lint.js index d10253f..857d71f 100644 --- a/build/tasks/lint.js +++ b/build/tasks/lint.js @@ -1,10 +1,10 @@ var gulp = require('gulp'); var paths = require('../paths'); -var jshint = require('gulp-jshint'); -var stylish = require('jshint-stylish'); +var eslint = require('gulp-eslint'); gulp.task('lint', function() { - return gulp.src(paths.source) - .pipe(jshint()) - .pipe(jshint.reporter(stylish)); -}); + return gulp.src([paths.source, paths.tests]) + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); +}); \ No newline at end of file diff --git a/build/tasks/prepare-release.js b/build/tasks/prepare-release.js index 3425ef7..e5eb180 100644 --- a/build/tasks/prepare-release.js +++ b/build/tasks/prepare-release.js @@ -33,4 +33,4 @@ gulp.task('prepare-release', function(callback){ 'changelog', callback ); -}); +}); \ No newline at end of file diff --git a/config.js b/config.js index 9573556..5277a00 100644 --- a/config.js +++ b/config.js @@ -8,7 +8,6 @@ System.config({ ] }, paths: { - "*": "dist/*", "github:*": "jspm_packages/github/*", "npm:*": "jspm_packages/npm/*", "aurelia-configuration/*": "dist/*.js" @@ -18,6 +17,7 @@ System.config({ "aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-beta.1.1.4", "aurelia-loader": "npm:aurelia-loader@1.0.0-beta.1.1.1", "aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0-beta.1.1.4", + "aurelia-path": "npm:aurelia-path@1.0.0-beta.1.1.1", "babel": "npm:babel-core@5.8.35", "babel-runtime": "npm:babel-runtime@5.8.35", "core-js": "npm:core-js@1.2.6", diff --git a/package.json b/package.json index e1e25db..8462f29 100644 --- a/package.json +++ b/package.json @@ -23,44 +23,64 @@ }, "jspm": { "registry": "npm", - "main": "index", + "main": "aurelia-configuration", "format": "amd", "directories": { "lib": "dist/amd" }, + "peerDependencies": { + "aurelia-dependency-injection": "^1.0.0-beta.1.1.4", + "aurelia-loader": "^1.0.0-beta.1.1.1", + "aurelia-path": "^1.0.0-beta.1.1.0" + }, "dependencies": { "aurelia-dependency-injection": "^1.0.0-beta.1.1.4", - "aurelia-loader": "^1.0.0-beta.1.1.1" + "aurelia-loader": "^1.0.0-beta.1.1.1", + "aurelia-path": "^1.0.0-beta.1.1.0" }, "devDependencies": { - "aurelia-pal-browser": "^1.0.0-beta.1.1.4", - "babel": "npm:babel-core@^5.8.24", - "babel-runtime": "npm:babel-runtime@^5.8.24", - "core-js": "npm:core-js@^1.1.4" + "babel": "^5.8.24", + "babel-runtime": "^5.8.24", + "core-js": "^2.0.3" } }, + "dependencies": { + "aurelia-dependency-injection": "^1.0.0-beta.1.1.4", + "aurelia-loader": "^1.0.0-beta.1.1.1", + "aurelia-path": "^1.0.0-beta.1.1.0" + }, "devDependencies": { - "aurelia-tools": "^0.1.18", - "conventional-changelog": "^0.4.2", + "aurelia-tools": "0.1.16", + "babel-dts-generator": "0.2.18", + "babel-eslint": "^4.1.1", + "conventional-changelog": "0.0.11", "del": "^1.1.0", - "gulp": "^3.9.1", - "gulp-babel": "^5.3.0", + "gulp": "^3.8.10", + "gulp-babel": "^5.2.1", "gulp-bump": "^0.3.1", - "gulp-changed": "^1.1.0", - "gulp-jshint": "^1.9.0", - "gulp-yuidoc": "^0.1.2", + "gulp-concat": "^2.6.0", + "gulp-coveralls": "0.1.4", + "gulp-eslint": "^1.0.0", + "gulp-insert": "^0.4.0", + "gulp-rename": "^1.2.2", + "gulp-typedoc": "^1.2.1", + "gulp-typedoc-extractor": "^0.0.8", + "isparta": "4.0.0", + "istanbul": "github:gotwarlost/istanbul#source-map", "jasmine-core": "^2.1.3", - "jshint-stylish": "^1.0.0", - "jspm": "^0.16.15", - "karma": "^0.13.21", - "karma-babel-preprocessor": "^5.2.1", - "karma-chrome-launcher": "^0.2.1", - "karma-coverage": "douglasduteil/karma-coverage#next", + "jspm": "0.16.15", + "karma": "^0.13.15", + "karma-babel-preprocessor": "^5.2.2", + "karma-chrome-launcher": "^0.1.7", + "karma-coverage": "github:douglasduteil/karma-coverage#next", "karma-jasmine": "^0.3.5", - "karma-jspm": "2.0.1-beta.2", + "karma-jspm": "^2.0.1", + "karma-sourcemap-loader": "0.3.6", "object.assign": "^1.0.3", "require-dir": "^0.1.0", "run-sequence": "^1.0.2", + "through2": "^2.0.0", + "vinyl": "^0.5.1", "vinyl-paths": "^1.0.0", "yargs": "^2.1.1" }