-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(options): add multiple openPage
support
#2266
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
Merged
alexander-akait
merged 7 commits into
webpack:master
from
signal-noise:feature/multiple-openpage
Oct 7, 2019
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
46aacfe
feat: allow multiple openPage options as array
aec9963
feat: added open-page-multiple example
c727994
test: moved to standard snapshots
df0384e
fix: runOpen - made warning output related url
b2907b8
fix: added quotes around path and browser
bfc661c
Merge branch 'master' into feature/multiple-openpage
1886814
Merge branch 'master' into feature/multiple-openpage
hiroppy 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 hidden or 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,15 @@ | ||
# CLI: Open Page Option (Multiple) | ||
|
||
```console | ||
npm run webpack-dev-server -- --open-page example1.html,example2.html | ||
``` | ||
|
||
Some applications may consist of multiple pages. During development it may | ||
be useful to directly open multiple pages at the same time. The pages to open | ||
may be specified as the argument to the `open-page` option. | ||
|
||
## What Should Happen | ||
|
||
The script should open `http://localhost:8080/example1.html` and | ||
`http://localhost:8080/example2.html` in your default browser. | ||
You should see the text on the page itself change to read `Success!`. |
This file contains hidden or 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,11 @@ | ||
'use strict'; | ||
|
||
const target = document.querySelector('#target'); | ||
|
||
if (window.location.href.endsWith('example1.html')) { | ||
target.classList.add('pass'); | ||
target.innerHTML = 'Success!'; | ||
} else { | ||
target.classList.add('fail'); | ||
target.innerHTML = 'Houston, we have a problem.'; | ||
} |
This file contains hidden or 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,11 @@ | ||
'use strict'; | ||
|
||
const target = document.querySelector('#target'); | ||
|
||
if (window.location.href.endsWith('example2.html')) { | ||
target.classList.add('pass'); | ||
target.innerHTML = 'Success!'; | ||
} else { | ||
target.classList.add('fail'); | ||
target.innerHTML = 'Houston, we have a problem.'; | ||
} |
This file contains hidden or 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,37 @@ | ||
'use strict'; | ||
|
||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
// our setup function adds behind-the-scenes bits to the config that all of our | ||
// examples need | ||
const { setup } = require('../../util'); | ||
|
||
module.exports = [ | ||
setup({ | ||
context: __dirname, | ||
entry: './app1.js', | ||
output: { | ||
filename: 'app1.js', | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: 'example1.html', | ||
template: '../../.assets/layout.html', | ||
title: 'Open Page (Multiple) / Example / Page 1', | ||
}), | ||
], | ||
}), | ||
setup({ | ||
context: __dirname, | ||
entry: './app2.js', | ||
output: { | ||
filename: 'app2.js', | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: 'example2.html', | ||
template: '../../.assets/layout.html', | ||
title: 'Open Page (Multiple) / Example / Page 2', | ||
}), | ||
], | ||
}), | ||
]; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,68 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`runOpen util on specify multiple absolute https URLs with pages in Google Chrome 1`] = ` | ||
Array [ | ||
"https://example2.com", | ||
Object { | ||
"app": "Google Chrome", | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util on specify multiple absolute https URLs with pages in Google Chrome 2`] = ` | ||
Array [ | ||
"https://example3.com", | ||
Object { | ||
"app": "Google Chrome", | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util on specify one relative URL and one absolute URL with pages in Google Chrome 1`] = ` | ||
Array [ | ||
"https://example.com/index.html", | ||
Object { | ||
"app": "Google Chrome", | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util on specify one relative URL and one absolute URL with pages in Google Chrome 2`] = ` | ||
Array [ | ||
"https://example2.com", | ||
Object { | ||
"app": "Google Chrome", | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util should open browser on specify URL with multiple pages inside array 1`] = ` | ||
Array [ | ||
"https://example.com/index.html", | ||
Object { | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util should open browser on specify URL with multiple pages inside array 2`] = ` | ||
Array [ | ||
"https://example.com/index2.html", | ||
Object { | ||
"wait": false, | ||
}, | ||
] | ||
`; | ||
|
||
exports[`runOpen util should open browser on specify URL with page inside array 1`] = ` | ||
Array [ | ||
"https://example.com/index.html", | ||
Object { | ||
"wait": false, | ||
}, | ||
] | ||
`; |
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.