Permalink
Browse files

feat(authUtils): make authUtils a named export, export authUtils from…

… index -- breaking change! --

* update to babel 6
* maybe jspm17 ready
* add lint-md task
* remove unused doc task
* renamed index.js to aurelia-authentication
* make d.ts defs as aurelia does
* depenency update

Breaking change
  • Loading branch information...
doktordirk committed Mar 25, 2016
1 parent 55895dd commit 7de0aa23843e87c2fa639abae22cb161c3f705c6
@@ -0,0 +1,24 @@
{
"output": true,
"plugins": {
"lint": {
"maximum-line-length": false,
"heading-style": "atx",
"no-duplicate-headings": false,
"no-undefined-references": false,
"no-shortcut-reference-link": false,
"no-heading-punctuation": ".,;:!",
"list-item-indent": false
}
},
"settings": {
"gfm": true,
"bullet": "*",
"closeAtx": false,
"fences": true,
"listItemIndent": "1",
"rule": "-",
"ruleRepetition": 10,
"ruleSpaces": false
}
}
@@ -0,0 +1,6 @@
{
"rules": {
"no-var": 0,
"no-console": 0
}
}
@@ -1,11 +1,60 @@
module.exports = {
modules: 'system',
moduleIds: false,
comments: false,
compact: false,
stage:2,
optional: [
"es7.decorators",
"es7.classProperties"
]
var path = require('path');
var paths = require('./paths');
exports.base = function() {
return {
filename: '',
filenameRelative: '',
sourceMap: true,
sourceRoot: '',
moduleRoot: path.resolve('src').replace(/\\/g, '/'),
moduleIds: false,
comments: false,
compact: false,
code:true,
presets: [ 'es2015-loose', 'stage-1'],
plugins: [
'syntax-flow',
'transform-decorators-legacy',
'transform-flow-strip-types'
]
};
}
exports['plugin-dts'] = ['babel-dts-generator', {
packageName: paths.packageName,
typings: '',
suppressModulePath: true,
suppressComments: false,
memberOutputFilter: /^_.*/
}];
exports.commonjs = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-commonjs');
return options;
};
exports.amd = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-amd');
return options;
};
exports.system = function() {
var options = exports.base();
options.plugins.push('transform-es2015-modules-systemjs');
return options;
};
exports.es2015 = function() {
var options = exports.base();
options.presets = ['stage-1']
return options;
};
exports.dts = function() {
var options = exports.base();
options.plugins.push(exports['plugin-dts']);
return options;
};
@@ -1,16 +1,23 @@
var path = require('path');
var appRoot = 'src/';
var fs = require('fs');
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf-8'));
var appRoot = 'src/';
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
// your main file which exports only configure and other modules.
// usually packageName or 'index.js'
var entryFileName = pkg.name + '.js';
module.exports = {
root: appRoot,
tmp: path.resolve(__dirname + '/../.tmp'),
source: appRoot + '**/*.js',
tsSource: [
appRoot + '**/*.js', // list files to parse for d.ts
'!' + appRoot + entryFileName // exclude entry file
],
html: appRoot + '**/*.html',
style: 'styles/**/*.css',
output: 'dist/',
doc:'./doc',
doc: './doc',
e2eSpecsSrc: 'test/e2e/src/*.js',
e2eSpecsDist: 'test/e2e/dist/',
packageName: pkg.name
@@ -4,55 +4,102 @@ 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 del = require('del');
var vinylPaths = require('vinyl-paths');
gulp.task('build-html-es6', function () {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.output + 'es6'));
// merged output file name. a folder of paths.packageName is temporarly created in build-dts
var jsName = paths.packageName + '.js';
gulp.task('build-dts', function() {
var importsToAdd = []; // stores extracted imports
return gulp.src(paths.tsSource)
.pipe(tools.sortFiles())
.pipe(through2.obj(function(file, enc, callback) { // extract all imports to importsToAdd
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
return callback();
}))
.pipe(concat(jsName)) // concat all selected files to jsName (now without their imports)
.pipe(insert.transform(function(contents) { // re-add extracted imports on top
return tools.createImportBlock(importsToAdd) + contents;
}))
.pipe(to5(assign({}, compilerOptions.dts()))); // compile to d.ts from file jsName. d.ts file is in folder paths.packageName
});
gulp.task('build-es6', ['build-html-es6'], function () {
gulp.task('build-es2015', ['build-html-es2015'], function() {
return gulp.src(paths.source)
.pipe(gulp.dest(paths.output + 'es6'));
.pipe(to5(assign({}, compilerOptions.es2015())))
.pipe(gulp.dest(paths.output + 'es2015'));
});
gulp.task('build-html-commonjs', function () {
return gulp.src(paths.html)
gulp.task('build-commonjs', ['build-html-commonjs'], function() {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions.commonjs())))
.pipe(gulp.dest(paths.output + 'commonjs'));
});
gulp.task('build-commonjs', ['build-html-commonjs'], function () {
gulp.task('build-amd', ['build-html-amd'], function() {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
.pipe(gulp.dest(paths.output + 'commonjs'));
.pipe(to5(assign({}, compilerOptions.amd())))
.pipe(gulp.dest(paths.output + 'amd'));
});
gulp.task('build-system', ['build-html-system'], function() {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions.system())))
.pipe(gulp.dest(paths.output + 'system'));
});
gulp.task('build-html-amd', function () {
gulp.task('copy-dts', function() {
var tdsPath = paths.packageName + '/' + paths.packageName + '.d.ts';
return gulp.src(tdsPath)
.pipe(rename(paths.packageName + '.d.ts'))
.pipe(gulp.dest(paths.output + 'es2015'))
.pipe(gulp.dest(paths.output + 'commonjs'))
.pipe(gulp.dest(paths.output + 'amd'))
.pipe(gulp.dest(paths.output + 'system'));
});
gulp.task('remove-dts-folder', function() {
var tdsFolder = paths.packageName;
return gulp.src([tdsFolder])
.pipe(vinylPaths(del));
});
gulp.task('build-html-es2015', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.output + 'amd'));
.pipe(gulp.dest(paths.output + 'es2015'));
});
gulp.task('build-amd', ['build-html-amd'], function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
.pipe(gulp.dest(paths.output + 'amd'));
gulp.task('build-html-commonjs', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.output + 'commonjs'));
});
gulp.task('build-html-system', function () {
gulp.task('build-html-amd', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.output + 'system'));
.pipe(gulp.dest(paths.output + 'amd'));
});
gulp.task('build-system', ['build-html-system'], function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'system'})))
gulp.task('build-html-system', function() {
return gulp.src(paths.html)
.pipe(gulp.dest(paths.output + 'system'));
});
gulp.task('build', function(callback) {
return runSequence(
'clean',
['build-es6', 'build-commonjs', 'build-amd', 'build-system'],
'dts',
['build-es2015', 'build-commonjs', 'build-amd', 'build-system'],
'build-dts',
'copy-dts',
'remove-dts-folder',
callback
);
});

This file was deleted.

Oops, something went wrong.
@@ -1,10 +1,26 @@
var gulp = require('gulp');
var paths = require('../paths');
var gulp = require('gulp');
var paths = require('../paths');
var eslint = require('gulp-eslint');
var mdlint = require('gulp-remark');
var squeezeParagraphs = require('remark-squeeze-paragraphs');
var remarkNormalizeHeadings = require('remark-normalize-headings');
var remarkValidateLinks = require('remark-validate-links');
var remarkToc = require('remark-toc');
gulp.task('lint', function() {
return gulp.src(paths.source)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('lint-md', function() {
gulp.src(['*.md', paths.doc + '/*.md', '!' + paths.doc + '/CHANGELOG.md'], {base: './'})
.pipe(mdlint()
.use(squeezeParagraphs)
.use(remarkNormalizeHeadings)
.use(remarkValidateLinks)
.use(remarkToc, {tight: true, maxDepth: 2})
).pipe(gulp.dest('./'));
});
@@ -6,9 +6,9 @@ var fs = require('fs');
var bump = require('gulp-bump');
var args = require('../args');
gulp.task('bump-version', function(){
gulp.task('bump-version', function() {
return gulp.src(['./package.json', './bower.json'])
.pipe(bump({type:args.bump })) //major|minor|patch|prerelease
.pipe(bump({type: args.bump })) //major|minor|patch|prerelease
.pipe(gulp.dest('./'));
});
@@ -24,12 +24,11 @@ gulp.task('changelog', function(callback) {
});
});
gulp.task('prepare-release', function(callback){
gulp.task('prepare-release', function(callback) {
return runSequence(
'build',
'lint',
'bump-version',
'doc',
'changelog',
callback
);

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 7de0aa2

Please sign in to comment.