This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from Groww/develop
Develop
- Loading branch information
Showing
5 changed files
with
125 additions
and
55 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
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 |
---|---|---|
@@ -1,56 +1,71 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import external from 'rollup-plugin-peer-deps-external'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import postcssImport from 'postcss-import'; | ||
import postcssUrl from 'postcss-url'; | ||
import typescript from 'rollup-plugin-typescript'; | ||
import postcssImport from "postcss-import"; | ||
import postcssUrl from "postcss-url"; | ||
import babel from "rollup-plugin-babel"; | ||
import copy from "rollup-plugin-copy"; | ||
import filesize from "rollup-plugin-filesize"; | ||
import copy from 'rollup-plugin-copy' | ||
import external from "rollup-plugin-peer-deps-external"; | ||
import postcss from "rollup-plugin-postcss"; | ||
import { terser } from "rollup-plugin-terser"; | ||
import typescript from "rollup-plugin-typescript"; | ||
|
||
import commonjs from "@rollup/plugin-commonjs"; | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
|
||
import { getInputFiles } from "./rollup.input"; | ||
|
||
// import pkg from './package.json'; | ||
|
||
const commonConfig = { | ||
plugins: [ | ||
commonjs(), | ||
postcss({ | ||
plugins: [ postcssImport(), postcssUrl({ url: 'inline' }) ], | ||
extract: true, | ||
extract: 'index.css', | ||
extensions: [ '.css' ] | ||
}), | ||
typescript(), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
presets: [ '@babel/preset-typescript', '@babel/preset-react' ], | ||
plugins: [ | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-proposal-private-methods' | ||
] | ||
}), | ||
external(), | ||
resolve(), | ||
terser(), | ||
filesize(), | ||
copy({ | ||
targets: [ | ||
{ src: 'src/types', dest: 'dist' } | ||
] | ||
}) | ||
], | ||
external: [ 'react', 'react-dom', 'classnames', 'react-lazyload' ] | ||
|
||
}; | ||
|
||
export default [ | ||
{ | ||
input: './src/index.ts', | ||
output: [ | ||
{ | ||
file: 'dist/index.js', | ||
dir: 'dist/cjs', | ||
format: 'cjs' | ||
}, | ||
{ | ||
file: 'dist/index.es.js', | ||
format: 'es', | ||
exports: 'named' | ||
} | ||
], | ||
plugins: [ | ||
commonjs(), | ||
postcss({ | ||
plugins: [postcssImport(), postcssUrl({ url: 'inline' })], | ||
extract: true, | ||
extensions: [".css"], | ||
}), | ||
typescript(), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
presets: ['@babel/preset-typescript', '@babel/preset-react'], | ||
plugins: [ | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-proposal-private-methods', | ||
] | ||
}), | ||
external(), | ||
resolve(), | ||
terser(), | ||
filesize(), | ||
copy({ | ||
targets: [ | ||
{ src: 'src/types', dest: 'dist' } | ||
] | ||
}) | ||
...commonConfig | ||
}, | ||
{ | ||
input: getInputFiles(), | ||
output: [ | ||
{ | ||
dir: 'dist/esm', | ||
format: 'es' | ||
} | ||
], | ||
external: ['react', 'react-dom', 'classnames', 'react-lazyload'] | ||
...commonConfig | ||
} | ||
]; |
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,43 @@ | ||
const fs = require('fs'); | ||
|
||
const fileTypes = [ '.ts', '.jsx', '.ts', '.tsx' ]; | ||
|
||
/* | ||
getModulePath generates an array of paths to components present in the atom or molecule | ||
for e.g. by calling getModulePaths('./src/components','molecules') the function will generate the following array: | ||
[ | ||
'./src/components/molecules/Carousel/index.jsx', | ||
'./src/components/molecules/CheckBoxGroup/index.ts', | ||
'./src/components/molecules/RadioButtonGroup/index.ts', | ||
] | ||
*/ | ||
|
||
function getModulePaths(path, componentType) { | ||
const moduleList = fs.readdirSync(path + '/' + componentType); | ||
|
||
const modulePaths = []; | ||
|
||
moduleList.forEach((module) => { | ||
fileTypes.every((fileType) => { | ||
const componentPathCandidate = `${path}/${componentType}/${module}/index${fileType}`; | ||
|
||
if (fs.existsSync(componentPathCandidate)) { | ||
modulePaths.push(componentPathCandidate); | ||
return false; // break loop | ||
} | ||
|
||
return true; // continue loop | ||
}); | ||
|
||
}); | ||
|
||
return modulePaths; | ||
} | ||
|
||
export function getInputFiles() { | ||
return [ | ||
'./src/index.ts', | ||
...getModulePaths('./src/components', 'atoms'), | ||
...getModulePaths('./src/components', 'molecules') | ||
]; | ||
} |
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
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 |
---|---|---|
|
@@ -49,6 +49,5 @@ | |
} | ||
|
||
.tb10IconClass { | ||
width: 17px !important; | ||
height: 17px !important; | ||
top: 6px; | ||
} |