From 9bdcf3ae8880869965b00f87b5afff68d827da01 Mon Sep 17 00:00:00 2001 From: Jean-Michel FRANCOIS Date: Tue, 28 Nov 2023 10:34:04 +0100 Subject: [PATCH] doc: update all documentation (#4869) --- fork/module-to-cdn/README.md | 78 ++++++++++++++----------- fork/module-to-cdn/jsonschema.json | 34 +++++++++++ tools/babel-plugin-assets-api/README.md | 2 + tools/eslint-plugin/README.md | 23 +++----- tools/scripts-cmf/README.md | 10 ++-- tools/scripts-config-babel/README.md | 4 +- 6 files changed, 96 insertions(+), 55 deletions(-) create mode 100644 fork/module-to-cdn/jsonschema.json diff --git a/fork/module-to-cdn/README.md b/fork/module-to-cdn/README.md index 617044f8732..32d5e511d17 100644 --- a/fork/module-to-cdn/README.md +++ b/fork/module-to-cdn/README.md @@ -1,30 +1,14 @@ # @talend/module-to-cdn -[![Build Status](https://travis-ci.org/toutpt/module-to-cdn.svg?branch=jmfrancois/chore/fork)](https://travis-ci.org/toutpt/module-to-cdn) -[![NPM][npm-icon] ][npm-url] -[![dependencies][dependencies-image] ][dependencies-url] -[![devdependencies][devdependencies-image] ][devdependencies-url] - -[npm-icon]: https://img.shields.io/npm/v/@talend/module-to-cdn.svg -[npm-url]: https://npmjs.org/package/@talend/module-to-cdn -[travis-ci-image]: https://travis-ci.org/toutpt/module-to-cdn.svg?branch=jmfrancois/chore/fork -[travis-ci-url]: https://travis-ci.org/toutpt/module-to-cdn -[dependencies-image]: https://david-dm.org/toutpt/module-to-cdn/status.svg -[dependencies-url]: https://david-dm.org/toutpt/module-to-cdn -[devdependencies-image]: https://david-dm.org/toutpt/module-to-cdn/dev-status.svg -[devdependencies-url]: https://david-dm.org/toutpt/module-to-cdn?type=dev - - > Get cdn config from npm module name ## Fork This module is fork of module-to-cdn from [Thomas Sileghem](http://mastilver.com). -Because unpkg is great for free usage [but not for production usage](https://kentcdodds.com/blog/unpkg-an-open-source-cdn-for-npm) we decided to made some changes to go forward. - -After the following [big PR]() on the repository and an email to the author we have got no news from the author as all other PRs. So we decided to fork. +Because unpkg is great for free usage [but not for production usage](https://kentcdodds.com/blog/unpkg-an-open-source-cdn-for-npm) we decided to made some changes to going forward. +After big PR on the repository and an email to the author we have got no news as all other PRs. So we decided to fork. ## Install @@ -32,7 +16,6 @@ After the following [big PR]() on the repository and an email to the author we $ npm install --save @talend/module-to-cdn ``` - ## Usage ```js @@ -50,6 +33,7 @@ moduleToCdn('react', '15.3.0'); */ ``` +Note if the package comes with css you will have them under `styleUrl` and `stylePath` properties ## API @@ -79,12 +63,12 @@ Default: `development` ### Result -* `name`: name of the module -* `var`: name of the global variable exposing the module -* `url`: url where the module is available -* `version`: the version asked for -* `path`: relative path of the umd file in the distributed package -* `local`: absolute path on the current system to the file +- `name`: name of the module +- `var`: name of the global variable exposing the module +- `url`: url where the module is available +- `version`: the version asked for +- `path`: relative path of the umd file in the distributed package +- `local`: absolute path on the current system to the file ## Configuration of the resolver @@ -118,9 +102,9 @@ moduleToCdn.add({ '@talend/my-private-module': { var: 'TalendMyPrivateModule', versions: { - '>= 0.0.0' : { - 'development': '/dist/build.js', - 'production': '/dist/build.min.js', + '>= 0.0.0': { + development: '/dist/build.js', + production: '/dist/build.min.js' } } } @@ -141,17 +125,45 @@ LIMIT=";ag-grid;ag-grid-community;ag-grid-enterprise;" ava -v ## Excluded modules +- hoist-non-react-statics: the umd build contains JS errors (process.env.NODE and require) on every versions. + +## style-versions -* hoist-non-react-statics: the umd build contains JS errors (process.env.NODE and require) on every versions. +For the sake of simplicity, range must match between js and styles. +Here is the line in the code that read it: + +```javascript +const styleConfig = moduleConf['style-versions'] && moduleConf['style-versions'][range]; +``` + +So take it as a constraint, for example: + +```json + "@talend/design-tokens": { + "var": "TalendDesignTokens", + "versions": { + "> 2.6.0": { + "development": "/dist/TalendDesignTokens.js", + "production": "/dist/TalendDesignTokens.min.js" + } + }, + "style-versions": { + "> 2.6.0": { + "development": "/dist/TalendDesignTokens.css", + "production": "/dist/TalendDesignTokens.min.css" + } + } + } +``` ## Contribute To add your modules you have to -* checkout this package on github -* install and run the tests (it will load the cache for the tests) -* add your module in the module.json file -* ensure everytime the provided umd path exists and is valid. +- checkout this package on github +- install and run the tests (it will load the cache for the tests) +- add your module in the module.json file +- ensure everytime the provided umd path exists and is valid. Example of not valid umd: https://unpkg.com/browse/react-popper@1.3.7/dist/index.umd.js createContext,deepEqual dependencies are always null. diff --git a/fork/module-to-cdn/jsonschema.json b/fork/module-to-cdn/jsonschema.json new file mode 100644 index 00000000000..9fe15150035 --- /dev/null +++ b/fork/module-to-cdn/jsonschema.json @@ -0,0 +1,34 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/Talend/ui/modules.schema.json", + "title": "cdn modules schema", + "description": "Help you edit the file in vscode", + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + + "properties": { + "var": { + "type": "string" + }, + "versions": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "development": { + "type": "string" + }, + "production": { + "type": "string" + } + } + } + } + } + } + } + } +} diff --git a/tools/babel-plugin-assets-api/README.md b/tools/babel-plugin-assets-api/README.md index 37d3eb90445..5bd1d83297f 100644 --- a/tools/babel-plugin-assets-api/README.md +++ b/tools/babel-plugin-assets-api/README.md @@ -23,3 +23,5 @@ assetsAPI.getURL('/', 'react', '16.14.0'); assetsAPI.getJSON('/foo.json', 'react', '16.14.0'); assetsAPI.getUMD('react', '16.14.0', 'React', '/umd/react.production.min.js'); ``` + +As you can see it uses production path in the getUMD. diff --git a/tools/eslint-plugin/README.md b/tools/eslint-plugin/README.md index d57b8ec30e5..550a33ec0a3 100644 --- a/tools/eslint-plugin/README.md +++ b/tools/eslint-plugin/README.md @@ -4,8 +4,7 @@ This package contains internal rules used at Talend. ## Installation -You have nothing to do if you use Talend/ui-scripts. - +You have nothing to do if you use Talend/ui-scripts. If not this can be used as any other eslint plugin ## Usage @@ -13,29 +12,21 @@ Add `talend` to the plugins section of your `.eslintrc` configuration file. You ```json { - "plugins": [ - "@talend" - ] + "plugins": ["@talend"] } ``` - Then configure the rules you want to use under the rules section. ```json { - "rules": { - "@talend/import-depth": 2 - } + "rules": { + "@talend/import-depth": 2 + } } ``` ## Supported Rules -* [talend/import-depth](./docs/rules/talend-import-depth.md) -* [talend/import-d3](./docs/rules/talend-import-d3.md) - - - - - +- [talend/import-depth](./docs/rules/talend-import-depth.md) +- [talend/import-d3](./docs/rules/talend-import-d3.md) diff --git a/tools/scripts-cmf/README.md b/tools/scripts-cmf/README.md index 81f133ccf68..c133710d85a 100644 --- a/tools/scripts-cmf/README.md +++ b/tools/scripts-cmf/README.md @@ -2,15 +2,15 @@ ## Usage -launch the command below to build your webapp. you can add it into `prepublish` npm script. - ``` -yarn cmf-settings +npx @talend/scripts-cmf ``` -Note: If you add `node_modules/.bin` into your env _PATH_ you can directly type `cmf-settings`. +You can also launch the command below to build your webapp. you can add it into `prepublish` npm script. -## cmf-settings +``` +yarn cmf-settings +``` This script merge a set of settings `sources` into a `destination` file. Each sources is a path to eiter a folder or a file. diff --git a/tools/scripts-config-babel/README.md b/tools/scripts-config-babel/README.md index 4ba4d886455..2e829428c59 100644 --- a/tools/scripts-config-babel/README.md +++ b/tools/scripts-config-babel/README.md @@ -1,4 +1,6 @@ -# Babel config customisation +This package contains the main babel configuration used everywhere else in Talend. + +## Babel config customisation You can use your own babelrc but it is not recommanded. To do so, you will need to extend the preset babelrc.