Clean duplicate code in UI project

This commit is contained in:
dannyrb 2019-08-06 14:22:44 -04:00
parent 60f48fbdc0
commit e47dcf27fc
11 changed files with 57 additions and 217 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Open Health Imaging Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -14,3 +14,5 @@ yarn add --dev -W package-name
- Patch status for PRs (we care about threshold only)
- Allows us to use multiproject test runner
- Flags per project for merged coverage; easier to break down coverage per project
- Remove all-contributors bot; install CLI per project and add per project commands
-

View File

@ -1,85 +0,0 @@
version: 2
### ABOUT
#
# This configuration powers our Circleci.io integration
#
# Note:
# Netlify works independently from this configuration to
# create pull request previews and to update `https://react.ohif.org`
###
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:10.15.1
jobs:
build_and_test:
<<: *defaults
steps:
# Download and cache dependencies
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
# when lock file changes, use increasingly general patterns to restore cache
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-v1-{{ .Branch }}-
- yarn-packages-v1-
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
paths:
- ~/.cache/yarn
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Build & Test
- run: yarn build
- run: yarn test
# Persist :+1:
- persist_to_workspace:
root: ~/repo
paths: .
npm_publish:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Avoid hosts unknown for github
command:
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking
no\n" > ~/.ssh/config
- run:
name: Publish using Semantic Release
command: npx semantic-release
workflows:
version: 2
# PULL REQUESTS
pull_requests:
jobs:
- build_and_test:
filters:
branches:
ignore:
- master
- feature/*
- hotfix/*
# MERGE TO MASTER
cut_release:
jobs:
- build_and_test:
filters:
branches:
only: master
- npm_publish:
requires:
- build_and_test

View File

@ -1,2 +0,0 @@
fixes:
- "::platform/ui/"

View File

@ -1,8 +0,0 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"sysoev.language-stylus",
"silvenon.mdx",
"dbaeumer.vscode-eslint"
]
}

View File

@ -1,29 +0,0 @@
{
"editor.rulers": [80, 120],
// ===
// Spacing
// ===
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
// ===
// Event Triggers
// ===
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"eslint.run": "onSave",
"eslint.validate": [
{ "language": "javascript", "autoFix": true },
{ "language": "javascriptreact", "autoFix": true }
],
"prettier.disableLanguages": [],
"prettier.endOfLine": "lf"
}

View File

@ -3,48 +3,44 @@
* https://www.docz.site/docs/project-configuration
*/
import { css } from 'docz-plugin-css';
import { css } from "docz-plugin-css";
export default {
dest: 'example/build',
public: '/public',
wrapper: 'src/__docs__/wrapper',
indexHtml: 'src/__docs__/index.html',
dest: "example/build",
public: "/public",
wrapper: "src/__docs__/wrapper",
indexHtml: "src/__docs__/index.html",
// Limited support for importing `.styl` files
codeSandbox: false,
// https://github.com/pedronauck/docz/pull/849/files
// Because we re-export using `index.js` files
notUseSpecifiers: true,
// filterComponents: files =>
// files.filter(filepath =>
// /\/[A-Z]\w*(\/index)?\.(js|jsx|ts|tsx)$/.test(filepath)
// ),
menu: [
'Introduction',
'Getting Started',
{ name: 'Elements', menu: ['Form / Select'] },
"Introduction",
"Getting Started",
{ name: "Elements", menu: ["Form / Select"] },
{
name: 'Components',
name: "Components",
menu: [
'CINE Dialog',
'Layout Button',
'Measurement Table',
'Overlay Trigger',
'Quick Switch',
'Rounded Button Group',
'Select Tree',
'Simple Dialog',
'Study Browser',
'Study List',
'Table List',
'Toolbar Section',
'About Modal',
'User Preferences Modal',
],
"CINE Dialog",
"Layout Button",
"Measurement Table",
"Overlay Trigger",
"Quick Switch",
"Rounded Button Group",
"Select Tree",
"Simple Dialog",
"Study Browser",
"Study List",
"Table List",
"Toolbar Section",
"About Modal",
"User Preferences Modal"
]
},
'Styling & Theming',
'Translating',
'Compatibility',
"Styling & Theming",
"Translating",
"Compatibility"
],
// Rollup Aliases?
// https://github.com/pedronauck/docz/issues/373
@ -53,9 +49,9 @@ export default {
css(),
// Stylus
css({
preprocessor: 'stylus',
cssmodules: false,
}),
preprocessor: "stylus",
cssmodules: false
})
],
// `docz` uses file-loader to pull in SVGs. This kills our icons before
// They can be picked up by our `babel-plugin-inline-react-svg` dependency
@ -64,50 +60,16 @@ export default {
// How we delete our rule:
// https://github.com/neutrinojs/webpack-chain/issues/48
onCreateWebpackChain: config => {
config.module.rules.delete('svg');
// config.module
// .rule('svg')
// .test(/\.(svg)(\?.*)?$/)
// .use('file-loader')
// .loader(require.resolve('file-loader'))
// .options({
// name: `static/img/[name].[ext]`,
// })
config.module.rules.delete("svg");
},
modifyBabelRc: babelrc => {
const newBabelRc = {
...babelrc,
plugins: [
...babelrc.plugins,
require.resolve('babel-plugin-inline-react-svg'),
],
require.resolve("babel-plugin-inline-react-svg")
]
};
return newBabelRc;
},
}
};
/*
* Alternative ways to extend/modify underlying webpack config
*
modifyBundlerConfig: (config) => {
config.module.rules.push({
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"]
})
return config
}
*
*
*
onCreateWebpackChain: config => {
config.module
.rule('css')
.test(/\.css$/)
.use('css-loader')
.loader('css-loader')
.options({ sourceMap: false,
importLoaders: 2 })
}
*/

View File

@ -1,21 +0,0 @@
# https://www.netlify.com/docs/continuous-deployment/#deploy-contexts
#
# Global settings applied to the whole site.
#
# “base” is the directory to change to before starting build. If you set base:
# that is where we will look for package.json/.nvmrc/etc, not repo root!
# “command” is your build command.
# “publish” is the directory to publish (relative to the root of your repo).
# COMMENT: NODE_VERSION in root `.nvmrc` takes priority
# COMMENT: Why we specify YARN_FLAGS: https://www.netlify.com/docs/build-gotchas/#yarn
[build.environment]
NODE_VERSION = "10.15.3"
YARN_VERSION = "1.15.2"
YARN_FLAGS = "--no-ignore-optional --pure-lockfile"
# COMMENT: This a rule for Single Page Applications
[[redirects]]
from = "/*"
to = "/index.html"
status = 200