Skip to content

Commit

Permalink
Transpile themebuilder modules and move npm results to the single fol…
Browse files Browse the repository at this point in the history
…der (#5657)
  • Loading branch information
BingoRUS authored Oct 5, 2018
1 parent ae51ce7 commit f86a556
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build/gulp/bundler-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gulp.task('bundler-config', function() {
.pipe(gulp.dest('js/bundles'))
.pipe(rename('dx.custom.config.js'))
.pipe(replace(/require *\( *["']..\//g, 'require("devextreme/'))
.pipe(gulp.dest(context.RESULT_NPM_PATH + '/bundles'));
.pipe(gulp.dest(context.RESULT_NPM_PATH + '/devextreme/bundles'));
});

gulp.task('bundler-config-dev', function() {
Expand Down
1 change: 0 additions & 1 deletion build/gulp/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ module.exports = {
uglify: argv.uglify,
RESULT_JS_PATH: 'artifacts/js',
RESULT_NPM_PATH: 'artifacts/npm',
RESULT_THEMEBUILDER_NPM_PATH: 'artifacts/themebuilder-npm',
TRANSPILED_PATH: 'artifacts/transpiled',
EULA_URL: 'https://js.devexpress.com/Licensing/'
};
21 changes: 11 additions & 10 deletions build/gulp/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var context = require('./context.js');
var headerPipes = require('./header-pipes.js');
var compressionPipes = require('./compression-pipes.js');
var version = require('../../package.json').version;
var packagePath = context.RESULT_NPM_PATH + '/devextreme';

var TRANSPILED_GLOBS = [
context.TRANSPILED_PATH + '/**/*.js',
Expand Down Expand Up @@ -76,27 +77,27 @@ gulp.task('npm-sources', ['npm-dts-generator'], function() {
.pipe(addDefaultExport())
.pipe(headerPipes.starLicense())
.pipe(compressionPipes.beautify())
.pipe(gulp.dest(context.RESULT_NPM_PATH)),
.pipe(gulp.dest(packagePath)),

gulp.src(JSON_GLOBS)
.pipe(gulp.dest(context.RESULT_NPM_PATH)),
.pipe(gulp.dest(packagePath)),

gulp.src('build/npm-bin/*.js')
.pipe(eol('\n'))
.pipe(gulp.dest(context.RESULT_NPM_PATH + '/bin')),
.pipe(gulp.dest(packagePath + '/bin')),

gulp.src('webpack.config.js')
.pipe(gulp.dest(context.RESULT_NPM_PATH + '/bin')),
.pipe(gulp.dest(packagePath + '/bin')),

gulp.src('package.json')
.pipe(replace(version, context.version.package))
.pipe(gulp.dest(context.RESULT_NPM_PATH)),
.pipe(gulp.dest(packagePath)),

gulp.src(DIST_GLOBS)
.pipe(gulp.dest(context.RESULT_NPM_PATH + '/dist')),
.pipe(gulp.dest(packagePath + '/dist')),

gulp.src('README.md')
.pipe(gulp.dest(context.RESULT_NPM_PATH))
.pipe(gulp.dest(packagePath))
);
});

Expand Down Expand Up @@ -165,19 +166,19 @@ gulp.task('npm-dts-generator', function() {
.pipe(replace(/\/\*\s*#EndGlobalDeclaration\s*\*\//g, '}'))
.pipe(replace(/\/\*\s*#StartJQueryAugmentation\s*\*\/[\s\S]*\/\*\s*#EndJQueryAugmentation\s*\*\//g, ''))
.pipe(footer('\nexport default DevExpress;'))
.pipe(gulp.dest(path.join(context.RESULT_NPM_PATH, 'bundles'))),
.pipe(gulp.dest(path.join(packagePath, 'bundles'))),

merge.apply(merge, tsModules)
.pipe(headerPipes.starLicense())
.pipe(gulp.dest(context.RESULT_NPM_PATH))
.pipe(gulp.dest(packagePath))
);
});

gulp.task('npm-dts-check', ['npm-dts-generator'], function() {
var content = 'import $ from \'jquery\';\n';

content += MODULES.map(function(moduleMeta) {
var modulePath = '\'./npm/' + moduleMeta.name + '\'';
var modulePath = '\'./npm/devextreme/' + moduleMeta.name + '\'';
if(!moduleMeta.exports) {
return 'import ' + modulePath + ';';
}
Expand Down
20 changes: 16 additions & 4 deletions build/gulp/themebuilder-npm.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
const gulp = require('gulp');
const babel = require('gulp-babel');
const replace = require('gulp-replace');
const merge = require('merge-stream');
const context = require('./context.js');
const version = require('../../themebuilder/package.json').version;
const packagePath = context.RESULT_NPM_PATH + '/devextreme-themebuilder';

const SCRIPTS = [
const ASSETS = [
'themebuilder/**/*.*',
'!themebuilder/modules/*.js',
'!themebuilder/tests/**/*.*',
'!themebuilder/node_modules/**/*',
'!themebuilder/.npmignore',
'!themebuilder/cli/.eslintrc',
'!themebuilder/package.json'
'!themebuilder/package.json',
'!themebuilder/package-lock.json'
];

const SCRIPTS = [
'themebuilder/modules/*.js'
];

gulp.task('themebuilder-npm', () => {
return merge(
gulp.src(ASSETS)
.pipe(gulp.dest(packagePath)),

gulp.src(SCRIPTS)
.pipe(gulp.dest(context.RESULT_THEMEBUILDER_NPM_PATH)),
.pipe(babel())
.pipe(gulp.dest(packagePath + '/modules')),

gulp.src('themebuilder/package.json')
.pipe(replace(version, context.version.package))
.pipe(gulp.dest(context.RESULT_THEMEBUILDER_NPM_PATH))
.pipe(gulp.dest(packagePath))
);
});

0 comments on commit f86a556

Please sign in to comment.