-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
675 additions
and
402 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,21 @@ | ||
# @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 | ||
|
||
``` | ||
$ 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/[email protected]/dist/index.umd.js | ||
createContext,deepEqual dependencies are always null. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
/// <reference types="cypress" /> | ||
|
||
import '@testing-library/cypress/add-commands'; | ||
import { mount } from 'cypress/react'; | ||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount; | ||
} | ||
} | ||
} | ||
|
||
Cypress.Commands.add('mount', (component, options) => { | ||
const wrapper = component; | ||
return mount(wrapper, options); | ||
}); | ||
|
||
import '@testing-library/cypress/add-commands'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.