Skip to content

Commit 1874bb6

Browse files
Merge pull request #359 from phovea/release-5.1.0
Release 5.1.0
2 parents 6b8ea8b + bbb0a9b commit 1874bb6

File tree

35 files changed

+305
-302
lines changed

35 files changed

+305
-302
lines changed

generators/_init-hybrid/index.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,8 @@ class Generator extends Base {
3737
}
3838

3939
default() {
40-
this.composeWith('phovea:_node', {
41-
options: this.options
42-
}, {
43-
local: require.resolve('../_node')
44-
});
4540
const types = this.config.get('type').split('-');
46-
this.composeWith('phovea:init-' + types[1], {
47-
options: this.options
48-
}, {
49-
local: require.resolve('../init-' + types[1])
50-
});
51-
this.composeWith('phovea:init-' + types[0], {
52-
options: this.options
53-
}, {
54-
local: require.resolve('../init-' + types[0])
55-
});
41+
this.composeWith(['phovea:_node', 'phovea:init-' + types[1], 'phovea:init-' + types[0]], {options: this.options})
5642
}
5743

5844
end() {

generators/_init-hybrid/templates/package.tmpl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"pretest": "echo hybrid",
2323
"posttest:web": "npm run lint",
2424
"posttest": "echo hybrid",
25-
"test:web": "test ! $(find tests -name \"*.ts\") || karma start",
25+
"test:web": "test ! $(find tests -name \"*.ts\") || jest",
2626
"test:python": "test ! $(find tests -name \"*.py\") || python setup.py test",
2727
"test": "npm run test:web && npm run test:python",
2828
"prebuild:python": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test:python",

generators/_init-python/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ class Generator extends Base {
6161
}
6262
this.composeWith('phovea:_node', {
6363
options: this.options
64-
}, {
65-
local: require.resolve('../_node')
6664
});
6765
}
6866

generators/_init-web/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const _ = require('lodash');
3+
const chalk = require('chalk');
34
const Base = require('yeoman-generator');
45
const {writeTemplates, patchPackageJSON, stringifyAble, useDevVersion} = require('../../utils');
56
const fs = require('fs');
@@ -109,8 +110,6 @@ class Generator extends Base {
109110
}
110111
this.composeWith('phovea:_node', {
111112
options: this.options
112-
}, {
113-
local: require.resolve('../_node')
114113
});
115114
}
116115

@@ -134,9 +133,10 @@ class Generator extends Base {
134133
});
135134
this.fs.copy(this.templatePath('_gitignore'), this.destinationPath('.gitignore'));
136135
writeTemplates.call(this, config);
137-
// don't overwrite existing registry file
138-
if (!fs.existsSync(this.destinationPath('phovea.js'))) {
139-
this.fs.copyTpl(this.templatePath('phovea.tmpl.js'), this.destinationPath('phovea.js'), stringifyAble(config));
136+
137+
// do not overwrite existing registry file
138+
if (!fs.existsSync(this.destinationPath('src/phovea.ts'))) {
139+
this.fs.copyTpl(this.templatePath('phovea.tmpl.ts'), this.destinationPath('src/phovea.ts'), stringifyAble(config));
140140
}
141141
}
142142

@@ -147,6 +147,16 @@ class Generator extends Base {
147147
});
148148
}
149149
}
150+
151+
end() {
152+
if(fs.existsSync(this.destinationPath('phovea.js'))) {
153+
this.log('\r\n');
154+
this.log(chalk.red(`ACTION REQUIRED!`));
155+
this.log(chalk.default(`Please migrate the content of`), chalk.yellow(`phovea.js`), chalk.default(`to`), chalk.yellow(`/src/phovea.ts`) + chalk.default(` now!`));
156+
this.log(chalk.default(`Afterwards you can remove the`), chalk.yellow(`phovea.js`), chalk.default(`file from this plugin repository.`));
157+
this.log(chalk.default(`If you do not migrate the content the registered extension points will be unavailable.`));
158+
}
159+
}
150160
}
151161

152162
module.exports = Generator;

generators/_init-web/templates/package.tmpl.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"docs": "typedoc --options typedoc.json src/",
1717
"prebuild": "node -e \"process.exit(process.env.PHOVEA_SKIP_TESTS === undefined?1:0)\" || npm run test",
1818
"pretest": "npm run compile",
19-
"test": "test ! -d tests || karma start",
19+
"test": "jest",
2020
"posttest": "npm run lint",
21-
"test:watch": "karma start --autoWatch=true --singleRun=false",
21+
"test:watch": "jest --watch",
2222
"build:dev": "webpack",
2323
"build": "webpack --env prod",
2424
"start": "webpack-dev-server --inline",
@@ -31,26 +31,21 @@
3131
"dist": "mkdir dist && cd build && tar cvzf ../dist/<%-name%>.tar.gz *"
3232
},
3333
"devDependencies": {
34-
"@types/jasmine": "2.5.47",
34+
"@types/jest": "24.9.1",
3535
"awesome-typescript-loader": "3.1.2",
3636
"cache-loader": "1.2.0",
3737
"css-loader": "0.28.0",
3838
"extract-text-webpack-plugin": "2.1.0",
3939
"extract-loader": "0.1.0",
40+
"identity-obj-proxy": "^3.0.0",
4041
"ifdef-loader": "2.0.0",
4142
"file-loader": "0.11.1",
4243
"fork-ts-checker-webpack-plugin": "0.4.4",
4344
"html-loader": "0.4.5",
4445
"imports-loader": "0.7.1",
45-
"jasmine": "2.5.3",
46+
"jest": "24.9.0",
47+
"jest-raw-loader": "1.0.1",
4648
"json-loader": "0.5.4",
47-
"karma": "1.5.0",
48-
"karma-chrome-launcher": "2.0.0",
49-
"karma-firefox-launcher": "1.0.1",
50-
"karma-jasmine": "1.1.0",
51-
"karma-junit-reporter": "2.0.0",
52-
"karma-sourcemap-loader": "0.3.7",
53-
"karma-webpack": "2.0.3",
5449
"node-sass": "^4.13.1",
5550
"null-loader": "0.1.1",
5651
"raw-loader": "0.5.1",
@@ -60,6 +55,7 @@
6055
"ts-loader": "4.0.1",
6156
"tslib": "~1.11.0",
6257
"tslint": "5.9.1",
58+
"ts-jest": "24.3.0",
6359
"typedoc": "~0.16.10",
6460
"typescript": "~3.8.2",
6561
"url-loader": "0.5.8",

generators/_init-web/templates/phovea.tmpl.js

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* *****************************************************************************
2+
* Caleydo - Visualization for Molecular Biology - http://caleydo.org
3+
* Copyright (c) The Caleydo Team. All rights reserved.
4+
* Licensed under the new BSD license, available at http://caleydo.org/license
5+
**************************************************************************** */
6+
7+
import {IRegistry} from 'phovea_core/src/plugin';
8+
9+
export default function (registry: IRegistry) {
10+
/// #if include('extension-type', 'extension-id')
11+
// registry.push('extension-type', 'extension-id', () => System.import('./extension_impl'), {});
12+
/// #endif
13+
14+
// generator-phovea:begin
15+
<%- extensions.map((d) => ` registry.push('${d.type}', '${d.id}', () => System.import('./src/${d.module}'), ${stringify(d.extras, ' ')});`).join('\n\n') %>
16+
// generator-phovea:end
17+
}
18+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// test dependencies that require transformation
2+
let pluginsToTransform = [
3+
'tdp_*',
4+
'phovea_*',
5+
'lineupjs'
6+
].join('|');
7+
8+
if(pluginsToTransform.length > 0) {
9+
/** Attention: Negative Lookahead! This regex adds the specified repos to a whitelist that holds plugins that are excluded from the transformIgnorePatterns.
10+
* This means that pluginsToTransform should contain all repos that export ts files. They can only be handled by the transformation. */
11+
pluginsToTransform = `(?!${pluginsToTransform})`;
12+
}
13+
14+
/**
15+
* TODO check if we can process inline webpack loaders (e.g. as found in https://github.com/phovea/phovea_ui/blob/master/src/_bootstrap.ts)
16+
* see also https://jestjs.io/docs/en/webpack#mocking-css-modules
17+
*/
18+
module.exports = {
19+
transform: {
20+
"^.+\\.tsx?$": "ts-jest",
21+
"\\.xml$": "jest-raw-loader"
22+
},
23+
testRegex: "(.*(test|spec))\\.(tsx?)$",
24+
moduleFileExtensions: [
25+
"ts",
26+
"tsx",
27+
"js",
28+
"jsx",
29+
"json",
30+
"node"
31+
],
32+
testURL: "http://localhost",
33+
modulePaths: [
34+
"src",
35+
"../node_modules",
36+
"../"
37+
],
38+
transformIgnorePatterns: [`../node_modules/${pluginsToTransform}`, `node_modules/${pluginsToTransform}`],
39+
globals: {
40+
"__VERSION__": "TEST_VERSION",
41+
"__APP_CONTEXT__": "TEST_CONTEXT",
42+
'ts-jest': {
43+
// has to be set to true, otherwise i18n import fails
44+
"tsConfig": {
45+
"esModuleInterop": true,
46+
}
47+
}
48+
},
49+
moduleNameMapper: {
50+
"^.+\\.(css|less|scss|sass|png|jpg|gif)$": "identity-obj-proxy",
51+
"imports-loader?.*": "imports-loader",
52+
"raw-loader?.*": "raw-loader",
53+
"file-loader?.*": "file-loader",
54+
"script-loader?.*": "script-loader"
55+
}
56+
}

generators/_init-web/templates/plain/karma.conf.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

generators/_init-web/templates/plain/tsd.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ declare module "*.html" {
2424
const content:string;
2525
export default content;
2626
}
27+
declare module "*.xml" {
28+
const content:string;
29+
export default content;
30+
}
2731
//allow json dependencies
2832
declare module "*.json";
2933
//allow file dependencies

0 commit comments

Comments
 (0)