From 57efd0fc825ef280b8168dc88158cb7b3bf4fc42 Mon Sep 17 00:00:00 2001 From: Mario Souto <13791385+omariosouto@users.noreply.github.com> Date: Mon, 1 Aug 2022 16:13:06 -0300 Subject: [PATCH] fix: export interfaces --- lib/index.ts | 2 +- lib/stylesheet/stylesheet.ts | 1 + package.json | 4 +-- rollup.config.js | 53 ++++++++++++++++++------------------ yarn.lock | 8 +++--- 5 files changed, 35 insertions(+), 33 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 29f2fbb..0988309 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,3 +1,3 @@ +export { StyleSheet, ResponsiveProperty } from "@lib/stylesheet/stylesheet"; export { default as parseStyleSheet } from "@lib/parse-stylesheet/parse-stylesheet"; export { breakpoints, Breakpoints } from "@lib/breakpoints/breakpoints"; -export { StyleSheet, ResponsiveProperty } from "@lib/stylesheet/stylesheet"; diff --git a/lib/stylesheet/stylesheet.ts b/lib/stylesheet/stylesheet.ts index 341bd5e..5548815 100644 --- a/lib/stylesheet/stylesheet.ts +++ b/lib/stylesheet/stylesheet.ts @@ -8,6 +8,7 @@ import { import { ResponsiveProperty } from "./responsive-property"; export { ResponsiveProperty } from "./responsive-property"; + export interface StyleSheet { // [box-model] height?: height; diff --git a/package.json b/package.json index 7c5cb88..5efdb7d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ }, "dependencies": {}, "devDependencies": { - "@typescript-eslint/parser": "^5.31.0", "@babel/core": "7.16.0", "@babel/plugin-proposal-private-property-in-object": "^7.16.5", "@babel/preset-env": "7.16.4", @@ -44,7 +43,7 @@ "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-commonjs": "20.0.0", "@rollup/plugin-node-resolve": "13.0.4", - "@rollup/plugin-typescript": "8.2.5", + "@rollup/plugin-typescript": "^8.3.4", "@semantic-release/changelog": "5.0.1", "@semantic-release/commit-analyzer": "8.0.1", "@semantic-release/git": "9.0.0", @@ -52,6 +51,7 @@ "@semantic-release/npm": "7.0.5", "@semantic-release/release-notes-generator": "9.0.1", "@types/jest": "^28.1.6", + "@typescript-eslint/parser": "^5.31.0", "eslint": "8.14.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-jest": "^26.6.0", diff --git a/rollup.config.js b/rollup.config.js index 76e331b..dc3cd57 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,26 +1,26 @@ /* eslint-disable no-console */ -/* eslint-disable @typescript-eslint/no-var-requires */ -import path from 'path'; -import { execSync } from 'child_process'; -import alias from '@rollup/plugin-alias'; -import resolve from '@rollup/plugin-node-resolve'; -import commonjs from '@rollup/plugin-commonjs'; -import babel from '@rollup/plugin-babel'; -import external from 'rollup-plugin-peer-deps-external'; -import dts from 'rollup-plugin-dts'; +import path from "path"; +import { execSync } from "child_process"; +import alias from "@rollup/plugin-alias"; +import resolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import babel from "@rollup/plugin-babel"; +import typescript from "@rollup/plugin-typescript"; +import external from "rollup-plugin-peer-deps-external"; +import dts from "rollup-plugin-dts"; -const packageJson = require('./package.json'); +const packageJson = require("./package.json"); -const extensions = ['.ts', '.tsx', '.json']; +const extensions = [".ts", ".tsx", ".json"]; const SKNBBuildEnd = (options = {}) => { - const { hook = 'generateBundle' } = options; + const { hook = "generateBundle" } = options; return { - name: 'skn-build-end', + name: "skn-build-end", [hook]: async () => { - execSync('[ -d dist ] || mkdir dist'); + execSync("[ -d dist ] || mkdir dist"); - const cmdExportTypes = 'yarn export:types'; + const cmdExportTypes = "yarn export:types"; console.log(`RUN: ${cmdExportTypes}`); execSync(cmdExportTypes); console.log(`DONE: ${cmdExportTypes}`); @@ -30,20 +30,20 @@ const SKNBBuildEnd = (options = {}) => { export default [ { - input: 'lib/index.ts', + input: "lib/index.ts", external: (id) => { return /^react|styled-jsx|next/.test(id); }, output: [ { file: packageJson.main, - format: 'cjs', + format: "cjs", sourcemap: true, name: packageJson.name, }, { file: packageJson.module, - format: 'esm', + format: "esm", sourcemap: true, }, ], @@ -52,9 +52,9 @@ export default [ alias({ entries: [ { - find: '@lib', + find: "@lib", replacement: () => { - return path.resolve(__dirname, 'lib'); + return path.resolve(__dirname, "lib"); }, }, ], @@ -63,26 +63,27 @@ export default [ jsnext: true, extensions, }), + typescript(), commonjs(), babel({ - babelHelpers: 'inline', - exclude: 'node_modules/**', + babelHelpers: "inline", + exclude: "node_modules/**", extensions, }), SKNBBuildEnd(), ], }, { - input: 'types/lib/index.d.ts', - output: [{ file: packageJson.types, format: 'esm' }], + input: "types/lib/index.d.ts", + output: [{ file: packageJson.types, format: "esm" }], external: [/\.css$/], plugins: [ alias({ entries: [ { - find: '@lib', + find: "@lib", replacement: () => { - return path.resolve(__dirname, 'types', 'lib'); + return path.resolve(__dirname, "types", "lib"); }, }, ], diff --git a/yarn.lock b/yarn.lock index 3bda162..93113d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1628,10 +1628,10 @@ is-module "^1.0.0" resolve "^1.19.0" -"@rollup/plugin-typescript@8.2.5": - version "8.2.5" - resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.2.5.tgz#e0319761b2b5105615e5a0c371ae05bc2984b7de" - integrity sha512-QL/LvDol/PAGB2O0S7/+q2HpSUNodpw7z6nGn9BfoVCPOZ0r4EALrojFU29Bkoi2Hr2jgTocTejJ5GGWZfOxbQ== +"@rollup/plugin-typescript@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.3.4.tgz#45cdc0787b658b37d0362c705d8de86bc8bc040e" + integrity sha512-wt7JnYE9antX6BOXtsxGoeVSu4dZfw0dU3xykfOQ4hC3EddxRbVG/K0xiY1Wup7QOHJcjLYXWAn0Kx9Z1SBHHg== dependencies: "@rollup/pluginutils" "^3.1.0" resolve "^1.17.0"