Skip to content

Commit

Permalink
Fixed incremental tsc caching, that prevented compilation output
Browse files Browse the repository at this point in the history
  • Loading branch information
divanc committed Aug 8, 2023
1 parent f5e91c9 commit a0ecef9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 31 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
],
"main": "dist/index.js",
"scripts": {
"build": "rm -rf dist && yarn run tsc --project tsconfig.build.json",
"prebuild": "rm -rf dist",
"build": "yarn run tsc --project tsconfig.build.json",
"clean": "./scripts/clean.sh",
"format": "prettier ./lib/src -w",
"lint": "eslint ./lib/src --ext .ts",
Expand All @@ -53,9 +54,9 @@
"@babel/preset-env": "^7.22.9",
"@babel/preset-typescript": "^7.22.5",
"@types/jest": "^29.5.3",
"@types/node": "^18.14.2",
"@types/node": "^18.10.0",
"@types/react": "^16.13.1",
"@types/react-native": "^0.63.0",
"@types/react-native": "0.70.5",
"@typescript-eslint/eslint-plugin": "5.59.6",
"@typescript-eslint/parser": "5.59.6",
"babel-jest": "^29.6.2",
Expand Down
36 changes: 35 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"compilerOptions": {
"diagnostics": true
"diagnostics": true,
"noEmit": false,
"incremental": false, // Force rewrite output
"tsBuildInfoFile": null,

"types": [
/* Specify type package names to be included without being referenced in a source file. */
"node",
"react-native"
],

"outDir": "dist" /* Specify an output folder for all emitted files. */,
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
"declarationMap": true /* Create sourcemaps for d.ts files. */,
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "removeComments": true /* Disable emitting comments. */,
// "noEmit": true, /* Disable emitting files from a compilation. */
"importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */,
"importsNotUsedAsValues": "remove" /* Specify emit/checking behavior for imports that are only used for types. */,
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true /* Include sourcemap files inside the emitted JavaScript. */,
// "inlineSources": true /* Include source code in the sourcemaps inside the emitted JavaScript. */,
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
"newLine": "crlf" /* Set the newline character for emitting files. */,
"stripInternal": true /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
},
"exclude": ["**/*.test.ts"]
}
29 changes: 2 additions & 27 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/* Modules */
"module": "CommonJS" /* Specify what module code is generated. */,
"rootDir": "./lib/src" /* Specify the root folder within your source files. */,
"moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"baseUrl": "./lib/src" /* Specify the base directory to resolve non-relative module names. */,
"paths": {
/* Specify a set of entries that re-map imports to additional lookup locations. */
Expand All @@ -34,8 +34,8 @@
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
"types": [
/* Specify type package names to be included without being referenced in a source file. */
"react-native",
"node",
"react-native",
"jest"
],
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
Expand All @@ -46,31 +46,6 @@
/* JavaScript Support */
"allowJs": false /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,

/* Emit */
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
"declarationMap": true /* Create sourcemaps for d.ts files. */,
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "dist" /* Specify an output folder for all emitted files. */,
// "removeComments": true /* Disable emitting comments. */,
// "noEmit": true, /* Disable emitting files from a compilation. */
"importHelpers": true /* Allow importing helper functions from tslib once per project, instead of including them per-file. */,
"importsNotUsedAsValues": "remove" /* Specify emit/checking behavior for imports that are only used for types. */,
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true /* Include sourcemap files inside the emitted JavaScript. */,
// "inlineSources": true /* Include source code in the sourcemaps inside the emitted JavaScript. */,
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
"newLine": "crlf" /* Set the newline character for emitting files. */,
"stripInternal": true /* Disable emitting declarations that have '@internal' in their JSDoc comments. */,
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
"noEmitOnError": true /* Disable emitting files if any type checking errors are reported. */,
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */

/* Interop Constraints */
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
Expand Down

0 comments on commit a0ecef9

Please sign in to comment.