-
Notifications
You must be signed in to change notification settings - Fork 808
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
[added] Build step for compiling to CommonJS modules #417
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b513046
Move lib to src so we can use lib for build output
f74775f
Use ES module for top level export
90215c4
Remove unnecessary react-create-class dependency
3367687
Transform based on env
f4dae7e
Create es and commonjs separate build steps
2bf4f60
Update yarn.lock
bd7c0c8
Remove unnecessary comma
965a2c3
Additional changes to support move from src to lib
1374871
[fixed] use the correct babel presets combination.
diasbruno eab214c
[fixed] added rules to compile on Makefile.
diasbruno 2fc1382
[fixed] removing 'es' for now.
diasbruno a3e0332
Merge pull request #1 from diasbruno/fix/compilation
fuller d13e966
Address review comments
4351936
remove yarn.lock per comment
846e65b
Update eslint config so it should pass
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,3 +1,21 @@ | ||
{ | ||
"presets": ["es2015", "stage-2", "react"] | ||
"presets": ["react"], | ||
"env": { | ||
"commonjs": { | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
], | ||
"presets": ["env"] | ||
}, | ||
"es": { | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
], | ||
"presets": [ | ||
["env", { "modules": false }] | ||
] | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ engines: | |
javascript: | ||
ratings: | ||
paths: | ||
- lib/** | ||
- src/** | ||
- "**.js" | ||
exclude_paths: | ||
- "specs/" | ||
|
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 |
---|---|---|
|
@@ -8,3 +8,7 @@ _book | |
*.diff | ||
examples/__build__ | ||
coverage | ||
|
||
## Built folders | ||
es | ||
lib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
"version": "2.0.0", | ||
"description": "Accessible modal dialog component for React.JS", | ||
"main": "./lib/index.js", | ||
"module": "./es/index.js", | ||
"jsnext:main": "./es/index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/reactjs/react-modal.git" | ||
|
@@ -14,20 +16,26 @@ | |
}, | ||
"scripts": { | ||
"start": "./node_modules/.bin/webpack-dev-server --inline --host 127.0.0.1 --content-base examples/", | ||
"test": "cross-env NODE_ENV=test karma start", | ||
"lint": "eslint lib/" | ||
"test": "cross-env BABEL_ENV=commonjs NODE_ENV=test karma start", | ||
"lint": "eslint lib/", | ||
"clean": "rimraf lib es", | ||
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib", | ||
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es", | ||
"build": "npm run clean && npm run build:commonjs && npm run build:es" | ||
}, | ||
"authors": [ | ||
"Ryan Florence" | ||
], | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^6.7.4", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.25.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "^6.2.4", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-preset-env": "^1.5.2", | ||
"babel-preset-react": "^6.24.1", | ||
"codeclimate-test-reporter": "^0.4.0", | ||
"coveralls": "^2.13.1", | ||
"cross-env": "^5.0.1", | ||
|
@@ -55,14 +63,13 @@ | |
"react-addons-test-utils": "^15.0.0", | ||
"react-dom": "^15.0.0", | ||
"rf-release": "0.4.0", | ||
"rimraf": "^2.5.4", | ||
"rimraf": "^2.6.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"sinon": "next", | ||
"uglify-js": "2.4.24", | ||
"webpack": "^1.12.14", | ||
"webpack-dev-server": "1.11.0" | ||
}, | ||
"dependencies": { | ||
"create-react-class": "^15.5.2", | ||
"element-class": "^0.2.0", | ||
"exenv": "1.2.0", | ||
"lodash.assign": "^4.2.0", | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,3 @@ | ||
import Modal from './components/Modal'; | ||
|
||
export default Modal; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supposedly the env and non-env configs should merge, but I was seeing the below issue when I tried to consolidate. Any help is appreciated.
Tried this:
Got this:
![image](https://user-images.githubusercontent.com/2483304/27213064-184edac2-522a-11e7-8b1b-dd15d5219c41.png)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the old
.babelrc
to fixv2.0.0
. I think we need to uselatest
instead ofstage-2
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latest
isn't enough for this. 'stage-2` should work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually after some tests,
.babelrc
is working as expected, but themain
in package.json is pointing to the non-compiled version. Your change to compile fromsrc
tolib
should fix without to much change (I believe).