From 60e08391b0847b05d555f62afe6ee777781d7f21 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Wed, 20 Apr 2022 21:43:35 -0300 Subject: [PATCH] update build and typescript config --- .gitignore | 1 + package-lock.json | 6 +++--- package.json | 9 +++++---- tsconfig.json | 14 ++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 93c7ab3..a8e1a7e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules lib es +types coverage examples .vscode \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a95840e..54ce49d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6334,9 +6334,9 @@ } }, "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "version": "4.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", + "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==", "dev": true }, "unbox-primitive": { diff --git a/package.json b/package.json index 4fce4a6..6dd221e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "A library to easily use Split JS SDK with Redux and React Redux", "main": "lib/index.js", "module": "es/index.js", - "types": "lib/index.d.ts", + "types": "types/index.d.ts", "files": [ "README.md", "CONTRIBUTORS-GUIDE.md", @@ -12,10 +12,11 @@ "CHANGES.txt", "src", "lib", - "es" + "es", + "types" ], "scripts": { - "build": "rimraf lib/* es/* && tsc && tsc -m es2015 -d false --outDir es", + "build": "rimraf lib/* es/* types/* && tsc && tsc -m commonjs --outDir lib -d true --declarationDir types", "postbuild": "./version_replace.sh", "check": "npm run check:lint && npm run check:types", "check:lint": "tslint -p tsconfig.json", @@ -81,7 +82,7 @@ "rimraf": "^3.0.0", "ts-jest": "^27.0.5", "tslint": "^5.20.1", - "typescript": "^4.0.2" + "typescript": "4.4.4" }, "peerDependencies": { "redux": "^2.0.0 || ^3.0.0 || ^4.0.0-0", diff --git a/tsconfig.json b/tsconfig.json index 645e5e1..63475f2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,24 +3,22 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "module": "es6", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": false, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ + "sourceMap": false, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "lib", /* Redirect output structure to the directory. */ + "outDir": "es", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ // "noEmit": true, /* Do not emit outputs. */ - - // @TODO uncomment the following when migrating to JS-commons and Rollup, to avoid duplicated helpers code in builds. - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */