-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Lerna/monorepo refactor package split (#199)
Split into 3 packages: - @morgan-stanley/desktopjs - @morgan-stanley/desktopjs-electron - @morgan-stanley/desktpojs-openfin - Changed public Node types in Electron package to any - Changed public OpenFin types in OpenFin package to any
- Loading branch information
Showing
73 changed files
with
19,919 additions
and
959 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 |
---|---|---|
|
@@ -8,4 +8,4 @@ dist/ | |
build/ | ||
docs/ | ||
.DS_Store | ||
package-lock.json | ||
lerna-debug.log |
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,22 @@ | ||
module.exports = { | ||
src: ['src/**/*.ts'], | ||
dest: 'dist', | ||
staging: { | ||
dest: 'build', | ||
}, | ||
test: { | ||
src: ['**/build/tests/**/*.js', '**/build/tests/**/*.spec.js'], | ||
coverage: { | ||
src: ['**/build/src/**/*.js', '!**/node_modules/**/*'], | ||
dest: 'build/coverage', | ||
coverageFile: 'build/coverage/coverage-final.json', | ||
lcovFile: 'build/coverage/lcov.info', | ||
threshold: 80 | ||
} | ||
}, | ||
tslint: '../../tslint.json', | ||
documentation: { | ||
src: ['packages/**/src/**/*.ts', '!**/*.d.ts' , '!**/node_modules/**/*'], | ||
out: 'docs/' | ||
} | ||
}; |
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,53 @@ | ||
'use strict'; | ||
|
||
var rollup = require('rollup'), | ||
clean = require('gulp-clean'), | ||
tsrollup = require('rollup-plugin-typescript'), | ||
replace = require('gulp-replace'), | ||
rollupReplace = require('rollup-plugin-replace'), | ||
commonjs = require('rollup-plugin-commonjs'), | ||
typescript = require('typescript'); | ||
|
||
module.exports = function (gulp, pkg, config, name, input, iffe, preventReload) { | ||
return function () { | ||
// Main bundle is umd | ||
return createBundle('umd', pkg.main) | ||
.then(function () { | ||
// Generate iife for use as a V8 extension if necessary since umd isn't supported | ||
createBundle('iife', config.dest + iffe); | ||
}).then(function () { | ||
if (preventReload) { | ||
// Wrap umd with a condition checking if desktopJS is already defined to not overwrite it. This will allow | ||
// preload registration of desktopJS without hosted web script includes redefining. | ||
gulp.src(pkg.main) | ||
.pipe(replace(/(\(function \(global, factory\)[\s\S]*}\)\)\);)([\s\S]*)/, "if (typeof desktopJS === \"undefined\") {$1}$2")) | ||
.pipe(clean()) | ||
.pipe(gulp.dest(config.dest)); | ||
} | ||
}); | ||
|
||
function createBundle(format, destination) { | ||
return rollup.rollup({ | ||
input: input, | ||
plugins: [ | ||
tsrollup({ typescript: typescript }), | ||
commonjs(), | ||
rollupReplace({ | ||
PACKAGE_VERSION: pkg.version | ||
}) | ||
] | ||
}).then(function (bundle) { | ||
return bundle.write({ | ||
file: destination, | ||
format: format, | ||
name: name, | ||
moduleName: pkg.title, | ||
sourcemap: true, | ||
globals: { | ||
"@morgan-stanley/desktopjs": "desktopJS" | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
} |
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,10 @@ | ||
'use strict'; | ||
|
||
var clean = require('gulp-clean'); | ||
|
||
module.exports = function (gulp, path) { | ||
return function () { | ||
return gulp.src(path, { read: false }) | ||
.pipe(clean()); | ||
}; | ||
} |
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,16 @@ | ||
'use strict'; | ||
|
||
var uglify = require('gulp-uglify'), | ||
sourcemaps = require('gulp-sourcemaps'), | ||
rename = require('gulp-rename'); | ||
|
||
module.exports = function (gulp, pkg, config) { | ||
return function () { | ||
return gulp.src(pkg.main) | ||
.pipe(sourcemaps.init({ loadMaps: true })) | ||
.pipe(uglify()) | ||
.pipe(rename({ extname: '.min.js' })) | ||
.pipe(sourcemaps.write('')) | ||
.pipe(gulp.dest(config.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
var typedoc = require('gulp-typedoc'); | ||
|
||
module.exports = function (gulp, config) { | ||
return function () { | ||
return gulp | ||
.src(config.documentation.src) | ||
.pipe(typedoc({ | ||
"name": "desktopJS", | ||
"mode": "modules", | ||
"target": "ES6", | ||
"module": "umd", | ||
"includeDeclarations": true, | ||
"excludeExternals": true, | ||
"excludePrivate": true, | ||
"out": config.documentation.out, | ||
"hideGenerator": true, | ||
"ignoreCompilerErrors": true, | ||
"logger": "none" | ||
})) | ||
.on('end', function () { | ||
require('fs').writeFileSync('docs/.nojekyll', ''); | ||
}); | ||
} | ||
} |
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,16 @@ | ||
'use strict'; | ||
|
||
var dts = require('dts-bundle'); | ||
|
||
module.exports = function (gulp, name, main, out) { | ||
return function () { | ||
return dts.bundle({ | ||
name: name, | ||
main: main, | ||
out: out, | ||
verbose: false, | ||
outputAsModuleFolder: true | ||
}); | ||
}; | ||
} | ||
|
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,25 @@ | ||
'use strict'; | ||
|
||
var sourcemaps = require('gulp-sourcemaps'), | ||
gulpts = require('gulp-typescript'), | ||
merge = require('merge2'); | ||
|
||
module.exports = function (gulp, config) { | ||
return function () { | ||
var tsProject = gulpts.createProject('./tsconfig-staging.json'); | ||
|
||
var tsResult = tsProject.src() | ||
.pipe(sourcemaps.init()) | ||
.pipe(tsProject(gulpts.reporter.fullReporter(true))) | ||
.on("error", (e) => { /* Continue */ }); | ||
|
||
return merge([ | ||
tsResult.js | ||
.pipe(sourcemaps.write('.')) | ||
.pipe(gulp.dest(config.staging.dest)), | ||
tsResult.dts | ||
.pipe(gulp.dest(config.staging.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
var jasmine = require('gulp-jasmine'), | ||
istanbul = require('gulp-istanbul'), | ||
remap = require('remap-istanbul/lib/gulpRemapIstanbul'), | ||
instanbulEnforcer = require('gulp-istanbul-enforcer'); | ||
|
||
module.exports = function (gulp, config) { | ||
return function () { | ||
return gulp.src(config.test.coverage.src) | ||
.pipe(istanbul({ includeUntested: true })) | ||
.pipe(istanbul.hookRequire()) | ||
.on('finish', function () { | ||
gulp.src(config.test.src) | ||
.pipe(jasmine({ verbose: true, errorOnFail: false, includeStackTrace: false })) | ||
.pipe(istanbul.writeReports({ | ||
dir: config.test.coverage.dest, | ||
reporters: ['json'] | ||
})) | ||
.on('end', remapCoverageFiles) | ||
.on('finish', function () { | ||
gulp.src('.') | ||
.pipe(instanbulEnforcer({ | ||
coverageDirectory: config.test.coverage.dest, | ||
rootDirectory: '', | ||
thresholds: { | ||
statements: config.test.coverage.threshold || 80 | ||
} | ||
})); | ||
}); | ||
}); | ||
|
||
/** Take js coverage json and remap to typescript. Output html and text */ | ||
function remapCoverageFiles() { | ||
return gulp.src(config.test.coverage.coverageFile) | ||
.pipe(remap({ | ||
reports: { | ||
'json': config.test.coverage.coverageFile, // overwrite js based json with ts remapped version | ||
'html': config.test.coverage.dest, | ||
'lcovonly': config.test.coverage.lcovFile, | ||
'text': null | ||
} | ||
})); | ||
}; | ||
}; | ||
} | ||
|
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,11 @@ | ||
'use strict'; | ||
|
||
var tslint = require('gulp-tslint'); | ||
|
||
module.exports = function (gulp, config) { | ||
return function () { | ||
return gulp.src(config.src) | ||
.pipe(tslint({ formatter: "verbose", configuration: config.tslint })) | ||
.pipe(tslint.report({ summarizeFailureOutput: true })); | ||
}; | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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.