Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Release 4.0.0 (#91)
Browse files Browse the repository at this point in the history
Release 4.0.0
  • Loading branch information
thinkh authored Dec 20, 2019
2 parents fc12b2e + ca2aeaa commit cd78e63
Show file tree
Hide file tree
Showing 20 changed files with 1,983 additions and 1,112 deletions.
37 changes: 27 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,50 @@ jobs:
build:
working_directory: ~/phovea
docker:
- image: circleci/node:8-browsers
- image: circleci/node:12-browsers
steps:
- checkout
- run:
name: Show Node.js and npm version
command: |
node -v
npm -v
- restore_cache:
key: deps1-{{ checksum "package.json" }}
key: deps1-{{ .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: deps1-{{ .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: dist
name: Show installed npm dependencies
command: npm list --depth=1 || true
- run:
name: Build
command: npm run dist
- store_artifacts:
path: 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:
Expand Down
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:12-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
18 changes: 12 additions & 6 deletions .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"author": "The Caleydo Team",
"githubAccount": "phovea",
"libraries": [
"papaparse",
"d3"
"d3",
"papaparse"
],
"modules": [
"phovea_core",
"phovea_ui",
"phovea_d3"
"phovea_d3",
"phovea_ui"
],
"extensions": [
{
Expand Down Expand Up @@ -73,10 +73,16 @@
"ignores": [],
"today": "Tue, 01 Nov 2016 15:57:01 GMT",
"libraryExternals": [
"papaparse",
"d3",
"papaparse",
"jquery",
"font-awesome"
]
],
"promptValues": {
"authorName": "The Caleydo Team",
"authorEmail": "[email protected]",
"authorUrl": "https://caleydo.org",
"githubAccount": "phovea"
}
}
}
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 = Buffer.from(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
Loading

0 comments on commit cd78e63

Please sign in to comment.