Skip to content

Commit

Permalink
fix jspm install issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanyow committed May 15, 2016
1 parent 2dfc2ca commit 2a3927c
Show file tree
Hide file tree
Showing 60 changed files with 1,828 additions and 3,141 deletions.
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Jeremy Danyow
Copyright (c) 2016 Jeremy Danyow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
77 changes: 49 additions & 28 deletions build/babel-options.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
var path = require('path');
var paths = require('./paths');

module.exports = {
filename: '',
filenameRelative: '',
modules: '',
sourceMap: true,
sourceMapName: '',
sourceRoot: '',
moduleRoot: path.resolve('src').replace(/\\/g, '/'),
moduleIds: false,
experimental: false,
comments: false,
compact: false,
code:true,
stage:0,
loose: "all",
optional: [],
plugins: [
"babel-dts-generator"
],
extra: {
dts: {
packageName: paths.packageName,
typings: '',
suppressModulePath: true,
suppressComments: false,
memberOutputFilter: /^_.*/
}
}
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',
['babel-dts-generator', {
packageName: paths.packageName,
typings: '',
suppressModulePath: true,
suppressComments: false,
memberOutputFilter: /^_.*/
}],
'transform-flow-strip-types'
]
};
}

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;
};
1 change: 0 additions & 1 deletion build/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
style: 'styles/**/*.css',
output: 'dist/',
doc:'./doc',
tests: 'test/**/*.js',
e2eSpecsSrc: 'test/e2e/src/*.js',
e2eSpecsDist: 'test/e2e/dist/',
packageName: pkg.name
Expand Down
55 changes: 29 additions & 26 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ var jsName = paths.packageName + '.js';

gulp.task('build-index', function(){
var importsToAdd = [];
var files = [
'ajax-adapter.js',
'promise-adapter.js',
'property-observation.js',
'observation-adapter.js',
'index.js'
].map(function(file){
return paths.root + file;
});

return gulp.src(paths.source)
.pipe(tools.sortFiles())
return gulp.src(files)
.pipe(through2.obj(function(file, enc, callback) {
file.contents = new Buffer(tools.extractImports(file.contents.toString("utf8"), importsToAdd));
this.push(file);
Expand All @@ -29,50 +37,45 @@ gulp.task('build-index', function(){
.pipe(gulp.dest(paths.output));
});

gulp.task('build-es6-temp', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions, {modules:'common'})))
.pipe(gulp.dest(paths.output + 'temp'));
});

gulp.task('build-es6', function () {
return gulp.src(paths.source)
.pipe(gulp.dest(paths.output + 'es6'));
gulp.task('build-es2015', function () {
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions.es2015())))
.pipe(gulp.dest(paths.output + 'es2015'));
});

gulp.task('build-commonjs', function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'common', plugins: []})))
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions.commonjs())))
.pipe(gulp.dest(paths.output + 'commonjs'));
});

gulp.task('build-amd', function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'amd', plugins: []})))
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions.amd())))
.pipe(gulp.dest(paths.output + 'amd'));
});

gulp.task('build-system', function () {
return gulp.src(paths.source)
.pipe(to5(assign({}, compilerOptions, {modules:'system', plugins: []})))
return gulp.src(paths.output + jsName)
.pipe(to5(assign({}, compilerOptions.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'));
return gulp.src(paths.root + paths.packageName + '.d.ts')
.pipe(gulp.dest(paths.output))
.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('build', function(callback) {
return runSequence(
'clean',
//'build-index',
['build-es6-temp', 'build-es6', 'build-commonjs', 'build-amd', 'build-system'],
//'build-dts',
'build-index',
['build-es2015', 'build-commonjs', 'build-amd', 'build-system'],
'build-dts',
callback
);
});
28 changes: 14 additions & 14 deletions build/tasks/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ var runSequence = require('run-sequence');
gulp.task('doc-generate', function(){
return gulp.src([paths.output + '*.d.ts', paths.doc + '/core-js.d.ts', './jspm_packages/npm/*/*.d.ts'])
.pipe(typedoc({
target'es6',
includeDeclarationstrue,
jsonpaths.doc + '/api.json',
namepaths.packageName + '-docs', 
mode: 'modules',
excludeExternals: true,
ignoreCompilerErrorsfalse,
versiontrue
}));
            target'es6',
            includeDeclarationstrue,
            jsonpaths.doc + '/api.json',
            namepaths.packageName + '-docs', 
mode: 'modules',
excludeExternals: true,
            ignoreCompilerErrorsfalse,
            versiontrue
        }));
});

gulp.task('doc-extract', function(){
return gulp.src([paths.doc + '/api.json'])
.pipe(typedocExtractor(paths.packageName))
.pipe(gulp.dest(paths.doc));
return gulp.src([paths.doc + '/api.json'])
.pipe(typedocExtractor(paths.packageName))
.pipe(gulp.dest(paths.doc));
});

gulp.task('doc', function(callback){
return runSequence(
'doc-generate',
'doc-extract',
'doc-generate',
'doc-extract',
callback
);
});
2 changes: 1 addition & 1 deletion build/tasks/prepare-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gulp.task('changelog', function(callback) {
gulp.task('prepare-release', function(callback){
return runSequence(
'build',
'lint',
//'lint',
'bump-version',
'doc',
'changelog',
Expand Down
Loading

0 comments on commit 2a3927c

Please sign in to comment.