Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add routes to simplify cherry picking #343

Merged
merged 2 commits into from
Nov 17, 2018
Merged

Add routes to simplify cherry picking #343

merged 2 commits into from
Nov 17, 2018

Conversation

TrySound
Copy link
Contributor

@TrySound TrySound commented Nov 11, 2018

main and module allows us to provide an entry points for both
bundler and node. However this doesn't work with modules cherry picking.

In this diff I suggest to add package.json with main and module
fields to each module. This will allow to import this library like this

import { create } from 'gl-matrix/vec2';

The structure looks like this

README.md
LICENSE.md
cjs/*.js
esm/*.js
mat2/package.json
mat2d/package.json
mat3/package.json
mat4/package.json
quat/package.json
quat2/package.json
vec2/package.json
vec3/package.json
vec4/package.json
gl-matrix-min.js
gl-matrix.js

Each package.json looks like this

{
  "name": "gl-matrix/vec2",
  "main": "../cjs/vec2.js",
  "module": "../esm/vec2.js"
}

To prevent root folder pollution I made it private and copy necessary
files like package.json, README.md and LICENSE.md into dist
folder. To publish package you need to go first to dist folder.

`main` and `module` allows us to provide an entry points for both
bundler and node. However this doesn't work with modules cherry picking.

In this diff I suggest to add `package.json` with `main` and `module`
fields to each module. This will allow to import this library like this

```js
import { create } from 'gl-matrix/vec2';
```

The structure looks like this

```
README.md
LICENSE.md
cjs/*.js
esm/*.js
mat2/package.json
mat2d/package.json
mat3/package.json
mat4/package.json
quat/package.json
quat2/package.json
vec2/package.json
vec3/package.json
vec4/package.json
gl-matrix-min.js
gl-matrix.js
```

Each `package.json` looks like this

```json
{
  "name": "gl-matrix/vec2",
  "main": "../cjs/vec2.js",
  "module": "../esm/vec2.js"
}
```

To prevent root folder pollution I made it private and copy necessary
files like `package.json`, `README.md` and `LICENSE.md` into dist
folder. To publish package you need to go first to `dist` folder.
@TrySound
Copy link
Contributor Author

TrySound commented Nov 11, 2018

/cc @stefnotch

After this one I'm gonna send one last PR to improve umd bundles.

@andrevenancio
Copy link
Contributor

Seems to be taking shape nicely! Nice one!

@TrySound
Copy link
Contributor Author

@stefnotch Can this be merged?

@stefnotch
Copy link
Collaborator

Oh, sorry for the late response. Yes, this does look quite fine, so, I'm merging it.

@stefnotch stefnotch merged commit 0196ec3 into toji:master Nov 17, 2018
@TrySound TrySound deleted the router branch November 17, 2018 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants