Skip to content

Commit

Permalink
Rollup error (#44)
Browse files Browse the repository at this point in the history
* Fixed rollup error (Async functions producing an error "ReferenceError: regeneratorRuntime is not defined")

* fixed tests

* Replaced gulp-uglify with uglify-es

* fixed 'parse is undefined' issue

* Added empty wdl string check
  • Loading branch information
ekoltsova authored and sidoruka committed Jan 25, 2018
1 parent baef7b2 commit 85a88c5
Show file tree
Hide file tree
Showing 10 changed files with 893 additions and 330 deletions.
6 changes: 5 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import istanbul from 'gulp-babel-istanbul';
import coveralls from 'gulp-coveralls';
import jsdoc from 'gulp-jsdoc3';
import sourcemaps from 'gulp-sourcemaps';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import sass from 'gulp-sass';
import sassModuleImporter from 'sass-module-importer'; // eslint-disable-line import/no-unresolved, import/extensions
Expand All @@ -28,9 +27,14 @@ import yargs from 'yargs';
import ftp from 'vinyl-ftp';
import url from 'url';

import uglifyes from 'uglify-es';
import composer from 'gulp-uglify/composer';

import webpackConfig from './webpack.config';
import rollupConfig from './rollup.config';

const uglify = composer(uglifyes, console);

const packageJson = require('./package.json');

gulp.task('default', done =>
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
"graph"
],
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
"last 2 Chrome versions"
],
"devDependencies": {
"babel-core": "^6.23.1",
Expand Down Expand Up @@ -97,11 +95,12 @@
"vinyl-ftp": "^0.6.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1",
"yargs": "^6.6.0"
"yargs": "^6.6.0",
"uglify-es": "^3.3.7"
},
"dependencies": {
"jszip": "^3.1.4",
"lodash": "^4.17.4"
"lodash": "^3.10.1"
},
"directories": {
"doc": "docs",
Expand Down
10 changes: 8 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ export default {
}),
rollupPluginBabel({
babelrc: false,
runtimeHelpers: true,
presets: [['env', { modules: false }]],
runtimeHelpers: false,
presets: [['env', {
modules: false,
targets: {
browsers: ['last 2 chrome versions'],
},
}]],
exclude: './node_modules/**',
plugins: ['external-helpers'],
}),
rollupPluginReplace({
Expand Down
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function initialize() {
const flow3 = await example3.createFlow();

// compare results
const equal = _.isEqualWith(flow1, flow3, ignoreFunctions);
const equal = _.isEqual(flow1, flow3, ignoreFunctions);
const comparison = equal ? 'the same' : '<span style="color:red">different</span>';
const infoDiv = document.getElementById('info');
if (infoDiv) {
Expand Down
4 changes: 2 additions & 2 deletions src/model/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ export default class Step {
* Create a workflow step. You should {@link Workflow#add add} it to a workflow or a compound step.
*
* @param {string} name - Step name. Must be unique in a parent step (e.g. {@link Workflow}).
* @param {Action=} action - Action to execute during the step. If no action is specified it will
* @param {Action=} [action={}] action - Action to execute during the step. If no action is specified it will
* automatically be created based on the configuration. Multiple steps may share a single action.
* @param {object} [config={}] - Action configuration containing input bindings.
* It should include action description in case the action is missing.
*
*/
constructor(name, action, config = {}) {
constructor(name, action = {}, config = {}) {
if (_.isUndefined(name)) {
throw new Error('Step must have a name');
}
Expand Down
4 changes: 3 additions & 1 deletion src/parser/WDL/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ async function importParsingStage(ast, opts) {
return result;
}

export default async function parse(data, opts = {}) {
async function parse(data, opts = {}) {
let result = {
status: true,
message: '',
Expand Down Expand Up @@ -468,3 +468,5 @@ export default async function parse(data, opts = {}) {

return result.status ? Promise.resolve(result) : Promise.reject(result.message);
}

export default parse;
15 changes: 11 additions & 4 deletions src/parser/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ import parseWDL from './WDL/parse';
* @memberOf module:pipeline
* @param {string} text - Text file contents to parse.
* @param {object} [opts={}] - Parser options.
* @param {string} [opts.format='wdl'] - Workflow definition format ('wdl', 'cwl').
* @param {string} [opts.format='wdl'] - Workflow definition format ('wdl').
* @param {file} [opts.zipFile=null] - Zip with import WDL files
* @param {array} [opts.subWfDetailing=null] - Array of Sub Workflow names that should be detailed; if array includes '*' each Sub Workflow will be detailed.
* @param {number} [opts.recursionDepth=0] - Integer that describes Sub Workflow detailing depth
* @param {string} [opts.baseURI=null] - Base URI for WDL import statements
* @returns {Promise} Parsing result object
*/
function parse(text, opts = {}) {
if (!text) {
return Promise.reject('No data to parse');
}
const format = opts.format || 'wdl';
const subWfDetailing = (opts.subWfDetailing && _.isArray(opts.subWfDetailing)) ? opts.subWfDetailing : null;
const recursionDepth = opts.recursionDepth || 0;
const baseURI = opts.baseURI || null;

const zipFile = opts.zipFile || null;
if (format === 'wdl') {
if (opts.zipFile) {
return JSZip.loadAsync(opts.zipFile).then((files) => {
if (zipFile) {
return JSZip.loadAsync(zipFile).then((files) => {
const zipWdlFiles = [];

files.forEach((relativePath, zipEntry) => {
Expand Down
3 changes: 2 additions & 1 deletion src/visual/VisualStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export default class VisualStep extends joint.shapes.devs.Model {

_updatePortsState(portsOn, ports) {
const defaultOnValue = this.attributes.portsEnabled;
portsOn = _.omitBy(portsOn, (val, name) => _.isUndefined(ports[name]));
const omitBy = _.omitBy || _.omit; // be prepared for legacy lodash 3.10.1
portsOn = omitBy(portsOn, (val, name) => _.isUndefined(ports[name]));
_.forEach(ports, (port, name) => {
if (_.isUndefined(portsOn[name])) {
portsOn[name] = defaultOnValue;
Expand Down
13 changes: 11 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const version = require('./version');
module.exports = {
devtool: 'inline-source-map',
entry: {
demo: './src/app.js',
demo: ['./src/app.js'],
},
output: {
publicPath: '/',
Expand All @@ -22,7 +22,16 @@ module.exports = {
use: [{
loader: 'babel-loader',
options: {
presets: [['env', { modules: false }]],
presets: [['env',
{
targets: {
browsers: [
'last 2 chrome versions',
],
},
modules: false,
},
]],
},
}],
},
Expand Down
Loading

0 comments on commit 85a88c5

Please sign in to comment.