diff --git a/.gitignore b/.gitignore index 0b3c7670e02..20b5b1f0f01 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ examples/**/static examples/**/dist cypress/videos cypress/screenshots +lib-composite +.tsbuildinfo +base.tsBuildInfoFile +.tsbuildinfoEsm \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000000..55712c19f1d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib" +} \ No newline at end of file diff --git a/Makefile b/Makefile index c28563dbfcd..182e48e3aeb 100644 --- a/Makefile +++ b/Makefile @@ -23,70 +23,18 @@ build-demo: ## compile the demo example to static js run-graphql-demo: ## run the demo example @yarn -s run-graphql-demo -build-ra-core: - @echo "Transpiling ra-core files..."; - @cd ./packages/ra-core && yarn -s build +build-composite: + @echo "Build composite project"; + @yarn build -build-ra-ui-materialui: - @echo "Transpiling ra-ui-materialui files..."; - @cd ./packages/ra-ui-materialui && yarn -s build - -build-react-admin: - @echo "Transpiling react-admin files..."; +copy-docs-react-admin: + @echo "Copy docs react-admin"; @rm -rf ./packages/react-admin/docs - @cd ./packages/react-admin && yarn -s build + @cd ./packages/react-admin @mkdir packages/react-admin/docs @cp docs/*.md packages/react-admin/docs -build-ra-data-fakerest: - @echo "Transpiling ra-data-fakerest files..."; - @cd ./packages/ra-data-fakerest && yarn -s build - -build-ra-data-json-server: - @echo "Transpiling ra-data-json-server files..."; - @cd ./packages/ra-data-json-server && yarn -s build - -build-ra-data-simple-rest: - @echo "Transpiling ra-data-simple-rest files..."; - @cd ./packages/ra-data-simple-rest && yarn -s build - -build-ra-data-graphql: - @echo "Transpiling ra-data-graphql files..."; - @cd ./packages/ra-data-graphql && yarn -s build - -build-ra-data-graphcool: - @echo "Transpiling ra-data-graphcool files..."; - @cd ./packages/ra-data-graphcool && yarn -s build - -build-ra-data-graphql-simple: - @echo "Transpiling ra-data-graphql-simple files..."; - @cd ./packages/ra-data-graphql-simple && yarn -s build - -build-ra-i18n-polyglot: - @echo "Transpiling ra-i18n-polyglot files..."; - @cd ./packages/ra-i18n-polyglot && yarn -s build - -build-ra-input-rich-text: - @echo "Transpiling ra-input-rich-text files..."; - @cd ./packages/ra-input-rich-text && yarn -s build - -build-ra-realtime: - @echo "Transpiling ra-realtime files..."; - @cd ./packages/ra-realtime && yarn -s build - -build-ra-tree-core: - @echo "Transpiling ra-tree-core files..."; - @cd ./packages/ra-tree-core && yarn -s build - -build-ra-tree-ui-materialui: - @echo "Transpiling ra-tree-ui-materialui files..."; - @cd ./packages/ra-tree-ui-materialui && yarn -s build - -build-data-generator: - @echo "Transpiling data-generator files..."; - @cd ./examples/data-generator && yarn -s build - -build: build-ra-core build-ra-ui-materialui build-ra-data-fakerest build-ra-data-json-server build-ra-data-simple-rest build-ra-data-graphql build-ra-data-graphcool build-ra-data-graphql-simple build-ra-i18n-polyglot build-ra-input-rich-text build-ra-realtime build-ra-tree-core build-ra-tree-ui-materialui build-data-generator build-react-admin ## compile ES6 files to JS +build: build-composite copy-docs-react-admin doc: ## compile doc as html and launch doc web server @yarn -s doc @@ -136,3 +84,7 @@ test-e2e: ## launch end-to-end tests test-e2e-local: ## launch end-to-end tests for development @echo 'Starting e2e tests environment. Ensure you started the simple example first (make run-simple)' @cd cypress && yarn -s start + +declarations-test: + @echo 'declarations-test' + @yarn validate-emitted-declarations \ No newline at end of file diff --git a/declarationsSanityTest/index.ts b/declarationsSanityTest/index.ts new file mode 100644 index 00000000000..ac8ecfcddaf --- /dev/null +++ b/declarationsSanityTest/index.ts @@ -0,0 +1,14 @@ +import {} from 'ra-core'; +import {} from 'ra-data-fakerest'; +import {} from 'ra-data-graphcool'; +import {} from 'ra-data-graphql'; +import {} from 'ra-data-graphql-simple'; +import {} from 'ra-data-json-server'; +import {} from 'ra-data-simple-rest'; +import {} from 'ra-i18n-polyglot'; +import {} from 'ra-input-rich-text'; +import {} from 'ra-realtime'; +import {} from 'ra-tree-core'; +import {} from 'ra-tree-ui-materialui'; +import {} from 'ra-ui-materialui'; +import {} from 'react-admin'; diff --git a/declarationsSanityTest/tsconfig.json b/declarationsSanityTest/tsconfig.json new file mode 100644 index 00000000000..22fdb9554c9 --- /dev/null +++ b/declarationsSanityTest/tsconfig.json @@ -0,0 +1,67 @@ +{ + "compilerOptions": { + /* 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'. */ + "lib": ["esnext"], /* 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": "preserve", /* 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. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* 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. */ + // "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'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + "types": ["react", "prop-types", "@types/prop-types"], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + }, + "include": ["index.ts"] +} diff --git a/examples/data-generator/tsconfig.esm.json b/examples/data-generator/tsconfig.esm.json new file mode 100644 index 00000000000..970d4f77610 --- /dev/null +++ b/examples/data-generator/tsconfig.esm.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig" +} diff --git a/examples/data-generator/tsconfig.json b/examples/data-generator/tsconfig.json index 8be9b276492..2b636d175fb 100644 --- a/examples/data-generator/tsconfig.json +++ b/examples/data-generator/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "lib", "rootDir": "src" diff --git a/package.json b/package.json index fa74583af76..ea4e87736f0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "name": "react-admin-lerna", "scripts": { - "build": "lerna run build", + "build": "yarn build-with-composite", "build-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=rest yarn -s build", "test-unit": "cross-env NODE_ENV=test cross-env BABEL_ENV=cjs NODE_ICU_DATA=node_modules/full-icu jest", "test-unit-ci": "cross-env NODE_ENV=test cross-env BABEL_ENV=cjs NODE_ICU_DATA=node_modules/full-icu jest --runInBand", @@ -15,7 +15,13 @@ "run-simple": "cd examples/simple && yarn -s start", "run-tutorial": "yarn run -s build && cd examples/tutorial && yarn -s start", "run-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=rest yarn -s start", - "run-graphql-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=graphql yarn -s start" + "run-graphql-demo": "cd examples/demo && cross-env REACT_APP_DATA_PROVIDER=graphql yarn -s start", + "build-with-composite": "yarn tsc --build tsconfig.build-all.all.json", + "watch-with-composite": "yarn tsc --build tsconfig.build-all.all.json --incremental --watch", + "cleanup": "lerna exec --parallel \"rm -fr lib && rm -fr esm\"", + "validate-emitted-declarations": "tsc -p declarationsSanityTest/tsconfig.json", + "validate-project-refs": "yarn cleanup && yarn lerna exec --no-bail --concurrency 1 \"cd ../../ yarn cleanup && cd - && tsc --build tsconfig.json\"", + "validate-project-refs-esm": "yarn cleanup && yarn lerna exec --no-bail --concurrency 1 \"cd ../../ yarn cleanup && cd - && tsc --build tsconfig.esm.json\"" }, "jest": { "setupFilesAfterEnv": [ @@ -33,7 +39,8 @@ ], "globals": { "ts-jest": { - "isolatedModules": true + "isolatedModules": true, + "tsConfig": "tsconfig.base.json" } } }, @@ -76,6 +83,6 @@ "cypress" ], "dependencies": { - "typescript": "^3.5.3" + "typescript": "^3.7.0-dev.20191011" } } diff --git a/packages/ra-core/package.json b/packages/ra-core/package.json index 65f73d9aebb..1e1512d7dfc 100644 --- a/packages/ra-core/package.json +++ b/packages/ra-core/package.json @@ -8,9 +8,8 @@ "esm", "src" ], - "main": "lib/index", + "main": "lib/index.js", "module": "esm/index.js", - "types": "esm/index.d.ts", "sideEffects": false, "authors": [ "François Zaninotto", diff --git a/packages/ra-core/tsconfig.esm.json b/packages/ra-core/tsconfig.esm.json new file mode 100644 index 00000000000..ba3e10429ea --- /dev/null +++ b/packages/ra-core/tsconfig.esm.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [] +} diff --git a/packages/ra-core/tsconfig.json b/packages/ra-core/tsconfig.json index e8a21555108..c5a31223622 100644 --- a/packages/ra-core/tsconfig.json +++ b/packages/ra-core/tsconfig.json @@ -1,11 +1,11 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "declaration": true, - "allowJs": false + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [] } diff --git a/packages/ra-data-fakerest/tsconfig.esm.json b/packages/ra-data-fakerest/tsconfig.esm.json new file mode 100644 index 00000000000..41685dd2632 --- /dev/null +++ b/packages/ra-data-fakerest/tsconfig.esm.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-fakerest/tsconfig.json b/packages/ra-data-fakerest/tsconfig.json index e8a21555108..098160a4bf1 100644 --- a/packages/ra-data-fakerest/tsconfig.json +++ b/packages/ra-data-fakerest/tsconfig.json @@ -1,11 +1,13 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "declaration": true, - "allowJs": false + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-data-graphcool/tsconfig.esm.json b/packages/ra-data-graphcool/tsconfig.esm.json new file mode 100644 index 00000000000..384eb5a9f7e --- /dev/null +++ b/packages/ra-data-graphcool/tsconfig.esm.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-graphcool/tsconfig.json b/packages/ra-data-graphcool/tsconfig.json index 8be9b276492..0dea68eaa8e 100644 --- a/packages/ra-data-graphcool/tsconfig.json +++ b/packages/ra-data-graphcool/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-data-graphql-simple/tsconfig.esm.json b/packages/ra-data-graphql-simple/tsconfig.esm.json new file mode 100644 index 00000000000..384eb5a9f7e --- /dev/null +++ b/packages/ra-data-graphql-simple/tsconfig.esm.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-graphql-simple/tsconfig.json b/packages/ra-data-graphql-simple/tsconfig.json index 8be9b276492..0dea68eaa8e 100644 --- a/packages/ra-data-graphql-simple/tsconfig.json +++ b/packages/ra-data-graphql-simple/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-data-graphql/tsconfig.esm.json b/packages/ra-data-graphql/tsconfig.esm.json new file mode 100644 index 00000000000..384eb5a9f7e --- /dev/null +++ b/packages/ra-data-graphql/tsconfig.esm.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-graphql/tsconfig.json b/packages/ra-data-graphql/tsconfig.json index 8be9b276492..0dea68eaa8e 100644 --- a/packages/ra-data-graphql/tsconfig.json +++ b/packages/ra-data-graphql/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-data-json-server/tsconfig.esm.json b/packages/ra-data-json-server/tsconfig.esm.json new file mode 100644 index 00000000000..41685dd2632 --- /dev/null +++ b/packages/ra-data-json-server/tsconfig.esm.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-json-server/tsconfig.json b/packages/ra-data-json-server/tsconfig.json index e8a21555108..098160a4bf1 100644 --- a/packages/ra-data-json-server/tsconfig.json +++ b/packages/ra-data-json-server/tsconfig.json @@ -1,11 +1,13 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "declaration": true, - "allowJs": false + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-data-simple-rest/tsconfig.esm.json b/packages/ra-data-simple-rest/tsconfig.esm.json new file mode 100644 index 00000000000..41685dd2632 --- /dev/null +++ b/packages/ra-data-simple-rest/tsconfig.esm.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-data-simple-rest/tsconfig.json b/packages/ra-data-simple-rest/tsconfig.json index e8a21555108..098160a4bf1 100644 --- a/packages/ra-data-simple-rest/tsconfig.json +++ b/packages/ra-data-simple-rest/tsconfig.json @@ -1,11 +1,13 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "declaration": true, - "allowJs": false + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/ra-i18n-polyglot/src/index.ts b/packages/ra-i18n-polyglot/src/index.ts index 27f6ce3cc72..147cfbfccf4 100644 --- a/packages/ra-i18n-polyglot/src/index.ts +++ b/packages/ra-i18n-polyglot/src/index.ts @@ -41,7 +41,7 @@ export default ( return { translate: (key: string, options: any = {}) => translate(key, options), changeLocale: (newLocale: string) => - new Promise(resolve => + new Promise(resolve => // so we systematically return a Promise for the messages // i18nProvider may return a Promise for language changes, resolve(getMessages(newLocale as string)) diff --git a/packages/ra-i18n-polyglot/tsconfig.esm.json b/packages/ra-i18n-polyglot/tsconfig.esm.json new file mode 100644 index 00000000000..41685dd2632 --- /dev/null +++ b/packages/ra-i18n-polyglot/tsconfig.esm.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-i18n-polyglot/tsconfig.json b/packages/ra-i18n-polyglot/tsconfig.json index 8be9b276492..58d0e94a9c2 100644 --- a/packages/ra-i18n-polyglot/tsconfig.json +++ b/packages/ra-i18n-polyglot/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" } + ] } diff --git a/packages/ra-input-rich-text/package.json b/packages/ra-input-rich-text/package.json index bb232ce8655..9c70e17872f 100644 --- a/packages/ra-input-rich-text/package.json +++ b/packages/ra-input-rich-text/package.json @@ -41,6 +41,7 @@ }, "peerDependencies": { "ra-core": "^3.0.0-alpha.0", + "ra-ui-materialui": "^3.0.0-alpha.0", "react": "^16.9.0", "react-dom": "^16.9.0" }, diff --git a/packages/ra-input-rich-text/tsconfig.esm.json b/packages/ra-input-rich-text/tsconfig.esm.json new file mode 100644 index 00000000000..ef81d3759a6 --- /dev/null +++ b/packages/ra-input-rich-text/tsconfig.esm.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + { "path": "../ra-ui-materialui/" } + ] +} diff --git a/packages/ra-input-rich-text/tsconfig.json b/packages/ra-input-rich-text/tsconfig.json index 8be9b276492..40a95bcba57 100644 --- a/packages/ra-input-rich-text/tsconfig.json +++ b/packages/ra-input-rich-text/tsconfig.json @@ -1,9 +1,15 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + { "path": "../ra-ui-materialui/tsconfig.json" } + ] } diff --git a/packages/ra-realtime/tsconfig.esm.json b/packages/ra-realtime/tsconfig.esm.json new file mode 100644 index 00000000000..2e6e9d29424 --- /dev/null +++ b/packages/ra-realtime/tsconfig.esm.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + { "path": "../react-admin/" } + ] +} diff --git a/packages/ra-realtime/tsconfig.json b/packages/ra-realtime/tsconfig.json index 8be9b276492..d8ff177e2ee 100644 --- a/packages/ra-realtime/tsconfig.json +++ b/packages/ra-realtime/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + { "path": "../react-admin/tsconfig.json" } + ] } diff --git a/packages/ra-tree-core/tsconfig.esm.json b/packages/ra-tree-core/tsconfig.esm.json new file mode 100644 index 00000000000..67e71c99dac --- /dev/null +++ b/packages/ra-tree-core/tsconfig.esm.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"] +} diff --git a/packages/ra-tree-core/tsconfig.json b/packages/ra-tree-core/tsconfig.json index 8be9b276492..67228298bea 100644 --- a/packages/ra-tree-core/tsconfig.json +++ b/packages/ra-tree-core/tsconfig.json @@ -1,8 +1,10 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], "include": ["src"] diff --git a/packages/ra-tree-ui-materialui/tsconfig.esm.json b/packages/ra-tree-ui-materialui/tsconfig.esm.json new file mode 100644 index 00000000000..0c9dc83b10b --- /dev/null +++ b/packages/ra-tree-ui-materialui/tsconfig.esm.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + { "path": "../ra-tree-core/" }, + { "path": "../ra-ui-materialui/" } + ] +} diff --git a/packages/ra-tree-ui-materialui/tsconfig.json b/packages/ra-tree-ui-materialui/tsconfig.json index 8be9b276492..dec72157cc5 100644 --- a/packages/ra-tree-ui-materialui/tsconfig.json +++ b/packages/ra-tree-ui-materialui/tsconfig.json @@ -1,9 +1,16 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "checkJs": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + { "path": "../ra-tree-core/tsconfig.json" }, + { "path": "../ra-ui-materialui/tsconfig.json" } + ] } diff --git a/packages/ra-ui-materialui/package.json b/packages/ra-ui-materialui/package.json index ac0e1972c5c..e02ccccc9be 100644 --- a/packages/ra-ui-materialui/package.json +++ b/packages/ra-ui-materialui/package.json @@ -8,7 +8,7 @@ "esm", "src" ], - "main": "lib/index", + "main": "lib/index.js", "module": "esm/index.js", "sideEffects": false, "authors": [ diff --git a/packages/ra-ui-materialui/src/auth/Login.tsx b/packages/ra-ui-materialui/src/auth/Login.tsx index 6c15ba07214..8ed59d703a2 100644 --- a/packages/ra-ui-materialui/src/auth/Login.tsx +++ b/packages/ra-ui-materialui/src/auth/Login.tsx @@ -23,7 +23,7 @@ import defaultTheme from '../defaultTheme'; import Notification from '../layout/Notification'; import DefaultLoginForm from './LoginForm'; -interface Props { +export interface Props { backgroundImage?: string; children: ReactNode; staticContext?: StaticContext; diff --git a/packages/ra-ui-materialui/src/auth/LoginForm.tsx b/packages/ra-ui-materialui/src/auth/LoginForm.tsx index f9a24e8eb58..c1a6fc2bbba 100644 --- a/packages/ra-ui-materialui/src/auth/LoginForm.tsx +++ b/packages/ra-ui-materialui/src/auth/LoginForm.tsx @@ -8,7 +8,7 @@ import CircularProgress from '@material-ui/core/CircularProgress'; import { makeStyles, Theme } from '@material-ui/core/styles'; import { useTranslate, useLogin, useNotify, useSafeSetState } from 'ra-core'; -interface Props { +export interface Props { redirectTo?: string; } diff --git a/packages/ra-ui-materialui/src/auth/Logout.tsx b/packages/ra-ui-materialui/src/auth/Logout.tsx index e0a4b3495ad..b7a15235e45 100644 --- a/packages/ra-ui-materialui/src/auth/Logout.tsx +++ b/packages/ra-ui-materialui/src/auth/Logout.tsx @@ -8,7 +8,7 @@ import ExitIcon from '@material-ui/icons/PowerSettingsNew'; import classnames from 'classnames'; import { useTranslate, useLogout } from 'ra-core'; -interface Props { +export interface Props { className?: string; redirectTo?: string; } diff --git a/packages/ra-ui-materialui/src/button/ExportButton.tsx b/packages/ra-ui-materialui/src/button/ExportButton.tsx index 23b10073a34..a9597691ff0 100644 --- a/packages/ra-ui-materialui/src/button/ExportButton.tsx +++ b/packages/ra-ui-materialui/src/button/ExportButton.tsx @@ -71,7 +71,7 @@ const fetchRelatedRecords = dataProvider => (data, field, resource) => const DefaultIcon = ; const defaultFilter = {}; -interface Props { +export interface Props { exporter?: ( data: any, fetchRelatedRecords: ( diff --git a/packages/ra-ui-materialui/src/field/BooleanField.tsx b/packages/ra-ui-materialui/src/field/BooleanField.tsx index d996d475616..9793a8f9644 100644 --- a/packages/ra-ui-materialui/src/field/BooleanField.tsx +++ b/packages/ra-ui-materialui/src/field/BooleanField.tsx @@ -32,7 +32,7 @@ const useStyles = makeStyles({ }, }); -interface Props extends FieldProps { +export interface Props extends FieldProps { valueLabelTrue?: string; valueLabelFalse?: string; } diff --git a/packages/ra-ui-materialui/src/field/DateField.tsx b/packages/ra-ui-materialui/src/field/DateField.tsx index 2bdfed7ae2c..1ec84492d01 100644 --- a/packages/ra-ui-materialui/src/field/DateField.tsx +++ b/packages/ra-ui-materialui/src/field/DateField.tsx @@ -17,7 +17,7 @@ const toLocaleStringSupportsLocales = (() => { return false; })(); -interface Props extends FieldProps { +export interface Props extends FieldProps { locales?: string | string[]; options?: object; showTime?: boolean; diff --git a/packages/ra-ui-materialui/src/field/FileField.tsx b/packages/ra-ui-materialui/src/field/FileField.tsx index f73811d6559..bb1786c5850 100644 --- a/packages/ra-ui-materialui/src/field/FileField.tsx +++ b/packages/ra-ui-materialui/src/field/FileField.tsx @@ -11,7 +11,7 @@ const useStyles = makeStyles({ root: { display: 'inline-block' }, }); -interface Props extends FieldProps { +export interface Props extends FieldProps { src?: string; title?: string; target?: string; diff --git a/packages/ra-ui-materialui/src/field/FunctionField.tsx b/packages/ra-ui-materialui/src/field/FunctionField.tsx index b947be88a4f..4306cf21077 100644 --- a/packages/ra-ui-materialui/src/field/FunctionField.tsx +++ b/packages/ra-ui-materialui/src/field/FunctionField.tsx @@ -5,7 +5,7 @@ import Typography, { TypographyProps } from '@material-ui/core/Typography'; import sanitizeRestProps from './sanitizeRestProps'; import { FieldProps, InjectedFieldProps, fieldPropTypes } from './types'; -interface Props extends FieldProps { +export interface Props extends FieldProps { render: (record: object, source: string) => any; } diff --git a/packages/ra-ui-materialui/src/field/ImageField.tsx b/packages/ra-ui-materialui/src/field/ImageField.tsx index 158f7cb686f..be7a68f8cc9 100644 --- a/packages/ra-ui-materialui/src/field/ImageField.tsx +++ b/packages/ra-ui-materialui/src/field/ImageField.tsx @@ -18,7 +18,7 @@ const useStyles = makeStyles({ }, }); -interface Props extends FieldProps { +export interface Props extends FieldProps { src?: string; title?: string; classes?: object; diff --git a/packages/ra-ui-materialui/src/field/NumberField.tsx b/packages/ra-ui-materialui/src/field/NumberField.tsx index 9987bd221a1..4bf6f4775f0 100644 --- a/packages/ra-ui-materialui/src/field/NumberField.tsx +++ b/packages/ra-ui-materialui/src/field/NumberField.tsx @@ -13,7 +13,7 @@ const hasNumberFormat = !!( typeof Intl.NumberFormat === 'function' ); -interface Props extends FieldProps { +export interface Props extends FieldProps { locales?: string | string[]; options?: object; } diff --git a/packages/ra-ui-materialui/src/field/RichTextField.tsx b/packages/ra-ui-materialui/src/field/RichTextField.tsx index 243d2897d05..d87a9582841 100644 --- a/packages/ra-ui-materialui/src/field/RichTextField.tsx +++ b/packages/ra-ui-materialui/src/field/RichTextField.tsx @@ -9,7 +9,7 @@ import { InjectedFieldProps, FieldProps, fieldPropTypes } from './types'; export const removeTags = (input: string) => input ? input.replace(/<[^>]+>/gm, '') : ''; -interface Props extends FieldProps { +export interface Props extends FieldProps { stripTags: boolean; } diff --git a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx index c3aee93ebd2..6d1ef57173c 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.tsx @@ -111,9 +111,9 @@ const AutocompleteArrayInput: FunctionComponent< onChange, onFocus, options: { - suggestionsContainerProps, - labelProps, - InputProps, + suggestionsContainerProps = undefined, + labelProps = undefined, + InputProps = undefined, ...options } = {}, optionText = 'name', diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index 4a0efea537e..49169cb4c52 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -111,9 +111,9 @@ const AutocompleteInput: FunctionComponent< onChange, onFocus, options: { - suggestionsContainerProps, - labelProps, - InputProps, + suggestionsContainerProps = undefined, + labelProps = undefined, + InputProps = undefined, ...options } = {}, optionText = 'name', diff --git a/packages/ra-ui-materialui/src/input/AutocompleteSuggestionItem.tsx b/packages/ra-ui-materialui/src/input/AutocompleteSuggestionItem.tsx index 2e2280f322a..7a3775c63a5 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteSuggestionItem.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteSuggestionItem.tsx @@ -20,7 +20,7 @@ const useStyles = makeStyles(theme => ({ highlightedSuggestionText: { fontWeight: 500 }, })); -interface Props { +export interface Props { suggestion: any; index: number; highlightedIndex: number; diff --git a/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx b/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx index b20c40ff868..7d774bbfed4 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteSuggestionList.tsx @@ -11,7 +11,7 @@ const useStyles = makeStyles({ }, }); -interface Props { +export interface Props { children: ReactNode; isOpen: boolean; menuProps: any; diff --git a/packages/ra-ui-materialui/src/input/FileInputPreview.tsx b/packages/ra-ui-materialui/src/input/FileInputPreview.tsx index 04b856c2b0a..3b590c7c650 100644 --- a/packages/ra-ui-materialui/src/input/FileInputPreview.tsx +++ b/packages/ra-ui-materialui/src/input/FileInputPreview.tsx @@ -12,7 +12,7 @@ const useStyles = makeStyles(theme => ({ }, })); -interface Props { +export interface Props { children: ReactNode; className?: string; onRemove: () => void; diff --git a/packages/ra-ui-materialui/src/input/InputHelperText.tsx b/packages/ra-ui-materialui/src/input/InputHelperText.tsx index 97598e8f847..885ce6901cc 100644 --- a/packages/ra-ui-materialui/src/input/InputHelperText.tsx +++ b/packages/ra-ui-materialui/src/input/InputHelperText.tsx @@ -1,7 +1,7 @@ import React, { FunctionComponent } from 'react'; import { useTranslate, ValidationError, ValidationErrorMessage } from 'ra-core'; -interface Props { +export interface Props { helperText?: string; error?: ValidationErrorMessage; touched: boolean; diff --git a/packages/ra-ui-materialui/src/input/Labeled.tsx b/packages/ra-ui-materialui/src/input/Labeled.tsx index 1e0f64837e3..7eec78a572b 100644 --- a/packages/ra-ui-materialui/src/input/Labeled.tsx +++ b/packages/ra-ui-materialui/src/input/Labeled.tsx @@ -23,7 +23,7 @@ const useStyles = makeStyles(theme => ({ }, })); -interface Props { +export interface Props { children: ReactElement; className?: string; classes?: object; diff --git a/packages/ra-ui-materialui/src/input/NumberInput.tsx b/packages/ra-ui-materialui/src/input/NumberInput.tsx index ffc3f5cf260..f88a2d583d0 100644 --- a/packages/ra-ui-materialui/src/input/NumberInput.tsx +++ b/packages/ra-ui-materialui/src/input/NumberInput.tsx @@ -12,7 +12,7 @@ const convertStringToNumber = value => { return isNaN(float) ? null : float; }; -interface Props { +export interface Props { step?: string | number; } diff --git a/packages/ra-ui-materialui/src/input/ReferenceInput.tsx b/packages/ra-ui-materialui/src/input/ReferenceInput.tsx index e1789dad115..bffd4500fee 100644 --- a/packages/ra-ui-materialui/src/input/ReferenceInput.tsx +++ b/packages/ra-ui-materialui/src/input/ReferenceInput.tsx @@ -18,7 +18,7 @@ import LinearProgress from '../layout/LinearProgress'; import Labeled from './Labeled'; import ReferenceError from './ReferenceError'; -interface Props { +export interface Props { allowEmpty: boolean; basePath: string; children: ReactElement; diff --git a/packages/ra-ui-materialui/src/layout/HideOnScroll.tsx b/packages/ra-ui-materialui/src/layout/HideOnScroll.tsx index 9ae4c821977..7b088fc07dd 100644 --- a/packages/ra-ui-materialui/src/layout/HideOnScroll.tsx +++ b/packages/ra-ui-materialui/src/layout/HideOnScroll.tsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import useScrollTrigger from '@material-ui/core/useScrollTrigger'; import Slide from '@material-ui/core/Slide'; -interface Props { +export interface Props { children: React.ReactElement; } diff --git a/packages/ra-ui-materialui/src/layout/Loading.js b/packages/ra-ui-materialui/src/layout/Loading.js index a00016fea4b..36c77f087f6 100644 --- a/packages/ra-ui-materialui/src/layout/Loading.js +++ b/packages/ra-ui-materialui/src/layout/Loading.js @@ -30,6 +30,9 @@ const useStyles = makeStyles(theme => ({ }, })); +/** + * @type {React.FunctionComponent} + */ const Loading = ({ classes: classesOverride, className, @@ -38,7 +41,7 @@ const Loading = ({ }) => { const classes = useStyles({ classes: classesOverride }); const translate = useTranslate(); - return ( + return ((
@@ -46,7 +49,7 @@ const Loading = ({
{translate(loadingSecondary)}.
- ); + )); }; Loading.propTypes = { diff --git a/packages/ra-ui-materialui/src/layout/Notification.tsx b/packages/ra-ui-materialui/src/layout/Notification.tsx index 5c81379a2d8..15b5bba058d 100644 --- a/packages/ra-ui-materialui/src/layout/Notification.tsx +++ b/packages/ra-ui-materialui/src/layout/Notification.tsx @@ -15,7 +15,7 @@ import { useTranslate, } from 'ra-core'; -interface Props { +export interface Props { type?: string; } @@ -37,7 +37,7 @@ const Notification: React.FunctionComponent< Props & Omit > = ({ type, className, autoHideDuration, ...rest }) => { const [open, setOpen] = useState(false); - const notification = useSelector(getNotification); + const notification = useSelector(getNotification); const dispatch = useDispatch(); const translate = useTranslate(); const styles = useStyles({}); diff --git a/packages/ra-ui-materialui/src/list/List.js b/packages/ra-ui-materialui/src/list/List.js index f3c3dee5442..34355344687 100644 --- a/packages/ra-ui-materialui/src/list/List.js +++ b/packages/ra-ui-materialui/src/list/List.js @@ -168,6 +168,9 @@ export const ListView = props => { ); }; +/** + * @type {import("react").WeakValidationMap} + */ ListView.propTypes = { actions: PropTypes.element, aside: PropTypes.element, diff --git a/packages/ra-ui-materialui/tsconfig.esm.json b/packages/ra-ui-materialui/tsconfig.esm.json new file mode 100644 index 00000000000..384eb5a9f7e --- /dev/null +++ b/packages/ra-ui-materialui/tsconfig.esm.json @@ -0,0 +1,14 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo", + "checkJs": false + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-core/" }, + ] +} diff --git a/packages/ra-ui-materialui/tsconfig.json b/packages/ra-ui-materialui/tsconfig.json index 8be9b276492..fac48726608 100644 --- a/packages/ra-ui-materialui/tsconfig.json +++ b/packages/ra-ui-materialui/tsconfig.json @@ -1,9 +1,16 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src" + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/tsbuildinfo", + "checkJs": false, + "strict": false, + "noImplicitAny": false }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/packages/react-admin/src/Admin.ts b/packages/react-admin/src/Admin.ts index ae5bf7b6b2b..177170dd24f 100644 --- a/packages/react-admin/src/Admin.ts +++ b/packages/react-admin/src/Admin.ts @@ -1,4 +1,4 @@ -import { CoreAdmin } from 'ra-core'; +import { CoreAdmin, LoginComponent } from 'ra-core'; import { Layout as DefaultLayout, Loading, @@ -16,7 +16,7 @@ Admin.defaultProps = { layout: DefaultLayout, catchAll: NotFound, loading: Loading, - loginPage: Login, + loginPage: Login as LoginComponent, logoutButton: Logout, }; diff --git a/packages/react-admin/src/index.ts b/packages/react-admin/src/index.ts index d830f9e9ecb..c54d749d9fd 100644 --- a/packages/react-admin/src/index.ts +++ b/packages/react-admin/src/index.ts @@ -1,7 +1,9 @@ -import Admin from './Admin'; -import AdminRouter from './AdminRouter'; -import defaultI18nProvider from './defaultI18nProvider'; +import { default as defaultI18nProvider } from './defaultI18nProvider'; +export { default as Admin } from './Admin'; +export { default as AdminRouter } from './AdminRouter'; export * from 'ra-core'; export * from 'ra-ui-materialui'; -export { Admin, AdminRouter, defaultI18nProvider }; + +// resolve the ambiguity +export { Notification, Pagination } from 'ra-ui-materialui'; diff --git a/packages/react-admin/tsconfig.esm.json b/packages/react-admin/tsconfig.esm.json new file mode 100644 index 00000000000..e98b7a28daf --- /dev/null +++ b/packages/react-admin/tsconfig.esm.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.esm.json", + "compilerOptions": { + "outDir": "./esm", + "rootDir": "./src", + "tsBuildInfoFile": "./esm/.tsbuildinfo" + }, + "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], + "include": ["src"], + "references": [ + { "path": "../ra-ui-materialui/" }, + { "path": "../ra-i18n-polyglot/" }, + { "path": "../ra-core/" }, + ] +} diff --git a/packages/react-admin/tsconfig.json b/packages/react-admin/tsconfig.json index 931a075be28..205a08a3d5e 100644 --- a/packages/react-admin/tsconfig.json +++ b/packages/react-admin/tsconfig.json @@ -1,11 +1,15 @@ { - "extends": "../../tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "lib", - "rootDir": "src", - "declaration": false, - "allowJs": false + "outDir": "./lib", + "rootDir": "./src", + "tsBuildInfoFile": "./lib/.tsbuildinfo" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js"], - "include": ["src"] + "include": ["src"], + "references": [ + { "path": "../ra-ui-materialui/tsconfig.json" }, + { "path": "../ra-i18n-polyglot/tsconfig.json" }, + { "path": "../ra-core/tsconfig.json" }, + ] } diff --git a/tsconfig.base.esm.json b/tsconfig.base.esm.json new file mode 100644 index 00000000000..d5b99a6404a --- /dev/null +++ b/tsconfig.base.esm.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "module": "es2015" + } +} \ No newline at end of file diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000000..5217d7b7c98 --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "ES5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "lib": [ + "es2017", + "dom" + ] /* 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", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "composite": true, /* Enable project compilation */ + "isolatedModules": false, + "incremental": true, + // "strict": true, + "tsBuildInfoFile": "./base.tsBuildInfoFile", + "noImplicitAny": false, + "moduleResolution": "node", + "types": ["node", "jest"], + "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + "skipLibCheck": true, + "noEmitHelpers": false, + "noEmitOnError": false + } +} \ No newline at end of file diff --git a/tsconfig.build-all.all.json b/tsconfig.build-all.all.json new file mode 100644 index 00000000000..4be86d5199e --- /dev/null +++ b/tsconfig.build-all.all.json @@ -0,0 +1,11 @@ +{ + "references": [ + { + "path": "./tsconfig.build-all.cjs.json" + }, + { + "path": "./tsconfig.build-all.esm.json" + } + ], + "include": [] +} \ No newline at end of file diff --git a/tsconfig.build-all.cjs.json b/tsconfig.build-all.cjs.json new file mode 100644 index 00000000000..bd94354e93e --- /dev/null +++ b/tsconfig.build-all.cjs.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "outDir": "lib-top-level" + }, + "references": [ + { "path": "packages/ra-data-graphcool" }, + { "path": "packages/ra-i18n-polyglot" }, + { "path": "packages/ra-ui-materialui" }, + { "path": "packages/ra-core" }, + { "path": "packages/react-admin" }, + { "path": "packages/ra-data-fakerest" }, + { "path": "packages/ra-data-graphql" }, + { "path": "packages/ra-data-graphql-simple" }, + { "path": "packages/ra-data-json-server" }, + { "path": "packages/ra-data-simple-rest" }, + { "path": "packages/ra-input-rich-text" }, + { "path": "packages/ra-realtime" }, + { "path": "packages/ra-tree-core" }, + { "path": "packages/ra-tree-ui-materialui" } + ], + "include": [] +} diff --git a/tsconfig.build-all.esm.json b/tsconfig.build-all.esm.json new file mode 100644 index 00000000000..a9c80fbcc03 --- /dev/null +++ b/tsconfig.build-all.esm.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "outDir": "lib-composite" + }, + "references": [ + { "path": "packages/ra-core/tsconfig.esm.json" }, + { "path": "packages/ra-data-fakerest/tsconfig.esm.json" }, + { "path": "packages/ra-data-graphcool/tsconfig.esm.json" }, + { "path": "packages/ra-data-graphql/tsconfig.esm.json" }, + { "path": "packages/ra-data-graphql-simple/tsconfig.esm.json" }, + { "path": "packages/ra-data-json-server/tsconfig.esm.json" }, + { "path": "packages/ra-data-simple-rest/tsconfig.esm.json" }, + { "path": "packages/ra-i18n-polyglot/tsconfig.esm.json" }, + { "path": "packages/ra-input-rich-text/tsconfig.esm.json" }, + // { "path": "packages/ra-language-english/tsconfig.esm.json" }, + // { "path": "packages/ra-language-french/tsconfig.esm.json" }, + { "path": "packages/ra-realtime/tsconfig.esm.json" }, + { "path": "packages/ra-tree-core/tsconfig.esm.json" }, + // { "path": "packages/ra-tree-language-english/tsconfig.esm.json" }, + // { "path": "packages/ra-tree-language-french/tsconfig.esm.json" }, + { "path": "packages/ra-tree-ui-materialui/tsconfig.esm.json" }, + { "path": "packages/ra-ui-materialui/tsconfig.esm.json" }, + { "path": "packages/react-admin/tsconfig.esm.json" } + ], + "include": [] +} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 7b6a1529e0a..00000000000 --- a/tsconfig.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - "target": - "ES5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, - "module": - "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - "lib": [ - "es2017", - "dom" - ] /* 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. */, - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./lib", /* 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 */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "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'). */ - - /* Strict Type-Checking Options */ - // "strict": true /* Enable all strict type-checking options. */, - "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - "moduleResolution": - "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - "skipLibCheck": true - } - // "references": [ - // { "path": "./packages/ra-core" }, - // { "path": "./packages/ra-data-fakerest" }, - // { "path": "./packages/ra-data-graphcool" }, - // { "path": "./packages/ra-data-graphql" }, - // { "path": "./packages/ra-data-graphql-simple" }, - // { "path": "./packages/ra-data-json-server" }, - // { "path": "./packages/ra-data-simple-rest" }, - // { "path": "./packages/ra-input-rich-text" }, - // { "path": "./packages/ra-realtime" }, - // { "path": "./packages/ra-tree-core" }, - // { "path": "./packages/ra-tree-ui-materialui" }, - // { "path": "./packages/ra-ui-materialui" }, - // { "path": "./packages/react-admin" } - // ] -} diff --git a/yarn.lock b/yarn.lock index c583ef929ea..a5c8bfcd9b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14991,10 +14991,10 @@ typescript-tuple@^2.1.0: dependencies: typescript-compare "^0.0.2" -typescript@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@^3.7.0-dev.20191011: + version "3.7.0-dev.20191011" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.0-dev.20191011.tgz#cf75edcc5d3feab16fa312e62edb2ba8e821d412" + integrity sha512-p/dukMW4mAF0EUuYBDPvO8/uxWYIh4r5Gh4IFtBLsrKmneeVkhlzWB7M3/5kZ0ucWC0BmFxA/6g6We61o2+yfw== ua-parser-js@^0.7.18: version "0.7.20"