Skip to content

Commit 3653277

Browse files
committed
Use DTSBundle to generate d.ts
1 parent 2596776 commit 3653277

File tree

4 files changed

+689
-340
lines changed

4 files changed

+689
-340
lines changed

gulpfile.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var ts = require("gulp-typescript");
1818
var tslint = require("gulp-tslint");
1919
var tsd = require("gulp-tsd");
2020
var uglify = require("gulp-uglify");
21+
var dtsBundle = require("dts-bundle");
2122

2223
var PATHS = {
2324
SRCROOT: "src/",
@@ -70,8 +71,6 @@ gulp.task("compile", function() {
7071
var tsResult = gulp.src([PATHS.SRCROOT + "**/*.+(ts|tsx)", "!**/*.d.ts"])
7172
.pipe(ts({
7273
declaration: true,
73-
inlineSourceMap: true,
74-
inlineSources: true,
7574
module: "commonjs"
7675
}));
7776

@@ -117,11 +116,6 @@ gulp.task("bundleApi", function () {
117116
.pipe(gulp.dest(PATHS.BUNDLEROOT));
118117
});
119118

120-
gulp.task("bundleDefinition", function () {
121-
gulp.src(PATHS.BUILDROOT + "scripts/onenoteApi.d.ts")
122-
.pipe(gulp.dest(PATHS.BUNDLEROOT));
123-
});
124-
125119
gulp.task("bundleTests", function () {
126120
return globby.sync(["**/*.js"], { cwd: PATHS.BUILDROOT + "tests" }).map(function (filePath) {
127121
return browserify(PATHS.BUILDROOT + "tests/" + filePath, { debug: true })
@@ -131,10 +125,23 @@ gulp.task("bundleTests", function () {
131125
});
132126
});
133127

128+
gulp.task("bundleDefinitions", function (callback) {
129+
dtsBundle.bundle({
130+
name: 'sample',
131+
out: '../../' + PATHS.BUNDLEROOT + '/oneNoteApi.d.ts',
132+
main: PATHS.BUILDROOT + '/scripts/oneNoteApi.d.ts',
133+
emitOnIncludedFileNotFound: true,
134+
emitOnNoIncludedFileNotFound: true,
135+
outputAsModuleFolder: true
136+
});
137+
callback();
138+
});
139+
134140
gulp.task("bundle", function (callback) {
135141
runSequence(
136142
"bundleApi",
137143
"bundleTests",
144+
"bundleDefinitions",
138145
callback);
139146
});
140147

@@ -164,7 +171,7 @@ gulp.task("exportApi", function () {
164171
var copyTask = gulp.src([
165172
PATHS.BUNDLEROOT + "oneNoteApi.js",
166173
PATHS.BUNDLEROOT + "oneNoteApi.min.js",
167-
PATHS.SRCROOT + "oneNoteApi.d.ts"
174+
PATHS.BUNDLEROOT + "oneNoteApi.d.ts"
168175
]).pipe(gulp.dest(PATHS.TARGETROOT));
169176

170177
return merge(modulesTask, copyTask);

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"browserify": "^13.0.0",
1515
"content-type": "^1.0.2",
1616
"del": "^2.0.2",
17+
"dts-bundle": "^0.7.3",
1718
"file-system": "^2.2.1",
1819
"globby": "^4.0.0",
1920
"gulp": "^3.9.0",

0 commit comments

Comments
 (0)