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
/* eslint-disable no-console */ | |
const { resolve, join, basename } = require('path'); | |
const { readFile, writeFile, copy } = require('fs-extra'); | |
const packagePath = process.cwd(); | |
const distPath = join(packagePath, './dist'); | |
const writeJson = (targetPath, obj) => | |
writeFile(targetPath, JSON.stringify(obj, null, 2), 'utf8'); | |
async function createPackageFile() { |
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
dist | |
├── Accordion | |
│ ├── Accordion.d.ts | |
│ ├── AccordionBody.d.ts | |
│ ├── AccordionButton.d.ts | |
│ ├── AccordionCollapse.d.ts | |
│ ├── AccordionContext.d.ts | |
│ ├── AccordionHeader.d.ts | |
│ ├── AccordionItem.d.ts | |
│ ├── AccordionItemContext.d.ts |
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
import peerDepsExternal from "rollup-plugin-peer-deps-external"; | |
import resolve from "@rollup/plugin-node-resolve"; | |
import commonjs from "@rollup/plugin-commonjs"; | |
import typescript from "rollup-plugin-typescript2"; | |
import replace from "@rollup/plugin-replace"; | |
import { terser } from "rollup-plugin-terser"; | |
const packageJson = require("./package.json"); | |
import generatePackageJson from "rollup-plugin-generate-package-json"; | |
const plugins = [ |
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
const packageJson = require("./package.json"); | |
export default [ | |
{ | |
input: ["src/index.ts"], | |
output: [ | |
{ | |
file: packageJson.module, | |
format: "esm", | |
sourcemap: true, | |
exports: "named", |
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
{ | |
"compilerOptions": { | |
"target": "esnext", | |
"module": "esnext", | |
"lib": ["dom", "esnext"], | |
// output .d.ts declaration files for consumers | |
"declaration": true, | |
"declarationDir": "dist", | |
// output .js.map sourcemap files for consumers | |
"sourceMap": true, |