Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Update dependencies #67

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules/
*.map
*.css
*.log
/.cache-loader
46 changes: 46 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -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
56 changes: 40 additions & 16 deletions buildInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'], {
Expand Down Expand Up @@ -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]);
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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, ' '));
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand All @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 18 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion src/force_directed_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(<any>nodes).links(<any>edges); // TODO remove possibly wrong <any> typecast

const $links = $root.selectAll('.edge').data(edges);
$links.enter().append('line').classed('edge', true);
Expand Down
5 changes: 3 additions & 2 deletions tests.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
"es2015",
"es2016.array.include",
"es2017.object"
],
"baseUrl": "../",
"noImplicitAny": false,
Expand Down
6 changes: 6 additions & 0 deletions tsconfig_dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "es6"
}
}
5 changes: 5 additions & 0 deletions tsd.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading