-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit with typescript + husky
- Loading branch information
0 parents
commit 0b3379a
Showing
33 changed files
with
17,200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/ | ||
version: 2.1 | ||
|
||
defaults: &defaults | ||
working_directory: ~/repo | ||
# https://circleci.com/docs/2.0/circleci-images/#language-image-variants | ||
docker: | ||
- image: circleci/node:10.15.1 | ||
environment: | ||
TERM: xterm # Enable colors in term | ||
|
||
jobs: | ||
CHECKOUT: | ||
<<: *defaults | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
name: Restore Package Cache | ||
keys: | ||
- packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- packages-v1-{{ .Branch }}- | ||
- packages-v1- | ||
- run: yarn install | ||
- save_cache: | ||
name: Save Package Cache | ||
paths: | ||
- ~/.cache/yarn | ||
key: packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- persist_to_workspace: | ||
root: ~/repo | ||
paths: . | ||
|
||
BUILD: | ||
<<: *defaults | ||
steps: | ||
- attach_workspace: | ||
at: ~/repo | ||
- run: npm run build && npm run build:release | ||
# https://circleci.com/docs/2.0/collect-test-data/#karma | ||
# - store_test_results: | ||
# path: reports/junit | ||
# - store_artifacts: | ||
# path: reports/junit | ||
- 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 [email protected] --debug | ||
|
||
workflows: | ||
version: 2 | ||
|
||
# PULL REQUEST | ||
PULL_REQUEST: | ||
jobs: | ||
- CHECKOUT: | ||
filters: | ||
branches: | ||
ignore: | ||
- master | ||
- feature/* | ||
- hotfix/* | ||
- BUILD: | ||
requires: | ||
- CHECKOUT | ||
|
||
# MERGE TO MASTER | ||
TEST_AND_RELEASE: | ||
jobs: | ||
- CHECKOUT: | ||
filters: | ||
branches: | ||
only: master | ||
- BUILD: | ||
requires: | ||
- CHECKOUT | ||
- NPM_PUBLISH: | ||
requires: | ||
- BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"extends": [ | ||
"react-app", | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"plugins": ["@typescript-eslint"], | ||
"parser": "babel-eslint", | ||
"env": { | ||
"jest": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
} | ||
}, | ||
"globals": { | ||
"context": true, | ||
"assert": true | ||
}, | ||
"rules": { | ||
"no-console": "warn", | ||
"no-undef": "warn", | ||
"no-unused-vars": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# dependencies | ||
node_modules | ||
|
||
# builds | ||
build | ||
dist | ||
.rpt2_cache | ||
|
||
# misc | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.idea | ||
.yalc | ||
yalc.lock | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"printWidth": 80, | ||
"proseWrap": "always", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"branch": "master" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"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", | ||
"workbench.colorCustomizations": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const autoprefixer = require('autoprefixer'); | ||
// Plugins | ||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') | ||
.BundleAnalyzerPlugin; | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | ||
|
||
// const ENTRY_VTK_EXT = path.join(__dirname, './../tsDist/src/index.js'); | ||
// const SRC_PATH = path.join(__dirname, './../tsDist/src'); | ||
|
||
const ENTRY_VTK_EXT = path.join(__dirname, './../src/index.js'); | ||
const SRC_PATH = path.join(__dirname, './../src'); | ||
const OUT_PATH = path.join(__dirname, './../dist'); | ||
|
||
/** | ||
* `argv` are options from the CLI. They will override our config here if set. | ||
* `-d` - Development shorthand, sets `debug`, `devtool`, and `mode` | ||
* `-p` - Production shorthand, sets `minimize`, `NODE_ENV`, and `mode` | ||
*/ | ||
module.exports = (env, argv) => { | ||
const isProdBuild = argv.mode !== 'development'; | ||
const outputFilename = isProdBuild ? '[name].umd.min.js' : '[name].umd.js'; | ||
|
||
return { | ||
entry: { | ||
index: ENTRY_VTK_EXT, | ||
}, | ||
devtool: 'source-map', | ||
output: { | ||
path: OUT_PATH, | ||
filename: outputFilename, | ||
library: 'VTKViewport', | ||
libraryTarget: 'umd', | ||
globalObject: 'this', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
use: ['ts-loader'], | ||
}, | ||
{ | ||
test: /\.(js|jsx)$/, | ||
exclude: /node_modules/, | ||
use: ['babel-loader'], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
exclude: /\.module\.css$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
plugins: () => [autoprefixer('last 2 version', 'ie >= 10')], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
modules: [path.resolve(__dirname, './../node_modules'), SRC_PATH], | ||
}, | ||
externals: [ | ||
// :wave: | ||
/\b(vtk.js)/, | ||
// Used to build/load metadata | ||
{ | ||
'cornerstone-core': { | ||
commonjs: 'cornerstone-core', | ||
commonjs2: 'cornerstone-core', | ||
amd: 'cornerstone-core', | ||
root: 'cornerstone', | ||
}, | ||
'cornerstone-tools': { | ||
commonjs: 'cornerstone-tools', | ||
commonjs2: 'cornerstone-tools', | ||
amd: 'cornerstone-tools', | ||
root: 'cornerstoneTools', | ||
}, | ||
// | ||
react: 'react', | ||
}, | ||
], | ||
node: { | ||
// https://github.com/webpack-contrib/style-loader/issues/200 | ||
Buffer: false, | ||
}, | ||
plugins: [ | ||
// Uncomment to generate bundle analyzer | ||
// new BundleAnalyzerPlugin(), | ||
// Show build progress | ||
new webpack.ProgressPlugin(), | ||
// Clear dist between builds | ||
// new CleanWebpackPlugin(), | ||
], | ||
}; | ||
}; |
Oops, something went wrong.