From efbcab600428afa3918e0742210a025178a13777 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 22 Jun 2021 23:06:33 +0200 Subject: [PATCH] Update README.md Co-authored-by: Tim Schaub --- README.md | 8 ++++---- config/tsconfig-build.json | 4 ++-- package.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0fb09a4b85..88ce883b48 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ OpenLayers appreciates contributions of all kinds. We especially want to thank See our [GitHub sponsors page](https://github.com/sponsors/openlayers) or [Open Collective](https://opencollective.com/openlayers/contribute/sponsors-214/checkout) if you too are interested in becoming a regular sponsor. -## Building ES6 +## ES Modules -The `ol` package contains a `src/` folder with the sources, authored in ES6. To use these untranspiled sources, either import modules from `ol/src` instead of `ol`, or configure your bundler with an alias pointing to `ol/src` for the `ol` package. +The `ol` package contains a `src/` folder with the sources, authored as [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). To use these untranspiled sources, either import modules from `ol/src` instead of `ol`, or configure your bundler with an alias pointing to `ol/src` for the `ol` package. ## IntelliSense (VS Code) support -The untranspiled sources in the `src/` are JSDoc type annotated. For applications authored in JavaScript, VS Code can get type definitions from these sources with a properly configured `jsconfig.json` in the project root: +The untranspiled sources in the `src/` folder are JSDoc type annotated. For applications authored in JavaScript, VS Code can get type definitions from these sources with a properly configured `jsconfig.json` in the project root:
jsconfig.json @@ -103,7 +103,7 @@ When authoring in TypeScript, we recommend you try out the types that are includ } } ``` -These are auto-generated with the TypeScript compiler, and will be the default in future versions. Alternatively, you can use third-party types from [Definitely Typed](https://definitelytyped.org) (`npm install @types/ol`). +These are auto-generated with the TypeScript compiler, and will be the default in future versions. Alternatively, you can use third-party types from [Definitely Typed](https://definitelytyped.org) (`npm install @types/ol`) or from [hanreev/types-ol](https://github.com/hanreev/types-ol). ## Supported Browsers diff --git a/config/tsconfig-build.json b/config/tsconfig-build.json index f5a8720329..56de194321 100644 --- a/config/tsconfig-build.json +++ b/config/tsconfig-build.json @@ -7,8 +7,8 @@ "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. */ + // "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": "../build/ol", /* Redirect output structure to the directory. */ diff --git a/package.json b/package.json index 14aff3ba93..4b2d4a87f3 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,12 @@ "start": "npm run serve-examples", "serve-examples": "webpack serve --config examples/webpack/config.js --mode development", "build-examples": "webpack --config examples/webpack/config.js --mode production", - "build-package": "npm run transpile && npm run copy-css && npm run move-types && node tasks/prepare-package.js", + "build-package": "npm run transpile && npm run copy-css && npm run generate-types && node tasks/prepare-package.js", "build-index": "shx rm -f build/index.js && npm run build-package && node tasks/generate-index.js", "build-legacy": "shx rm -rf build/legacy && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css", "build-site": "npm run build-examples && npm run apidoc && mkdir -p build/site && cp site/index.html build/site && mv build/apidoc build/site/apidoc && mv build/examples build/site/examples", "copy-css": "shx cp src/ol/ol.css build/ol/ol.css", - "move-types": "shx rm -rf build/types && shx mkdir -p build/types && shx cp -Rf build/ol/* build/types/ && shx rm 'build/ol/**/*.d.ts*' && shx rm 'build/types/**/*.js*' && shx mv build/types build/ol/", + "generate-types": "tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol/types", "transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers.cjs && tsc --project config/tsconfig-build.json", "typecheck": "tsc --pretty", "apidoc-debug": "shx rm -rf build/apidoc && node --inspect-brk=9229 ./node_modules/jsdoc/jsdoc.js -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc",