Skip to content

Commit

Permalink
Defer to rollup TS plugin to build types
Browse files Browse the repository at this point in the history
  • Loading branch information
jedmao committed Sep 5, 2019
1 parent 291c263 commit 7214b8e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ dist
lib
es
coverage
types

website/translated_docs
website/build/
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,24 @@
"main": "lib/redux.js",
"unpkg": "dist/redux.js",
"module": "es/redux.js",
"types": "types/index.d.ts",
"types": "lib/redux.d.ts",
"files": [
"dist",
"lib",
"es",
"src",
"types"
"src"
],
"scripts": {
"clean": "rimraf lib dist es coverage types",
"clean": "rimraf lib dist es coverage",
"format": "prettier --write \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"",
"format:check": "prettier --list-different \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"",
"lint": "eslint --ext js,ts src test",
"pretest": "npm run build",
"test": "jest",
"test:watch": "npm test -- --watch",
"test:cov": "npm test -- --coverage",
"build": "npm run build-types && rollup -c",
"build": "rollup -c",
"prepare": "npm run clean && npm run check-types && npm run format:check && npm run lint && npm test",
"build-types": "tsc --emitDeclarationOnly",
"check-types": "tsc --noEmit",
"examples:lint": "eslint --ext js,ts examples",
"examples:test": "cross-env CI=true babel-node examples/testAll.js"
Expand Down
10 changes: 5 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import pkg from './package.json'
export default [
// CommonJS
{
input: 'src/index.ts',
input: 'src/redux.ts',
output: { file: 'lib/redux.js', format: 'cjs', indent: false },
external: [
...Object.keys(pkg.dependencies || {}),
Expand All @@ -26,7 +26,7 @@ export default [

// ES
{
input: 'src/index.ts',
input: 'src/redux.ts',
output: { file: 'es/redux.js', format: 'es', indent: false },
external: [
...Object.keys(pkg.dependencies || {}),
Expand All @@ -43,7 +43,7 @@ export default [

// ES for Browsers
{
input: 'src/index.ts',
input: 'src/redux.ts',
output: { file: 'es/redux.mjs', format: 'es', indent: false },
plugins: [
nodeResolve({
Expand All @@ -69,7 +69,7 @@ export default [

// UMD Development
{
input: 'src/index.ts',
input: 'src/redux.ts',
output: {
file: 'dist/redux.js',
format: 'umd',
Expand All @@ -92,7 +92,7 @@ export default [

// UMD Production
{
input: 'src/index.ts',
input: 'src/redux.ts',
output: {
file: 'dist/redux.min.js',
format: 'umd',
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/typescript.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { checkDirectory } from 'typings-tester'

describe('TypeScript definitions', function() {
it('should compile against index.d.ts', () => {
it('should compile against redux.d.ts', () => {
checkDirectory(__dirname + '/typescript')
})
})
2 changes: 1 addition & 1 deletion test/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"strict": true,
"baseUrl": "../..",
"paths": {
"redux": ["types/index.d.ts"]
"redux": ["lib/redux.d.ts"]
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"declarationDir": "./types" /* Output directory for generated declaration files. */,
// "declarationDir": "./types" /* Output directory for generated declaration files. */,
// "emitDeclarationOnly": true /* Only emit ‘.d.ts’ declaration files. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
Expand Down

0 comments on commit 7214b8e

Please sign in to comment.