This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update to babel 6 * maybe jspm17 ready * add lint-md task * remove unused doc task * renamed index.js to aurelia-orm * make d.ts defs as aurelia does * update dependencies
- Loading branch information
1 parent
3eb578d
commit 6a6368c
Showing
30 changed files
with
460 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rules": { | ||
"no-var": 0, | ||
"no-console": 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
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, | ||
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/' | ||
e2eSpecsDist: 'test/e2e/dist/', | ||
packageName: pkg.name | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,105 @@ | ||
var gulp = require('gulp'); | ||
var runSequence = require('run-sequence'); | ||
var to5 = require('gulp-babel'); | ||
var paths = require('../paths'); | ||
var gulp = require('gulp'); | ||
var runSequence = require('run-sequence'); | ||
var to5 = require('gulp-babel'); | ||
var paths = require('../paths'); | ||
var compilerOptions = require('../babel-options'); | ||
var assign = Object.assign || require('object.assign'); | ||
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-es6', ['build-html-es6'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(gulp.dest(paths.output + 'es6')); | ||
|
||
gulp.task('build-dts', function() { | ||
var importsToAdd = []; // stores extracted imports | ||
|
||
return gulp.src(paths.tsSource) | ||
//.pipe(tools.sortFiles()) // sort fails with subdirectories! | ||
.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-html-commonjs', function() { | ||
return gulp.src(paths.html) | ||
.pipe(gulp.dest(paths.output + 'commonjs')); | ||
gulp.task('build-es2015', ['build-html-es2015'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(to5(assign({}, compilerOptions.es2015()))) | ||
.pipe(gulp.dest(paths.output + 'es2015')); | ||
}); | ||
|
||
gulp.task('build-commonjs', ['build-html-commonjs'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(to5(assign({}, compilerOptions, {modules: 'common'}))) | ||
.pipe(to5(assign({}, compilerOptions.commonjs()))) | ||
.pipe(gulp.dest(paths.output + 'commonjs')); | ||
}); | ||
|
||
gulp.task('build-html-amd', function() { | ||
return gulp.src(paths.html) | ||
gulp.task('build-amd', ['build-html-amd'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(to5(assign({}, compilerOptions.amd()))) | ||
.pipe(gulp.dest(paths.output + 'amd')); | ||
}); | ||
|
||
gulp.task('build-amd', ['build-html-amd'], function() { | ||
gulp.task('build-system', ['build-html-system'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(to5(assign({}, compilerOptions, {modules: 'amd'}))) | ||
.pipe(gulp.dest(paths.output + 'amd')); | ||
.pipe(to5(assign({}, compilerOptions.system()))) | ||
.pipe(gulp.dest(paths.output + 'system')); | ||
}); | ||
|
||
gulp.task('build-html-system', 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 + 'system')); | ||
.pipe(gulp.dest(paths.output + 'es2015')); | ||
}); | ||
|
||
gulp.task('build-system', ['build-html-system'], function() { | ||
return gulp.src(paths.source) | ||
.pipe(to5(assign({}, compilerOptions, {modules: 'system'}))) | ||
gulp.task('build-html-commonjs', function() { | ||
return gulp.src(paths.html) | ||
.pipe(gulp.dest(paths.output + 'commonjs')); | ||
}); | ||
|
||
gulp.task('build-html-amd', function() { | ||
return gulp.src(paths.html) | ||
.pipe(gulp.dest(paths.output + 'amd')); | ||
}); | ||
|
||
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'], | ||
['build-es2015', 'build-commonjs', 'build-amd', 'build-system'], | ||
'build-dts', | ||
'copy-dts', | ||
'remove-dts-folder', | ||
callback | ||
); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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('./')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.