Skip to content

Commit

Permalink
build: add rollup configuration for building the library
Browse files Browse the repository at this point in the history
build: add typescript configuration for building the library
build: add output formats for the library (cjs, esm, iife)
feat: add default export class KinopoiskDev to index.ts
chore: add dist folder to .gitignore
  • Loading branch information
mdwitr0 committed Jun 20, 2023
1 parent 8ef0f97 commit 16f9572
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
dist
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
"name": "kinopoiskdev_ts_client",
"version": "1.0.0",
"description": "JS/TS библиотека для kinopoisk.dev API",
"main": "index.js",
"type": "module",
"main": "dist/bundle.cjs.js",
"module": "dist/bundle.esm.js",
"browser": "dist/bundle.iife.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "rollup -c"
},
"keywords": [],
"author": "mdwitr0",
Expand Down
27 changes: 27 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import typescript from 'rollup-plugin-typescript2';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
input: 'src/index.ts',
output: [
{
file: 'dist/bundle.cjs.js',
format: 'cjs',
},
{
file: 'dist/bundle.esm.js',
format: 'esm',
},
{
file: 'dist/bundle.iife.js',
format: 'iife',
name: 'kinopoiskdev',
}
],
plugins: [
typescript(),
resolve(),
commonjs(),
],
};
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default class KinopoiskDev {

}
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"outDir": "./dist",
"sourceMap": true,
"noImplicitAny": true,
"module": "ESNext",
"target": "ESNext",
"jsx": "react"
},
"include": [
"./src/**/*"
]
}

0 comments on commit 16f9572

Please sign in to comment.