Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from uniprank/development
Browse files Browse the repository at this point in the history
Fixed issue (#2) webpack and systemjs loader
  • Loading branch information
Denfie authored Feb 27, 2017
2 parents 1a92980 + 2fbe671 commit 2ddf8f9
Show file tree
Hide file tree
Showing 9 changed files with 2,628 additions and 521 deletions.
2,053 changes: 2,053 additions & 0 deletions bundles/ng2-file-uploader.systemjs.umd.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bundles/ng2-file-uploader.umd.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bundles/ng2-file-uploader.webpack.umd.js.map

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const gulp = require('gulp');
const typedoc = require('gulp-typedoc');
const conventionalChangelog = require('gulp-conventional-changelog');
const systemjsBuilder = require('gulp-systemjs-builder')

gulp.task('changelog', () => {
return gulp.src('CHANGELOG.md', {
Expand Down Expand Up @@ -37,3 +38,65 @@ gulp.task('docs', () => {
noLib: true
}));
});

// Bundle dependencies into vendors file
gulp.task('bundle:libs', function () {
return gulp.src([
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/semantic-ui/dist/semantic.min.js',
'node_modules/es6-shim/es6-shim.min.js',
'node_modules/es6-promise/dist/es6-promise.min.js',
'node_modules/systemjs/dist/system.src.js',
'system.config.js',
])
.pipe(concat('vendors.min.js'))
.pipe(uglify())
.pipe(gulp.dest('public/lib/js'));
});

// Compile TypeScript to JS
gulp.task('compile:ts', function () {
return gulp
.src([
"module/**/*.ts",
"lib/**/*.d.ts"
])
.pipe(sourcemaps.init())
.pipe(tsc({
"module": "system",
"moduleResolution": "node",
"outDir": "public/dist/js",
"target": "ES5"
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'));
});

// Generate systemjs-based builds
gulp.task('bundle:js', function() {
var builder = new sysBuilder('public', './system.config.js');
return builder.buildStatic('app', 'public/dist/js/app.min.js');
});

// Minify JS bundle
gulp.task('minify:js', function() {
return gulp
.src('public/dist/js/app.min.js')
.pipe(uglify())
.pipe(gulp.dest('public/dist/js'));
});

gulp.task('scripts', ['compile:ts', 'bundle:js', 'minify:js']);

gulp.task('build-sjs', function () {
var builder = systemjsBuilder()
builder.loadConfigSync('./system.config.js')

builder.buildStatic('./lib/index.js - rxjs/Rx - @angular/common - @angular/core', 'ng2-file-uploader.systemjs.umd.js', {
minify: false,
mangle: false,
sourceMaps: true
})
.pipe(gulp.dest('./bundles'));
})
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@uniprank/ng2-file-uploader",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "https://github.com/uniprank/ng2-file-uploader#readme",
"author": "Dennis Fiedler <[email protected]>",
"description": "An angular file uploader library",
Expand Down Expand Up @@ -46,14 +46,17 @@
"@types/core-js": "0.9.35",
"@types/node": "7.0.5",
"awesome-typescript-loader": "^3.0.7",
"babel-core": "^6.23.1",
"codelyzer": "2.0.1",
"glob": "^7.1.1",
"gulp": "3.9.1",
"gulp": "^3.9.1",
"gulp-conventional-changelog": "1.1.0",
"gulp-systemjs-builder": "^0.15.0",
"gulp-typedoc": "2.0.2",
"reflect-metadata": "0.1.10",
"rxjs": "5.2.0",
"shx": "^0.2.2",
"systemjs-builder": "^0.16.3",
"ts-loader": "^2.0.1",
"tslint": "4.4.2",
"tslint-loader": "^3.4.2",
Expand All @@ -74,6 +77,7 @@
"dev": "tsc --watch",
"docs": "gulp docs",
"lint": "tslint \"module/**/*.ts\"",
"start": "npm run dev",
"prepublish": "npm run build"
},
"contributors": [
Expand Down
47 changes: 47 additions & 0 deletions system.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(function(global) {
var meta = {
'lib/vendor.js': {
format: 'global',
exports: '@angular'
}
};

// map tells the System loader where to look for things
var map = {
'lib': 'lib', // 'dist',
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular'
};

// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'lib': { main: 'index.js', defaultExtension: 'js' },
'lib/module': { main: 'index.js', defaultExtension: 'js' },
'lib/module/source': { main: 'index.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' }
};

var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
//
];

// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});

var config = {
meta: meta,
map: map,
packages: packages
}

// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }

System.config(config);

})(this);
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"module": "es6",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Expand All @@ -15,7 +15,7 @@
"stripInternal": true,
"noUnusedParameters": true,
"lib": ["dom", "es6"],
"outDir": "./lib",
"outDir": "lib",
"rootDir": ".",
"types": [
"node"
Expand All @@ -25,7 +25,6 @@
"module/**/*.ts"
],
"files": [
"vendor.ts",
"index.ts",
"ng2-file-uploader.ts"
],
Expand Down
4 changes: 2 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var path = require('path');
module.exports = {
entry: {
'vendor': './vendor.ts',
'ng2-file-uploader.umd': './index.ts',
'ng2-file-uploader.min': './index.ts'
'ng2-file-uploader.webpack.umd': './index.ts',
'ng2-file-uploader.webpack.min': './index.ts'
},

output: {
Expand Down

0 comments on commit 2ddf8f9

Please sign in to comment.