This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support electron (sort of) and nightmare. fixes #179
- Loading branch information
1 parent
6e66c59
commit cd9601f
Showing
9 changed files
with
79 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
pkg: { | ||
patches: { | ||
'index.js': [ | ||
'path.join(__dirname, fs', | ||
'path.join(path.dirname(process.execPath), \'electron\', fs' | ||
] | ||
}, | ||
deployFiles: [ | ||
[ 'dist', 'electron/dist' ] | ||
] | ||
} | ||
}; |
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,4 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
}; |
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,18 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
pkg: { | ||
patches: { | ||
'lib/nightmare.js': [ | ||
'path.join(__dirname, \'runner.js\')', | ||
'path.join(path.dirname(process.execPath), \'nightmare/runner.js\')' | ||
] | ||
}, | ||
deployFiles: [ | ||
[ 'lib/runner.js', 'nightmare/runner.js' ], | ||
[ 'lib/frame-manager.js', 'nightmare/frame-manager.js' ], | ||
[ 'lib/ipc.js', 'nightmare/ipc.js' ], | ||
[ 'lib/preload.js', 'nightmare/preload.js' ] | ||
] | ||
} | ||
}; |
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,5 @@ | ||
'use strict'; | ||
|
||
// see nightmare | ||
require('electron'); | ||
console.log('ok'); |
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,7 @@ | ||
'use strict'; | ||
|
||
module.exports = function () { | ||
return { | ||
deployFilesFrom: [ 'electron' ] | ||
}; | ||
}; |
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 @@ | ||
{ "private": true } |
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,21 @@ | ||
'use strict'; | ||
|
||
var Nightmare = require('nightmare'); | ||
var nightmare = new Nightmare({ show: true }); | ||
|
||
nightmare | ||
.goto('http://yahoo.com') | ||
.type('form[action*="/search"] [name=p]', 'github nightmare') | ||
.click('form[action*="/search"] [type=submit]') | ||
.wait('#main') | ||
.evaluate(function () { | ||
// nightmare takes thisFunction.toString(), so --public is needed | ||
return document.querySelector('#main .searchCenterMiddle li a').href; | ||
}) | ||
.end() | ||
.then(function (result) { | ||
console.log(result); | ||
}) | ||
.catch(function (error) { | ||
console.error('Search failed:', error); | ||
}); |
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,7 @@ | ||
'use strict'; | ||
|
||
module.exports = function () { | ||
return { | ||
deployFilesFrom: [ 'electron', 'nightmare' ] | ||
}; | ||
}; |
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 @@ | ||
{ "private": true } |