Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: UI Kit 빌드 세팅 완료 #2

Merged
merged 3 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
rules: {},
};
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.vscode 폴더나 .idea 폴더 들도 같이 ignore 시키면 좋을거 같아요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿굿

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8581690 에서 추가되었습니다!

/dist

# misc
.DS_Store
Expand All @@ -21,3 +22,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDE
.vscode
.idea
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src
example
.storybook
.github
config
tasks
.vscode
.idea
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.15.0
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
.github
node_modules
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5"
}
57 changes: 39 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,18 @@
"type": "git",
"url": "https://github.com/Lubycon/lubycon-ui-kit.git"
},
"keywords": ["lubycon"],
"keywords": [
"lubycon"
],
"author": "Lubycon",
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"typescript": "^4.0.3",
"web-vitals": "^0.2.4"
},
"dependencies": {},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "yarn clean && rollup -c && yarn copy && tsc --emitDeclarationOnly -p tsconfig.build.json",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"clean": "rm -rf dist && mkdir dist",
"copy": "ncp src/sass/modules dist/sass && ncp package.json dist/package.json"
},
"eslintConfig": {
"extends": [
Expand All @@ -50,5 +41,35 @@
"last 1 safari version"
]
},
"sideEffects": false
"sideEffects": false,
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"autoprefixer": "^9.0.0",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"ncp": "^2.0.0",
"postcss": "^7.0.2",
"prettier": "^2.1.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"rollup": "^2.33.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^3.1.8",
"rollup-plugin-typescript2": "^0.29.0",
"sass": "^1.29.0",
"typescript": "^4.0.3"
}
}
Binary file removed public/favicon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions public/index.html

This file was deleted.

Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

72 changes: 72 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import path from 'path';

import autoprefixer from 'autoprefixer';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import typescript from 'rollup-plugin-typescript2';
// import babel from 'rollup-plugin-babel';

const extensions = ['.js', '.jsx', '.ts', '.tsx'];

export default [
buildCJS('src/components/index.ts'),
buildESM('src/components/index.ts'),
buildCSS('src/components/index.scss', 'css/lubycon-ui-kit.css'),
buildCSS('src/components/index.scss', 'css/lubycon-ui-kit.min.css', {
minimize: {
preset: ['default'],
},
}),
];

function buildJS(input, output, format) {
return {
input,
external: ['react', 'react-dom'],
output: [{ file: output, format, sourcemap: true }],
plugins: [
typescript({
tsconfig: 'tsconfig.json',
}),
// babel({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

바벨 설정은 TODO 인가요 ??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사실 요게 TDS 설정을 가져온 건데, 거기에는 바벨이 붙어있었거든용.

여기서는 굳이 필요없을 것 같기는 한데 TDS에서 바벨을 왜 붙힌건지 명확하게 파악이 안되어서 일단 주석으로만 처리해두었습니다. 도입 의도가 명확하게 파악되고 진짜 필요없다는 판단이 들면 제거하려고 합니다!

// extensions,
// runtimeHelpers: true,
// include: ['src/**'],
// }),
resolve({ extensions }),
commonjs({
namedExports: {
'prop-types': ['node', 'bool', 'string', 'any', 'arrayOf', 'oneOfType', 'object', 'func'],
},
}),
],
};
}

function buildCJS(input) {
const filename = path.parse(input).name;

return buildJS(input, `dist/${filename}.js`, 'cjs');
}

function buildESM(input) {
const filename = path.parse(input).name;
return buildJS(input, `dist/esm/${filename}.js`, 'es');
}

function buildCSS(inputFile, outputFile, postCSSOptions = {}) {
return {
input: inputFile,
output: { file: `dist/${outputFile}`, format: 'cjs' }, // format is not used.
plugins: [
postcss({
plugins: [autoprefixer],
sourceMap: true,
extract: true,
extensions: ['.scss', '.css'],
...postCSSOptions,
}),
],
};
}
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

9 changes: 0 additions & 9 deletions src/App.test.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions src/App.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React, { HTMLAttributes } from 'react';

export default function Button(props: HTMLAttributes<HTMLButtonElement>): JSX.Element {
return <button className="button" {...props} />;
}
3 changes: 3 additions & 0 deletions src/components/Button/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.button {
outline: 0;
}
1 change: 1 addition & 0 deletions src/components/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './Button/style.scss';
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Button } from './Button';
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

Loading