/* dicom-anonymizer-js/index.js */
function Anonymizer() {}
Anonymizer.prototype.anonymize = function(fileBlob) {
return new Promise(function(resolve, reject) {
const reader = new window.FileReader()
reader.onload = function(file) {
// ...
};
export default Anonymizer;
/* dicom-anonymizer-js/package.json */
{
"name": "@lunit/dicom-anonymizer-js",
"version": "1.0.1",
"main": "./index.js",
}
# Publish
$ yarn publish
# .npmrc
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
# Install
$ export NPM_TOKEN="00000000-0000-0000-0000-000000000000"
$ yarn add @lunit/dicom-anonymizer-js
/* app/package.json */
{
"dependencies": {
"@lunit/dicom-anonymizer-js": "^1.0.0"
}
}
/* app/index.js */
import Anonymizer from '@lunit/dicom-anonymizer-js';
const anonymizer = new Anonymizer();
anonymizer.anonymize(dicomFile).then(anonymized => {
//...
});
/* insight-react-components/Button.js */
import styled from 'styled-components'
import theme from '../theme'
const Button = styled.button`
background-color: ${props => props.theme.primary};
...
`
Button.defaultProps = {
theme
}
export default Button
/* insight-react-components/index.js */
export { default as Button } from './components/Button';
export { default as theme } from './theme';
// ...
export { GlobalStyle } from './global';
/* App.js */
import { theme, Button, GlobalStyle } from '@lunit/insight-react-components'
const DeleteButton = styled(Button)`
background-color: red;
`
const App = () => {
return (
<ThemeProvider theme={theme}>
<>
<GlobalStyle />
<div>
<Button>Action</Button>
<DeleteButton>Delete</DeleteButton>
</div>
</>
</ThemeProvider>
)
}
/* src/useShortcut.js */
import { useEffect } from "react";
const useShortcut = ({ shortcut, onKeyDown }) => {
useEffect(() => {
const keyHandler = function(event) {
if (
event.key === shortcut &&
event.target.tagName !== "INPUT"
) {
onKeyDown();
}
};
document.addEventListener("keydown", keyHandler);
return () => {
document.removeEventListener("keydown", keyHandler);
};
}, [onKeyDown, shortcut]);
};
export default useShortcut;
Yarn Workspace
Lerna
$ tree src
src
├── __tests__
│ └── test.js
├── _packages
│ └── @lunit
│ ├── package1
│ ├── package1
│ └── package3
├── app1
├── app2
└── app3
원티드(wanted.co.kr)에서 루닛을 검색해주세요