Use rollup for react-base16-styling

This commit is contained in:
Nathan Bierema 2022-01-08 22:53:19 -05:00
parent 0a7b441dac
commit 4a8c9ef7c9
6 changed files with 61 additions and 14 deletions

View File

@ -1,3 +1,11 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
"presets": [
[
"@babel/preset-env",
{
"targets": "defaults"
}
],
"@babel/preset-typescript"
]
}

View File

@ -1 +1 @@
lib
dist

View File

@ -1,10 +1,14 @@
module.exports = {
extends: '../../eslintrc.ts.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
extends: '../../eslintrc.js.base.json',
overrides: [
{
files: ['*.ts'],
extends: '../../eslintrc.ts.jest.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./test/tsconfig.json'],
},
},
{
files: ['test/**/*.ts'],
extends: '../../eslintrc.ts.jest.base.json',

View File

@ -18,16 +18,15 @@
"lib",
"src"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/react-base16-styling.cjs.js",
"module": "dist/react-base16-styling.esm.js",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/reduxjs/redux-devtools.git"
},
"scripts": {
"build": "yarn run build:types && yarn run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".ts\" --source-maps inline",
"build": "rollup -c",
"clean": "rimraf lib",
"test": "jest",
"lint": "eslint . --ext .ts",
@ -36,6 +35,7 @@
"prepublish": "yarn run type-check && yarn run lint && yarn run test"
},
"dependencies": {
"@babel/runtime": "^7.16.7",
"@types/base16": "^1.0.2",
"@types/lodash": "^4.14.178",
"base16": "^1.0.0",
@ -44,10 +44,12 @@
"lodash.curry": "^4.1.1"
},
"devDependencies": {
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@rollup/plugin-babel": "^5.3.0",
"@types/color": "^3.0.2",
"@types/jest": "^27.4.0",
"@types/lodash.curry": "^4.1.6",
@ -58,7 +60,10 @@
"eslint-plugin-jest": "^25.3.4",
"jest": "^27.4.5",
"rimraf": "^3.0.2",
"rollup": "^2.63.0",
"rollup-plugin-typescript2": "^0.31.1",
"ts-jest": "^27.1.2",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
}
}

View File

@ -0,0 +1,24 @@
import typescript from 'rollup-plugin-typescript2';
import babel from '@rollup/plugin-babel';
const config = [
{
input: 'src/index.ts',
output: [
{ file: 'dist/react-base16-styling.cjs.js', format: 'cjs' },
{ file: 'dist/react-base16-styling.esm.js', format: 'esm' },
],
plugins: [
typescript(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'runtime',
extensions: ['.ts'],
plugins: ['@babel/plugin-transform-runtime'],
}),
],
external: [/@babel\/runtime/, 'base16', 'color', 'lodash.curry'],
},
];
export default config;

View File

@ -23856,10 +23856,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "react-base16-styling@workspace:packages/react-base16-styling"
dependencies:
"@babel/cli": ^7.16.7
"@babel/core": ^7.16.7
"@babel/eslint-parser": ^7.16.5
"@babel/plugin-transform-runtime": ^7.16.7
"@babel/preset-env": ^7.16.7
"@babel/preset-typescript": ^7.16.7
"@babel/runtime": ^7.16.7
"@rollup/plugin-babel": ^5.3.0
"@types/base16": ^1.0.2
"@types/color": ^3.0.2
"@types/jest": ^27.4.0
@ -23876,7 +23879,10 @@ __metadata:
jest: ^27.4.5
lodash.curry: ^4.1.1
rimraf: ^3.0.2
rollup: ^2.63.0
rollup-plugin-typescript2: ^0.31.1
ts-jest: ^27.1.2
tslib: ^2.3.1
typescript: ~4.5.4
languageName: unknown
linkType: soft