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 = { module.exports = {
extends: '../../eslintrc.ts.base.json', extends: '../../eslintrc.js.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
overrides: [ overrides: [
{
files: ['*.ts'],
extends: '../../eslintrc.ts.jest.base.json',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./test/tsconfig.json'],
},
},
{ {
files: ['test/**/*.ts'], files: ['test/**/*.ts'],
extends: '../../eslintrc.ts.jest.base.json', extends: '../../eslintrc.ts.jest.base.json',

View File

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