From 1e602992e4015025d92282519b106a07d5741ed8 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Mon, 16 Apr 2018 10:48:33 +0200 Subject: [PATCH 1/4] yo phovea:update --- .circleci/config.yml | 31 ++++++ .gitignore | 1 + .gitlab-ci.yml | 46 ++++++++ buildInfo.js | 56 +++++++--- index.js | 8 +- karma.conf.js | 2 +- package.json | 26 +++-- tests.webpack.js | 5 +- tsconfig.json | 4 +- tsconfig_dev.json | 6 ++ tsd.d.ts | 5 + webpack.config.js | 251 +++++++++++++++++++++++++++---------------- 12 files changed, 316 insertions(+), 125 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .gitlab-ci.yml create mode 100644 tsconfig_dev.json diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..0018acf --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,31 @@ +version: 2 +jobs: + build: + working_directory: ~/phovea + docker: + - image: circleci/node:6-browsers + tags: + - /v\d+.\d+.\d+.*/ + steps: + - checkout + - restore_cache: + key: deps2-{{ .Branch }}-{{ checksum "package.json" }} + - run: + name: install-npm-wee + command: npm install + - run: #remove all resolved github dependencies + name: delete-vcs-dependencies + command: | + (grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf + - save_cache: + key: deps2-{{ .Branch }}-{{ checksum "package.json" }} + paths: + - ./node_modules + - run: #install all dependencies + name: install-npm-wee2 + command: npm install + - run: + name: dist + command: npm run dist + - store_artifacts: + path: dist diff --git a/.gitignore b/.gitignore index ef38070..7fce761 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ node_modules/ *.map *.css *.log +/.cache-loader \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..05d99fb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,46 @@ +image: circleci/node:6-browsers + +variables: + GIT_DEPTH: "1" + +cache: + key: "$CI_REPOSITORY_URL-$CI_COMMIT_REF_NAME" + paths: + - node_modules + +before_script: + # Install ssh-agent if not already installed, it is required by Docker. + # (change apt-get to yum if you use a CentOS-based image) + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + + # Run ssh-agent (inside the build environment) + - eval $(ssh-agent -s) + + # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store + - ssh-add <(echo "$SSH_PRIVATE_KEY") + + # For Docker builds disable host key checking. Be aware that by adding that + # you are suspectible to man-in-the-middle attacks. + # WARNING: Use this only with the Docker executor, if you use it with shell + # you will overwrite your user's SSH config. + - mkdir -p ~/.ssh + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + +stages: + - install + - build + +install-npm-wee: + stage: install + script: + - npm install + +dist: + stage: build + script: + - npm run dist + allow_failure: false + artifacts: + expire_in: 1 week + paths: + - dist diff --git a/buildInfo.js b/buildInfo.js index 120c82c..09204ef 100644 --- a/buildInfo.js +++ b/buildInfo.js @@ -2,13 +2,11 @@ * Created by sam on 13.11.2016. */ - const spawnSync = require('child_process').spawnSync; const path = require('path'); const resolve = path.resolve; const fs = require('fs'); - function dependencyGraph(cwd) { const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; const r = spawnSync(npm, ['ls', '--prod', '--json'], { @@ -37,9 +35,9 @@ function gitHead(cwd) { function resolveModules() { const reg = fs.readFileSync('../phovea_registry.js').toString(); - const regex = /import '(.*)\/phovea_registry.js'/g; + const regex = /^import '(.*)\/phovea_registry.js'/gm; const modules = []; - var r; + let r; while ((r = regex.exec(reg)) !== null) { modules.push(r[1]); } @@ -55,19 +53,20 @@ function resolveWorkspace() { const workspaceDeps = dependencyGraph('..').dependencies; const modules = new Set(resolveModules()); + let deps = null; const resolveModule = (m) => { console.log('resolve', m); - const pkg = require(`../${m}/package.json`); + const pkg = JSON.parse(fs.readFileSync(`../${m}/package.json`).toString()); const head = gitHead('../' + m); const repo = pkg.repository.url; return { name: pkg.name, version: pkg.version, - resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length-4) : repo}/commit/${head}` : pkg.version, + resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length - 4) : repo}/commit/${head}` : pkg.version, dependencies: deps(pkg.dependencies) }; }; - const deps = (deps) => { + deps = (deps) => { const r = {}; Object.keys(deps).forEach((d) => { if (d in workspaceDeps) { @@ -121,31 +120,56 @@ function generate() { const isWorkspaceContext = fs.existsSync('../phovea_registry.js'); if (isWorkspaceContext) { return resolveWorkspace(); - } else { - return resolveSingle(); } + return resolveSingle(); } - const IS_WINDOWS = process.platform === 'win32'; function tmpdir() { if (IS_WINDOWS) { return process.env.TEMP || process.env.TMP || - (process.env.SystemRoot || process.env.windir) + '\\temp'; - } else { - return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp'; + (process.env.SystemRoot || process.env.windir) + '\\temp'; + } + return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp'; +} + +function resolveScreenshot() { + const f = resolve(__dirname, 'media/screenshot.png'); + if (!fs.existsSync(f)) { + return null; } + const buffer = new Buffer(fs.readFileSync(f)).toString('base64'); + return `data:image/png;base64,${buffer}`; +} + +function metaData(pkg) { + pkg = pkg || require(`./package.json`); + return { + name: pkg.name, + displayName: pkg.displayName, + version: pkg.version, + repository: pkg.repository.url, + homepage: pkg.homepage, + description: pkg.description, + screenshot: resolveScreenshot() + }; } +module.exports.metaData = metaData; +module.exports.metaDataTmpFile = function (pkg) { + const s = metaData(pkg); + const file = `${tmpdir()}/metaData${Math.random().toString(36).slice(-8)}.txt`; + fs.writeFileSync(file, JSON.stringify(s, null, ' ')); + return file; +}; module.exports.generate = generate; -module.exports.tmpFile = function() { +module.exports.tmpFile = function () { const s = generate(); const file = `${tmpdir()}/buildInfo${Math.random().toString(36).slice(-8)}.txt`; fs.writeFileSync(file, JSON.stringify(s, null, ' ')); return file; -} - +}; if (require.main === module) { fs.writeFile('deps.json', JSON.stringify(generate(), null, ' ')); diff --git a/index.js b/index.js index beb0591..61859c3 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ * generates and object that contain all modules in the src folder accessible as properties */ -/*** +/** * magic file name for the pseudo root file * @type {string} */ @@ -28,19 +28,19 @@ function byName(a, b) { } return a.toLowerCase().localeCompare(b.toLowerCase()); } -//list all modules in the src folder excluding the one starting with _ +// list all modules in the src folder excluding the one starting with _ var req = require.context('./src', true, /^\.\/(?!internal)(([^_][\w]+)|(\w+\/index))\.tsx?$/); var files = req.keys().sort(byName); -//root file exists? else use anonymous root object +// root file exists? else use anonymous root object if (files[0] === INDEX_FILE) { module.exports = req(files.shift()); } else { module.exports = {}; } -//generate getter for all modules +// generate getter for all modules files.forEach(function (f) { Object.defineProperty(module.exports, f.substring(2, f.lastIndexOf('/index.') > 0 ? f.lastIndexOf('/index.') : f.lastIndexOf('.')), { get: function () { diff --git a/karma.conf.js b/karma.conf.js index d15ca8b..eb434ab 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -14,7 +14,7 @@ module.exports = (config) => { // list of files / patterns to load in the browser files: [ - 'tests.webpack.js' //just load this file + 'tests.webpack.js' // just load this file ], // preprocess matching files before serving them to the browser diff --git a/package.json b/package.json index 2ff179d..4246b63 100644 --- a/package.json +++ b/package.json @@ -73,18 +73,22 @@ "karma-sourcemap-loader": "0.3.7", "karma-webpack": "2.0.2", "mkdirp": "0.5.1", - "node-sass": "4.5.0", + "node-sass": "4.7.2", "null-loader": "0.1.1", "raw-loader": "0.5.1", - "sass-loader": "5.0.0", - "style-loader": "0.13.1", - "tslib": "1.5.0", - "tslint": "4.4.2", - "typedoc": "0.5.5", - "typescript": "2.2.0", - "url-loader": "0.5.7", - "webpack": "2.2.1", - "webpack-dev-server": "2.3.0", - "extract-loader": "0.1.0" + "sass-loader": "6.0.7", + "style-loader": "0.16.1", + "tslib": "1.9.0", + "tslint": "5.9.1", + "typedoc": "0.11.1", + "typescript": "2.7.2", + "url-loader": "0.5.8", + "webpack": "2.3.3", + "webpack-dev-server": "2.4.2", + "cache-loader": "1.2.0", + "ifdef-loader": "2.0.0", + "fork-ts-checker-webpack-plugin": "0.4.1", + "thread-loader": "1.1.2", + "ts-loader": "4.0.1" } } diff --git a/tests.webpack.js b/tests.webpack.js index e0b8754..9438ac4 100644 --- a/tests.webpack.js +++ b/tests.webpack.js @@ -4,10 +4,11 @@ * Licensed under the new BSD license, available at http://caleydo.org/license **************************************************************************** */ -//build registry +// build registry require('./phovea_registry.js'); + /** * find all tests in the spec directory and load them */ -var context = require.context('./tests', true, /\.test\.ts$/); //make sure you have your directory and regex test set correctly! +var context = require.context('./tests', true, /\.test\.ts$/); // make sure you have your directory and regex test set correctly! context.keys().forEach(context); diff --git a/tsconfig.json b/tsconfig.json index e65e1a7..82e5d03 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,9 @@ "experimentalDecorators": true, "lib": [ "dom", - "es2015" + "es2015", + "es2016.array.include", + "es2017.object" ], "baseUrl": "../", "noImplicitAny": false, diff --git a/tsconfig_dev.json b/tsconfig_dev.json new file mode 100644 index 0000000..807b9bf --- /dev/null +++ b/tsconfig_dev.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es6" + } +} diff --git a/tsd.d.ts b/tsd.d.ts index 0c265d5..9e343ca 100644 --- a/tsd.d.ts +++ b/tsd.d.ts @@ -9,7 +9,12 @@ declare module "*.scss" { const content:string; export default content; } +declare module "*.css" { + const content:string; + export default content; +} declare module "*.png"; +declare module "*.jpg"; //allow html dependencies declare module "*.html" { const content:string; diff --git a/webpack.config.js b/webpack.config.js index e829ee3..95542e3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,17 +4,18 @@ * Licensed under the new BSD license, available at http://caleydo.org/license **************************************************************************** */ -const {libraryAliases, libraryExternals, modules, entries, ignores, type} = require('./.yo-rc.json')['generator-phovea']; +const {libraryAliases, libraryExternals, modules, entries, ignores, type, registry, vendor} = require('./.yo-rc.json')['generator-phovea']; const resolve = require('path').resolve; const pkg = require('./package.json'); const webpack = require('webpack'); const fs = require('fs'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const buildInfo = require('./buildInfo.js'); const now = new Date(); const prefix = (n) => n < 10 ? ('0' + n) : n.toString(); -const buildId = `${now.getUTCFullYear()}${prefix(now.getUTCMonth())}${prefix(now.getUTCDate())}-${prefix(now.getUTCHours())}${prefix(now.getUTCMinutes())}${prefix(now.getUTCSeconds())}`; +const buildId = `${now.getUTCFullYear()}${prefix(now.getUTCMonth() + 1)}${prefix(now.getUTCDate())}-${prefix(now.getUTCHours())}${prefix(now.getUTCMinutes())}${prefix(now.getUTCSeconds())}`; pkg.version = pkg.version.replace('SNAPSHOT', buildId); const year = (new Date()).getFullYear(); @@ -23,32 +24,75 @@ const banner = '/*! ' + (pkg.title || pkg.name) + ' - v' + pkg.version + ' - ' + '* Copyright (c) ' + year + ' ' + pkg.author.name + ';' + ' Licensed ' + pkg.license + '*/\n'; +const preCompilerFlags = {flags: (registry || {}).flags || {}}; +const includeFeature = registry ? (extension, id) => { + const exclude = registry.exclude || []; + const include = registry.include || []; + if (!exclude && !include) { + return true; + } + const test = (f) => Array.isArray(f) ? extension.match(f[0]) && (id || '').match(f[1]) : extension.match(f); + return include.every(test) && !exclude.some(test); +} : () => true; + +const tsLoader = [ + { + loader: 'awesome-typescript-loader' + } +]; -//list of loaders and their mappings +const tsLoaderDev = [ + {loader: 'cache-loader'}, + { + loader: 'thread-loader', + options: { + // there should be 1 cpu for the fork-ts-checker-webpack-plugin + workers: require('os').cpus().length - 1 + } + }, + { + loader: 'ts-loader', + options: { + happyPackMode: true, // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack, + compilerOptions: { + target: 'es6' + } + } + } +]; + +// list of loaders and their mappings const webpackloaders = [ - {test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, - {test: /\.tsx?$/, loader: 'awesome-typescript-loader'}, - {test: /\.json$/, loader: 'json-loader'}, + {test: /\.scss$/, use: 'style-loader!css-loader!sass-loader'}, + {test: /\.css$/, use: 'style-loader!css-loader'}, + {test: /\.tsx?$/, use: tsLoader}, + { + test: /phovea(_registry)?\.js$/, use: [{ + loader: 'ifdef-loader', + options: Object.assign({include: includeFeature}, preCompilerFlags) + }] + }, + {test: /\.json$/, use: 'json-loader'}, { test: /\.(png|jpg)$/, loader: 'url-loader', - query: { - limit: 10000, //inline <= 10kb + options: { + limit: 10000 // inline <= 10kb } }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader', - query: { - limit: 10000, //inline <= 10kb + options: { + limit: 10000, // inline <= 10kb mimetype: 'application/font-woff' } }, { test: /\.svg(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader', - query: { - limit: 10000, //inline <= 10kb + options: { + limit: 10000, // inline <= 10kb mimetype: 'image/svg+xml' } }, @@ -58,15 +102,15 @@ const webpackloaders = [ /** * tests whether the given phovea module name is matching the requested file and if so convert it to an external lookup * depending on the loading type - **/ + */ function testPhoveaModule(moduleName, request) { if (!(new RegExp('^' + moduleName + '/src.*')).test(request)) { return false; } const subModule = request.match(/.*\/src\/?(.*)/)[1]; - //skip empty modules = root + // skip empty modules = root const path = subModule === '' ? [moduleName] : [moduleName, subModule]; - //phovea_ ... phovea.name + // phovea_ ... phovea.name const rootPath = /phovea_.*/.test(moduleName) ? ['phovea', moduleName.slice(7)].concat(path.slice(1)) : path; return { root: rootPath, @@ -91,6 +135,7 @@ function testPhoveaModules(modules) { // use workspace registry file if available const isWorkspaceContext = fs.existsSync(resolve(__dirname, '..', 'phovea_registry.js')); const registryFile = isWorkspaceContext ? '../phovea_registry.js' : './phovea_registry.js'; +const actMetaData = `file-loader?name=phoveaMetaData.json!${buildInfo.metaDataTmpFile(pkg)}`; const actBuildInfoFile = `file-loader?name=buildInfo.json!${buildInfo.tmpFile()}`; /** @@ -99,18 +144,18 @@ const actBuildInfoFile = `file-loader?name=buildInfo.json!${buildInfo.tmpFile()} * @returns {*} */ function injectRegistry(entry) { - //build also the registry + const extraFiles = [registryFile, actBuildInfoFile, actMetaData]; + // build also the registry if (typeof entry === 'string') { - return [registryFile, actBuildInfoFile].concat(entry); - } else { - const transformed = {}; - Object.keys(entry).forEach((eentry) => { - transformed[eentry] = [registryFile, actBuildInfoFile].concat(entry[eentry]); - }); - return transformed; + return extraFiles.concat(entry); } - + const transformed = {}; + Object.keys(entry).forEach((eentry) => { + transformed[eentry] = extraFiles.concat(entry[eentry]); + }); + return transformed; } + /** * generate a webpack configuration */ @@ -120,28 +165,24 @@ function generateWebpack(options) { output: { path: resolve(__dirname, 'build'), filename: (options.name || (pkg.name + (options.bundle ? '_bundle' : ''))) + (options.min && !options.nosuffix ? '.min' : '') + '.js', - publicPath: '' //no public path = relative + chunkFilename: '[chunkhash].js', + publicPath: '' // no public path = relative }, resolve: { - // Add `.ts` and `.tsx` as a resolvable extension. + // add `.ts` and `.tsx` as a resolvable extension. extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'], alias: Object.assign({}, options.libs || {}), - //fallback to the directory above if they are siblings just in the workspace context + symlinks: false, + // fallback to the directory above if they are siblings just in the workspace context modules: isWorkspaceContext ? [ resolve(__dirname, '../'), 'node_modules' ] : ['node_modules'] }, plugins: [ - new webpack.BannerPlugin({ - banner: banner, - raw: true - }), - //define magic constants that are replaced + // define magic constants that are replaced new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify(options.isProduction ? 'production': 'development') - }, + 'process.env.NODE_ENV': JSON.stringify(options.isProduction ? 'production' : 'development'), __VERSION__: JSON.stringify(pkg.version), __LICENSE__: JSON.stringify(pkg.license), __BUILD_ID__: buildId, @@ -149,12 +190,8 @@ function generateWebpack(options) { __TEST__: options.isTest, __PRODUCTION__: options.isProduction, __APP_CONTEXT__: JSON.stringify('/') - }), - new webpack.optimize.MinChunkSizePlugin({ - minChunkSize: 10000 //at least 10.000 characters - }), - new webpack.optimize.AggressiveMergingPlugin() - //rest depends on type + }) + // rest depends on type ], externals: [], module: { @@ -180,45 +217,70 @@ function generateWebpack(options) { secure: false } }, - contentBase: resolve(__dirname, 'build') + contentBase: resolve(__dirname, 'build'), + watchOptions: { + aggregateTimeout: 500, + ignored: /node_modules/ + } + }, + watchOptions: { + aggregateTimeout: 500, + ignored: /node_modules/ } }; + if (options.isProduction) { + base.plugins.unshift(new webpack.BannerPlugin({ + banner: banner, + raw: true + })); + base.plugins.push(new webpack.optimize.MinChunkSizePlugin({ + minChunkSize: 10000 // at least 10.000 characters + })); + // base.plugins.push(new webpack.optimize.ModuleConcatenationPlugin()); + } else if (options.isDev) { + // switch to def settings + base.module.loaders.find((d) => d.use === tsLoader).use = tsLoaderDev; + base.plugins.push(new ForkTsCheckerWebpackPlugin({checkSyntacticErrors: true, tsconfig: './tsconfig_dev.json'})); + } + if (options.library) { let libName = /phovea_.*/.test(pkg.name) ? ['phovea', pkg.name.slice(7)] : pkg.name; - //generate a library, i.e. output the last entry element - //create library name + // generate a library, i.e. output the last entry element + // create library name if (options.moduleBundle) { libName = 'phovea'; } base.output.library = libName; base.output.libraryTarget = 'umd'; - base.output.umdNamedDefine = false; //anonymous require module + base.output.umdNamedDefine = false; // anonymous require module } - if (!options.bundle) { - //if we don't bundle don't include external libraries and other phovea modules + // if we don't bundle don't include external libraries and other phovea modules base.externals.push(...(options.externals || Object.keys(options.libs || {}))); - //ignore all phovea modules + // ignore all phovea modules if (options.modules) { base.externals.push(testPhoveaModules(options.modules)); } - //ignore extra modules + // ignore extra modules (options.ignore || []).forEach(function (d) { - base.module.loaders.push({test: new RegExp(d), loader: 'null-loader'}); //use null loader + base.module.loaders.push({test: new RegExp(d), loader: 'null-loader'}); // use null loader }); - //ingore phovea module registry calls + // ingore phovea module registry calls (options.modules || []).forEach(function (m) { - base.module.loaders.push({test: new RegExp('.*[\\\\/]' + m + '[\\\\/]phovea_registry.js'), loader: 'null-loader'}); //use null loader + base.module.loaders.push({ + test: new RegExp('.*[\\\\/]' + m + '[\\\\/]phovea_registry.js'), + loader: 'null-loader' + }); // use null loader }); } if (!options.bundle || options.isApp) { - //extract the included css file to own file - let p = new ExtractTextPlugin({ - filename: (options.isApp || options.moduleBundle ? 'style' : pkg.name) + (options.min && !options.nosuffix ? '.min' : '') + '.css', + // extract the included css file to own file + const p = new ExtractTextPlugin({ + filename: (options.isApp || options.moduleBundle ? 'style' : pkg.name) + (options.min && !options.nosuffix ? '.min' : '') + '.css', allChunks: true // there seems to be a bug in dynamically loaded chunk styles are not loaded, workaround: extract all styles from all chunks }); base.plugins.push(p); @@ -226,38 +288,45 @@ function generateWebpack(options) { test: /\.scss$/, loader: p.extract(['css-loader', 'sass-loader']) }; + base.module.loaders[1] = { + test: /\.css$/, + loader: p.extract(['css-loader']) + }; } if (options.isApp) { // create manifest // base.plugins.push(new webpack.optimize.AppCachePlugin()); } if (options.commons) { - //build a commons plugin + // build a commons plugin base.plugins.push(new webpack.optimize.CommonsChunkPlugin({ // The order of this array matters - names: ['common'], + name: 'common', + filename: 'common.js', minChunks: 2 })); } + if (options.vendor) { + (Array.isArray(options.vendor) ? options.vendor : [options.vendor]).forEach((reg) => { + base.plugins.push(new webpack.optimize.CommonsChunkPlugin({ + async: true, + children: true, + deepChildren: true, + minChunks: (module, count) => new RegExp(reg, 'i').test(module.resource) && count >= 2 + })); + }); + } if (options.min) { - //use a minifier + // use a minifier base.plugins.push( new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }), - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false - }, - output: { - comments: false - }, - sourceMap: false - })); + new webpack.optimize.UglifyJsPlugin()); } else { - //generate source maps - base.devtool = 'source-map'; + // generate source maps + base.devtool = 'inline-source-map'; } return base; } @@ -272,6 +341,7 @@ function generateWebpackConfig(env) { libs: libraryAliases, externals: libraryExternals, modules: modules, + vendor: vendor, ignore: ignores, isProduction: isProduction, isDev: isDev, @@ -286,36 +356,37 @@ function generateWebpackConfig(env) { if (type.startsWith('app')) { base.isApp = true; - base.bundle = true; //bundle everything together - base.name = '[name]'; //multiple entries case - base.commons = true; //extract commons module + base.bundle = true; // bundle everything together + base.name = '[name]'; // multiple entries case + base.commons = true; // extract commons module } else if (type === 'bundle') { - base.library = true; //expose as library - base.moduleBundle = true; //expose as library 'phovea' - base.name = pkg.name; //to avoid adding _bundle + base.library = true; // expose as library + base.moduleBundle = true; // expose as library 'phovea' + base.name = pkg.name; // to avoid adding _bundle base.bundle = true; - } else { //type === 'lib' + } else { // type === 'lib' base.library = true; } - //single generation + // single generation if (isDev) { return generateWebpack(base); - } else if (type.startsWith('app')) { //isProduction app + } + if (type.startsWith('app')) { // isProduction app return generateWebpack(Object.assign({}, base, { - min: true, - nosuffix: true - })); - } else { //isProduction - return [ - //plain - generateWebpack(base), - //minified - generateWebpack(Object.assign({}, base, { - min: true - })) - ]; + min: true, + nosuffix: true + })); } + // isProduction + return [ + // plain + generateWebpack(base), + // minified + generateWebpack(Object.assign({}, base, { + min: true + })) + ]; } module.exports = generateWebpackConfig; From 4b8e81137444cab6a7149fcbcb488eb659929799 Mon Sep 17 00:00:00 2001 From: Holger Stitz Date: Mon, 16 Apr 2018 10:48:52 +0200 Subject: [PATCH 2/4] Fix tslint with typescript 2.7.2 --- src/force_directed_graph.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/force_directed_graph.ts b/src/force_directed_graph.ts index 9b6f056..951fb88 100644 --- a/src/force_directed_graph.ts +++ b/src/force_directed_graph.ts @@ -116,7 +116,7 @@ export class ForceDirectedGraphVis extends AVisInstance implements IVisInstance })); const f = d3.layout.force() .size(this.rawSize); - f.nodes(nodes).links(edges); + f.nodes(nodes).links(edges); // TODO remove possibly wrong typecast const $links = $root.selectAll('.edge').data(edges); $links.enter().append('line').classed('edge', true); From f6f6aa7391e0a6f401d8149b2210284a252a03f3 Mon Sep 17 00:00:00 2001 From: anita-steiner Date: Thu, 17 May 2018 05:32:23 +0200 Subject: [PATCH 3/4] 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ff179d..a3839a7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "phovea_vis", "description": "Utilitiy reposititory containing common visualizations (table, heatmap, scatterplot, axis, pie, distribution, ..)", "homepage": "https://phovea.caleydo.org", - "version": "0.1.1-SNAPSHOT", + "version": "1.0.0", "author": { "name": "The Caleydo Team", "email": "contact@caleydo.org", From d1128ae3d20a6d7c7f05f122e2f9b4c193db05ec Mon Sep 17 00:00:00 2001 From: anita-steiner Date: Wed, 25 Jul 2018 04:44:46 +0200 Subject: [PATCH 4/4] changes for version 2.0 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2ff179d..e131ca2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "phovea_vis", "description": "Utilitiy reposititory containing common visualizations (table, heatmap, scatterplot, axis, pie, distribution, ..)", "homepage": "https://phovea.caleydo.org", - "version": "0.1.1-SNAPSHOT", + "version": "2.0.0", "author": { "name": "The Caleydo Team", "email": "contact@caleydo.org", @@ -50,8 +50,8 @@ "dist": "mkdirp dist && cd build && tar cvzf ../dist/phovea_vis.tar.gz *" }, "dependencies": { - "phovea_core": "github:phovea/phovea_core#develop", - "phovea_d3": "github:phovea/phovea_d3#develop", + "phovea_core": "2.0.0", + "phovea_d3": "2.0.0", "@types/d3": "3.5.36", "d3": "3.5.17" },