From 59c09a272e9537a2bd1a269a19a3b8a8d71c8031 Mon Sep 17 00:00:00 2001 From: Evgenij Shangin Date: Thu, 14 Apr 2022 14:47:25 +0300 Subject: [PATCH] feat: add cjs build (#22) --- package.json | 11 +++++++---- tsconfig.cjs.json | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tsconfig.cjs.json diff --git a/package.json b/package.json index d71d931..d86eb82 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,16 @@ "description": "i18n library for Yandex Cloud UI services", "version": "0.4.0", "license": "MIT", - "main": "build/esm/index.js", + "main": "build/cjs/index.js", + "module": "build/esm/index.js", + "types": "build/esm/index.d.ts", "repository": "git@github.com:yandex-cloud/i18n", "scripts": { - "build": "tsc", + "build": "npm run build:clean && npm run build:compile", + "build:compile": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json", + "build:clean": "rm -rf build", "lint": "eslint src/*", - "prepublish": "rm -rf build && npm run build", + "prepublish": "npm run build", "test": "jest", "typecheck": "tsc --noEmit" }, @@ -16,7 +20,6 @@ "example", "build" ], - "types": "build/esm/index.d.ts", "publishConfig": { "access": "public" }, diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..5f695f4 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "@yandex-cloud/tsconfig/tsconfig", + "compilerOptions": { + "outDir": "build/cjs", + "declaration": true + }, + "include": ["src/*.ts"], + "exclude": ["**/*.spec.ts"] +}