diff --git a/.circleci/config.yml b/.circleci/config.yml index 009eb47..2740dfa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,54 +3,83 @@ jobs: build: working_directory: ~/phovea docker: - - image: caleydo/phovea_circleci_python:v2.0 + - image: circleci/python:3.7-buster-node-browsers # for node version see Dockerfile on https://hub.docker.com/r/circleci/python steps: - checkout - run: + name: Show Node.js and npm version + command: | + node -v + npm -v + - run: + name: Show Python and pip version + command: | + python --version + pip --version + - run: + name: Install Docker packages from docker_packages.txt command: | (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs sudo apt-get install -y)) - restore_cache: - key: deps1-{{ checksum "package.json" }} + key: deps2-{{ .Branch }}-{{ checksum "package.json" }} - run: - name: install-npm-wee + name: Install npm dependencies command: npm install - - run: #remove all resolved github dependencies - name: delete-vcs-dependencies + - run: + name: Remove npm dependencies installed from git repositories (avoid caching of old commits) command: | (grep -l '._resolved.: .\(git[^:]*\|bitbucket\):' ./node_modules/*/package.json || true) | xargs -r dirname | xargs -r rm -rf - save_cache: - key: deps1-{{ checksum "package.json" }} + key: deps2-{{ .Branch }}-{{ checksum "package.json" }} paths: - ./node_modules - - run: #install all dependencies - name: install-npm-wee2 + - run: + name: Install npm dependencies from git repositories (always get latest commit) command: npm install + - run: + name: Show installed npm dependencies + command: npm list --depth=1 || true - restore_cache: - key: deps1-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} + key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} - run: - name: install-pip-wee + name: Install pip requirements command: | virtualenv ~/venv . ~/venv/bin/activate pip install -r requirements_dev.txt pip install -r requirements.txt - save_cache: - key: deps1-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} + key: deps1-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_dev.txt" }} paths: - ~/venv - - run: #force update of VCS dependencies? - name: update-pip-vcs-dependencies + - run: + name: Force an update of pip dependencies from git repositories # not sure if this is working ? command: | . ~/venv/bin/activate pip install --upgrade --upgrade-strategy=only-if-needed -r requirements.txt - run: - name: build + name: Show installed pip packages + command: pip list || true + - run: + name: Build command: | . ~/venv/bin/activate - npm run build - + npm run dist + - store_artifacts: + path: dist + destination: dist workflows: version: 2 +# build-nightly: +# triggers: +# - schedule: +# cron: "15 1 * * 1-5" # "At 01:15 on every day-of-week from Monday through Friday.”, see: https://crontab.guru/#15_1_*_*_1-5 +# filters: +# branches: +# only: +# - develop +# jobs: +# - build build-branch: jobs: - build: diff --git a/.gitignore b/.gitignore index 2104b5e..5c74ff0 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ node_modules/ /tests/**/*.js *.map *.css +/.cache-loader +package-lock.json diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 82c4be7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: python -sudo: required -env: -- TOXENV=py27 -- TOXENV=py34 - -node_js: -- 6 - -addons: - firefox: 49.0.1 - -before_install: -- export DISPLAY=:99.0 -- sh -e /etc/init.d/xvfb start -- nvm install 6 -- if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi - -install: -- (!(test -f docker_packages.txt) || (cat docker_packages.txt | xargs sudo apt-get install -y)) -- pip install -r requirements_dev.txt -- pip install -r requirements.txt -- npm install - -script: npm run dist - -deploy: - provider: releases - api_key: - secure: TK9/P34Bi3WuppiDrBCwVcn41yCBwmILaU8hXTBzUPbT7TbeFIwsC6/4CtH85Z+ZrUve4S5pTmWRNf2dQDxWw3uYu7+bJuemV2J1LHG76mognj+TNEiYxfLQUt3Gql4W7C7FcI4Rlx5/uMN9wY1wro8TWUBMwT6jjSrUWIvK3GXoojd5bHvJx07XpjWl9wCon4D0ruZiFoM2mdeP23lbc2GckETi32oEKswnQXxkMACmxbPzoWbvkxH4aK8Bt2Rj2sl2TbPhVkN6DAkHGkGAvLI+2/aRfG27+oo3OKsaDjbuGABct8TfZccJ970CbQ8kbnCjYxstvqkg1JWjF0W67sX/flBZZOEUA5l0OLWo6HqMGMxm7/lEQhIdPMsRmvXL+HVOxkMrB2dda58QzxVwiZp+rRqUaeabPZp8Kl5xodGrVxsBvxe6zAbJ5jCtCSumG6+kLyKI00/kYlghqQNrgUw0ZsYJlQ34h3lo/24QpaeyDpQoCkGWQgtgqiXGpeKSu7bCnOqIqAy3nbT9Utwj7K8gIasTG5idosEAz/THMampNbGDuyxxc340sYGNMg9Bhm1g2ILWRdtV470p5hwBtIDTKi3/PAizEO26+Wh0zI47Sg3ao57avcbCsTmzbZUeA5J4bojmchhJCHX8su9cSCGh/2fJA/1eBIgEvOQ8LNE= - file_glob: true - file: - - dist/tdp_dummy*.egg - - dist/tdp_dummy.tar.gz - on: - tags: true - -notifications: - slack: - secure: E8/1UIdHSczUbN+6i6gd1d5LM4vmLdwLQ30tpyjvnM0wvfDce76oPxLJAy240WJ5ybXRZUtNrttpVpt4tEXCy8aLFCmxD7s77rVloH+q1J8R/ptTFWZGhFGEujk1awEmVbzcWxJkV9/JENQaeGBKxwv8/EQwWwEkAb7p/+AJb9owmH88b3wUZUGHBWtbMiyyaF4Rm1Wg1stJB8Z1Ga7PRF4cqufTgcDdsCPVv9gAY+VxOIGqX/Vfuc9UWpUH8vq8lHUE7Inn5QS78kuFfSgLWga3H6Mu/Gko1XNlWk0QWWQBUvEZ6ZC6Wuo68KzvUjJHDTnx8WyfHue2JNHIslcX+eJq2WHLeEgM24VeNkILCGo/H/60NGHiSjrIv/Y9h6bQ9FDjo6TUyE4nbdPYN1RN9FQ5UbI9Y4Gi753H9mqnHWlEywBOzHxdZCAuz9Wh03CCF/blsvJ+Obbyo6Jrfe+g44jyi9kQdBNQ78qG6v4EXws8FiYao6x3PpgIwFix42Cpr+soAh5FpA3C1zHSAyZZpXF65/lrDl5yPNofK7Wy0B9bw+0I6Z/u7ZKFNVZXvYPGYvtUVcsALGBdmYc61+LCta36Po0KZseWVAlJj6QnOJDYzv0wvV/zsuf9A5KpYFGiqV9Q7zmtiO5FYF5sBy+lE7O9tHVO4O18IRndhRQgxhs= - on_success: change - on_failure: always diff --git a/.yo-rc.json b/.yo-rc.json index 242a8b8..b2734ff 100644 --- a/.yo-rc.json +++ b/.yo-rc.json @@ -17,6 +17,12 @@ "libraryExternals": [], "entries": "./index.js", "ignores": [], - "today": "Sun, 06 Nov 2016 22:40:46 GMT" + "today": "Sun, 06 Nov 2016 22:40:46 GMT", + "promptValues": { + "authorName": "The Caleydo Team", + "authorEmail": "contact@caleydo.org", + "authorUrl": "https://caleydo.org", + "githubAccount": "caleydo" + } } } \ No newline at end of file diff --git a/buildInfo.js b/buildInfo.js index 21d8c40..4e7bd68 100644 --- a/buildInfo.js +++ b/buildInfo.js @@ -35,7 +35,7 @@ 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 = []; let r; while ((r = regex.exec(reg)) !== null) { @@ -56,7 +56,7 @@ function resolveWorkspace() { 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 { @@ -139,7 +139,7 @@ function resolveScreenshot() { if (!fs.existsSync(f)) { return null; } - const buffer = new Buffer(fs.readFileSync(f)).toString('base64'); + const buffer = Buffer.from(fs.readFileSync(f)).toString('base64'); return `data:image/png;base64,${buffer}`; } @@ -147,8 +147,10 @@ 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() }; diff --git a/buildPython.js b/buildPython.js new file mode 100644 index 0000000..c30f2e8 --- /dev/null +++ b/buildPython.js @@ -0,0 +1,69 @@ +/** + * Created by sam on 13.11.2016. + */ + +const spawnSync = require('child_process').spawnSync; +const fs = require('fs'); + +function gitHead(cwd) { + const r = spawnSync('git', ['rev-parse', '--verify', 'HEAD'], { + cwd: cwd + }); + if (!r.stdout) { + console.error(cwd, r.error); + return 'error'; + } + return r.stdout.toString().trim(); +} + +function resolvePlugin(repo, version) { + if (fs.lstatSync('.git').isDirectory() && repo) { + if (repo.endsWith('.git')) { + repo = repo.slice(0, repo.length - 4); + return repo + '/commit/' + gitHead('.'); + } + } + // not a git repo + return version; +} + +function toVersion(v) { + const now = new Date().toISOString(); + // %Y%m%d-%H%M%S + const fmt = now + .replace(/T/, ' ') + .replace(/\..+/, '') + .replace(/[-:]/, '') + .replace(' ', '-'); + return v.replace('SNAPSHOT', fmt); +} + +function _main() { + const pkg = require('./package.json'); + const name = pkg.name; + const version = toVersion(pkg.version); + const resolved = resolvePlugin((pkg.repository || {}).url, version); + + const buildInfo = { + name, + version, + resolved, + description: pkg.description, + homepage: pkg.homepage, + repository: (pkg.repository || {}).url + }; + + const l = ('build/source/' + name.toLowerCase()).split('/'); + l.forEach((_, i) => { + const path = l.slice(0, i + 1).join('/'); + if (!fs.existsSync(path)) { + fs.mkdirSync(path); + } + }); + + fs.writeFileSync('build/source/' + name.toLowerCase() + '/buildInfo.json', JSON.stringify(buildInfo, null, ' ')); +} + +if (require.main === module) { + _main(); +} diff --git a/deploy/docker-compose.partial.yml b/deploy/docker-compose.partial.yml new file mode 100644 index 0000000..745b1fd --- /dev/null +++ b/deploy/docker-compose.partial.yml @@ -0,0 +1 @@ +version: '2.0' diff --git a/package.json b/package.json index b89aad9..2fbc43f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "tdp_dummy", "description": "", "homepage": "https://phovea.caleydo.org", - "version": "5.0.0", + "version": "6.0.0", "author": { "name": "The Caleydo Team", "email": "contact@caleydo.org", @@ -18,8 +18,8 @@ }, "main": "build/tdp_dummy.js", "engines": { - "npm": ">= 3", - "node": ">= 6", + "npm": ">= 6.12", + "node": ">= 12.13", "iojs": ">= 3" }, "files": [ @@ -43,7 +43,7 @@ "predist": "echo hybrid", "dist": "npm run dist:web && npm run dist:python", "compile": "tsc", - "lint": "tslint -c tslint.json -p .", + "lint": "tslint -c tslint.json -p . 'src/**/*.ts?(x)' 'tests/**/*.ts?(x)'", "docs": "npm run docs:web && npm run docs:python", "prebuild": "echo hybrid", "posttest": "echo hybrid", @@ -63,29 +63,31 @@ "test:python": "test ! $(find tests -name \"*.py\") || python setup.py test", "predist:web": "npm run build:web && npm run docs:web", "dist:web": "mkdirp dist && cd build && tar cvzf ../dist/tdp_dummy.tar.gz *", - "dist:python": "python setup.py bdist_egg", + "dist:python": "python setup.py sdist bdist_wheel", "docs:web": "typedoc --options typedoc.json src/**.ts", "docs:python": "sphinx-apidoc -o docs -f ./tdp_dummy && sphinx-build ./docs build/docs", - "build:python": "python build.py", + "build:python": "rm -rf build/source && find . -name '*.pyc' -delete && node buildPython.js && cp -r ./tdp_dummy build/source/", "build:web": "webpack --env prod", "prebuild:python": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test:python", "prebuild:web": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test:web", "predist:python": "npm run build:python && npm run docs:python" }, "dependencies": { - "tdp_core": "github:datavisyn/tdp_core#semver:^5.0.2" + "tdp_core": "github:datavisyn/tdp_core#semver:^8.0.0" }, "optionalDependencies": { - "dTiles": "github:datavisyn/dTiles#semver:^3.0.0", - "ordino": "github:Caleydo/ordino#semver:^5.0.0" + "ordino": "github:Caleydo/ordino#semver:^6.0.0" }, "devDependencies": { "@types/jasmine": "2.5.47", "awesome-typescript-loader": "3.1.2", + "cache-loader": "1.2.0", "css-loader": "0.28.0", - "extract-loader": "0.1.0", "extract-text-webpack-plugin": "2.1.0", + "extract-loader": "0.1.0", + "ifdef-loader": "2.0.0", "file-loader": "0.11.1", + "fork-ts-checker-webpack-plugin": "0.4.1", "html-loader": "0.4.5", "imports-loader": "0.7.1", "jasmine": "2.5.3", @@ -98,22 +100,19 @@ "karma-sourcemap-loader": "0.3.7", "karma-webpack": "2.0.3", "mkdirp": "0.5.1", - "node-sass": "4.7.2", + "node-sass": "^4.12.0", "null-loader": "0.1.1", "raw-loader": "0.5.1", "sass-loader": "6.0.7", "style-loader": "0.16.1", + "thread-loader": "1.1.2", + "ts-loader": "4.0.1", "tslib": "1.9.0", "tslint": "5.9.1", "typedoc": "0.11.1", - "typescript": "2.7.2", + "typescript": "2.8.1", "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" + "webpack-dev-server": "2.4.2" } } diff --git a/phovea.js b/phovea.js index ea1ad95..441536b 100644 --- a/phovea.js +++ b/phovea.js @@ -128,8 +128,6 @@ module.exports = function (registry, feature) { factory: 'createScore' }); - - /// #if include('dTiles') registry.push('dTilesSearchProvider', 'dummyA', function () { return import('./src/DummySearchProvider') }, { @@ -137,14 +135,12 @@ module.exports = function (registry, feature) { factory: 'createA' }); - registry.push('dTilesSearchProvider', 'dummyB', function () { return import('./src/DummySearchProvider') }, { idType: 'IDTypeB', factory: 'createB' }); - /// #endif // generator-phovea:end }; diff --git a/phovea_registry.js b/phovea_registry.js index 4e1b190..e4b0c05 100644 --- a/phovea_registry.js +++ b/phovea_registry.js @@ -13,8 +13,5 @@ import {register} from 'phovea_core/src/plugin'; /// #if include('ordino') import 'ordino/phovea_registry.js'; /// #endif -/// #if include('dTiles') -import 'dTiles/phovea_registry.js'; -/// #endif //self register('tdp_dummy',require('./phovea.js')); diff --git a/requirements.txt b/requirements.txt index 0b7ba53..f4b0ffd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ --e git+https://github.com/datavisyn/tdp_core.git@v5.0.2#egg=tdp_core +-e git+https://github.com/datavisyn/tdp_core.git@v8.0.0#egg=tdp_core diff --git a/requirements_dev.txt b/requirements_dev.txt index 7ca3f68..03169b4 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,6 +1,6 @@ -flake8==3.0.4 -pep8-naming==0.4.1 -pytest==3.0.3 -pytest-runner==2.9 -Sphinx==1.5.2 -recommonmark==0.4.0 +flake8==3.5.0 +pep8-naming==0.8.2 +pytest==3.5.0 +pytest-runner==4.2 +Sphinx==1.7.2 +recommonmark==0.6.0 diff --git a/setup.py b/setup.py index 18e10f0..4027003 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ # Copyright (c) The Caleydo Team. All rights reserved. # Licensed under the new BSD license, available at http://caleydo.org/license ############################################################################### -from __future__ import with_statement, print_function + from setuptools import setup, find_packages from codecs import open from os import path @@ -26,12 +26,12 @@ def read_it(name): def packaged(*files): r = {} global pkg - r[pkg['name'].encode('ascii')] = list(files) + r[pkg['name']] = list(files) return r def requirements(file): - return [r.strip().encode('ascii') for r in read_it(file).strip().split('\n') if not r.startswith('-e git+https://')] + return [r.strip() for r in read_it(file).strip().split('\n') if not r.startswith('-e git+https://')] def to_version(v): @@ -39,12 +39,14 @@ def to_version(v): now = datetime.datetime.utcnow() return v.replace('SNAPSHOT', now.strftime('%Y%m%d-%H%M%S')) + setup( - name=pkg['name'], + name=pkg['name'].lower(), version=to_version(pkg['version']), url=pkg['homepage'], description=pkg['description'], long_description=read_it('README.md'), + long_description_content_type='text/markdown', keywords=pkg.get('keywords', ''), author=pkg['author']['name'], author_email=pkg['author']['email'], @@ -63,8 +65,7 @@ def to_version(v): # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: ' + ('BSD License' if pkg['license'] == 'BSD-3-Clause' else pkg['license']), 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4' + 'Programming Language :: Python :: 3.7' ], # You can just specify the packages manually here if your project is diff --git a/src/DummySearchProvider.ts b/src/DummySearchProvider.ts index 1f61208..5976992 100644 --- a/src/DummySearchProvider.ts +++ b/src/DummySearchProvider.ts @@ -1,7 +1,7 @@ import {IDummyDataSource, dataSourceA, dataSourceB} from './config'; import {getTDPLookup, getTDPFilteredRows} from 'tdp_core/src/rest'; import './style.scss'; -import {IResult, ISearchProvider} from 'dTiles/src/extensions'; +import {IResult, ISearchProvider} from 'tdp_core/src/public/search'; export default class DummySearchProvider implements ISearchProvider { diff --git a/tox.ini b/tox.ini index a349028..9b4ec36 100644 --- a/tox.ini +++ b/tox.ini @@ -5,12 +5,11 @@ ############################################################################### [tox] -envlist = py{27,34} +envlist = py{37} [testenv] basepython = - py27: python2.7 - py34: python3.4 + py37: python3.7 deps = flake8 pytest diff --git a/tsconfig.json b/tsconfig.json index 82e5d03..ab4451b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,9 @@ ], "baseUrl": "../", "noImplicitAny": false, - "skipLibCheck": true + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true }, "include": [ "src/**/*.ts", diff --git a/tslint.json b/tslint.json index 434c5eb..ec45867 100644 --- a/tslint.json +++ b/tslint.json @@ -23,6 +23,7 @@ "forin": true, "indent": [ true, + "spaces", 2 ], "interface-name": true, @@ -31,9 +32,25 @@ "max-line-length": false, "member-ordering": [ false, - "public-before-private", - "static-before-instance", - "variables-before-functions" + { + "order": [ + "public-static-field", + "public-static-method", + "public-instance-field", + "public-constructor", + "public-instance-method", + "protected-static-field", + "protected-static-method", + "protected-instance-field", + "protected-constructor", + "protected-instance-method", + "private-static-field", + "private-static-method", + "private-instance-field", + "private-constructor", + "private-instance-method" + ] + } ], "new-parens": true, "no-arg": true, @@ -96,18 +113,13 @@ ], "typedef-whitespace": [ true, - [ - "callSignature", - "noSpace" - ], - [ - "catchClause", - "noSpace" - ], - [ - "indexSignature", - "space" - ] + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } ], "use-isnan": true, "variable-name": [ diff --git a/webpack.config.js b/webpack.config.js index ec65fe7..95542e3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,16 +4,7 @@ * Licensed under the new BSD license, available at http://caleydo.org/license **************************************************************************** */ -const { - libraryAliases, - libraryExternals, - modules, - entries, - ignores, - type, - registry, - vendor -} = 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'); @@ -33,9 +24,7 @@ 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 preCompilerFlags = {flags: (registry || {}).flags || {}}; const includeFeature = registry ? (extension, id) => { const exclude = registry.exclude || []; const include = registry.include || []; @@ -46,13 +35,14 @@ const includeFeature = registry ? (extension, id) => { return include.every(test) && !exclude.some(test); } : () => true; -const tsLoader = [{ - loader: 'awesome-typescript-loader' -}]; +const tsLoader = [ + { + loader: 'awesome-typescript-loader' + } +]; -const tsLoaderDev = [{ - loader: 'cache-loader' - }, +const tsLoaderDev = [ + {loader: 'cache-loader'}, { loader: 'thread-loader', options: { @@ -65,40 +55,24 @@ const tsLoaderDev = [{ options: { happyPackMode: true, // IMPORTANT! use happyPackMode mode to speed-up compilation and reduce errors reported to webpack, compilerOptions: { - "target": "es6", - "jsx": "react", - "jsxFactory": "h", + target: 'es6' } } } ]; // list of loaders and their mappings -const webpackloaders = [{ - test: /\.scss$/, - use: 'style-loader!css-loader!sass-loader' - }, - { - test: /\.css$/, - use: 'style-loader!css-loader' - }, - { - test: /\.tsx?$/, - use: tsLoader - }, +const webpackloaders = [ + {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: [{ + test: /phovea(_registry)?\.js$/, use: [{ loader: 'ifdef-loader', - options: Object.assign({ - include: includeFeature - }, preCompilerFlags) + options: Object.assign({include: includeFeature}, preCompilerFlags) }] }, - { - test: /\.json$/, - use: 'json-loader' - }, + {test: /\.json$/, use: 'json-loader'}, { test: /\.(png|jpg)$/, loader: 'url-loader', @@ -122,10 +96,7 @@ const webpackloaders = [{ mimetype: 'image/svg+xml' } }, - { - test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/, - loader: 'file-loader' - } + {test: /\.(ttf|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader'} ]; /** @@ -270,10 +241,7 @@ function generateWebpack(options) { } 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' - })); + base.plugins.push(new ForkTsCheckerWebpackPlugin({checkSyntacticErrors: true, tsconfig: './tsconfig_dev.json'})); } if (options.library) { @@ -299,10 +267,7 @@ function generateWebpack(options) { // 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 (options.modules || []).forEach(function (m) { @@ -315,7 +280,7 @@ function generateWebpack(options) { if (!options.bundle || options.isApp) { // extract the included css file to own file const p = new ExtractTextPlugin({ - filename: (options.isApp || options.moduleBundle ? '[name]' : pkg.name) + (options.min && !options.nosuffix ? '.min' : '') + '.css', + 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); @@ -361,7 +326,7 @@ function generateWebpack(options) { new webpack.optimize.UglifyJsPlugin()); } else { // generate source maps - base.devtool = 'source-map'; + base.devtool = 'inline-source-map'; } return base; }