mirror of
https://github.com/zhigang1992/react-content-loader.git
synced 2026-05-13 10:07:08 +08:00
* test(Refactor): (#117) * test(Refactor): * Holder / SVG tests * Svg tests * Removed old tests * Coverage * Migrate to travis * Update travis * Update travis * ci(Release): * test(package): * ci(Travis): * chore(devDependencies): Package to generate the changelog * feat(Codebase): Format * feat(Types): Export types * ci(Build step): * feat(RTL): Flip the content BREAKING CHANGE: Flip all content instead of only flip the animation direction Closes #122 * Migrate codebase to Typescript (#120) * Ignore rpt2_cache * Add typescript pkg; Add tsc runner script * Replace babel with ts compiler * Typescript configs * Update lockfile * Convert Holder to tsx * Convert svg to tsx * Convert index.js to ts * Convert uid to ts * Convert BulletListStyle to tsx * Convert CodeStyle to tsx * Convert FacebookStyle to tsx * Convert InstagramStyle to tsx * Convert ListStyle to tsx * Remove flow preset * Add ts-node for ts execustion env for nodejs * Remove flow preset & rollup-babel plugin; Add ts-node for ts env in nodejs * Update lockfile * Update watch script for tsc * Rename IProps to IContentLoaderProps; Use FC for validation * Remove unwanted ISvgProps; import IContentLoaderProps for type validations * import and re-export IContentLoaderProps for better types * Import and use types from IContentLoaderProps * Remove eslint; replaced by tslint and tslint-prettier * Add tslint-config-prettier * Implement stricter type checking * Remove comments as it is handled by tslint-config-prettier now * Replace lint by tsc * remove eslint and flow configs * Add style default props * Add jest options to include ts test files * Add options to load json file * Migrate tests from JS to TS for better interoperability * Updated snapshots * Remove ts-node * Break line after react import * Remove export from bottom of file and move to component definition BREAKING CHANGE: Migrate codebase to typescript Closes #120
91 lines
1.8 KiB
JavaScript
91 lines
1.8 KiB
JavaScript
import replace from "rollup-plugin-replace"
|
|
import { uglify } from "rollup-plugin-uglify"
|
|
import typescript from "rollup-plugin-typescript2"
|
|
import pkg from "./package.json"
|
|
|
|
const mergeAll = objs => Object.assign({}, ...objs)
|
|
|
|
const commonPlugins = [
|
|
typescript({
|
|
typescript: require("typescript")
|
|
})
|
|
]
|
|
|
|
const configBase = {
|
|
input: "src/index.ts",
|
|
output: {
|
|
exports: "named"
|
|
},
|
|
external: [
|
|
...Object.keys(pkg.dependencies || {}),
|
|
...Object.keys(pkg.peerDependencies || {})
|
|
],
|
|
plugins: commonPlugins
|
|
}
|
|
|
|
const umdConfig = mergeAll([
|
|
configBase,
|
|
{
|
|
output: mergeAll([
|
|
configBase.output,
|
|
{
|
|
file: `dist/${pkg.name}.js`,
|
|
format: "umd",
|
|
name: "ContentLoader",
|
|
globals: {
|
|
react: "React",
|
|
"react-dom": "ReactDOM"
|
|
}
|
|
}
|
|
]),
|
|
external: Object.keys(pkg.peerDependencies || {})
|
|
}
|
|
])
|
|
|
|
const devUmdConfig = mergeAll([
|
|
umdConfig,
|
|
{
|
|
plugins: umdConfig.plugins.concat(
|
|
replace({
|
|
"process.env.NODE_ENV": JSON.stringify("development")
|
|
})
|
|
)
|
|
}
|
|
])
|
|
|
|
const prodUmdConfig = mergeAll([
|
|
umdConfig,
|
|
{
|
|
output: mergeAll([
|
|
umdConfig.output,
|
|
{ file: umdConfig.output.file.replace(/\.js$/, ".min.js") }
|
|
])
|
|
},
|
|
{
|
|
plugins: umdConfig.plugins.concat(
|
|
replace({
|
|
"process.env.NODE_ENV": JSON.stringify("production")
|
|
}),
|
|
uglify({
|
|
compress: {
|
|
pure_getters: true,
|
|
unsafe: true,
|
|
unsafe_comps: true
|
|
}
|
|
})
|
|
)
|
|
}
|
|
])
|
|
|
|
const webConfig = mergeAll([
|
|
configBase,
|
|
{
|
|
output: [
|
|
mergeAll([configBase.output, { file: pkg.module, format: "es" }]),
|
|
mergeAll([configBase.output, { file: pkg.main, format: "cjs" }])
|
|
]
|
|
}
|
|
])
|
|
|
|
export default [devUmdConfig, prodUmdConfig, webConfig]
|