Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit fa77ed6

Browse files
author
Adam Richie-Halford
committed
Merge branch 'master' of github.com:akeshavan/preAFQ
2 parents 7d8f234 + 65eeaa6 commit fa77ed6

File tree

11 files changed

+633
-26
lines changed

11 files changed

+633
-26
lines changed

.travis.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
# Config file for automatic testing at travis-ci.org
2-
3-
language: python
4-
python:
5-
- 3.6
6-
- 3.5
7-
- 3.4
8-
9-
# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
10-
install: pip install -U tox-travis
11-
12-
# Command to run tests, e.g. python setup.py test
13-
script: tox
14-
15-
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- '6.0'
5+
cache:
6+
directories:
7+
- preafqViewer/node_modules
8+
branches:
9+
only:
10+
- master
11+
notifications:
12+
email: false
13+
before_script:
14+
- cd preafqViewer
15+
- npm prune
16+
script:
17+
- npm run build
18+
- npm test
19+
after_success:
20+
- bash ./deploy.sh
21+
env:
22+
global:
23+
- GH_USER: akeshavan
24+
- GH_REPO: preAFQ
25+
- secure: irToFjVhLgr3rOdobRrhpJqSJtamvDTiBHmq4Xr1m3G24rirSRqSEjp6zronYbyNJ/VnoIhc0L8/VKrDUNsGR+0zqwJ4b4/2nR7LG7grvH79hWz2zGOckm2oYFC0BKyCFSiJ4n5op5SVslARr2ONgO+BqtclBIVAyHcbfnRMhHawZvcaWDgUOeLT8cTCT3uddOWNRQY1bH+nwv7OjqpQHlvLTAXjSH7XdVoGnzPhK79F1djUrpzJSODcsZl+VU1ghVKc1fj8AEpha0m3ZF0dSRK9xYBXOYaoXsbjXjDMo2kZJd8vobZ2Tvl9WP8xpEEJjqFMRxqDCd9JZq9kr/vVWpirm7mWce65BiJBj7K2iBwWjruqeLhYLcM8bdIEDybTqV8ZeXeghcbBpw+L+5hgSHbEK+XZFmTO9XKOpF0XhvYjxpti8cv2PIJ6Dhg+j+LrAo3MkRuYZ19DgKdId4fr+PM6Fuxfwa/h0AkL2bKampeofrbRQZDS/Q2TxTfp4UaxMYhLWLoJqZFYsdcLIPjlmMPSTvvnWq+YJ8bHxqrdORiUKDY32uXQ/LBFrQVjgZJFzR7OOazWcxykpBMYJh5sH1A6a52xJj26heygM2CxPGdwzapFM1XmS0QZ+qeGVYx9YMSD+oBxgpHj3xQorvon+YEiSdnTeyLWKq7sTciTAPM=

docker/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,24 @@ RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
8585
&& conda config --system --prepend channels conda-forge \
8686
&& conda config --system --set auto_update_conda false \
8787
&& conda config --system --set show_channel_urls true \
88-
&& sync && conda clean -tipsy && sync \
89-
&& conda create -y -q --name preafq
90-
91-
RUN conda install -y -q --name preafq \
92-
-c \
93-
conda-forge \
94-
python=3.6 \
95-
nipype \
96-
dipy \
97-
boto3 \
98-
&& sync && conda clean -tipsy && sync
88+
&& sync && conda clean -tipsy && sync
89+
# && conda create -y -q --name preafq
90+
91+
# RUN conda install -y -q --name preafq \
92+
# -c \
93+
# conda-forge \
94+
# python=3.6 \
95+
# nipype \
96+
# dipy \
97+
# boto3 \
98+
# && sync && conda clean -tipsy && sync
99+
100+
ADD environment.yml environment.yml
101+
RUN apt-get update && apt-get install -y git gcc
102+
RUN conda env create -f environment.yml
103+
104+
#&& sync && conda clean -tipsy && sync
105+
99106

100107
RUN sed -i '$isource activate preafq' $ND_ENTRYPOINT
101108

preafqViewer/build/build.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict'
2+
require('./check-versions')()
3+
4+
process.env.NODE_ENV = 'production'
5+
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const config = require('../config')
12+
const webpackConfig = require('./webpack.prod.conf')
13+
14+
const spinner = ora('building for production...')
15+
spinner.start()
16+
17+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18+
if (err) throw err
19+
webpack(webpackConfig, (err, stats) => {
20+
spinner.stop()
21+
if (err) throw err
22+
process.stdout.write(stats.toString({
23+
colors: true,
24+
modules: false,
25+
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26+
chunks: false,
27+
chunkModules: false
28+
}) + '\n\n')
29+
30+
if (stats.hasErrors()) {
31+
console.log(chalk.red(' Build failed with errors.\n'))
32+
process.exit(1)
33+
}
34+
35+
console.log(chalk.cyan(' Build complete.\n'))
36+
console.log(chalk.yellow(
37+
' Tip: built files are meant to be served over an HTTP server.\n' +
38+
' Opening index.html over file:// won\'t work.\n'
39+
))
40+
})
41+
})

preafqViewer/build/check-versions.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
6+
7+
function exec (cmd) {
8+
return require('child_process').execSync(cmd).toString().trim()
9+
}
10+
11+
const versionRequirements = [
12+
{
13+
name: 'node',
14+
currentVersion: semver.clean(process.version),
15+
versionRequirement: packageConfig.engines.node
16+
}
17+
]
18+
19+
if (shell.which('npm')) {
20+
versionRequirements.push({
21+
name: 'npm',
22+
currentVersion: exec('npm --version'),
23+
versionRequirement: packageConfig.engines.npm
24+
})
25+
}
26+
27+
module.exports = function () {
28+
const warnings = []
29+
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i]
32+
33+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34+
warnings.push(mod.name + ': ' +
35+
chalk.red(mod.currentVersion) + ' should be ' +
36+
chalk.green(mod.versionRequirement)
37+
)
38+
}
39+
}
40+
41+
if (warnings.length) {
42+
console.log('')
43+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
44+
console.log()
45+
46+
for (let i = 0; i < warnings.length; i++) {
47+
const warning = warnings[i]
48+
console.log(' ' + warning)
49+
}
50+
51+
console.log()
52+
process.exit(1)
53+
}
54+
}

preafqViewer/build/logo.png

6.69 KB
Loading

preafqViewer/build/utils.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
'use strict'
2+
const path = require('path')
3+
const config = require('../config')
4+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
5+
const packageConfig = require('../package.json')
6+
7+
exports.assetsPath = function (_path) {
8+
const assetsSubDirectory = process.env.NODE_ENV === 'production'
9+
? config.build.assetsSubDirectory
10+
: config.dev.assetsSubDirectory
11+
12+
return path.posix.join(assetsSubDirectory, _path)
13+
}
14+
15+
exports.cssLoaders = function (options) {
16+
options = options || {}
17+
18+
const cssLoader = {
19+
loader: 'css-loader',
20+
options: {
21+
sourceMap: options.sourceMap
22+
}
23+
}
24+
25+
const postcssLoader = {
26+
loader: 'postcss-loader',
27+
options: {
28+
sourceMap: options.sourceMap
29+
}
30+
}
31+
32+
// generate loader string to be used with extract text plugin
33+
function generateLoaders (loader, loaderOptions) {
34+
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35+
36+
if (loader) {
37+
loaders.push({
38+
loader: loader + '-loader',
39+
options: Object.assign({}, loaderOptions, {
40+
sourceMap: options.sourceMap
41+
})
42+
})
43+
}
44+
45+
// Extract CSS when that option is specified
46+
// (which is the case during production build)
47+
if (options.extract) {
48+
return ExtractTextPlugin.extract({
49+
use: loaders,
50+
fallback: 'vue-style-loader'
51+
})
52+
} else {
53+
return ['vue-style-loader'].concat(loaders)
54+
}
55+
}
56+
57+
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
58+
return {
59+
css: generateLoaders(),
60+
postcss: generateLoaders(),
61+
less: generateLoaders('less'),
62+
sass: generateLoaders('sass', { indentedSyntax: true }),
63+
scss: generateLoaders('sass'),
64+
stylus: generateLoaders('stylus'),
65+
styl: generateLoaders('stylus')
66+
}
67+
}
68+
69+
// Generate loaders for standalone style files (outside of .vue)
70+
exports.styleLoaders = function (options) {
71+
const output = []
72+
const loaders = exports.cssLoaders(options)
73+
74+
for (const extension in loaders) {
75+
const loader = loaders[extension]
76+
output.push({
77+
test: new RegExp('\\.' + extension + '$'),
78+
use: loader
79+
})
80+
}
81+
82+
return output
83+
}
84+
85+
exports.createNotifierCallback = () => {
86+
const notifier = require('node-notifier')
87+
88+
return (severity, errors) => {
89+
if (severity !== 'error') return
90+
91+
const error = errors[0]
92+
const filename = error.file && error.file.split('!').pop()
93+
94+
notifier.notify({
95+
title: packageConfig.name,
96+
message: severity + ': ' + error.name,
97+
subtitle: filename || '',
98+
icon: path.join(__dirname, 'logo.png')
99+
})
100+
}
101+
}

preafqViewer/build/vue-loader.conf.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
const utils = require('./utils')
3+
const config = require('../config')
4+
const isProduction = process.env.NODE_ENV === 'production'
5+
const sourceMapEnabled = isProduction
6+
? config.build.productionSourceMap
7+
: config.dev.cssSourceMap
8+
9+
module.exports = {
10+
loaders: utils.cssLoaders({
11+
sourceMap: sourceMapEnabled,
12+
extract: isProduction
13+
}),
14+
cssSourceMap: sourceMapEnabled,
15+
cacheBusting: config.dev.cacheBusting,
16+
transformToRequire: {
17+
video: ['src', 'poster'],
18+
source: 'src',
19+
img: 'src',
20+
image: 'xlink:href'
21+
}
22+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
'use strict'
2+
const path = require('path')
3+
const utils = require('./utils')
4+
const config = require('../config')
5+
const vueLoaderConfig = require('./vue-loader.conf')
6+
7+
function resolve (dir) {
8+
return path.join(__dirname, '..', dir)
9+
}
10+
11+
const createLintingRule = () => ({
12+
test: /\.(js|vue)$/,
13+
loader: 'eslint-loader',
14+
enforce: 'pre',
15+
include: [resolve('src'), resolve('test')],
16+
options: {
17+
formatter: require('eslint-friendly-formatter'),
18+
emitWarning: !config.dev.showEslintErrorsInOverlay
19+
}
20+
})
21+
22+
module.exports = {
23+
context: path.resolve(__dirname, '../'),
24+
entry: {
25+
app: './src/main.js'
26+
},
27+
output: {
28+
path: config.build.assetsRoot,
29+
filename: '[name].js',
30+
publicPath: process.env.NODE_ENV === 'production'
31+
? config.build.assetsPublicPath
32+
: config.dev.assetsPublicPath
33+
},
34+
resolve: {
35+
extensions: ['.js', '.vue', '.json'],
36+
alias: {
37+
'vue$': 'vue/dist/vue.esm.js',
38+
'@': resolve('src'),
39+
}
40+
},
41+
module: {
42+
rules: [
43+
...(config.dev.useEslint ? [createLintingRule()] : []),
44+
{
45+
test: /\.vue$/,
46+
loader: 'vue-loader',
47+
options: vueLoaderConfig
48+
},
49+
{
50+
test: /\.js$/,
51+
loader: 'babel-loader',
52+
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
53+
},
54+
{
55+
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
56+
loader: 'url-loader',
57+
options: {
58+
limit: 10000,
59+
name: utils.assetsPath('img/[name].[hash:7].[ext]')
60+
}
61+
},
62+
{
63+
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
64+
loader: 'url-loader',
65+
options: {
66+
limit: 10000,
67+
name: utils.assetsPath('media/[name].[hash:7].[ext]')
68+
}
69+
},
70+
{
71+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
72+
loader: 'url-loader',
73+
options: {
74+
limit: 10000,
75+
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
76+
}
77+
}
78+
]
79+
},
80+
node: {
81+
// prevent webpack from injecting useless setImmediate polyfill because Vue
82+
// source contains it (although only uses it if it's native).
83+
setImmediate: false,
84+
// prevent webpack from injecting mocks to Node native modules
85+
// that does not make sense for the client
86+
dgram: 'empty',
87+
fs: 'empty',
88+
net: 'empty',
89+
tls: 'empty',
90+
child_process: 'empty'
91+
}
92+
}

0 commit comments

Comments
 (0)