Skip to content

Commit

Permalink
Provide es2015 module. (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Domratchev authored and rhurey committed Jun 19, 2019
1 parent fb2c958 commit c5210a8
Show file tree
Hide file tree
Showing 6 changed files with 1,970 additions and 6,057 deletions.
52 changes: 38 additions & 14 deletions gulpfile.js
@@ -1,25 +1,28 @@
(function () {
'use strict';
var gulp = require("gulp");
var gulp = require('gulp');
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var tslint = require("gulp-tslint");
var uglify = require('gulp-uglify');
var tslint = require('gulp-tslint');
var terser = require('gulp-terser');
var rename = require('gulp-rename');
var pump = require('pump');
var webpack = require('webpack-stream');
var dtsBundleWebpack = require('dts-bundle-webpack');

var tsProject = ts.createProject('tsconfig.json');
var tsProject2015 = ts.createProject('tsconfig.json', {
target: 'es2015',
module: 'esnext'
});

gulp.task("build", gulp.series(function build() {
gulp.task('build', gulp.series(function build() {
return gulp.src([
"src/**/*.ts",
"microsoft.cognitiveservices.speech.sdk.ts"],
'src/**/*.ts',
'microsoft.cognitiveservices.speech.sdk.ts'],
{ base: '.' })
.pipe(tslint({
formatter: "prose",
configuration: "tslint.json"
formatter: 'prose',
configuration: 'tslint.json'
}))
.pipe(tslint.report({
summarizeFailureOutput: true
Expand All @@ -33,7 +36,28 @@
.pipe(gulp.dest('./distrib/lib/external/'));
}));

gulp.task("bundle", gulp.series("build", function bundle() {
gulp.task('build2015', gulp.series(function build() {
return gulp.src([
'src/**/*.ts',
'microsoft.cognitiveservices.speech.sdk.ts'],
{ base: '.' })
.pipe(tslint({
formatter: 'prose',
configuration: 'tslint.json'
}))
.pipe(tslint.report({
summarizeFailureOutput: true
}))
.pipe(sourcemaps.init())
.pipe(tsProject2015())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('distrib/es2015'));
}, function () {
return gulp.src('./external/**/*')
.pipe(gulp.dest('./distrib/es2015/external/'));
}));

gulp.task('bundle', gulp.series('build', function bundle() {
return gulp.src('bundleApp.js')
.pipe(webpack({
output: { filename: 'microsoft.cognitiveservices.speech.sdk.bundle.js' },
Expand All @@ -42,7 +66,7 @@
rules: [{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader"
loader: 'source-map-loader'
}],
},
plugins: [
Expand All @@ -60,11 +84,11 @@
.pipe(gulp.dest('./distrib/browser'));
}));

gulp.task('compress', gulp.series("bundle", function (cb) {
gulp.task('compress', gulp.series('bundle', function (cb) {
return pump([
gulp.src('distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.js'),
rename(function (path) { path.basename = "microsoft.cognitiveservices.speech.sdk.bundle-min"; }),
uglify(),
rename(function (path) { path.basename = 'microsoft.cognitiveservices.speech.sdk.bundle-min'; }),
terser(),
gulp.dest('distrib/browser')
],
cb
Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Expand Up @@ -5,9 +5,9 @@ module.exports = {
"^.+\\.ts$": "ts-jest",
},
testRegex: "tests/.*Tests\\.ts$",
testPathIgnorePatterns: ["/lib/", "/node_modules/", "/src/"],
testPathIgnorePatterns: ["/lib/", "/es2015/", "/node_modules/", "/src/"],
moduleFileExtensions: ["ts", "js", "jsx", "json", "node"],
collectCoverage: true,
"reporters": [ "default", "jest-junit" ],
setupTestFrameworkScriptFile:"./secrets/TestConfiguration.ts"
"reporters": ["default", "jest-junit"],
setupTestFrameworkScriptFile: "./secrets/TestConfiguration.ts"
};
4 changes: 2 additions & 2 deletions jsdoc-conf.json
Expand Up @@ -19,7 +19,7 @@
"linenums": true,
"source": {
"include": [
"./distrib/src/sdk"
"./distrib/lib/src/sdk"
],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
Expand All @@ -32,4 +32,4 @@
"destination": "./outjs",
"template": "templates/default"
}
}
}

0 comments on commit c5210a8

Please sign in to comment.