mirror of
https://github.com/S2-/gitlit
synced 2025-08-04 05:10:05 +02:00
add node modules to repo
This commit is contained in:
2
node_modules/electron-packager/.eslintignore
generated
vendored
Normal file
2
node_modules/electron-packager/.eslintignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/test/fixtures/**/node_modules/**
|
||||
**/test/work/*
|
43
node_modules/electron-packager/.github/config.yml
generated
vendored
Normal file
43
node_modules/electron-packager/.github/config.yml
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
|
||||
|
||||
# Comment to be posted to on first time issues
|
||||
newIssueWelcomeComment: |
|
||||
👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the [support docs](https://github.com/electron-userland/electron-packager/blob/master/SUPPORT.md). If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.
|
||||
|
||||
To help make it easier for us to investigate your issue, please follow the [contributing guidelines](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md#before-opening-bug-reportstechnical-issues).
|
||||
|
||||
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
|
||||
|
||||
# Comment to be posted to on PRs from first time contributors in your repository
|
||||
newPRWelcomeComment: |
|
||||
Thanks for opening a pull request!
|
||||
|
||||
Here are some highlighted action items that will help get it across the finish line, from the
|
||||
[pull request guidelines](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md#filing-pull-requests):
|
||||
- Follow the [JavaScript coding style](https://standardjs.com/).
|
||||
- Run `npm run lint` locally to catch formatting errors earlier.
|
||||
- Document any user-facing changes in `NEWS.md` and other docs.
|
||||
- Include tests when adding/changing behavior.
|
||||
|
||||
Development and triage is community-driven, so please be patient and we will get back to you as soon as we can.
|
||||
|
||||
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
|
||||
|
||||
# Comment to be posted to on pull requests merged by a first time user
|
||||
firstPRMergeComment: >
|
||||
Thanks for your contribution! 🎉
|
||||
|
||||
# Configuration for request-info - https://github.com/behaviorbot/request-info
|
||||
|
||||
# *Required* Comment to reply with
|
||||
requestInfoReplyComment: >
|
||||
Thanks for filing this issue/PR! It would be much appreciated if you could provide us with more information so we can effectively analyze the situation in context.
|
||||
|
||||
# *OPTIONAL* default titles to check against for lack of descriptiveness
|
||||
# MUST BE ALL LOWERCASE
|
||||
requestInfoDefaultTitles:
|
||||
- update readme.md
|
||||
- updates
|
||||
|
||||
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
|
||||
requestInfoLabelToAdd: needs info
|
33
node_modules/electron-packager/.github/issue_template.md
generated
vendored
Normal file
33
node_modules/electron-packager/.github/issue_template.md
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<!--
|
||||
Thanks for filing an issue!
|
||||
If you have questions about usage, see <https://github.com/electron-userland/electron-packager/blob/master/SUPPORT.md>.
|
||||
Please check off all of the steps as they are completed by replacing [ ] with [x].
|
||||
-->
|
||||
|
||||
* [ ] I have read the [contribution documentation](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md) for this project.
|
||||
* [ ] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
|
||||
* [ ] I have searched the issue tracker for an issue that matches the one I want to file, without success.
|
||||
|
||||
**Please describe your issue:**
|
||||
|
||||
|
||||
<!-- For bugs and questions, please answer these questions to the best of your ability. -->
|
||||
|
||||
**Console output when you run electron-packager with the environment variable `DEBUG=electron-packager`. Please include the stack trace if one exists.**
|
||||
|
||||
```
|
||||
Put the console output here
|
||||
```
|
||||
|
||||
**What command line arguments are you passing? Alternatively, if you are using the API, what
|
||||
parameters are you passing to the `packager()` function?**
|
||||
|
||||
```
|
||||
Put the arguments or parameters here
|
||||
```
|
||||
|
||||
**Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
|
||||
reproduce your problem. Using [electron-quick-start](https://github.com/electron/electron-quick-start)
|
||||
is a good starting point.**
|
||||
|
||||
|
14
node_modules/electron-packager/.github/no-response.yml
generated
vendored
Normal file
14
node_modules/electron-packager/.github/no-response.yml
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Configuration for probot-no-response - https://github.com/probot/no-response
|
||||
|
||||
# Number of days of inactivity before an Issue is closed for lack of response
|
||||
daysUntilClose: 14
|
||||
|
||||
# Label requiring a response
|
||||
responseRequiredLabel: needs info
|
||||
|
||||
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
|
||||
closeComment: >
|
||||
Since the original issue reporter has not responded to the request for additional
|
||||
information in about two weeks, it's assumed that they either found the
|
||||
answer in another manner or decided not to pursue this issue. If this is incorrect,
|
||||
they can respond with answers to the questions posed, and this issue can be reopened.
|
13
node_modules/electron-packager/.github/pull_request_template.md
generated
vendored
Normal file
13
node_modules/electron-packager/.github/pull_request_template.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!--
|
||||
Thanks for filing a pull request!
|
||||
Please check off all of the steps as they are completed by replacing [ ] with [x].
|
||||
-->
|
||||
|
||||
* [ ] I have read the [contribution documentation](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md) for this project.
|
||||
* [ ] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project follows, as appropriate.
|
||||
* [ ] The changes are appropriately documented (if applicable).
|
||||
* [ ] The changes have sufficient test coverage (if applicable).
|
||||
* [ ] The testsuite passes successfully on my local machine (if applicable).
|
||||
|
||||
**Summarize your changes:**
|
||||
|
10
node_modules/electron-packager/.npmignore
generated
vendored
Normal file
10
node_modules/electron-packager/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
*.cer
|
||||
*.csr
|
||||
*.key
|
||||
*.pem
|
||||
node_modules
|
||||
test/fixtures/basic/main-link.js
|
||||
test/work
|
||||
.DS_Store
|
||||
.nyc_output
|
||||
npm-debug.log
|
35
node_modules/electron-packager/.travis.yml
generated
vendored
Normal file
35
node_modules/electron-packager/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
sudo: required
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
dist: trusty
|
||||
osx_image: xcode8
|
||||
language: node_js
|
||||
node_js:
|
||||
- '4'
|
||||
- '6'
|
||||
- '8'
|
||||
- '9'
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: '9'
|
||||
cache:
|
||||
- apt: true
|
||||
- directories:
|
||||
- "node_modules"
|
||||
- "$HOME/.electron"
|
||||
before_install: test/ci/before_install.sh
|
||||
install:
|
||||
- npm install
|
||||
- npm update
|
||||
before_script: test/ci/_before_script.js
|
||||
after_success: npm run codecov
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.\d+/
|
||||
env:
|
||||
global:
|
||||
# prevent wine popup dialogs about installing additional packages
|
||||
- WINEDLLOVERRIDES="mscoree,mshtml="
|
||||
- WINEDEBUG="-all"
|
5
node_modules/electron-packager/CODE_OF_CONDUCT.md
generated
vendored
Normal file
5
node_modules/electron-packager/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Code of Conduct
|
||||
|
||||
This project is a part of the Electron ecosystem. As such, all contributions to this project follow
|
||||
[Electron's code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
|
||||
where appropriate.
|
145
node_modules/electron-packager/CONTRIBUTING.md
generated
vendored
Normal file
145
node_modules/electron-packager/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
# Contributing to Electron Packager
|
||||
|
||||
Electron Packager is a community-driven project. As such, we welcome and encourage all sorts of
|
||||
contributions. They include, but are not limited to:
|
||||
|
||||
- Constructive feedback
|
||||
- [Questions about usage](https://github.com/electron-userland/electron-packager/blob/master/SUPPORT.md)
|
||||
- [Bug reports / technical issues](#before-opening-bug-reportstechnical-issues)
|
||||
- Documentation changes
|
||||
- Feature requests
|
||||
- [Pull requests](#filing-pull-requests)
|
||||
|
||||
We strongly suggest that before filing an issue, you search through the existing issues to see
|
||||
if it has already been filed by someone else.
|
||||
|
||||
This project is a part of the Electron ecosystem. As such, all contributions to this project follow
|
||||
[Electron's code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
|
||||
where appropriate.
|
||||
|
||||
## Before opening bug reports/technical issues
|
||||
|
||||
### Debugging
|
||||
|
||||
One way to troubleshoot potential problems is to set the `DEBUG` environment variable before
|
||||
calling electron-packager. This will print debug information from the specified modules. The
|
||||
value of the environment variable is a comma-separated list of modules which support this logging
|
||||
feature. Known modules include:
|
||||
|
||||
* `electron-download`
|
||||
* `electron-osx-sign`
|
||||
* `electron-packager` (always use this one before filing an issue)
|
||||
* `extract-zip`
|
||||
* `get-package-info`
|
||||
|
||||
We use the [`debug`](https://www.npmjs.com/package/debug#usage) module for this functionality. It
|
||||
has examples on how to set environment variables if you don't know how.
|
||||
|
||||
**If you are using `npm run` to execute `electron-packager`, run the `electron-packager` command
|
||||
without using `npm run` and make a note of the output, because `npm run` does not print out error
|
||||
messages when a script errors.**
|
||||
|
||||
## Contribution suggestions
|
||||
|
||||
We use the label [`help wanted`](https://github.com/electron-userland/electron-packager/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) in the issue tracker to denote fairly-well-scoped-out bugs or feature requests that the community can pick up and work on. If any of those labeled issues do not have enough information, please feel free to ask constructive questions. (This applies to any open issue.)
|
||||
|
||||
## Filing Pull Requests
|
||||
|
||||
Here are some things to keep in mind as you file pull requests to fix bugs, add new features, etc.:
|
||||
|
||||
* Travis CI is used to make sure that the project builds packages as expected on the supported
|
||||
platforms, using supported Node.js versions.
|
||||
* Unless it's impractical, please write tests for your changes. This will help us so that we can
|
||||
spot regressions much easier.
|
||||
* If your PR changes the behavior of an existing feature, or adds a new feature, please add/edit
|
||||
the package's documentation. Files that will likely need to be updated include `readme.md`,
|
||||
`docs/api.md`, and `usage.txt`.
|
||||
* This project uses the [JavaScript Standard Style](https://standardjs.com/) as a coding convention.
|
||||
CI will fail if the PR does not conform to this standard.
|
||||
* One of the philosophies of the project is to keep the code base as small as possible. If you are
|
||||
adding a new feature, think about whether it is appropriate to go into a separate Node module,
|
||||
and then be integrated into this project.
|
||||
* If you are contributing a nontrivial change, please add an entry to `NEWS.md`. The format is
|
||||
similar to the one described at [Keep a Changelog](http://keepachangelog.com/).
|
||||
* Please **do not** bump the version number in your pull requests, the maintainers will do that.
|
||||
Feel free to indicate whether the changes require a major, minor, or patch version bump, as
|
||||
prescribed by the [semantic versioning specification](http://semver.org/).
|
||||
* Once your pull request is approved, please make sure your commits are rebased onto the latest
|
||||
commit in the master branch, and that you limit/squash the number of commits created to a
|
||||
"feature"-level. For instance:
|
||||
|
||||
bad:
|
||||
|
||||
```
|
||||
commit 1: add foo option
|
||||
commit 2: standardize code
|
||||
commit 3: add test
|
||||
commit 4: add docs
|
||||
commit 5: add bar option
|
||||
commit 6: add test + docs
|
||||
```
|
||||
|
||||
good:
|
||||
|
||||
```
|
||||
commit 1: add foo option
|
||||
commit 2: add bar option
|
||||
```
|
||||
|
||||
Squashing commits during discussion of the pull request is almost always unnecessary, and makes it
|
||||
more difficult for both the submitters and reviewers to understand what changed in between comments.
|
||||
However, rebasing is encouraged when practical, particularly when there's a merge conflict.
|
||||
|
||||
If you are continuing the work of another person's PR and need to rebase/squash, please retain the
|
||||
attribution of the original author(s) and continue the work in subsequent commits.
|
||||
|
||||
### Running tests
|
||||
|
||||
To run the test suite on your local machine, you'll first need to do a little
|
||||
setup.
|
||||
|
||||
If you're using macOS:
|
||||
|
||||
```sh
|
||||
TRAVIS_OS_NAME=osx ./test/ci/before_install.sh
|
||||
```
|
||||
|
||||
If you're using a Debian/Ubuntu-derived distribution of Linux with x86_64
|
||||
architecture:
|
||||
|
||||
```sh
|
||||
TRAVIS_OS_NAME=linux ./test/ci/before_install.sh
|
||||
```
|
||||
|
||||
Then you can install dependencies and run the suite:
|
||||
|
||||
```sh
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
### Creating test fixtures
|
||||
|
||||
For some unit tests, a test fixture Electron project is required. Sometimes it's OK to use an
|
||||
existing fixture, such as `basic`. If you need to add a new fixture:
|
||||
|
||||
1. Create a new subdirectory in `test/fixtures/`.
|
||||
2. Add a `package.json` with only the minimal configuration necessary for your test(s).
|
||||
3. If necessary, add supporting files, such as the JS file specified in the `main` key in the
|
||||
`package.json` file.
|
||||
4. Use `fixtureSubdir` from `test/util.js` to reference the fixture subdirectory in your test.
|
||||
|
||||
## For Collaborators
|
||||
|
||||
Make sure to get a `:thumbsup:`, `+1` or `LGTM` from another collaborator before merging a PR.
|
||||
|
||||
### Release process
|
||||
|
||||
- if you aren't sure if a release should happen, open an issue
|
||||
- make sure that `NEWS.md` is up to date
|
||||
- make sure the tests pass
|
||||
- `npm version <major|minor|patch>`
|
||||
- `git push && git push --tags` (or `git push` with `git config --global push.followTags true` on latest git)
|
||||
- create a new GitHub release from the pushed tag with the contents of `NEWS.md` for that version
|
||||
- close the milestone associated with the version if one is open
|
||||
- `npm publish`
|
23
node_modules/electron-packager/LICENSE
generated
vendored
Normal file
23
node_modules/electron-packager/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) 2015 Max Ogden and other contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
624
node_modules/electron-packager/NEWS.md
generated
vendored
Normal file
624
node_modules/electron-packager/NEWS.md
generated
vendored
Normal file
@@ -0,0 +1,624 @@
|
||||
# Changes by Version
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
[Unreleased]: https://github.com/electron-userland/electron-packager/compare/v12.1.0...master
|
||||
|
||||
## [12.1.0]
|
||||
|
||||
[12.1.0]: https://github.com/electron-userland/electron-packager/compare/v12.0.2...v12.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* `--version` shows the Packager/Node versions & host platform/arch (#841)
|
||||
|
||||
### Fixed
|
||||
|
||||
* `mips64el` arch is only available with Electron 1.8.x (#843)
|
||||
* better detection of node modules (#847)
|
||||
|
||||
## [12.0.2] - 2018-05-02
|
||||
|
||||
[12.0.2]: https://github.com/electron-userland/electron-packager/compare/v12.0.1...v12.0.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* Support for Node 10 via the CLI (#835)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* The callback version of the API (use `nodeify` if you need that syntax style) (#837)
|
||||
|
||||
## [12.0.1] - 2018-04-10
|
||||
|
||||
[12.0.1]: https://github.com/electron-userland/electron-packager/compare/v12.0.0...v12.0.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Upgraded `galactus` to `^0.2.1` to fix a bug with relative paths
|
||||
|
||||
## [12.0.0] - 2018-04-03
|
||||
|
||||
[12.0.0]: https://github.com/electron-userland/electron-packager/compare/v11.2.0...v12.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
* `prune` exclusively utilizes the `galactus` module for pruning devDependencies, instead of
|
||||
depending on package managers (#819)
|
||||
* `electron-packager` is no longer ignored by default (#819)
|
||||
* A warning is emitted when an Electron module is a production dependency (#819)
|
||||
|
||||
### Removed
|
||||
|
||||
* `packageManager` option (#819)
|
||||
|
||||
## [11.2.0] - 2018-03-24
|
||||
|
||||
[11.2.0]: https://github.com/electron-userland/electron-packager/compare/v11.1.0...v11.2.0
|
||||
|
||||
### Added
|
||||
|
||||
* Utility function to execute hooks serially (#814)
|
||||
|
||||
## [11.1.0] - 2018-03-04
|
||||
|
||||
[11.1.0]: https://github.com/electron-userland/electron-packager/compare/v11.0.1...v11.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* Support for MAS Login Helper (Electron 2.0.0-beta.1 and above) (#807)
|
||||
|
||||
## [11.0.1] - 2018-02-12
|
||||
|
||||
[11.0.1]: https://github.com/electron-userland/electron-packager/compare/v11.0.0...v11.0.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* `rcedit` module updated to 1.0.0, which fixes some bugs (#804)
|
||||
* `--help` prints usage to stdout (#805)
|
||||
|
||||
## [11.0.0] - 2018-02-06
|
||||
|
||||
[11.0.0]: https://github.com/electron-userland/electron-packager/compare/v10.1.2...v11.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* `linux` platform, `mips64el` arch builds (Electron 1.8.2-beta.5 and above) (#800)
|
||||
|
||||
### Changed
|
||||
|
||||
* `all` or `platform=linux, arch=all` now include `arch=mips64el` if the Electron version specified
|
||||
is 1.8.2-beta.5 or above (#800)
|
||||
|
||||
## [10.1.2] - 2018-01-26
|
||||
|
||||
[10.1.2]: https://github.com/electron-userland/electron-packager/compare/v10.1.1...v10.1.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* `overwrite: true` when no platform/arch is specified (#794)
|
||||
|
||||
## [10.1.1] - 2018-01-02
|
||||
|
||||
[10.1.1]: https://github.com/electron-userland/electron-packager/compare/v10.1.0...v10.1.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* ARM detection with prebuilt armv7l Node.js (#783)
|
||||
* Don't create `yarn.lock` when pruning with Yarn (#784)
|
||||
|
||||
## [10.1.0] - 2017-11-19
|
||||
|
||||
[10.1.0]: https://github.com/electron-userland/electron-packager/compare/v10.0.0...v10.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* Option to set the executable name separate from the app name (#758)
|
||||
|
||||
### Fixed
|
||||
|
||||
* `mz` dependency (#759)
|
||||
|
||||
## [10.0.0] - 2017-11-19
|
||||
|
||||
[10.0.0]: https://github.com/electron-userland/electron-packager/compare/v9.1.0...v10.0.0
|
||||
|
||||
### Changed
|
||||
|
||||
* Switch from `minimist` to `yargs-parser` (#732)
|
||||
* Electron Packager only officially supports Node versions that are supported by the
|
||||
NodeJS team (#747)
|
||||
* Refactor to use `Promise`s internally. This has the side effect of somewhat parallelizing
|
||||
building two or more targets at once and/or two or more functions for a given hook, via
|
||||
`Promise.all` (#753)
|
||||
|
||||
## [9.1.0] - 2017-09-15
|
||||
|
||||
[9.1.0]: https://github.com/electron-userland/electron-packager/compare/v9.0.1...v9.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* `hostArch()` and `allOfficialArchsForPlatformAndVersion()` (#727)
|
||||
|
||||
### Changed
|
||||
|
||||
* CLI arguments with nonstandard argument values emit warnings (#722)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* In the CLI, `--tmpdir=false` has been deprecated in favor of `--no-tmpdir` (#722)
|
||||
|
||||
## [9.0.1] - 2017-09-02
|
||||
|
||||
[9.0.1]: https://github.com/electron-userland/electron-packager/compare/v9.0.0...v9.0.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Inferring `win32metadata.CompanyName` from `author` in `package.json` when it's an Object (#718)
|
||||
|
||||
## [9.0.0] - 2017-08-23
|
||||
|
||||
[9.0.0]: https://github.com/electron-userland/electron-packager/compare/v8.7.2...v9.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* API hook for afterPrune (#677)
|
||||
* Package manager-agnostic pruning support (set `packageManager` to `false`) (#690)
|
||||
* `linux` platform, `arm64` arch builds (Electron 1.8.0 and above) (#711)
|
||||
|
||||
### Changed
|
||||
|
||||
* Promise support for `packager` - function returns a Promise instead of the return value of the
|
||||
callback (#658)
|
||||
* `win32metadata.CompanyName` defaults to `author` name from nearest `package.json` (#667)
|
||||
* `win32metadata.FileDescription` defaults to `productName` or `name` from
|
||||
nearest `package.json` (#667)
|
||||
* `win32metadata.OriginalFilename` defaults to renamed `.exe` (#667)
|
||||
* `win32metadata.ProductName` defaults to `productName` or `name` from nearest `package.json` (#667)
|
||||
* `win32metadata.InternalName` defaults to `productName` or `name` from
|
||||
nearest `package.json` (#667)
|
||||
* Warn when downloading from the official Electron releases and the arch/platform combination
|
||||
specified is invalid (#562)
|
||||
* Do not error out immediately if a `download.mirror` is specified and an unofficial arch/platform
|
||||
is specified (#670)
|
||||
* Allow spaces when specifying archs/platforms as a string, rather than an array (#487)
|
||||
* The `extraResource` option works on all target platforms (#637)
|
||||
* `all` or `platform=linux, arch=all` now include `arch=arm64` if the Electron version specified is
|
||||
1.8.0 or above (#711)
|
||||
|
||||
### Fixed
|
||||
|
||||
* `common.warning` for codesigning (#694)
|
||||
|
||||
### Removed
|
||||
|
||||
* `version` is removed in favor of `electronVersion` (CLI: `--electron-version`) (#665)
|
||||
* `version-string` is removed in favor of `win32metadata` (#668)
|
||||
* Options set via the JavaScript API formatted in kebab-case (i.e., with hyphens) are removed in
|
||||
favor of their camelCase variants, per JavaScript naming standards (#669)
|
||||
|
||||
## [8.7.2] - 2017-06-25
|
||||
|
||||
[8.7.2]: https://github.com/electron-userland/electron-packager/compare/v8.7.1...v8.7.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* Stop yarn creating `.bin` folders when pruning (#678)
|
||||
|
||||
## [8.7.1] - 2017-06-05
|
||||
|
||||
[8.7.1]: https://github.com/electron-userland/electron-packager/compare/v8.7.0...v8.7.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Usage docs for `win32metadata.application-manifest` and `win32metadata.requested-execution-level`
|
||||
|
||||
## [8.7.0] - 2017-05-01
|
||||
|
||||
[8.7.0]: https://github.com/electron-userland/electron-packager/compare/v8.6.0...v8.7.0
|
||||
|
||||
### Added
|
||||
|
||||
* `packageManager` (`--package-manager` via CLI) option (#618)
|
||||
* `win32metadata.application-manifest` option (#610)
|
||||
* `win32metadata.requested-execution-level` option (#610)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Support for `extract-zip` >= 1.6.1
|
||||
|
||||
## [8.6.0] - 2017-03-14
|
||||
|
||||
[8.6.0]: https://github.com/electron-userland/electron-packager/compare/v8.5.2...v8.6.0
|
||||
|
||||
### Added
|
||||
|
||||
* Limited support for electron-prebuilt-compile (#608)
|
||||
|
||||
### Changed
|
||||
|
||||
* Options formatted in kebab-case (i.e., with hyphens) are available in camelCase, per JavaScript naming standards (#580)
|
||||
* rcedit upgraded to 0.8.0
|
||||
|
||||
### Deprecated
|
||||
|
||||
* Options formatted in kebab-case (i.e., with hyphens) are deprecated in favor of their camelCase variants, per JavaScript naming standards (#580)
|
||||
|
||||
## [8.5.2] - 2017-02-19
|
||||
|
||||
[8.5.2]: https://github.com/electron-userland/electron-packager/compare/v8.5.1...v8.5.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* Prepend all warning messages with "WARNING:" (#593)
|
||||
* Ignore the generated temporary directory on Linux (#596)
|
||||
* Prevent app names from ending in " Helper" (#600)
|
||||
|
||||
## [8.5.1] - 2017-01-22
|
||||
|
||||
[8.5.1]: https://github.com/electron-userland/electron-packager/compare/v8.5.0...v8.5.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Show CLI option when showing option deprecation message (#560)
|
||||
|
||||
## [8.5.0] - 2017-01-10
|
||||
|
||||
[8.5.0]: https://github.com/electron-userland/electron-packager/compare/v8.4.0...v8.5.0
|
||||
|
||||
### Added
|
||||
|
||||
* `electronVersion` (`--electron-version` via CLI) option (#547)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `version` is deprecated in favor of `electronVersion` (`--electron-version` via CLI) (#547)
|
||||
|
||||
## [8.4.0] - 2016-12-08
|
||||
|
||||
[8.4.0]: https://github.com/electron-userland/electron-packager/compare/v8.3.0...v8.4.0
|
||||
|
||||
### Added
|
||||
|
||||
* `quiet` option (#541)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Better type checking when validating arch/platform (#534)
|
||||
|
||||
## [8.3.0] - 2016-11-16
|
||||
|
||||
[8.3.0]: https://github.com/electron-userland/electron-packager/compare/v8.2.0...v8.3.0
|
||||
|
||||
### Changed
|
||||
|
||||
* Upgrade to electron-osx-sign 0.4.x (#384)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Clarify symlink error message for Windows
|
||||
|
||||
## [8.2.0] - 2016-10-29
|
||||
|
||||
[8.2.0]: https://github.com/electron-userland/electron-packager/compare/v8.1.0...v8.2.0
|
||||
|
||||
### Added
|
||||
|
||||
* Allow `extend-info` to specify an object instead of a filename (#510)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Retrieving metadata from `package.json` by upgrading `get-package-info` (#505)
|
||||
* Typo when using `extend-info` (#510)
|
||||
|
||||
## [8.1.0] - 2016-09-30
|
||||
|
||||
[8.1.0]: https://github.com/electron-userland/electron-packager/compare/v8.0.0...v8.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* `.o` and `.obj` files are ignored by default (#491)
|
||||
* Electron downloads are now checked against their published checksums (#493)
|
||||
* Documentation for `download.quiet` option to enable/disable progress bar (#494)
|
||||
* The `build-version` property, when unspecified, now defaults to the
|
||||
`app-version` property value on Windows (#501)
|
||||
|
||||
## [8.0.0] - 2016-09-03
|
||||
|
||||
[8.0.0]: https://github.com/electron-userland/electron-packager/compare/v7.7.0...v8.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* `win32metadata` option (#331, #463)
|
||||
* `linux` platform, `armv7l` arch support (#106, #474)
|
||||
|
||||
### Changed
|
||||
|
||||
* `all` now includes the `linux` platform, `armv7l` arch combination
|
||||
* Default the `platform` option to the host platform (#464)
|
||||
* Default the `arch` option to the host arch (#36, #464)
|
||||
* Default the `prune` option to `true` (#235, #472)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Allow scoped package names as Electron app names - invalid characters are replaced with
|
||||
hyphens (#308, #455)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `version-string` is deprecated in favor of `win32metadata` (#331, #463)
|
||||
|
||||
### Removed
|
||||
|
||||
* `asar-unpack` is removed in favor of `asar.unpack`
|
||||
* `asar-unpack-dir` is removed in favor of `asar.unpackDir`
|
||||
* `cache` is removed in favor of `download.cache`
|
||||
* `strict-ssl` is removed in favor of `download.strictSSL`
|
||||
|
||||
## [7.7.0] - 2016-08-20
|
||||
|
||||
[7.7.0]: https://github.com/electron-userland/electron-packager/compare/v7.6.0...v7.7.0
|
||||
|
||||
### Added
|
||||
|
||||
* The `package.json` `version` property is the default app version if `--app-version` is
|
||||
unspecified (#449)
|
||||
|
||||
### Changed
|
||||
|
||||
* [darwin/mas] Explicitly disallow `osx-sign.binaries` (#459)
|
||||
|
||||
## [7.6.0] - 2016-08-14
|
||||
|
||||
[7.6.0]: https://github.com/electron-userland/electron-packager/compare/v7.5.1...v7.6.0
|
||||
|
||||
### Added
|
||||
|
||||
* [API] hook for afterCopy (#448)
|
||||
* [darwin/mas] Documentation for `protocol` and `protocol-name` options (#121, #450)
|
||||
|
||||
### Changed
|
||||
|
||||
* [CLI] Minimum Node version is enforced (#454)
|
||||
|
||||
### Fixed
|
||||
|
||||
* [CLI] ensure --out has either a string or null value (#442)
|
||||
* Use `get-package-info` (again) to support finding prebuilt in parent directories (#445)
|
||||
|
||||
## [7.5.1] - 2016-08-06
|
||||
|
||||
[7.5.1]: https://github.com/electron-userland/electron-packager/compare/v7.5.0...v7.5.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Resolve to absolute path when inferring app name/Electron version (#440)
|
||||
|
||||
## [7.5.0] - 2016-08-04
|
||||
|
||||
[7.5.0]: https://github.com/electron-userland/electron-packager/compare/v7.4.0...v7.5.0
|
||||
|
||||
### Added
|
||||
|
||||
* Support the new `electron` package name (#435)
|
||||
|
||||
## [7.4.0] - 2016-07-31
|
||||
|
||||
[7.4.0]: https://github.com/electron-userland/electron-packager/compare/v7.3.0...v7.4.0
|
||||
|
||||
### Added
|
||||
|
||||
* Basic debugging messages via the `debug` module - see CONTRIBUTING.md for usage (#433)
|
||||
|
||||
### Changed
|
||||
|
||||
* Clearer error message when inferring the app name and/or Electron version fails
|
||||
|
||||
### Fixed
|
||||
|
||||
* (Test) apps named "Electron" can be packaged successfully (#415)
|
||||
|
||||
## [7.3.0] - 2016-07-10
|
||||
|
||||
[7.3.0]: https://github.com/electron-userland/electron-packager/compare/v7.2.0...v7.3.0
|
||||
|
||||
### Added
|
||||
|
||||
* `asar` options can be specified as an `Object` (via the API) or with dot notation (via the CLI) -
|
||||
see the respective docs for details (#353, #417)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `asar-unpack` is deprecated in favor of `asar.unpack` (#417)
|
||||
* `asar-unpack-dir` is deprecated in favor of `asar.unpackDir` (#417)
|
||||
|
||||
## [7.2.0] - 2016-07-03
|
||||
|
||||
[7.2.0]: https://github.com/electron-userland/electron-packager/compare/v7.1.0...v7.2.0
|
||||
|
||||
### Added
|
||||
|
||||
* `derefSymlinks` option (#410)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Clarified message when `wine` is not found (#357)
|
||||
|
||||
## [7.1.0] - 2016-06-22
|
||||
|
||||
[7.1.0]: https://github.com/electron-userland/electron-packager/compare/v7.0.4...v7.1.0
|
||||
|
||||
### Added
|
||||
|
||||
* Add `afterExtract` hook (#354, #403)
|
||||
|
||||
## [7.0.4] - 2016-06-14
|
||||
|
||||
[7.0.4]: https://github.com/electron-userland/electron-packager/compare/v7.0.3...v7.0.4
|
||||
|
||||
### Fixed
|
||||
|
||||
* Clarified app name/Electron version error message (#390)
|
||||
|
||||
## [7.0.3] - 2016-05-31
|
||||
|
||||
[7.0.3]: https://github.com/electron-userland/electron-packager/compare/v7.0.2...v7.0.3
|
||||
|
||||
### Changed
|
||||
|
||||
* [contributors] Code contributions need to be validated in "strict" mode (#342, #351)
|
||||
|
||||
### Fixed
|
||||
|
||||
* CLI output truncated when using Node 6 (and possibly earlier) (#381)
|
||||
|
||||
## [7.0.2] - 2016-05-18
|
||||
|
||||
[7.0.2]: https://github.com/electron-userland/electron-packager/compare/v7.0.1...v7.0.2
|
||||
|
||||
### Fixed
|
||||
|
||||
* The default `.git` ignore only ignores that directory (#344)
|
||||
* Specifying the `download.strictSSL` CLI parameter no longer triggers a deprecation warning for
|
||||
`strict-ssl` (#349)
|
||||
|
||||
## [7.0.1] - 2016-04-21
|
||||
|
||||
[7.0.1]: https://github.com/electron-userland/electron-packager/compare/v7.0.0...v7.0.1
|
||||
|
||||
### Fixed
|
||||
|
||||
* Not specifying `strict-ssl` CLI parameter no longer triggers a deprecation warning (#335)
|
||||
|
||||
## [7.0.0] - 2016-04-17
|
||||
|
||||
[7.0.0]: https://github.com/electron-userland/electron-packager/compare/v6.0.2...v7.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* Add `download` parameter (#320)
|
||||
|
||||
### Changed
|
||||
|
||||
* **Dropped support for running on Node < 4.0.** (#319)
|
||||
|
||||
### Fixed
|
||||
|
||||
* `strict-ssl` (and by extension, `download.strictSSL`) defaults to `true`, as documented (#320)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `cache` is deprecated in favor of `download.cache` (#320)
|
||||
* `strict-ssl` is deprecated in favor of `download.strictSSL` (#320)
|
||||
|
||||
### Removed
|
||||
|
||||
* [win32] `version-string.FileVersion` and `version-string.ProductVersion` are replaced by
|
||||
favor of `app-version` and `build-version`, respectively (#327)
|
||||
* [win32] `version-string.LegalCopyright` is replaced by `app-copyright` (#327)
|
||||
|
||||
## [6.0.2] - 2016-04-09
|
||||
|
||||
[6.0.2]: https://github.com/electron-userland/electron-packager/compare/v6.0.1...v6.0.2
|
||||
|
||||
### Changed
|
||||
|
||||
* [win32] `rcedit` dependency updated to 0.5.x. **The DLL mentioned in the 6.0.1 release notes
|
||||
is no longer required.**
|
||||
|
||||
## [6.0.1] - 2016-04-08
|
||||
|
||||
[6.0.1]: https://github.com/electron-userland/electron-packager/compare/v6.0.0...v6.0.1
|
||||
|
||||
### Changed
|
||||
|
||||
* [win32] `rcedit` dependency updated to 0.4.x. **A new DLL is required to run the new version
|
||||
of rcedit, please see [the documentation](https://github.com/electron-userland/electron-packager/blob/master/readme.md#building-windows-apps-from-non-windows-platforms)
|
||||
for details**
|
||||
* API documentation moved from readme.md to docs/api.md (#296)
|
||||
|
||||
### Fixed
|
||||
|
||||
* [darwin/mas] The OSX icon is properly replaced when Electron ≥ 0.37.4 is used (#301)
|
||||
* `default_app.asar` is deleted during packaging (necessary when Electron ≥ 0.37.4 is used).
|
||||
The `default_app` folder is still deleted for older Electron versions (#298, #311)
|
||||
|
||||
## [6.0.0] - 2016-03-28
|
||||
|
||||
[6.0.0]: https://github.com/electron-userland/electron-packager/compare/v5.2.1...v6.0.0
|
||||
|
||||
### Added
|
||||
|
||||
* Add support for a new target platform, Mac App Store (`mas`), including signing OS X apps
|
||||
(#223, #278)
|
||||
* Add `app-copyright` parameter (#223)
|
||||
* Add `tmpdir` parameter to specify a custom temp directory (#230); set to `false` to disable
|
||||
using a temporary directory at all (#251, #276)
|
||||
* Add `NEWS.md`, a human-readable list of changes in each version (since 5.2.0) (#263)
|
||||
|
||||
### Changed
|
||||
|
||||
* **The GitHub repository has been moved into an organization,
|
||||
[electron-userland](https://github.com/electron-userland)**
|
||||
* Allow the `ignore` parameter to take a function (#247)
|
||||
* [contributors] Update Standard (JavaScript coding standard) package to 5.4.x
|
||||
* [contributors] Add code coverage support via Coveralls (#257)
|
||||
* Better docs around contributing to the project (#258)
|
||||
* Ignore the directory specified by the `out` parameter by default (#255)
|
||||
* [darwin/mas] Add support for merging arbitrary plist files and adding arbitrary resource
|
||||
files (#253)
|
||||
* Split out the code to sign OS X apps into a separate Node module,
|
||||
[electron-osx-sign](https://github.com/electron-userland/electron-osx-sign) (#223)
|
||||
* [darwin/mas] **BREAKING**: The `sign` parameter is now `osx-sign` (for better cross-platform
|
||||
compatibility) and optionally takes several of the same sub-parameters as
|
||||
electron-osx-sign (#286)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* [win32] `version-string.LegalCopyright` is deprecated in favor of `app-copyright` (#268)
|
||||
|
||||
### Fixed
|
||||
|
||||
* [darwin/mas] Ensure `CFBundleVersion` and `CFBundleShortVersionString` are strings (#250)
|
||||
* [darwin/mas] Correctly set the helper bundle ID in all relevant plist files (#223)
|
||||
* [darwin/mas] OSX-specific binaries are correctly renamed to the application name (#244, #293)
|
||||
|
||||
**If you are upgrading from ≤ 5.2.1 and building for a `darwin` target, you may experience problems. See #323 for details.**
|
||||
|
||||
## [5.2.1] - 2016-01-17
|
||||
|
||||
[5.2.1]: https://github.com/electron-userland/electron-packager/compare/v5.2.0...v5.2.1
|
||||
|
||||
### Changed
|
||||
|
||||
* [win32] Add support for Windows for the `app-version` and `build-version` parameters (#229)
|
||||
* If `appname` and/or `version` are omitted from the parameters, infer from `package.json` (#94)
|
||||
|
||||
### Deprecated
|
||||
|
||||
* [win32] `version-string.FileVersion` and `version-string.ProductVersion` are deprecated in
|
||||
favor of `app-version` and `build-version`, respectively (#229)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Remove `default_app` from built packages (#206)
|
||||
* Add documentation for optional arguments (#226)
|
||||
* [darwin] Don't declare helper app as a protocol handler (#220)
|
||||
|
||||
## [5.2.0] - 2015-12-16
|
||||
|
||||
[5.2.0]: https://github.com/electron-userland/electron-packager/compare/v5.1.1...v5.2.0
|
||||
|
||||
### Added
|
||||
|
||||
* Add `asar-unpack-dir` parameter (#174)
|
||||
* [darwin] Add `app-category-type` parameter (#202)
|
||||
* Add `strict-ssl` parameter (#209)
|
||||
|
||||
### Changed
|
||||
|
||||
* Ignore `node_modules/.bin` by default (#189)
|
||||
|
||||
----
|
||||
|
||||
For versions prior to 5.2.0, please see `git log`.
|
8
node_modules/electron-packager/SUPPORT.md
generated
vendored
Normal file
8
node_modules/electron-packager/SUPPORT.md
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Support for Electron Packager
|
||||
|
||||
If you have questions about usage, we encourage you to read the [frequently asked
|
||||
questions](https://github.com/electron-userland/electron-packager/blob/master/docs/faq.md),
|
||||
and visit one of the several [community-driven sites](https://github.com/electron/electron#community).
|
||||
|
||||
Troubleshooting suggestions can be found in our [contributing
|
||||
documentation](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md#debugging).
|
56
node_modules/electron-packager/cli.js
generated
vendored
Executable file
56
node_modules/electron-packager/cli.js
generated
vendored
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
var semver = require('semver')
|
||||
if (semver.lt(process.versions.node, '4.0.0')) {
|
||||
console.error('CANNOT RUN WITH NODE ' + process.versions.node)
|
||||
console.error('Electron Packager requires Node 4.0 or above.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Not consts so that this file can load in Node < 4.0
|
||||
var common = require('./common')
|
||||
var fs = require('fs')
|
||||
var packager = require('./')
|
||||
var path = require('path')
|
||||
var usage = fs.readFileSync(path.join(__dirname, 'usage.txt')).toString()
|
||||
|
||||
var args = common.parseCLIArgs(process.argv.slice(2))
|
||||
|
||||
// temporary fix for https://github.com/nodejs/node/issues/6456
|
||||
var stdioWriters = [process.stdout, process.stderr]
|
||||
stdioWriters.forEach(function (stdioWriter) {
|
||||
if (stdioWriter._handle && stdioWriter._handle.setBlocking) {
|
||||
stdioWriter._handle.setBlocking(true)
|
||||
}
|
||||
})
|
||||
|
||||
function printUsageAndExit (isError) {
|
||||
var print = isError ? console.error : console.log
|
||||
print(usage)
|
||||
process.exit(isError ? 1 : 0)
|
||||
}
|
||||
|
||||
if (args.help) {
|
||||
printUsageAndExit(false)
|
||||
} else if (args.version) {
|
||||
if (typeof args.version !== 'boolean') {
|
||||
console.error('--version does not take an argument. Perhaps you meant --app-version or --electron-version?\n')
|
||||
}
|
||||
console.log(common.hostInfo())
|
||||
process.exit(0)
|
||||
} else if (!args.dir) {
|
||||
printUsageAndExit(true)
|
||||
}
|
||||
|
||||
packager(args)
|
||||
.then(function done (appPaths) {
|
||||
if (appPaths.length > 1) console.error('Wrote new apps to:\n' + appPaths.join('\n'))
|
||||
else if (appPaths.length === 1) console.error('Wrote new app to', appPaths[0])
|
||||
return true
|
||||
}).catch(function error (err) {
|
||||
if (err.message) console.error(err.message)
|
||||
else console.error(err, err.stack)
|
||||
process.exit(1)
|
||||
})
|
16
node_modules/electron-packager/collaborators.md
generated
vendored
Normal file
16
node_modules/electron-packager/collaborators.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
## Collaborators
|
||||
|
||||
electron-packager is only possible due to the excellent work of the following collaborators:
|
||||
|
||||
<table><tbody><tr><th align="left">malept</th><td><a href="https://github.com/malept">GitHub/malept</a></td></tr>
|
||||
<tr><th align="left">maxogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td></tr>
|
||||
<tr><th align="left">shama</th><td><a href="https://github.com/shama">GitHub/shama</a></td></tr>
|
||||
<tr><th align="left">feross</th><td><a href="https://github.com/feross">GitHub/feross</a></td></tr>
|
||||
<tr><th align="left">sindresorhus</th><td><a href="https://github.com/sindresorhus">GitHub/sindresorhus</a></td></tr>
|
||||
<tr><th align="left">mafintosh</th><td><a href="https://github.com/mafintosh">GitHub/mafintosh</a></td></tr>
|
||||
<tr><th align="left">kfranqueiro</th><td><a href="https://github.com/kfranqueiro">GitHub/kfranqueiro</a></td></tr>
|
||||
<tr><th align="left">jden</th><td><a href="https://github.com/jden">GitHub/jden</a></td></tr>
|
||||
<tr><th align="left">jlord</th><td><a href="https://github.com/jlord">GitHub/jlord</a></td></tr>
|
||||
<tr><th align="left">stefanbuck</th><td><a href="https://github.com/stefanbuck">GitHub/stefanbuck</a></td></tr>
|
||||
<tr><th align="left">remixz</th><td><a href="https://github.com/remixz">GitHub/remixz</a></td></tr>
|
||||
</tbody></table>
|
160
node_modules/electron-packager/common.js
generated
vendored
Normal file
160
node_modules/electron-packager/common.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
'use strict'
|
||||
|
||||
const metadata = require('./package.json')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const sanitize = require('sanitize-filename')
|
||||
const yargs = require('yargs-parser')
|
||||
|
||||
function parseCLIArgs (argv) {
|
||||
let args = yargs(argv, {
|
||||
boolean: [
|
||||
'all',
|
||||
'deref-symlinks',
|
||||
'download.strictSSL',
|
||||
'overwrite',
|
||||
'prune',
|
||||
'quiet'
|
||||
],
|
||||
default: {
|
||||
'deref-symlinks': true,
|
||||
'download.strictSSL': true,
|
||||
prune: true
|
||||
},
|
||||
string: [
|
||||
'electron-version',
|
||||
'out'
|
||||
]
|
||||
})
|
||||
|
||||
args.dir = args._[0]
|
||||
args.name = args._[1]
|
||||
|
||||
const protocolSchemes = [].concat(args.protocol || [])
|
||||
const protocolNames = [].concat(args.protocolName || [])
|
||||
|
||||
if (protocolSchemes && protocolNames && protocolNames.length === protocolSchemes.length) {
|
||||
args.protocols = protocolSchemes.map(function (scheme, i) {
|
||||
return {schemes: [scheme], name: protocolNames[i]}
|
||||
})
|
||||
}
|
||||
|
||||
if (args.out === '') {
|
||||
warning('Specifying --out= without a value is the same as the default value')
|
||||
args.out = null
|
||||
}
|
||||
|
||||
// Overrides for multi-typed arguments, because minimist doesn't support it
|
||||
|
||||
// asar: `Object` or `true`
|
||||
if (args.asar === 'true' || args.asar instanceof Array) {
|
||||
warning('--asar does not take any arguments, it only has sub-properties (see --help)')
|
||||
args.asar = true
|
||||
}
|
||||
|
||||
// osx-sign: `Object` or `true`
|
||||
if (args.osxSign === 'true') {
|
||||
warning('--osx-sign does not take any arguments, it only has sub-properties (see --help)')
|
||||
args.osxSign = true
|
||||
}
|
||||
|
||||
// tmpdir: `String` or `false`
|
||||
if (args.tmpdir === 'false') {
|
||||
warning('--tmpdir=false is deprecated, use --no-tmpdir instead')
|
||||
args.tmpdir = false
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
function sanitizeAppName (name) {
|
||||
return sanitize(name, {replacement: '-'})
|
||||
}
|
||||
|
||||
function generateFinalBasename (opts) {
|
||||
return `${sanitizeAppName(opts.name)}-${opts.platform}-${opts.arch}`
|
||||
}
|
||||
|
||||
function generateFinalPath (opts) {
|
||||
return path.join(opts.out || process.cwd(), generateFinalBasename(opts))
|
||||
}
|
||||
|
||||
function info (message, quiet) {
|
||||
if (!quiet) {
|
||||
console.error(message)
|
||||
}
|
||||
}
|
||||
|
||||
function warning (message, quiet) {
|
||||
if (!quiet) {
|
||||
console.warn(`WARNING: ${message}`)
|
||||
}
|
||||
}
|
||||
|
||||
function subOptionWarning (properties, optionName, parameter, value, quiet) {
|
||||
if (properties.hasOwnProperty(parameter)) {
|
||||
warning(`${optionName}.${parameter} will be inferred from the main options`, quiet)
|
||||
}
|
||||
properties[parameter] = value
|
||||
}
|
||||
|
||||
function createAsarOpts (opts) {
|
||||
let asarOptions
|
||||
if (opts.asar === true) {
|
||||
asarOptions = {}
|
||||
} else if (typeof opts.asar === 'object') {
|
||||
asarOptions = opts.asar
|
||||
} else if (opts.asar === false || opts.asar === undefined) {
|
||||
return false
|
||||
} else {
|
||||
warning(`asar parameter set to an invalid value (${opts.asar}), ignoring and disabling asar`)
|
||||
return false
|
||||
}
|
||||
|
||||
return asarOptions
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parseCLIArgs: parseCLIArgs,
|
||||
|
||||
ensureArray: function ensureArray (value) {
|
||||
return Array.isArray(value) ? value : [value]
|
||||
},
|
||||
isPlatformMac: function isPlatformMac (platform) {
|
||||
return platform === 'darwin' || platform === 'mas'
|
||||
},
|
||||
|
||||
createAsarOpts: createAsarOpts,
|
||||
|
||||
deprecatedParameter: function deprecatedParameter (properties, oldName, newName, newCLIName) {
|
||||
if (properties.hasOwnProperty(oldName)) {
|
||||
warning(`The ${oldName} parameter is deprecated, use ${newName} (or --${newCLIName} in the CLI) instead`)
|
||||
if (!properties.hasOwnProperty(newName)) {
|
||||
properties[newName] = properties[oldName]
|
||||
}
|
||||
delete properties[oldName]
|
||||
}
|
||||
},
|
||||
subOptionWarning: subOptionWarning,
|
||||
|
||||
baseTempDir: function baseTempDir (opts) {
|
||||
return path.join(opts.tmpdir || os.tmpdir(), 'electron-packager')
|
||||
},
|
||||
generateFinalBasename: generateFinalBasename,
|
||||
generateFinalPath: generateFinalPath,
|
||||
sanitizeAppName: sanitizeAppName,
|
||||
/**
|
||||
* Convert slashes to UNIX-format separators.
|
||||
*/
|
||||
normalizePath: function normalizePath (pathToNormalize) {
|
||||
return pathToNormalize.replace(/\\/g, '/')
|
||||
},
|
||||
|
||||
hostInfo: function hostInfo () {
|
||||
return `Electron Packager ${metadata.version}\n` +
|
||||
`Node ${process.version}\n` +
|
||||
`Host Operating system: ${process.platform} (${process.arch})`
|
||||
},
|
||||
info: info,
|
||||
warning: warning
|
||||
}
|
1
node_modules/electron-packager/docs/_config.yml
generated
vendored
Normal file
1
node_modules/electron-packager/docs/_config.yml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
theme: jekyll-theme-cayman
|
434
node_modules/electron-packager/docs/api.md
generated
vendored
Normal file
434
node_modules/electron-packager/docs/api.md
generated
vendored
Normal file
@@ -0,0 +1,434 @@
|
||||
# electron-packager API
|
||||
|
||||
Short Promise example:
|
||||
|
||||
```javascript
|
||||
const packager = require('electron-packager')
|
||||
packager(options)
|
||||
.then(appPaths => { /* … */ })
|
||||
```
|
||||
|
||||
Short [(deprecated) callback syntax](#callback) example:
|
||||
|
||||
```javascript
|
||||
const packager = require('electron-packager')
|
||||
packager(options, function done_callback (err, appPaths) { /* … */ })
|
||||
```
|
||||
|
||||
## `options`
|
||||
|
||||
### Required
|
||||
|
||||
#### `dir`
|
||||
|
||||
*String*
|
||||
|
||||
The source directory.
|
||||
|
||||
### Optional
|
||||
|
||||
#### All Platforms
|
||||
|
||||
##### `afterCopy`
|
||||
|
||||
*Array of Functions*
|
||||
|
||||
An array of functions to be called after your app directory has been copied to a temporary directory. Each function is called with five parameters:
|
||||
|
||||
- `buildPath` (*String*): The path to the temporary folder where your app has been copied to
|
||||
- `electronVersion` (*String*): The version of electron you are packaging for
|
||||
- `platform` (*String*): The target platform you are packaging for
|
||||
- `arch` (*String*): The target architecture you are packaging for
|
||||
- `callback` (*Function*): Must be called once you have completed your actions
|
||||
|
||||
By default, the functions are called in parallel (via
|
||||
[`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all)).
|
||||
If you need the functions called serially, there is a utility function provided:
|
||||
|
||||
```javascript
|
||||
const packager = require('electron-packager')
|
||||
const serialHooks = require('electron-packager/hooks').serialHooks
|
||||
|
||||
packager({
|
||||
// ...
|
||||
afterCopy: [serialHooks([
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
setTimeout(() => {
|
||||
console.log('first function')
|
||||
callback()
|
||||
}, 1000)
|
||||
},
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
console.log('second function')
|
||||
callback()
|
||||
}
|
||||
])],
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
##### `afterExtract`
|
||||
|
||||
*Array of Functions*
|
||||
|
||||
An array of functions to be called after Electron has been extracted to a temporary directory. Each function is called with five parameters:
|
||||
|
||||
- `buildPath` (*String*): The path to the temporary folder where Electron has been extracted to
|
||||
- `electronVersion` (*String*): The version of electron you are packaging for
|
||||
- `platform` (*String*): The target platform you are packaging for
|
||||
- `arch` (*String*): The target architecture you are packaging for
|
||||
- `callback` (*Function*): Must be called once you have completed your actions
|
||||
|
||||
By default, the functions are called in parallel (via
|
||||
[`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all)).
|
||||
If you need the functions called serially, there is a utility function provided:
|
||||
|
||||
```javascript
|
||||
const packager = require('electron-packager')
|
||||
const serialHooks = require('electron-packager/hooks').serialHooks
|
||||
|
||||
packager({
|
||||
// ...
|
||||
afterExtract: [serialHooks([
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
setTimeout(() => {
|
||||
console.log('first function')
|
||||
callback()
|
||||
}, 1000)
|
||||
},
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
console.log('second function')
|
||||
callback()
|
||||
}
|
||||
])],
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
##### `afterPrune`
|
||||
|
||||
*Array of Functions*
|
||||
|
||||
An array of functions to be called after the prune command has been run
|
||||
in the temporary directory. Each function is called with five parameters:
|
||||
|
||||
- `buildPath` (*String*): The path to the temporary folder where your app has been copied to
|
||||
- `electronVersion` (*String*): The version of electron you are packaging for
|
||||
- `platform` (*String*): The target platform you are packaging for
|
||||
- `arch` (*String*): The target architecture you are packaging for
|
||||
- `callback` (*Function*): Must be called once you have completed your actions
|
||||
|
||||
**NOTE:** None of these functions will be called if the `prune` option is `false`.
|
||||
|
||||
By default, the functions are called in parallel (via
|
||||
[`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all)).
|
||||
If you need the functions called serially, there is a utility function provided:
|
||||
|
||||
```javascript
|
||||
const packager = require('electron-packager')
|
||||
const serialHooks = require('electron-packager/hooks').serialHooks
|
||||
|
||||
packager({
|
||||
// ...
|
||||
afterPrune: [serialHooks([
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
setTimeout(() => {
|
||||
console.log('first function')
|
||||
callback()
|
||||
}, 1000)
|
||||
},
|
||||
(buildPath, electronVersion, platform, arch, callback) => {
|
||||
console.log('second function')
|
||||
callback()
|
||||
}
|
||||
])],
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
##### `all`
|
||||
|
||||
*Boolean*
|
||||
|
||||
When `true`, sets both [`arch`](#arch) and [`platform`](#platform) to `all`.
|
||||
|
||||
##### `appCopyright`
|
||||
|
||||
*String*
|
||||
|
||||
The human-readable copyright line for the app. Maps to the `LegalCopyright` metadata property on Windows, and `NSHumanReadableCopyright` on OS X.
|
||||
|
||||
##### `appVersion`
|
||||
|
||||
*String*
|
||||
|
||||
The release version of the application. By default the `version` property in the `package.json` is used but it can be overridden with this argument. If neither are provided, the version of Electron will be used. Maps to the `ProductVersion` metadata property on Windows, and `CFBundleShortVersionString` on OS X.
|
||||
|
||||
#### `arch`
|
||||
|
||||
*String* (default: the arch of the host computer running Node)
|
||||
|
||||
Allowed values: `ia32`, `x64`, `armv7l`, `arm64` _(Electron 1.8.0 and above)_, `mips64el`
|
||||
_(Electron 1.8.2-beta.5 and above)_, `all`
|
||||
|
||||
The target system architecture(s) to build for.
|
||||
Not required if the [`all`](#all) option is set.
|
||||
If `arch` is set to `all`, all supported architectures for the target platforms specified by [`platform`](#platform) will be built.
|
||||
Arbitrary combinations of individual architectures are also supported via a comma-delimited string or array of strings.
|
||||
The non-`all` values correspond to the architecture names used by [Electron releases]. This value
|
||||
is not restricted to the official set if [`download.mirror`](#download) is set.
|
||||
|
||||
##### `asar`
|
||||
|
||||
*Boolean* or *Object* (default: `false`)
|
||||
|
||||
Whether to package the application's source code into an archive, using [Electron's archive format](https://github.com/electron/asar). Reasons why you may want to enable this feature are described in [an application packaging tutorial in Electron's documentation](http://electron.atom.io/docs/v0.36.0/tutorial/application-packaging/). When the value is `true`, pass default configuration to the `asar` module. The configuration values listed below can be customized when the value is an `Object`. Supported parameters include, but are not limited to:
|
||||
- `ordering` (*String*): A path to an ordering file for packing files. An explanation can be found on the [Atom issue tracker](https://github.com/atom/atom/issues/10163).
|
||||
- `unpack` (*String*): A [glob expression](https://github.com/isaacs/minimatch#features), when specified, unpacks the file with matching names to the `app.asar.unpacked` directory.
|
||||
- `unpackDir` (*String*): Unpacks the dir to the `app.asar.unpacked` directory whose names exactly or pattern match this string. The `asar.unpackDir` is relative to `dir`.
|
||||
|
||||
Some examples:
|
||||
|
||||
- `asar.unpackDir = 'sub_dir'` will unpack the directory `/<dir>/sub_dir`
|
||||
- `asar.unpackDir = '**/{sub_dir1/sub_sub_dir,sub_dir2}/*'` will unpack the directories `/<dir>/sub_dir1/sub_sub_dir` and `/<dir>/sub_dir2`, but it will not include their subdirectories.
|
||||
- `asar.unpackDir = '**/{sub_dir1/sub_sub_dir,sub_dir2}/**'` will unpack the subdirectories of the directories `/<dir>/sub_dir1/sub_sub_dir` and `/<dir>/sub_dir2`.
|
||||
- `asar.unpackDir = '**/{sub_dir1/sub_sub_dir,sub_dir2}/**/*'` will unpack the directories `/<dir>/sub_dir1/sub_sub_dir` and `/<dir>/sub_dir2` and their subdirectories.
|
||||
|
||||
##### `buildVersion`
|
||||
|
||||
*String*
|
||||
|
||||
The build version of the application. Defaults to the value of [`appVersion`](#appversion). Maps to the `FileVersion` metadata property on Windows, and `CFBundleVersion` on OS X.
|
||||
|
||||
##### `derefSymlinks`
|
||||
|
||||
*Boolean* (default: `true`)
|
||||
|
||||
Whether symlinks should be dereferenced during the copying of the application source.
|
||||
|
||||
##### `download`
|
||||
|
||||
*Object*
|
||||
|
||||
If present, passes custom options to [`electron-download`](https://www.npmjs.com/package/electron-download)
|
||||
(see the link for more detailed option descriptions and the defaults). Supported parameters include,
|
||||
but are not limited to:
|
||||
- `cache` (*String*): The directory where prebuilt, pre-packaged Electron downloads are cached.
|
||||
- `mirror` (*String*): The URL to override the default Electron download location.
|
||||
- `quiet` (*Boolean* - default: `false`): Whether to show a progress bar when downloading Electron.
|
||||
- `strictSSL` (*Boolean* - default: `true`): Whether SSL certificates are required to be valid when
|
||||
downloading Electron.
|
||||
|
||||
|
||||
##### `electronVersion`
|
||||
|
||||
*String*
|
||||
|
||||
The Electron version with which the app is built (without the leading 'v') - for example,
|
||||
[`1.4.13`](https://github.com/electron/electron/releases/tag/v1.4.13). See [Electron releases] for
|
||||
valid versions. If omitted, it will use the version of the nearest local installation of
|
||||
`electron`, `electron-prebuilt-compile`, or `electron-prebuilt`, defined in `package.json` in either
|
||||
`dependencies` or `devDependencies`.
|
||||
|
||||
##### `extraResource`
|
||||
|
||||
*String* or *Array* of *String*s
|
||||
|
||||
One or more files to be copied directly into the app's `Contents/Resources` directory for OS X
|
||||
target platforms, and the `resources` directory for other target platforms.
|
||||
|
||||
##### `executableName`
|
||||
|
||||
*String*
|
||||
|
||||
The name of the executable file (sans file extension). Defaults to the value for the [`name`](#name)
|
||||
parameter. For `darwin` or `mas` target platforms, this does not affect the name of the `.app`
|
||||
folder - this will use [`name`](#name) parameter.
|
||||
|
||||
##### `icon`
|
||||
|
||||
*String*
|
||||
|
||||
The local path to the icon file, if the target platform supports setting embedding an icon.
|
||||
|
||||
Currently you must look for conversion tools in order to supply an icon in the format required by the platform:
|
||||
|
||||
- OS X: `.icns`
|
||||
- Windows: `.ico` ([See the readme](https://github.com/electron-userland/electron-packager#building-windows-apps-from-non-windows-platforms) for details on non-Windows platforms)
|
||||
- Linux: this option is not required, as the dock/window list icon is set via
|
||||
[the `icon` option in the `BrowserWindow` constructor](http://electron.atom.io/docs/api/browser-window/#new-browserwindowoptions).
|
||||
*Please note that you need to use a PNG, and not the OS X or Windows icon formats, in order for it
|
||||
to show up in the dock/window list.* Setting the icon in the file manager is not currently supported.
|
||||
|
||||
If the file extension is omitted, it is auto-completed to the correct extension based on the platform, including when [`--platform=all`](#platform) is in effect.
|
||||
|
||||
##### `ignore`
|
||||
|
||||
*RegExp*, *Array* of *RegExp*s, or *Function*
|
||||
|
||||
One or more additional [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
|
||||
patterns which specify which files to ignore when copying files to create the app bundle(s). The
|
||||
regular expressions are matched against the absolute path of a given file/directory to be copied.
|
||||
|
||||
The following paths are always ignored (*when you aren't using the predicate function that is
|
||||
described after the list*):
|
||||
|
||||
* the directory specified by the [`out`](#out) parameter
|
||||
* the temporary directory used to build the Electron app
|
||||
* `node_modules/.bin`
|
||||
* `node_modules/electron`
|
||||
* `node_modules/electron-prebuilt`
|
||||
* `node_modules/electron-prebuilt-compile`
|
||||
* `node_modules/electron-packager`
|
||||
* `.git`
|
||||
* files and folders ending in `.o` and `.obj`
|
||||
|
||||
**Please note that [glob patterns](https://en.wikipedia.org/wiki/Glob_%28programming%29) will not work.**
|
||||
|
||||
**Note**: If you're trying to ignore Node modules specified in `devDependencies`, you may want to
|
||||
use [`prune`](#prune) instead.
|
||||
|
||||
Alternatively, this can be a predicate function that, given an absolute file path, returns `true` if
|
||||
the file should be ignored, or `false` if the file should be kept. *This does not use any of the
|
||||
default ignored directories listed above.*
|
||||
|
||||
##### `name`
|
||||
|
||||
*String*
|
||||
|
||||
The application name. If omitted, it will use the `productName` or `name` value from the nearest `package.json`.
|
||||
|
||||
**Regardless of source, characters in the Electron app name which are not allowed in all target
|
||||
platforms' filenames (e.g., `/`), will be replaced by hyphens (`-`).**
|
||||
|
||||
##### `out`
|
||||
|
||||
*String* (default: current working directory)
|
||||
|
||||
The base directory where the finished package(s) are created.
|
||||
|
||||
##### `overwrite`
|
||||
|
||||
*Boolean* (default: `false`)
|
||||
|
||||
Whether to replace an already existing output directory for a given platform (`true`) or skip recreating it (`false`).
|
||||
|
||||
##### `platform`
|
||||
|
||||
*String* (default: the arch of the host computer running Node)
|
||||
|
||||
Allowed values: `linux`, `win32`, `darwin`, `mas`, `all`
|
||||
|
||||
The target platform(s) to build for.
|
||||
Not required if the [`all`](#all) option is set.
|
||||
If `platform` is set to `all`, all [supported target platforms](#supported-platforms) for the target architectures specified by [`arch`](#arch) will be built.
|
||||
Arbitrary combinations of individual platforms are also supported via a comma-delimited string or array of strings.
|
||||
The non-`all` values correspond to the platform names used by [Electron releases]. This value
|
||||
is not restricted to the official set if [`download.mirror`](#download) is set.
|
||||
|
||||
##### `prune`
|
||||
|
||||
*Boolean* (default: `true`)
|
||||
|
||||
Walks the `node_modules` dependency tree to remove all of the packages specified in the
|
||||
`devDependencies` section of `package.json` from the outputted Electron app.
|
||||
|
||||
##### `quiet`
|
||||
|
||||
*Boolean* (default: `false`)
|
||||
|
||||
If `true`, disables printing informational and warning messages to the console when packaging the
|
||||
application. This does *not* disable errors.
|
||||
|
||||
##### `tmpdir`
|
||||
|
||||
*String* or *`false`* (default: system temp directory)
|
||||
|
||||
The base directory to use as a temp directory. Set to `false` to disable use of a temporary directory.
|
||||
|
||||
#### OS X/Mac App Store targets only
|
||||
|
||||
##### `appBundleId`
|
||||
|
||||
*String*
|
||||
|
||||
The bundle identifier to use in the application's plist.
|
||||
|
||||
##### `appCategoryType`
|
||||
|
||||
*String*
|
||||
|
||||
The application category type, as shown in the Finder via *View → Arrange by Application Category* when viewing the Applications directory.
|
||||
|
||||
For example, `app-category-type=public.app-category.developer-tools` will set the application category to *Developer Tools*.
|
||||
|
||||
Valid values are listed in [Apple's documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
|
||||
|
||||
##### `extendInfo`
|
||||
|
||||
*String* or *Object*
|
||||
|
||||
When the value is a `String`, the filename of a plist file. Its contents are added to the app's plist. When the value is an `Object`, an already-parsed plist data structure that is merged into the app's plist.
|
||||
|
||||
Entries from `extend-info` override entries in the base plist file supplied by `electron`, `electron-prebuilt-compile`, or `electron-prebuilt`, but are overridden by other explicit arguments such as [`appVersion`](#appversion) or [`appBundleId`](#appbundleid).
|
||||
|
||||
##### `helperBundleId`
|
||||
|
||||
*String*
|
||||
|
||||
The bundle identifier to use in the application helper's plist.
|
||||
|
||||
##### `osxSign`
|
||||
|
||||
*Object* or *`true`*
|
||||
|
||||
If present, signs OS X target apps when the host platform is OS X and XCode is installed. When the value is `true`, pass default configuration to the signing module. The configuration values listed below can be customized when the value is an `Object`. See [electron-osx-sign](https://www.npmjs.com/package/electron-osx-sign#opts) for more detailed option descriptions and the defaults.
|
||||
- `identity` (*String*): The identity used when signing the package via `codesign`.
|
||||
- `entitlements` (*String*): The path to the 'parent' entitlements.
|
||||
- `entitlements-inherit` (*String*): The path to the 'child' entitlements.
|
||||
|
||||
##### `protocols`
|
||||
|
||||
*Array* of *Object*s
|
||||
|
||||
One or more URL protocols associated with the Electron app.
|
||||
|
||||
Each *Object* is required to have the following properties:
|
||||
|
||||
- `name` (*String*): The descriptive name. Maps to the `CFBundleURLName` metadata property.
|
||||
- `schemes` (*Array* of *String*s): One or more protocol schemes associated with the app. For
|
||||
example, specifying `myapp` would cause URLs such as `myapp://path` to be opened with the app.
|
||||
Maps to the `CFBundleURLSchemes` metadata property.
|
||||
|
||||
#### Windows targets only
|
||||
|
||||
##### `win32metadata`
|
||||
|
||||
*Object*
|
||||
|
||||
Object (also known as a "hash") of application metadata to embed into the executable:
|
||||
- `CompanyName` (defaults to `author` name from the nearest `package.json`)
|
||||
- `FileDescription` (defaults to either `productName` or `name` from the nearest `package.json`)
|
||||
- `OriginalFilename` (defaults to renamed `.exe` file)
|
||||
- `ProductName` (defaults to either `productName` or `name` from the nearest `package.json`)
|
||||
- `InternalName` (defaults to either `productName` or `name` from the nearest `package.json`)
|
||||
- `requested-execution-level`
|
||||
- `application-manifest`
|
||||
|
||||
For more information, see the [`node-rcedit` module](https://github.com/electron/node-rcedit).
|
||||
|
||||
## callback
|
||||
|
||||
### `err`
|
||||
|
||||
*Error* (or *Array*, in the case of an `copy` error)
|
||||
|
||||
Contains errors, if any.
|
||||
|
||||
### `appPaths`
|
||||
|
||||
*Array* of *String*s
|
||||
|
||||
Paths to the newly created application bundles.
|
||||
|
||||
[Electron releases]: https://github.com/electron/electron/releases
|
47
node_modules/electron-packager/docs/faq.md
generated
vendored
Normal file
47
node_modules/electron-packager/docs/faq.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Frequently Asked Questions
|
||||
|
||||
## Why does the menubar appear when running in development mode, but disappear when packaged?
|
||||
|
||||
Based on [a comment from **@MarshallOfSound**](https://github.com/electron-userland/electron-packager/issues/553#issuecomment-270805213):
|
||||
|
||||
When you're running in "development mode" (for example, `electron /path/to/app`), Electron uses the
|
||||
`default_app` codepath to run your app, which also provides a default menubar. When the app is
|
||||
packaged, Electron runs your app directly. To have a menubar that's consistent between development
|
||||
and packaged modes, you'll need to [define it yourself](https://electron.atom.io/docs/api/menu/).
|
||||
|
||||
## Why isn't my `ignore` option working?
|
||||
|
||||
As stated in the documentation for [`ignore`](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#ignore), it uses "[one] or more additional
|
||||
[regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)
|
||||
patterns. […] Please note that [glob patterns](https://en.wikipedia.org/wiki/Glob_%28programming%29)
|
||||
will not work."
|
||||
|
||||
## Why isn't the relative path in my app code working?
|
||||
|
||||
To make a path work in both development and packaged mode, you'll need to generate a path based on
|
||||
the location of the JavaScript file that is referencing the file. For example, if you had an app
|
||||
structure like the following:
|
||||
|
||||
```
|
||||
AppName
|
||||
├── package.json
|
||||
├── data
|
||||
│ └── somedata.json
|
||||
└── src
|
||||
└── main.js
|
||||
```
|
||||
|
||||
In `src/main.js`, you would access `data/somedata.json` similar to this:
|
||||
|
||||
```javascript
|
||||
const path = require('path');
|
||||
const jsonFilename = path.resolve(__dirname, '..', 'data', 'somedata.json');
|
||||
console.log(require(jsonFilename));
|
||||
```
|
||||
|
||||
## How do I set an icon on Linux?
|
||||
|
||||
The docs for [`icon`](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#icon)
|
||||
already show how to set an icon on your `BrowserWindow`, but your dock/taskbar may not use that and
|
||||
instead use the `Icon` value in your `.desktop` file. The [Linux distributable creators](https://github.com/electron-userland/electron-packager#distributable-creators)
|
||||
can help you set/distribute the appropriate icon in that case.
|
39
node_modules/electron-packager/download.js
generated
vendored
Normal file
39
node_modules/electron-packager/download.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('./common')
|
||||
const debug = require('debug')('electron-packager')
|
||||
const download = require('electron-download')
|
||||
const pify = require('pify')
|
||||
const semver = require('semver')
|
||||
const targets = require('./targets')
|
||||
|
||||
function createDownloadOpts (opts, platform, arch) {
|
||||
let downloadOpts = Object.assign({}, opts.download)
|
||||
|
||||
common.subOptionWarning(downloadOpts, 'download', 'platform', platform, opts.quiet)
|
||||
common.subOptionWarning(downloadOpts, 'download', 'arch', arch, opts.quiet)
|
||||
common.subOptionWarning(downloadOpts, 'download', 'version', opts.electronVersion, opts.quiet)
|
||||
|
||||
return downloadOpts
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createDownloadCombos: function createDownloadCombos (opts, selectedPlatforms, selectedArchs, ignoreFunc) {
|
||||
return targets.createPlatformArchPairs(opts, selectedPlatforms, selectedArchs, ignoreFunc).map(combo => {
|
||||
const platform = combo[0]
|
||||
const arch = combo[1]
|
||||
return createDownloadOpts(opts, platform, arch)
|
||||
})
|
||||
},
|
||||
createDownloadOpts: createDownloadOpts,
|
||||
downloadElectronZip: function downloadElectronZip (downloadOpts) {
|
||||
// armv7l builds have only been backfilled for Electron >= 1.0.0.
|
||||
// See: https://github.com/electron/electron/pull/6986
|
||||
/* istanbul ignore if */
|
||||
if (downloadOpts.arch === 'armv7l' && semver.lt(downloadOpts.version, '1.0.0')) {
|
||||
downloadOpts.arch = 'arm'
|
||||
}
|
||||
debug(`Downloading Electron with options ${JSON.stringify(downloadOpts)}`)
|
||||
return pify(download)(downloadOpts)
|
||||
}
|
||||
}
|
25
node_modules/electron-packager/hooks.js
generated
vendored
Normal file
25
node_modules/electron-packager/hooks.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
const pify = require('pify')
|
||||
|
||||
module.exports = {
|
||||
promisifyHooks: function promisifyHooks (hooks, args) {
|
||||
if (!hooks || !Array.isArray(hooks)) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
return Promise.all(hooks.map(hookFn => pify(hookFn).apply(this, args)))
|
||||
},
|
||||
serialHooks: function serialHooks (hooks) {
|
||||
return function () {
|
||||
const args = Array.prototype.splice.call(arguments, 0, arguments.length - 1)
|
||||
const done = arguments[arguments.length - 1]
|
||||
let result = Promise.resolve()
|
||||
for (const hook of hooks) {
|
||||
result = result.then(() => hook.apply(this, args))
|
||||
}
|
||||
|
||||
return result.then(() => done()) // eslint-disable-line promise/no-callback-in-promise
|
||||
}
|
||||
}
|
||||
}
|
94
node_modules/electron-packager/ignore.js
generated
vendored
Normal file
94
node_modules/electron-packager/ignore.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('./common')
|
||||
const debug = require('debug')('electron-packager')
|
||||
const path = require('path')
|
||||
const prune = require('./prune')
|
||||
const targets = require('./targets')
|
||||
|
||||
const DEFAULT_IGNORES = [
|
||||
'/\\.git($|/)',
|
||||
'/node_modules/\\.bin($|/)',
|
||||
'\\.o(bj)?$'
|
||||
]
|
||||
|
||||
function generateIgnores (opts) {
|
||||
if (typeof (opts.ignore) !== 'function') {
|
||||
if (opts.ignore) {
|
||||
opts.ignore = common.ensureArray(opts.ignore).concat(DEFAULT_IGNORES)
|
||||
} else {
|
||||
opts.ignore = [].concat(DEFAULT_IGNORES)
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
opts.ignore.push(common.baseTempDir(opts))
|
||||
}
|
||||
|
||||
debug('Ignored path regular expressions:', opts.ignore)
|
||||
}
|
||||
}
|
||||
|
||||
function generateOutIgnores (opts) {
|
||||
const normalizedOut = opts.out ? path.resolve(opts.out) : null
|
||||
const outIgnores = []
|
||||
if (normalizedOut === null || normalizedOut === process.cwd()) {
|
||||
for (const platform of Object.keys(targets.officialPlatformArchCombos)) {
|
||||
for (const arch of targets.officialPlatformArchCombos[platform]) {
|
||||
let basenameOpts = {
|
||||
arch: arch,
|
||||
name: opts.name,
|
||||
platform: platform
|
||||
}
|
||||
outIgnores.push(path.join(process.cwd(), common.generateFinalBasename(basenameOpts)))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outIgnores.push(normalizedOut)
|
||||
}
|
||||
|
||||
debug('Ignored paths based on the out param:', outIgnores)
|
||||
|
||||
return outIgnores
|
||||
}
|
||||
|
||||
function userIgnoreFilter (opts) {
|
||||
let ignore = opts.ignore || []
|
||||
let ignoreFunc = null
|
||||
|
||||
if (typeof (ignore) === 'function') {
|
||||
ignoreFunc = file => { return !ignore(file) }
|
||||
} else {
|
||||
ignore = common.ensureArray(ignore)
|
||||
|
||||
ignoreFunc = function filterByRegexes (file) {
|
||||
return !ignore.some(regex => file.match(regex))
|
||||
}
|
||||
}
|
||||
|
||||
const outIgnores = generateOutIgnores(opts)
|
||||
const pruner = opts.prune ? new prune.Pruner(opts.dir) : null
|
||||
|
||||
return function filter (file) {
|
||||
if (outIgnores.indexOf(file) !== -1) {
|
||||
return false
|
||||
}
|
||||
|
||||
let name = file.split(path.resolve(opts.dir))[1]
|
||||
|
||||
if (path.sep === '\\') {
|
||||
name = common.normalizePath(name)
|
||||
}
|
||||
|
||||
if (pruner && name.startsWith('/node_modules/')) {
|
||||
return prune.isModule(file)
|
||||
.then(isModule => isModule ? pruner.pruneModule(name) : ignoreFunc(name))
|
||||
}
|
||||
|
||||
return ignoreFunc(name)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateIgnores: generateIgnores,
|
||||
generateOutIgnores: generateOutIgnores,
|
||||
userIgnoreFilter: userIgnoreFilter
|
||||
}
|
185
node_modules/electron-packager/index.js
generated
vendored
Normal file
185
node_modules/electron-packager/index.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('./common')
|
||||
const debug = require('debug')('electron-packager')
|
||||
const download = require('./download')
|
||||
const extract = require('extract-zip')
|
||||
const fs = require('fs-extra')
|
||||
const getMetadataFromPackageJSON = require('./infer')
|
||||
const hooks = require('./hooks')
|
||||
const ignore = require('./ignore')
|
||||
const nodeify = require('nodeify')
|
||||
const path = require('path')
|
||||
const pify = require('pify')
|
||||
const targets = require('./targets')
|
||||
|
||||
function debugHostInfo () {
|
||||
debug(common.hostInfo())
|
||||
}
|
||||
|
||||
class Packager {
|
||||
constructor (opts) {
|
||||
this.opts = opts
|
||||
this.tempBase = common.baseTempDir(opts)
|
||||
this.useTempDir = opts.tmpdir !== false
|
||||
this.canCreateSymlinks = undefined
|
||||
}
|
||||
|
||||
ensureTempDir () {
|
||||
if (this.useTempDir) {
|
||||
return fs.remove(this.tempBase)
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
testSymlink (comboOpts, zipPath) {
|
||||
const testPath = path.join(this.tempBase, 'symlink-test')
|
||||
const testFile = path.join(testPath, 'test')
|
||||
const testLink = path.join(testPath, 'testlink')
|
||||
|
||||
const cleanup = (symlinksWork) =>
|
||||
fs.remove(testPath).then(() => symlinksWork)
|
||||
|
||||
return fs.outputFile(testFile, '')
|
||||
.then(() => fs.symlink(testFile, testLink))
|
||||
.then(() => cleanup(true))
|
||||
.catch(/* istanbul ignore next */ () => cleanup(false))
|
||||
.then(result => {
|
||||
this.canCreateSymlinks = result
|
||||
if (this.canCreateSymlinks) return this.checkOverwrite(comboOpts, zipPath)
|
||||
|
||||
/* istanbul ignore next */
|
||||
return this.skipHostPlatformSansSymlinkSupport(comboOpts)
|
||||
})
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
skipHostPlatformSansSymlinkSupport (comboOpts) {
|
||||
common.info(`Cannot create symlinks (on Windows hosts, it requires admin privileges); skipping ${comboOpts.platform} platform`, this.opts.quiet)
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
overwriteAndCreateApp (outDir, comboOpts, zipPath) {
|
||||
debug(`Removing ${outDir} due to setting overwrite: true`)
|
||||
return fs.remove(outDir)
|
||||
.then(() => this.createApp(comboOpts, zipPath))
|
||||
}
|
||||
|
||||
extractElectronZip (comboOpts, zipPath, buildDir) {
|
||||
debug(`Extracting ${zipPath} to ${buildDir}`)
|
||||
return pify(extract)(zipPath, { dir: buildDir })
|
||||
.then(() => hooks.promisifyHooks(this.opts.afterExtract, [buildDir, comboOpts.electronVersion, comboOpts.platform, comboOpts.arch]))
|
||||
}
|
||||
|
||||
createApp (comboOpts, zipPath) {
|
||||
let buildParentDir
|
||||
if (this.useTempDir) {
|
||||
buildParentDir = this.tempBase
|
||||
} else {
|
||||
buildParentDir = this.opts.out || process.cwd()
|
||||
}
|
||||
const buildDir = path.resolve(buildParentDir, `${comboOpts.platform}-${comboOpts.arch}-template`)
|
||||
common.info(`Packaging app for platform ${comboOpts.platform} ${comboOpts.arch} using electron v${comboOpts.electronVersion}`, this.opts.quiet)
|
||||
|
||||
debug(`Creating ${buildDir}`)
|
||||
return fs.ensureDir(buildDir)
|
||||
.then(() => this.extractElectronZip(comboOpts, zipPath, buildDir))
|
||||
.then(() => {
|
||||
const os = require(targets.osModules[comboOpts.platform])
|
||||
const app = new os.App(comboOpts, buildDir)
|
||||
return app.create()
|
||||
})
|
||||
}
|
||||
|
||||
checkOverwrite (comboOpts, zipPath) {
|
||||
const finalPath = common.generateFinalPath(comboOpts)
|
||||
return fs.pathExists(finalPath)
|
||||
.then(exists => {
|
||||
if (exists) {
|
||||
if (this.opts.overwrite) {
|
||||
return this.overwriteAndCreateApp(finalPath, comboOpts, zipPath)
|
||||
} else {
|
||||
common.info(`Skipping ${comboOpts.platform} ${comboOpts.arch} (output dir already exists, use --overwrite to force)`, this.opts.quiet)
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return this.createApp(comboOpts, zipPath)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
packageForPlatformAndArch (downloadOpts) {
|
||||
return download.downloadElectronZip(downloadOpts)
|
||||
.then(zipPath => {
|
||||
// Create delegated options object with specific platform and arch, for output directory naming
|
||||
const comboOpts = Object.assign({}, this.opts, {
|
||||
arch: downloadOpts.arch,
|
||||
platform: downloadOpts.platform,
|
||||
electronVersion: downloadOpts.version
|
||||
})
|
||||
|
||||
if (!this.useTempDir) {
|
||||
return this.createApp(comboOpts, zipPath)
|
||||
}
|
||||
|
||||
if (common.isPlatformMac(comboOpts.platform)) {
|
||||
/* istanbul ignore else */
|
||||
if (this.canCreateSymlinks === undefined) {
|
||||
return this.testSymlink(comboOpts, zipPath)
|
||||
} else if (!this.canCreateSymlinks) {
|
||||
return this.skipHostPlatformSansSymlinkSupport(comboOpts)
|
||||
}
|
||||
}
|
||||
|
||||
return this.checkOverwrite(comboOpts, zipPath)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function packageAllSpecifiedCombos (opts, archs, platforms) {
|
||||
const packager = new Packager(opts)
|
||||
return packager.ensureTempDir()
|
||||
.then(() => Promise.all(download.createDownloadCombos(opts, platforms, archs).map(
|
||||
downloadOpts => packager.packageForPlatformAndArch(downloadOpts)
|
||||
)))
|
||||
}
|
||||
|
||||
function packagerPromise (opts) {
|
||||
debugHostInfo()
|
||||
if (debug.enabled) debug(`Packager Options: ${JSON.stringify(opts)}`)
|
||||
|
||||
const archs = targets.validateListFromOptions(opts, 'arch')
|
||||
const platforms = targets.validateListFromOptions(opts, 'platform')
|
||||
if (!Array.isArray(archs)) return Promise.reject(archs)
|
||||
if (!Array.isArray(platforms)) return Promise.reject(platforms)
|
||||
|
||||
debug(`Target Platforms: ${platforms.join(', ')}`)
|
||||
debug(`Target Architectures: ${archs.join(', ')}`)
|
||||
|
||||
const packageJSONDir = path.resolve(process.cwd(), opts.dir) || process.cwd()
|
||||
|
||||
return getMetadataFromPackageJSON(platforms, opts, packageJSONDir)
|
||||
.then(() => {
|
||||
if (opts.name.endsWith(' Helper')) {
|
||||
throw new Error('Application names cannot end in " Helper" due to limitations on macOS')
|
||||
}
|
||||
|
||||
debug(`Application name: ${opts.name}`)
|
||||
debug(`Target Electron version: ${opts.electronVersion}`)
|
||||
|
||||
ignore.generateIgnores(opts)
|
||||
|
||||
return packageAllSpecifiedCombos(opts, archs, platforms)
|
||||
})
|
||||
// Remove falsy entries (e.g. skipped platforms)
|
||||
.then(appPaths => appPaths.filter(appPath => appPath))
|
||||
}
|
||||
|
||||
module.exports = function packager (opts, cb) {
|
||||
if (cb) {
|
||||
/* istanbul ignore next */
|
||||
common.warning('The callback-based version of packager() is deprecated and will be removed in a future major version, please convert to the Promise version or use the nodeify module.')
|
||||
}
|
||||
return nodeify(packagerPromise(opts), cb)
|
||||
}
|
140
node_modules/electron-packager/infer.js
generated
vendored
Normal file
140
node_modules/electron-packager/infer.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
'use strict'
|
||||
|
||||
const debug = require('debug')('electron-packager')
|
||||
const getPackageInfo = require('get-package-info')
|
||||
const parseAuthor = require('parse-author')
|
||||
const path = require('path')
|
||||
const pify = require('pify')
|
||||
const resolve = require('resolve')
|
||||
|
||||
function isMissingRequiredProperty (props) {
|
||||
return props.some(prop => prop === 'productName' || prop === 'dependencies.electron')
|
||||
}
|
||||
|
||||
function errorMessageForProperty (prop) {
|
||||
let hash, propDescription
|
||||
switch (prop) {
|
||||
case 'productName':
|
||||
hash = 'name'
|
||||
propDescription = 'application name'
|
||||
break
|
||||
case 'dependencies.electron':
|
||||
hash = 'electronversion'
|
||||
propDescription = 'Electron version'
|
||||
break
|
||||
default:
|
||||
hash = ''
|
||||
propDescription = '[Unknown Property]'
|
||||
}
|
||||
|
||||
return `Unable to determine ${propDescription}. Please specify an ${propDescription}\n\n` +
|
||||
'For more information, please see\n' +
|
||||
`https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#${hash}\n`
|
||||
}
|
||||
|
||||
function getVersion (opts, electronProp) {
|
||||
// Destructured assignments are added in Node 6
|
||||
const splitProp = electronProp.prop.split('.')
|
||||
const depType = splitProp[0]
|
||||
const packageName = splitProp[1]
|
||||
const src = electronProp.src
|
||||
if (packageName === 'electron-prebuilt-compile') {
|
||||
// electron-prebuilt-compile cannot be resolved because `main` does not point
|
||||
// to a valid JS file.
|
||||
const electronVersion = electronProp.pkg[depType][packageName]
|
||||
if (!/^\d+\.\d+\.\d+/.test(electronVersion)) {
|
||||
throw new Error('Using electron-prebuilt-compile with Electron Packager requires specifying an exact Electron version')
|
||||
}
|
||||
|
||||
opts.electronVersion = electronVersion
|
||||
return Promise.resolve()
|
||||
} else {
|
||||
return pify(resolve, { multiArgs: true })(packageName, { basedir: path.dirname(src) })
|
||||
.then(res => {
|
||||
debug(`Inferring target Electron version from ${packageName} in ${src}`)
|
||||
const pkg = res[1]
|
||||
opts.electronVersion = pkg.version
|
||||
return null
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function handleMetadata (opts, result) {
|
||||
if (result.values.productName) {
|
||||
debug(`Inferring application name from ${result.source.productName.prop} in ${result.source.productName.src}`)
|
||||
opts.name = result.values.productName
|
||||
}
|
||||
|
||||
if (result.values.version) {
|
||||
debug(`Inferring appVersion from version in ${result.source.version.src}`)
|
||||
opts.appVersion = result.values.version
|
||||
}
|
||||
|
||||
if (result.values.author && !opts.win32metadata) {
|
||||
opts.win32metadata = {}
|
||||
}
|
||||
|
||||
if (result.values.author) {
|
||||
debug(`Inferring win32metadata.CompanyName from author in ${result.source.author.src}`)
|
||||
if (typeof result.values.author === 'string') {
|
||||
opts.win32metadata.CompanyName = parseAuthor(result.values.author).name
|
||||
} else if (result.values.author.name) {
|
||||
opts.win32metadata.CompanyName = result.values.author.name
|
||||
} else {
|
||||
debug('Cannot infer win32metadata.CompanyName from author, no name found')
|
||||
}
|
||||
}
|
||||
|
||||
if (result.values['dependencies.electron']) {
|
||||
return getVersion(opts, result.source['dependencies.electron'])
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function getMetadataFromPackageJSON (platforms, opts, dir) {
|
||||
let props = []
|
||||
if (!opts.name) props.push(['productName', 'name'])
|
||||
if (!opts.appVersion) props.push('version')
|
||||
if (!opts.electronVersion) {
|
||||
props.push([
|
||||
'dependencies.electron',
|
||||
'devDependencies.electron',
|
||||
'dependencies.electron-prebuilt-compile',
|
||||
'devDependencies.electron-prebuilt-compile',
|
||||
'dependencies.electron-prebuilt',
|
||||
'devDependencies.electron-prebuilt'
|
||||
])
|
||||
}
|
||||
|
||||
if (platforms.indexOf('win32') !== -1 && !(opts.win32metadata && opts.win32metadata.CompanyName)) {
|
||||
props.push('author')
|
||||
}
|
||||
|
||||
// Name and version provided, no need to infer
|
||||
if (props.length === 0) return Promise.resolve()
|
||||
|
||||
// Search package.json files to infer name and version from
|
||||
return getPackageInfo(props, dir)
|
||||
.then(result => handleMetadata(opts, result))
|
||||
.catch(err => {
|
||||
if (err.missingProps) {
|
||||
const missingProps = err.missingProps.map(prop => {
|
||||
return Array.isArray(prop) ? prop[0] : prop
|
||||
})
|
||||
|
||||
if (isMissingRequiredProperty(missingProps)) {
|
||||
const messages = missingProps.map(errorMessageForProperty)
|
||||
|
||||
debug(err.message)
|
||||
err.message = messages.join('\n') + '\n'
|
||||
throw err
|
||||
} else {
|
||||
// Missing props not required, can continue w/ partial result
|
||||
return handleMetadata(opts, err.result)
|
||||
}
|
||||
}
|
||||
|
||||
throw err
|
||||
})
|
||||
}
|
25
node_modules/electron-packager/linux.js
generated
vendored
Normal file
25
node_modules/electron-packager/linux.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
const App = require('./platform')
|
||||
const common = require('./common')
|
||||
|
||||
class LinuxApp extends App {
|
||||
get originalElectronName () {
|
||||
return 'electron'
|
||||
}
|
||||
|
||||
get newElectronName () {
|
||||
return common.sanitizeAppName(this.executableName)
|
||||
}
|
||||
|
||||
create () {
|
||||
return this.initialize()
|
||||
.then(() => this.renameElectron())
|
||||
.then(() => this.copyExtraResources())
|
||||
.then(() => this.move())
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
App: LinuxApp
|
||||
}
|
332
node_modules/electron-packager/mac.js
generated
vendored
Normal file
332
node_modules/electron-packager/mac.js
generated
vendored
Normal file
@@ -0,0 +1,332 @@
|
||||
'use strict'
|
||||
|
||||
const App = require('./platform')
|
||||
const common = require('./common')
|
||||
const debug = require('debug')('electron-packager')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const plist = require('plist')
|
||||
const sign = require('electron-osx-sign').signAsync
|
||||
|
||||
class MacApp extends App {
|
||||
constructor (opts, templatePath) {
|
||||
super(opts, templatePath)
|
||||
|
||||
this.appName = opts.name
|
||||
}
|
||||
|
||||
get appCategoryType () {
|
||||
return this.opts.appCategoryType
|
||||
}
|
||||
|
||||
get appCopyright () {
|
||||
return this.opts.appCopyright
|
||||
}
|
||||
|
||||
get appVersion () {
|
||||
return this.opts.appVersion
|
||||
}
|
||||
|
||||
get buildVersion () {
|
||||
return this.opts.buildVersion
|
||||
}
|
||||
|
||||
get protocols () {
|
||||
return this.opts.protocols.map((protocol) => {
|
||||
return {
|
||||
CFBundleURLName: protocol.name,
|
||||
CFBundleURLSchemes: [].concat(protocol.schemes)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
get dotAppName () {
|
||||
return `${common.sanitizeAppName(this.appName)}.app`
|
||||
}
|
||||
|
||||
get defaultBundleName () {
|
||||
return `com.electron.${common.sanitizeAppName(this.appName).toLowerCase()}`
|
||||
}
|
||||
|
||||
get originalResourcesDir () {
|
||||
return path.join(this.contentsPath, 'Resources')
|
||||
}
|
||||
|
||||
get resourcesDir () {
|
||||
return path.join(this.dotAppName, 'Contents', 'Resources')
|
||||
}
|
||||
|
||||
get electronBinaryDir () {
|
||||
return path.join(this.contentsPath, 'MacOS')
|
||||
}
|
||||
|
||||
get originalElectronName () {
|
||||
return 'Electron'
|
||||
}
|
||||
|
||||
get newElectronName () {
|
||||
return this.appPlist.CFBundleExecutable
|
||||
}
|
||||
|
||||
get renamedAppPath () {
|
||||
return path.join(this.stagingPath, this.dotAppName)
|
||||
}
|
||||
|
||||
get electronAppPath () {
|
||||
return path.join(this.stagingPath, `${this.originalElectronName}.app`)
|
||||
}
|
||||
|
||||
get contentsPath () {
|
||||
return path.join(this.electronAppPath, 'Contents')
|
||||
}
|
||||
|
||||
get frameworksPath () {
|
||||
return path.join(this.contentsPath, 'Frameworks')
|
||||
}
|
||||
|
||||
get loginItemsPath () {
|
||||
return path.join(this.contentsPath, 'Library', 'LoginItems')
|
||||
}
|
||||
|
||||
get loginHelperPath () {
|
||||
return path.join(this.loginItemsPath, 'Electron Login Helper.app')
|
||||
}
|
||||
|
||||
updatePlist (base, displayName, identifier, name) {
|
||||
return Object.assign(base, {
|
||||
CFBundleDisplayName: displayName,
|
||||
CFBundleExecutable: common.sanitizeAppName(displayName),
|
||||
CFBundleIdentifier: identifier,
|
||||
CFBundleName: common.sanitizeAppName(name)
|
||||
})
|
||||
}
|
||||
|
||||
updateHelperPlist (base, suffix) {
|
||||
let helperSuffix, identifier, name
|
||||
if (suffix) {
|
||||
helperSuffix = `Helper ${suffix}`
|
||||
identifier = `${this.helperBundleIdentifier}.${suffix}`
|
||||
name = `${this.appName} ${helperSuffix}`
|
||||
} else {
|
||||
helperSuffix = 'Helper'
|
||||
identifier = this.helperBundleIdentifier
|
||||
name = this.appName
|
||||
}
|
||||
return this.updatePlist(base, `${this.appName} ${helperSuffix}`, identifier, name)
|
||||
}
|
||||
|
||||
extendAppPlist (propsOrFilename) {
|
||||
if (!propsOrFilename) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
if (typeof propsOrFilename === 'string') {
|
||||
return this.loadPlist(propsOrFilename)
|
||||
.then(plist => Object.assign(this.appPlist, plist))
|
||||
} else {
|
||||
return Promise.resolve(Object.assign(this.appPlist, propsOrFilename))
|
||||
}
|
||||
}
|
||||
|
||||
loadPlist (filename, propName) {
|
||||
return fs.readFile(filename)
|
||||
.then(buffer => plist.parse(buffer.toString()))
|
||||
.then(plist => {
|
||||
if (propName) this[propName] = plist
|
||||
return plist
|
||||
})
|
||||
}
|
||||
|
||||
ehPlistFilename (helper) {
|
||||
return this.helperPlistFilename(path.join(this.frameworksPath, helper))
|
||||
}
|
||||
|
||||
helperPlistFilename (helperApp) {
|
||||
return path.join(helperApp, 'Contents', 'Info.plist')
|
||||
}
|
||||
|
||||
determinePlistFilesToUpdate () {
|
||||
const appPlistFilename = path.join(this.contentsPath, 'Info.plist')
|
||||
const helperPlistFilename = this.ehPlistFilename('Electron Helper.app')
|
||||
const helperEHPlistFilename = this.ehPlistFilename('Electron Helper EH.app')
|
||||
const helperNPPlistFilename = this.ehPlistFilename('Electron Helper NP.app')
|
||||
const loginHelperPlistFilename = this.helperPlistFilename(this.loginHelperPath)
|
||||
|
||||
const plists = [
|
||||
[appPlistFilename, 'appPlist'],
|
||||
[helperPlistFilename, 'helperPlist'],
|
||||
[helperEHPlistFilename, 'helperEHPlist'],
|
||||
[helperNPPlistFilename, 'helperNPPlist']
|
||||
]
|
||||
|
||||
return fs.pathExists(loginHelperPlistFilename)
|
||||
.then(exists => {
|
||||
if (exists) {
|
||||
plists.push([loginHelperPlistFilename, 'loginHelperPlist'])
|
||||
}
|
||||
return plists
|
||||
})
|
||||
}
|
||||
|
||||
updatePlistFiles () {
|
||||
let plists
|
||||
|
||||
const appBundleIdentifier = filterCFBundleIdentifier(this.opts.appBundleId || this.defaultBundleName)
|
||||
this.helperBundleIdentifier = filterCFBundleIdentifier(this.opts.helperBundleId || `${appBundleIdentifier}.helper`)
|
||||
|
||||
return this.determinePlistFilesToUpdate()
|
||||
.then(plistsToUpdate => {
|
||||
plists = plistsToUpdate
|
||||
return Promise.all(plists.map(plistArgs => this.loadPlist.apply(this, plistArgs)))
|
||||
}).then(() => this.extendAppPlist(this.opts.extendInfo))
|
||||
.then(() => {
|
||||
this.appPlist = this.updatePlist(this.appPlist, this.executableName, appBundleIdentifier, this.appName)
|
||||
this.helperPlist = this.updateHelperPlist(this.helperPlist)
|
||||
this.helperEHPlist = this.updateHelperPlist(this.helperEHPlist, 'EH')
|
||||
this.helperNPPlist = this.updateHelperPlist(this.helperNPPlist, 'NP')
|
||||
|
||||
if (this.loginHelperPlist) {
|
||||
const loginHelperName = common.sanitizeAppName(`${this.appName} Login Helper`)
|
||||
this.loginHelperPlist.CFBundleExecutable = loginHelperName
|
||||
this.loginHelperPlist.CFBundleIdentifier = `${appBundleIdentifier}.loginhelper`
|
||||
this.loginHelperPlist.CFBundleName = loginHelperName
|
||||
}
|
||||
|
||||
if (this.appVersion) {
|
||||
this.appPlist.CFBundleShortVersionString = this.appPlist.CFBundleVersion = '' + this.appVersion
|
||||
}
|
||||
|
||||
if (this.buildVersion) {
|
||||
this.appPlist.CFBundleVersion = '' + this.buildVersion
|
||||
}
|
||||
|
||||
if (this.opts.protocols && this.opts.protocols.length) {
|
||||
this.appPlist.CFBundleURLTypes = this.protocols
|
||||
}
|
||||
|
||||
if (this.appCategoryType) {
|
||||
this.appPlist.LSApplicationCategoryType = this.appCategoryType
|
||||
}
|
||||
|
||||
if (this.appCopyright) {
|
||||
this.appPlist.NSHumanReadableCopyright = this.appCopyright
|
||||
}
|
||||
|
||||
return Promise.all(plists.map(plistArgs => {
|
||||
const filename = plistArgs[0]
|
||||
const varName = plistArgs[1]
|
||||
return fs.writeFile(filename, plist.build(this[varName]))
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
moveHelpers () {
|
||||
const helpers = [' Helper', ' Helper EH', ' Helper NP']
|
||||
return Promise.all(helpers.map(suffix => this.moveHelper(this.frameworksPath, suffix)))
|
||||
.then(() => fs.pathExists(this.loginItemsPath))
|
||||
.then(exists => exists ? this.moveHelper(this.loginItemsPath, ' Login Helper') : null)
|
||||
}
|
||||
|
||||
moveHelper (helperDirectory, suffix) {
|
||||
const originalBasename = `Electron${suffix}`
|
||||
const newBasename = `${common.sanitizeAppName(this.appName)}${suffix}`
|
||||
const originalAppname = `${originalBasename}.app`
|
||||
const executableBasePath = path.join(helperDirectory, originalAppname, 'Contents', 'MacOS')
|
||||
|
||||
return this.relativeRename(executableBasePath, originalBasename, newBasename)
|
||||
.then(() => this.relativeRename(helperDirectory, originalAppname, `${newBasename}.app`))
|
||||
}
|
||||
|
||||
copyIcon () {
|
||||
if (!this.opts.icon) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
return this.normalizeIconExtension('.icns')
|
||||
// Ignore error if icon doesn't exist, in case it's only available for other OS
|
||||
.catch(Promise.resolve)
|
||||
.then(icon => {
|
||||
debug(`Copying icon "${icon}" to app's Resources as "${this.appPlist.CFBundleIconFile}"`)
|
||||
return fs.copy(icon, path.join(this.originalResourcesDir, this.appPlist.CFBundleIconFile))
|
||||
})
|
||||
}
|
||||
|
||||
renameAppAndHelpers () {
|
||||
return this.moveHelpers()
|
||||
.then(() => fs.rename(this.electronAppPath, this.renamedAppPath))
|
||||
}
|
||||
|
||||
signAppIfSpecified () {
|
||||
let osxSignOpt = this.opts.osxSign
|
||||
let platform = this.opts.platform
|
||||
let version = this.opts.electronVersion
|
||||
|
||||
if ((platform === 'all' || platform === 'mas') &&
|
||||
osxSignOpt === undefined) {
|
||||
common.warning('signing is required for mas builds. Provide the osx-sign option, ' +
|
||||
'or manually sign the app later.')
|
||||
}
|
||||
|
||||
if (osxSignOpt) {
|
||||
const signOpts = createSignOpts(osxSignOpt, platform, this.renamedAppPath, version, this.opts.quiet)
|
||||
debug(`Running electron-osx-sign with the options ${JSON.stringify(signOpts)}`)
|
||||
return sign(signOpts)
|
||||
// Although not signed successfully, the application is packed.
|
||||
.catch(err => common.warning(`Code sign failed; please retry manually. ${err}`))
|
||||
} else {
|
||||
return Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
create () {
|
||||
return this.initialize()
|
||||
.then(() => this.updatePlistFiles())
|
||||
.then(() => this.copyIcon())
|
||||
.then(() => this.renameElectron())
|
||||
.then(() => this.renameAppAndHelpers())
|
||||
.then(() => this.copyExtraResources())
|
||||
.then(() => this.signAppIfSpecified())
|
||||
.then(() => this.move())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove special characters and allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)
|
||||
* Apple documentation:
|
||||
* https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070
|
||||
*/
|
||||
function filterCFBundleIdentifier (identifier) {
|
||||
return identifier.replace(/ /g, '-').replace(/[^a-zA-Z0-9.-]/g, '')
|
||||
}
|
||||
|
||||
function createSignOpts (properties, platform, app, version, quiet) {
|
||||
// use default sign opts if osx-sign is true, otherwise clone osx-sign object
|
||||
let signOpts = properties === true ? {identity: null} : Object.assign({}, properties)
|
||||
|
||||
// osx-sign options are handed off to sign module, but
|
||||
// with a few additions from the main options
|
||||
// user may think they can pass platform, app, or version, but they will be ignored
|
||||
common.subOptionWarning(signOpts, 'osx-sign', 'platform', platform, quiet)
|
||||
common.subOptionWarning(signOpts, 'osx-sign', 'app', app, quiet)
|
||||
common.subOptionWarning(signOpts, 'osx-sign', 'version', version, quiet)
|
||||
|
||||
if (signOpts.binaries) {
|
||||
common.warning('osx-sign.binaries is not an allowed sub-option. Not passing to electron-osx-sign.')
|
||||
delete signOpts.binaries
|
||||
}
|
||||
|
||||
// Take argument osx-sign as signing identity:
|
||||
// if opts.osxSign is true (bool), fallback to identity=null for
|
||||
// autodiscovery. Otherwise, provide signing certificate info.
|
||||
if (signOpts.identity === true) {
|
||||
signOpts.identity = null
|
||||
}
|
||||
|
||||
return signOpts
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
App: MacApp,
|
||||
createSignOpts: createSignOpts,
|
||||
filterCFBundleIdentifier: filterCFBundleIdentifier
|
||||
}
|
133
node_modules/electron-packager/package.json
generated
vendored
Normal file
133
node_modules/electron-packager/package.json
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"electron-packager@12.1.0",
|
||||
"/home/s2/Documents/Code/gitlit"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "electron-packager@12.1.0",
|
||||
"_id": "electron-packager@12.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-BI3U/zhIvhnFhzwxW1sxLfYhUyg=",
|
||||
"_location": "/electron-packager",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "electron-packager@12.1.0",
|
||||
"name": "electron-packager",
|
||||
"escapedName": "electron-packager",
|
||||
"rawSpec": "12.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "12.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-12.1.0.tgz",
|
||||
"_spec": "12.1.0",
|
||||
"_where": "/home/s2/Documents/Code/gitlit",
|
||||
"author": {
|
||||
"name": "max ogden"
|
||||
},
|
||||
"ava": {
|
||||
"timeout": "60s"
|
||||
},
|
||||
"bin": {
|
||||
"electron-packager": "cli.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/electron-userland/electron-packager/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"asar": "^0.14.0",
|
||||
"debug": "^3.0.0",
|
||||
"electron-download": "^4.0.0",
|
||||
"electron-osx-sign": "^0.4.1",
|
||||
"extract-zip": "^1.0.3",
|
||||
"fs-extra": "^5.0.0",
|
||||
"galactus": "^0.2.1",
|
||||
"get-package-info": "^1.0.0",
|
||||
"nodeify": "^1.0.1",
|
||||
"parse-author": "^2.0.0",
|
||||
"pify": "^3.0.0",
|
||||
"plist": "^2.0.0",
|
||||
"rcedit": "^1.0.0",
|
||||
"resolve": "^1.1.6",
|
||||
"sanitize-filename": "^1.6.0",
|
||||
"semver": "^5.3.0",
|
||||
"yargs-parser": "^10.0.0"
|
||||
},
|
||||
"description": "Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI",
|
||||
"devDependencies": {
|
||||
"ava": "^0.25.0",
|
||||
"buffer-equal": "^1.0.0",
|
||||
"codecov": "^3.0.0",
|
||||
"eslint": "^4.18.0",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-plugin-ava": "^4.3.0",
|
||||
"eslint-plugin-import": "^2.2.0",
|
||||
"eslint-plugin-node": "^6.0.0",
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^3.0.0",
|
||||
"mz": "^2.6.0",
|
||||
"nyc": "^11.0.0",
|
||||
"pkg-up": "^2.0.0",
|
||||
"sinon": "^5.0.7",
|
||||
"tempy": "^0.2.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 4.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:ava/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:promise/recommended",
|
||||
"standard"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
},
|
||||
"plugins": [
|
||||
"ava",
|
||||
"promise"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
2,
|
||||
{
|
||||
"CallExpression": {
|
||||
"arguments": "first"
|
||||
},
|
||||
"SwitchCase": 1
|
||||
}
|
||||
],
|
||||
"ava/prefer-async-await": 0,
|
||||
"no-console": 0,
|
||||
"strict": "error"
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/electron-userland/electron-packager",
|
||||
"keywords": [],
|
||||
"license": "BSD-2-Clause",
|
||||
"main": "index.js",
|
||||
"name": "electron-packager",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/electron-userland/electron-packager.git"
|
||||
},
|
||||
"scripts": {
|
||||
"codecov": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && nyc ava test/index.js"
|
||||
},
|
||||
"version": "12.1.0"
|
||||
}
|
184
node_modules/electron-packager/platform.js
generated
vendored
Normal file
184
node_modules/electron-packager/platform.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
'use strict'
|
||||
|
||||
const asar = require('asar')
|
||||
const debug = require('debug')('electron-packager')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const pify = require('pify')
|
||||
|
||||
const common = require('./common')
|
||||
const hooks = require('./hooks')
|
||||
const ignore = require('./ignore')
|
||||
|
||||
class App {
|
||||
constructor (opts, templatePath) {
|
||||
this.opts = opts
|
||||
this.templatePath = templatePath
|
||||
|
||||
if (this.opts.prune === undefined) {
|
||||
this.opts.prune = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource directory path before renaming.
|
||||
*/
|
||||
get originalResourcesDir () {
|
||||
return this.resourcesDir
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource directory path after renaming.
|
||||
*/
|
||||
get resourcesDir () {
|
||||
return path.join(this.stagingPath, 'resources')
|
||||
}
|
||||
|
||||
get originalResourcesAppDir () {
|
||||
return path.join(this.originalResourcesDir, 'app')
|
||||
}
|
||||
|
||||
get electronBinaryDir () {
|
||||
return this.stagingPath
|
||||
}
|
||||
|
||||
get originalElectronName () {
|
||||
/* istanbul ignore next */
|
||||
throw new Error('Child classes must implement this')
|
||||
}
|
||||
|
||||
get newElectronName () {
|
||||
/* istanbul ignore next */
|
||||
throw new Error('Child classes must implement this')
|
||||
}
|
||||
|
||||
get executableName () {
|
||||
return this.opts.executableName || this.opts.name
|
||||
}
|
||||
|
||||
get stagingPath () {
|
||||
if (this.opts.tmpdir === false) {
|
||||
return common.generateFinalPath(this.opts)
|
||||
} else {
|
||||
return path.join(
|
||||
common.baseTempDir(this.opts),
|
||||
`${this.opts.platform}-${this.opts.arch}`,
|
||||
common.generateFinalBasename(this.opts)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
relativeRename (basePath, oldName, newName) {
|
||||
debug(`Renaming ${oldName} to ${newName} in ${basePath}`)
|
||||
return fs.rename(path.join(basePath, oldName), path.join(basePath, newName))
|
||||
}
|
||||
|
||||
renameElectron () {
|
||||
return this.relativeRename(this.electronBinaryDir, this.originalElectronName, this.newElectronName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the following initial operations for an app:
|
||||
* * Creates temporary directory
|
||||
* * Copies template into temporary directory
|
||||
* * Copies user's app into temporary directory
|
||||
* * Prunes non-production node_modules (if opts.prune is either truthy or undefined)
|
||||
* * Remove default_app (which is either a folder or an asar file)
|
||||
* * Creates an asar (if opts.asar is set)
|
||||
*
|
||||
* Prune and asar are performed before platform-specific logic, primarily so that
|
||||
* this.originalResourcesAppDir is predictable (e.g. before .app is renamed for Mac)
|
||||
*/
|
||||
initialize () {
|
||||
debug(`Initializing app in ${this.stagingPath} from ${this.templatePath} template`)
|
||||
|
||||
return fs.move(this.templatePath, this.stagingPath, { clobber: true })
|
||||
.then(() => this.copyTemplate())
|
||||
.then(() => this.removeDefaultApp())
|
||||
.then(() => this.asarApp())
|
||||
}
|
||||
|
||||
copyTemplate () {
|
||||
return fs.copy(this.opts.dir, this.originalResourcesAppDir, {
|
||||
filter: ignore.userIgnoreFilter(this.opts),
|
||||
dereference: this.opts.derefSymlinks
|
||||
}).then(() => hooks.promisifyHooks(this.opts.afterCopy, [
|
||||
this.originalResourcesAppDir,
|
||||
this.opts.electronVersion,
|
||||
this.opts.platform,
|
||||
this.opts.arch
|
||||
])).then(() => {
|
||||
if (this.opts.prune) {
|
||||
return hooks.promisifyHooks(this.opts.afterPrune, [
|
||||
this.originalResourcesAppDir,
|
||||
this.opts.electronVersion,
|
||||
this.opts.platform,
|
||||
this.opts.arch
|
||||
])
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
removeDefaultApp () {
|
||||
return fs.remove(path.join(this.originalResourcesDir, 'default_app'))
|
||||
.then(() => fs.remove(path.join(this.originalResourcesDir, 'default_app.asar')))
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces an icon filename to a given extension and returns the normalized filename,
|
||||
* if it exists. Otherwise, returns null.
|
||||
*
|
||||
* This error path is used by win32 if no icon is specified.
|
||||
*/
|
||||
normalizeIconExtension (targetExt) {
|
||||
if (!this.opts.icon) throw new Error('No filename specified to normalizeExt')
|
||||
|
||||
let iconFilename = this.opts.icon
|
||||
const ext = path.extname(iconFilename)
|
||||
if (ext !== targetExt) {
|
||||
iconFilename = path.join(path.dirname(iconFilename), path.basename(iconFilename, ext) + targetExt)
|
||||
}
|
||||
|
||||
return fs.pathExists(iconFilename)
|
||||
.then(() => iconFilename)
|
||||
.catch(/* istanbul ignore next */ () => null)
|
||||
}
|
||||
|
||||
asarApp () {
|
||||
const asarOptions = common.createAsarOpts(this.opts)
|
||||
if (!asarOptions) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
const dest = path.join(this.originalResourcesDir, 'app.asar')
|
||||
debug(`Running asar with the options ${JSON.stringify(asarOptions)}`)
|
||||
return pify(asar.createPackageWithOptions)(this.originalResourcesAppDir, dest, asarOptions)
|
||||
.then(() => fs.remove(this.originalResourcesAppDir))
|
||||
}
|
||||
|
||||
copyExtraResources () {
|
||||
if (!this.opts.extraResource) return Promise.resolve()
|
||||
|
||||
const extraResources = common.ensureArray(this.opts.extraResource)
|
||||
|
||||
return Promise.all(extraResources.map(
|
||||
resource => fs.copy(resource, path.resolve(this.stagingPath, this.resourcesDir, path.basename(resource)))
|
||||
))
|
||||
}
|
||||
|
||||
move () {
|
||||
const finalPath = common.generateFinalPath(this.opts)
|
||||
|
||||
if (this.opts.tmpdir === false) {
|
||||
return Promise.resolve(finalPath)
|
||||
}
|
||||
|
||||
debug(`Moving ${this.stagingPath} to ${finalPath}`)
|
||||
return fs.move(this.stagingPath, finalPath)
|
||||
.then(() => finalPath)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = App
|
65
node_modules/electron-packager/prune.js
generated
vendored
Normal file
65
node_modules/electron-packager/prune.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('./common')
|
||||
const galactus = require('galactus')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
const ELECTRON_MODULES = [
|
||||
'electron',
|
||||
'electron-prebuilt',
|
||||
'electron-prebuilt-compile'
|
||||
]
|
||||
|
||||
class Pruner {
|
||||
constructor (dir) {
|
||||
this.baseDir = common.normalizePath(dir)
|
||||
this.galactus = new galactus.DestroyerOfModules({
|
||||
rootDirectory: dir,
|
||||
shouldKeepModuleTest: (module, isDevDep) => this.shouldKeepModule(module, isDevDep)
|
||||
})
|
||||
this.walkedTree = false
|
||||
}
|
||||
|
||||
setModules (moduleMap) {
|
||||
const modulePaths = Array.from(moduleMap.keys()).map(modulePath => `/${common.normalizePath(modulePath)}`)
|
||||
this.modules = new Set(modulePaths)
|
||||
this.walkedTree = true
|
||||
}
|
||||
|
||||
pruneModule (name) {
|
||||
if (this.walkedTree) {
|
||||
return this.isProductionModule(name)
|
||||
} else {
|
||||
return this.galactus.collectKeptModules({ relativePaths: true })
|
||||
.then(moduleMap => this.setModules(moduleMap))
|
||||
.then(() => this.isProductionModule(name))
|
||||
}
|
||||
}
|
||||
|
||||
shouldKeepModule (module, isDevDep) {
|
||||
if (isDevDep || module.depType === galactus.DepType.ROOT) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Node 6 has Array.prototype.includes
|
||||
if (ELECTRON_MODULES.indexOf(module.name) !== -1) {
|
||||
common.warning(`Found '${module.name}' but not as a devDependency, pruning anyway`)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
isProductionModule (name) {
|
||||
return this.modules.has(name)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isModule: function isModule (pathToCheck) {
|
||||
return fs.pathExists(path.join(pathToCheck, 'package.json'))
|
||||
.then(exists => exists && path.basename(path.dirname(pathToCheck)) === 'node_modules')
|
||||
},
|
||||
Pruner: Pruner
|
||||
}
|
212
node_modules/electron-packager/readme.md
generated
vendored
Normal file
212
node_modules/electron-packager/readme.md
generated
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
# Electron Packager
|
||||
|
||||
Package your [Electron](http://electron.atom.io) app into OS-specific bundles (`.app`, `.exe`, etc.) via JavaScript or the command line.
|
||||
|
||||
[](https://travis-ci.org/electron-userland/electron-packager)
|
||||
[](https://ci.appveyor.com/project/electron-userland/electron-packager)
|
||||
[](https://codecov.io/gh/electron-userland/electron-packager)
|
||||
[](https://dependencyci.com/github/electron-userland/electron-packager)
|
||||
|
||||
[Supported Platforms](#supported-platforms) |
|
||||
[Installation](#installation) |
|
||||
[Usage](#usage) |
|
||||
[API](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md) |
|
||||
[Contributing](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md) |
|
||||
[Support](https://github.com/electron-userland/electron-packager/blob/master/SUPPORT.md) |
|
||||
[Related Apps/Libraries](#related) |
|
||||
[FAQ](https://github.com/electron-userland/electron-packager/blob/master/docs/faq.md) |
|
||||
[Release Notes](https://github.com/electron-userland/electron-packager/blob/master/NEWS.md)
|
||||
|
||||
----
|
||||
|
||||
## About
|
||||
|
||||
Electron Packager is a command line tool and Node.js library that bundles Electron-based application
|
||||
source code with a renamed Electron executable and supporting files into folders ready for distribution.
|
||||
|
||||
For creating distributables like installers and Linux packages, consider using either [Electron
|
||||
Forge](https://github.com/electron-userland/electron-forge) (which uses Electron Packager
|
||||
internally), or one of the [related Electron tools](#distributable-creators), which utilizes
|
||||
Electron Packager-created folders as a basis.
|
||||
|
||||
Note that packaged Electron applications can be relatively large. A zipped, minimal Electron
|
||||
application is approximately the same size as the zipped prebuilt binary for a given target
|
||||
platform, target arch, and [Electron version](https://github.com/electron/electron/releases)
|
||||
_(files named `electron-v${version}-${platform}-${arch}.zip`)_.
|
||||
|
||||
### Electron Packager is an [OPEN Open Source Project](http://openopensource.org/)
|
||||
|
||||
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
|
||||
|
||||
See [CONTRIBUTING.md](https://github.com/electron-userland/electron-packager/blob/master/CONTRIBUTING.md) and [openopensource.org](http://openopensource.org/) for more details.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
Electron Packager is known to run on the following **host** platforms:
|
||||
|
||||
* Windows (32/64 bit)
|
||||
* OS X (also known as macOS)
|
||||
* Linux (x86/x86_64)
|
||||
|
||||
It generates executables/bundles for the following **target** platforms:
|
||||
|
||||
* Windows (also known as `win32`, for both 32/64 bit)
|
||||
* OS X (also known as `darwin`) / [Mac App Store](http://electron.atom.io/docs/v0.36.0/tutorial/mac-app-store-submission-guide/) (also known as `mas`)<sup>*</sup>
|
||||
* Linux (for x86, x86_64, armv7l, arm64, and mips64el architectures)
|
||||
|
||||
<sup>*</sup> *Note for OS X / MAS target bundles: the `.app` bundle can only be signed when building on a host OS X platform.*
|
||||
|
||||
## Installation
|
||||
|
||||
This module requires Node.js 4.0 or higher to run.
|
||||
|
||||
```sh
|
||||
# for use in npm scripts
|
||||
npm install electron-packager --save-dev
|
||||
|
||||
# for use from cli
|
||||
npm install electron-packager -g
|
||||
```
|
||||
|
||||
### Building Windows apps from non-Windows platforms
|
||||
|
||||
Building an Electron app for the Windows target platform requires editing the `Electron.exe` file.
|
||||
Currently, Electron Packager uses [node-rcedit](https://github.com/atom/node-rcedit) to accomplish
|
||||
this. A Windows executable is bundled in that Node package and needs to be run in order for this
|
||||
functionality to work, so on non-Windows host platforms, [Wine](https://www.winehq.org/) 1.6 or
|
||||
later needs to be installed. On OS X, it is installable via [Homebrew](http://brew.sh/).
|
||||
|
||||
## Usage
|
||||
|
||||
JavaScript API usage can be found in the [API documentation](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md).
|
||||
|
||||
### From the Command Line
|
||||
|
||||
Running electron-packager from the command line has this basic form:
|
||||
|
||||
```
|
||||
electron-packager <sourcedir> <appname> --platform=<platform> --arch=<arch> [optional flags...]
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
- Find or download the correct release of Electron
|
||||
- Use that version of Electron to create a app in `<out>/<appname>-<platform>-<arch>` *(this can be customized via an optional flag)*
|
||||
|
||||
`--platform` and `--arch` can be omitted, in two cases:
|
||||
|
||||
* If you specify `--all` instead, bundles for all valid combinations of target
|
||||
platforms/architectures will be created.
|
||||
* Otherwise, a single bundle for the host platform/architecture will be created.
|
||||
|
||||
For an overview of the other optional flags, run `electron-packager --help` or see
|
||||
[usage.txt](https://github.com/electron-userland/electron-packager/blob/master/usage.txt). For
|
||||
detailed descriptions, see the [API documentation](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md).
|
||||
|
||||
If `appname` is omitted, this will use the name specified by "productName" or "name" in the nearest package.json.
|
||||
|
||||
**Characters in the Electron app name which are not allowed in all target platforms' filenames
|
||||
(e.g., `/`), will be replaced by hyphens (`-`).**
|
||||
|
||||
You should be able to launch the app on the platform you built for. If not, check your settings and try again.
|
||||
|
||||
**Be careful** not to include `node_modules` you don't want into your final app. If you put them in
|
||||
the `devDependencies` section of `package.json`, by default none of the modules related to those
|
||||
dependencies will be copied in the app bundles. (This behavior can be turned off with the
|
||||
`--no-prune` flag.) In addition, folders like `.git` and `node_modules/.bin` will be ignored by
|
||||
default. You can use `--ignore` to ignore files and folders via a regular expression (*not* a
|
||||
[glob pattern](https://en.wikipedia.org/wiki/Glob_%28programming%29)). Examples include
|
||||
`--ignore=\.gitignore` or `--ignore="\.git(ignore|modules)"`.
|
||||
|
||||
#### Example
|
||||
|
||||
Let's assume that you have made an app based on the [electron-quick-start](https://github.com/electron/electron-quick-start) repository on a OS X host platform with the following file structure:
|
||||
|
||||
```
|
||||
foobar
|
||||
├── package.json
|
||||
├── index.html
|
||||
├── […other files, like LICENSE…]
|
||||
└── script.js
|
||||
```
|
||||
|
||||
…and that the following is true:
|
||||
|
||||
* `electron-packager` is installed globally
|
||||
* `productName` in `package.json` has been set to `Foo Bar`
|
||||
* The `electron` module is in the `devDependencies` section of `package.json`, and set to the exact version of `1.4.15`.
|
||||
* `npm install` for the `Foo Bar` app has been run at least once
|
||||
|
||||
When one runs the following command for the first time in the `foobar` directory:
|
||||
|
||||
```
|
||||
electron-packager .
|
||||
```
|
||||
|
||||
`electron-packager` will do the following:
|
||||
|
||||
* Use the current directory for the `sourcedir`
|
||||
* Infer the `appname` from the `productName` in `package.json`
|
||||
* Infer the `appVersion` from the `version` in `package.json`
|
||||
* Infer the `platform` and `arch` from the host, in this example, `darwin` platform and `x64` arch.
|
||||
* Download the darwin x64 build of Electron 1.4.15 (and cache the downloads in `~/.electron`)
|
||||
* Build the OS X `Foo Bar.app`
|
||||
* Place `Foo Bar.app` in `foobar/Foo Bar-darwin-x64/` (since an `out` directory was not specified, it used the current working directory)
|
||||
|
||||
The file structure now looks like:
|
||||
|
||||
```
|
||||
foobar
|
||||
├── Foo Bar-darwin-x64
|
||||
│ ├── Foo Bar.app
|
||||
│ │ └── […Mac app contents…]
|
||||
│ ├── LICENSE
|
||||
│ └── version
|
||||
├── […other application bundles, like "Foo Bar-win32-x64" (sans quotes)…]
|
||||
├── package.json
|
||||
├── index.html
|
||||
├── […other files, like LICENSE…]
|
||||
└── script.js
|
||||
```
|
||||
|
||||
The `Foo Bar.app` folder generated can be executed by a system running OS X, which will start the packaged Electron app. This is also true of the Windows x64 build on a system running a new enough version of Windows for a 64-bit system (via `Foo Bar-win32-x64/Foo Bar.exe`), and so on.
|
||||
|
||||
## Related
|
||||
|
||||
- [Electron Forge](https://www.npmjs.com/package/electron-forge) - creates, builds, and distributes modern Electron applications
|
||||
- [electron-packager-interactive](https://github.com/Urucas/electron-packager-interactive) - an interactive CLI for electron-packager
|
||||
- [grunt-electron](https://github.com/sindresorhus/grunt-electron) - grunt plugin for electron-packager
|
||||
|
||||
### Distributable Creators
|
||||
|
||||
* [electron-installer-zip](https://github.com/mongodb-js/electron-installer-zip) - creates symlink-compatible ZIP files
|
||||
|
||||
Windows:
|
||||
|
||||
* [electron-winstaller](https://github.com/electron/windows-installer) - Squirrel.Windows-based
|
||||
installer
|
||||
* [electron-windows-store](https://github.com/felixrieseberg/electron-windows-store) - creates an
|
||||
AppX package for the Windows Store
|
||||
* [electron-wix-msi](https://github.com/felixrieseberg/electron-wix-msi) - creates traditional MSI
|
||||
installers
|
||||
|
||||
OS X:
|
||||
|
||||
* [electron-installer-dmg](https://github.com/mongodb-js/electron-installer-dmg) - creates a DMG
|
||||
|
||||
Linux:
|
||||
|
||||
* [electron-installer-debian](https://github.com/unindented/electron-installer-debian) - creates a DEB file
|
||||
* [electron-installer-redhat](https://github.com/unindented/electron-installer-redhat) - creates an RPM
|
||||
* [electron-installer-flatpak](https://github.com/endlessm/electron-installer-flatpak) - creates a Flatpak file
|
||||
* [electron-installer-snap](https://github.com/electron-userland/electron-installer-snap) - creates a Snap file
|
||||
|
||||
### Plugins
|
||||
|
||||
These Node modules utilize Electron Packager API hooks:
|
||||
|
||||
- [electron-packager-languages](https://npm.im/electron-packager-languages) - set the locales
|
||||
available to Electron when packaged, which is used by the Mac App Store, among other places
|
||||
- [electron-packager-plugin-non-proprietary-codecs-ffmpeg](https://www.npmjs.com/package/electron-packager-plugin-non-proprietary-codecs-ffmpeg) - replaces the normal version of FFmpeg in Electron with a version without proprietary codecs
|
||||
- [electron-rebuild](https://github.com/electron/electron-rebuild) - rebuild native Node.js modules
|
||||
against the packaged Electron version
|
158
node_modules/electron-packager/targets.js
generated
vendored
Normal file
158
node_modules/electron-packager/targets.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('./common')
|
||||
const execSync = require('child_process').execSync
|
||||
const semver = require('semver')
|
||||
|
||||
const officialArchs = ['ia32', 'x64', 'armv7l', 'arm64', 'mips64el']
|
||||
const officialPlatforms = ['darwin', 'linux', 'mas', 'win32']
|
||||
const officialPlatformArchCombos = {
|
||||
darwin: ['x64'],
|
||||
linux: ['ia32', 'x64', 'armv7l', 'arm64', 'mips64el'],
|
||||
mas: ['x64'],
|
||||
win32: ['ia32', 'x64']
|
||||
}
|
||||
|
||||
const linuxArchBuildVersions = {
|
||||
arm64: '>= 1.8.0',
|
||||
mips64el: '^1.8.2-beta.5'
|
||||
}
|
||||
|
||||
// Maps to module filename for each platform (lazy-required if used)
|
||||
const osModules = {
|
||||
darwin: './mac',
|
||||
linux: './linux',
|
||||
mas: './mac', // map to darwin
|
||||
win32: './win32'
|
||||
}
|
||||
|
||||
const supported = {
|
||||
arch: new Set(officialArchs),
|
||||
platform: new Set(officialPlatforms)
|
||||
}
|
||||
|
||||
function createPlatformArchPairs (opts, selectedPlatforms, selectedArchs, ignoreFunc) {
|
||||
let combinations = []
|
||||
for (const arch of selectedArchs) {
|
||||
for (const platform of selectedPlatforms) {
|
||||
if (usingOfficialElectronPackages(opts)) {
|
||||
if (!validOfficialPlatformArch(opts, platform, arch)) {
|
||||
warnIfAllNotSpecified(opts, `The platform/arch combination ${platform}/${arch} is not currently supported by Electron Packager`)
|
||||
continue
|
||||
} else if (platform === 'linux') {
|
||||
const buildVersion = linuxArchBuildVersions[arch]
|
||||
if (buildVersion && !officialLinuxBuildExists(opts, buildVersion)) {
|
||||
warnIfAllNotSpecified(opts, `Official linux/${arch} support only exists in Electron ${buildVersion}`)
|
||||
continue
|
||||
}
|
||||
}
|
||||
if (typeof ignoreFunc === 'function' && ignoreFunc(platform, arch)) continue
|
||||
}
|
||||
combinations.push([platform, arch])
|
||||
}
|
||||
}
|
||||
|
||||
return combinations
|
||||
}
|
||||
|
||||
function unsupportedListOption (name, value, supported) {
|
||||
return new Error(`Unsupported ${name}=${value} (${typeof value}); must be a string matching: ${Array.from(supported.values()).join(', ')}`)
|
||||
}
|
||||
|
||||
function usingOfficialElectronPackages (opts) {
|
||||
return !opts.download || !opts.download.hasOwnProperty('mirror')
|
||||
}
|
||||
|
||||
function validOfficialPlatformArch (opts, platform, arch) {
|
||||
return officialPlatformArchCombos[platform] && officialPlatformArchCombos[platform].indexOf(arch) !== -1
|
||||
}
|
||||
|
||||
function officialLinuxBuildExists (opts, buildVersion) {
|
||||
return semver.satisfies(opts.electronVersion, buildVersion)
|
||||
}
|
||||
|
||||
function allPlatformsOrArchsSpecified (opts) {
|
||||
return opts.all || opts.arch === 'all' || opts.platform === 'all'
|
||||
}
|
||||
|
||||
function warnIfAllNotSpecified (opts, message) {
|
||||
if (!allPlatformsOrArchsSpecified(opts)) {
|
||||
common.warning(message)
|
||||
}
|
||||
}
|
||||
|
||||
function hostArch () {
|
||||
if (process.arch === 'arm') {
|
||||
switch (process.config.variables.arm_version) {
|
||||
case '6':
|
||||
return module.exports.unameArch()
|
||||
case '7':
|
||||
return 'armv7l'
|
||||
default:
|
||||
common.warning(`Could not determine specific ARM arch. Detected ARM version: ${JSON.stringify(process.config.variables.arm_version)}`)
|
||||
}
|
||||
}
|
||||
|
||||
return process.arch
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
allOfficialArchsForPlatformAndVersion: function allOfficialArchsForPlatformAndVersion (platform, electronVersion) {
|
||||
const archs = officialPlatformArchCombos[platform]
|
||||
if (platform === 'linux') {
|
||||
const excludedArchs = Object.keys(linuxArchBuildVersions)
|
||||
.filter(arch => !officialLinuxBuildExists({electronVersion: electronVersion}, linuxArchBuildVersions[arch]))
|
||||
return archs.filter(arch => excludedArchs.indexOf(arch) === -1)
|
||||
}
|
||||
|
||||
return archs
|
||||
},
|
||||
createPlatformArchPairs: createPlatformArchPairs,
|
||||
hostArch: hostArch,
|
||||
officialArchs: officialArchs,
|
||||
officialPlatformArchCombos: officialPlatformArchCombos,
|
||||
officialPlatforms: officialPlatforms,
|
||||
osModules: osModules,
|
||||
supported: supported,
|
||||
/**
|
||||
* Returns the arch name from the `uname` utility.
|
||||
*/
|
||||
unameArch: function unameArch () {
|
||||
/* istanbul ignore next */
|
||||
return execSync('uname -m').toString().trim()
|
||||
},
|
||||
// Validates list of architectures or platforms.
|
||||
// Returns a normalized array if successful, or throws an Error.
|
||||
validateListFromOptions: function validateListFromOptions (opts, name) {
|
||||
if (opts.all) return Array.from(supported[name].values())
|
||||
|
||||
let list = opts[name]
|
||||
if (!list) {
|
||||
if (name === 'arch') {
|
||||
list = hostArch()
|
||||
} else {
|
||||
list = process[name]
|
||||
}
|
||||
} else if (list === 'all') {
|
||||
return Array.from(supported[name].values())
|
||||
}
|
||||
|
||||
if (!Array.isArray(list)) {
|
||||
if (typeof list === 'string') {
|
||||
list = list.split(/,\s*/)
|
||||
} else {
|
||||
return unsupportedListOption(name, list, supported[name])
|
||||
}
|
||||
}
|
||||
|
||||
const officialElectronPackages = usingOfficialElectronPackages(opts)
|
||||
|
||||
for (let value of list) {
|
||||
if (officialElectronPackages && !supported[name].has(value)) {
|
||||
return unsupportedListOption(name, value, supported[name])
|
||||
}
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
}
|
105
node_modules/electron-packager/test/_setup.js
generated
vendored
Normal file
105
node_modules/electron-packager/test/_setup.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('../common')
|
||||
const download = require('../download')
|
||||
const config = require('./config.json')
|
||||
const exec = require('mz/child_process').exec
|
||||
const fs = require('fs-extra')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const targets = require('../targets')
|
||||
|
||||
function fixtureSubdir (subdir) {
|
||||
return path.join(__dirname, 'fixtures', subdir)
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip testing darwin/mas target on Windows since Electron Packager itself skips it
|
||||
* (see https://github.com/electron-userland/electron-packager/issues/71)
|
||||
*/
|
||||
function skipDownloadingMacZips (platform, arch) {
|
||||
return common.isPlatformMac(platform) && process.platform === 'win32'
|
||||
}
|
||||
|
||||
function downloadAll (version) {
|
||||
console.log(`Calling electron-download for ${version} before running tests...`)
|
||||
const combinations = download.createDownloadCombos({electronVersion: config.version, all: true}, targets.officialPlatforms, targets.officialArchs, skipDownloadingMacZips)
|
||||
|
||||
return Promise.all(combinations.map(combination => downloadElectronZip(version, combination)))
|
||||
}
|
||||
|
||||
function downloadElectronZip (version, options) {
|
||||
return download.downloadElectronZip(Object.assign({}, options, {
|
||||
cache: path.join(os.homedir(), '.electron'),
|
||||
quiet: !!process.env.CI,
|
||||
version: version
|
||||
}))
|
||||
}
|
||||
|
||||
function downloadMASLoginHelperElectronZip () {
|
||||
if (process.platform !== 'win32') {
|
||||
const version = '2.0.0-beta.1'
|
||||
console.log(`Calling electron-download for ${version} (MAS only) before running tests...`)
|
||||
return downloadElectronZip(version, { platform: 'mas', arch: 'x64' })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Download all Electron distributions before running tests to avoid timing out due to network
|
||||
* speed. Most tests run with the config.json version, but we have some tests using 0.37.4, an
|
||||
* `electron` module specific test using 1.3.1., and an MAS-specific test using 2.0.0-beta.1.
|
||||
*/
|
||||
function preDownloadElectron () {
|
||||
const versions = [
|
||||
config.version,
|
||||
'0.37.4',
|
||||
'1.3.1'
|
||||
]
|
||||
return Promise.all(versions.map(downloadAll))
|
||||
.then(downloadMASLoginHelperElectronZip)
|
||||
}
|
||||
|
||||
function npmInstallForFixture (fixture) {
|
||||
const fixtureDir = fixtureSubdir(fixture)
|
||||
return fs.exists(path.join(fixtureDir, 'node_modules'))
|
||||
.then(exists => {
|
||||
if (exists) {
|
||||
return true
|
||||
} else {
|
||||
console.log(`Running npm install in fixtures/${fixture}...`)
|
||||
return exec('npm install --no-bin-links', {cwd: fixtureDir})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function npmInstallForFixtures () {
|
||||
const fixtures = [
|
||||
'basic',
|
||||
'basic-renamed-to-electron',
|
||||
'electron-in-dependencies',
|
||||
'infer-missing-version-only',
|
||||
'el-0374'
|
||||
]
|
||||
return Promise.all(fixtures.map(npmInstallForFixture))
|
||||
}
|
||||
|
||||
const WORK_CWD = path.join(__dirname, 'work')
|
||||
|
||||
function ensureEmptyWorkDirExists () {
|
||||
return fs.remove(WORK_CWD)
|
||||
.then(() => fs.mkdirs(WORK_CWD))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fixtureSubdir: fixtureSubdir,
|
||||
setupTestsuite: function setupTestsuite () {
|
||||
return preDownloadElectron()
|
||||
.then(npmInstallForFixtures)
|
||||
.catch(error => {
|
||||
console.error(error.stack || error)
|
||||
return process.exit(1)
|
||||
})
|
||||
.then(ensureEmptyWorkDirExists)
|
||||
},
|
||||
WORK_CWD: WORK_CWD
|
||||
}
|
117
node_modules/electron-packager/test/_util.js
generated
vendored
Normal file
117
node_modules/electron-packager/test/_util.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
'use strict'
|
||||
|
||||
// Keeping this module because it handles non-buffers gracefully
|
||||
const bufferEqual = require('buffer-equal')
|
||||
const common = require('../common')
|
||||
const config = require('./config.json')
|
||||
const fs = require('fs-extra')
|
||||
const packager = require('../index')
|
||||
const path = require('path')
|
||||
const setup = require('./_setup')
|
||||
const tempy = require('tempy')
|
||||
const test = require('ava')
|
||||
|
||||
const ORIGINAL_CWD = process.cwd()
|
||||
|
||||
test.before(t => {
|
||||
if (!process.env.CI) {
|
||||
return setup.setupTestsuite()
|
||||
.then(() => process.chdir(setup.WORK_CWD))
|
||||
}
|
||||
return Promise.resolve(process.chdir(setup.WORK_CWD))
|
||||
})
|
||||
|
||||
test.after.always(t => {
|
||||
process.chdir(ORIGINAL_CWD)
|
||||
return fs.remove(setup.WORK_CWD)
|
||||
})
|
||||
|
||||
test.beforeEach(t => {
|
||||
t.context.workDir = tempy.directory()
|
||||
t.context.tempDir = tempy.directory()
|
||||
})
|
||||
|
||||
test.afterEach.always(t => {
|
||||
return fs.remove(t.context.workDir)
|
||||
.then(() => fs.remove(t.context.tempDir))
|
||||
})
|
||||
|
||||
function testSinglePlatform (name, testFunction, testFunctionArgs, parallel) {
|
||||
module.exports.packagerTest(name, (t, opts) => {
|
||||
Object.assign(opts, module.exports.singlePlatformOptions())
|
||||
return testFunction.apply(null, [t, opts].concat(testFunctionArgs))
|
||||
}, parallel)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
allPlatformArchCombosCount: 9,
|
||||
areFilesEqual: function areFilesEqual (file1, file2) {
|
||||
let buffer1, buffer2
|
||||
|
||||
return fs.readFile(file1)
|
||||
.then((data) => {
|
||||
buffer1 = data
|
||||
return fs.readFile(file2)
|
||||
}).then((data) => {
|
||||
buffer2 = data
|
||||
return bufferEqual(buffer1, buffer2)
|
||||
})
|
||||
},
|
||||
fixtureSubdir: setup.fixtureSubdir,
|
||||
generateResourcesPath: function generateResourcesPath (opts) {
|
||||
return common.isPlatformMac(opts.platform)
|
||||
? path.join(opts.name + '.app', 'Contents', 'Resources')
|
||||
: 'resources'
|
||||
},
|
||||
invalidOptionTest: function invalidOptionTest (opts) {
|
||||
return t => t.throws(packager(opts))
|
||||
},
|
||||
packageAndEnsureResourcesPath: function packageAndEnsureResourcesPath (t, opts) {
|
||||
let resourcesPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
resourcesPath = path.join(paths[0], module.exports.generateResourcesPath(opts))
|
||||
return fs.stat(resourcesPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The output directory should contain the expected resources subdirectory')
|
||||
return resourcesPath
|
||||
})
|
||||
},
|
||||
packagerTest: function packagerTest (name, testFunction, parallel) {
|
||||
const testDefinition = parallel ? test : test.serial
|
||||
testDefinition(name, t => {
|
||||
return testFunction(t, {
|
||||
name: 'packagerTest',
|
||||
out: t.context.workDir,
|
||||
tmpdir: t.context.tempDir
|
||||
})
|
||||
})
|
||||
},
|
||||
singlePlatformOptions: function singlePlatformOptions () {
|
||||
return {
|
||||
platform: 'linux',
|
||||
arch: 'x64',
|
||||
electronVersion: config.version
|
||||
}
|
||||
},
|
||||
// Rest parameters are added (not behind a feature flag) in Node 6
|
||||
testSinglePlatform: function (name, testFunction /*, ...testFunctionArgs */) {
|
||||
const testFunctionArgs = Array.prototype.slice.call(arguments, 2)
|
||||
return testSinglePlatform(name, testFunction, testFunctionArgs, false)
|
||||
},
|
||||
// Rest parameters are added (not behind a feature flag) in Node 6
|
||||
testSinglePlatformParallel: function (name, testFunction /*, ...testFunctionArgs */) {
|
||||
const testFunctionArgs = Array.prototype.slice.call(arguments, 2)
|
||||
return testSinglePlatform(name, testFunction, testFunctionArgs, true)
|
||||
},
|
||||
verifyPackageExistence: function verifyPackageExistence (finalPaths) {
|
||||
return Promise.all(finalPaths.map((finalPath) => {
|
||||
return fs.stat(finalPath)
|
||||
.then(
|
||||
stats => stats.isDirectory(),
|
||||
() => false
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
55
node_modules/electron-packager/test/asar.js
generated
vendored
Normal file
55
node_modules/electron-packager/test/asar.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('../common')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
test('asar argument test: asar is not set', t => {
|
||||
const asarOpts = common.createAsarOpts({})
|
||||
t.false(asarOpts, 'createAsarOpts returns false')
|
||||
})
|
||||
|
||||
test('asar argument test: asar is true', t => {
|
||||
t.deepEqual(common.createAsarOpts({asar: true}), {})
|
||||
})
|
||||
|
||||
test('asar argument test: asar is not an Object or a bool', t => {
|
||||
t.false(common.createAsarOpts({asar: 'string'}), 'createAsarOpts returns false')
|
||||
})
|
||||
|
||||
util.testSinglePlatform('default_app.asar removal test', (t, opts) => {
|
||||
opts.name = 'default_appASARTest'
|
||||
opts.dir = util.fixtureSubdir('el-0374')
|
||||
opts.electronVersion = '0.37.4'
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(resourcesPath => fs.pathExists(path.join(resourcesPath, 'default_app.asar')))
|
||||
.then(exists => t.false(exists, 'The output directory should not contain the Electron default_app.asar file'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('asar test', (t, opts) => {
|
||||
opts.name = 'asarTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.asar = {
|
||||
'unpack': '*.pac',
|
||||
'unpackDir': 'dir_to_unpack'
|
||||
}
|
||||
let resourcesPath
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(generatedResourcesPath => {
|
||||
resourcesPath = generatedResourcesPath
|
||||
return fs.stat(path.join(resourcesPath, 'app.asar'))
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'app.asar should exist under the resources subdirectory when opts.asar is true')
|
||||
return fs.pathExists(path.join(resourcesPath, 'app'))
|
||||
}).then(exists => {
|
||||
t.false(exists, 'app subdirectory should NOT exist when app.asar is built')
|
||||
return fs.stat(path.join(resourcesPath, 'app.asar.unpacked'))
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'app.asar.unpacked should exist under the resources subdirectory when opts.asar_unpack is set some expression')
|
||||
return fs.stat(path.join(resourcesPath, 'app.asar.unpacked', 'dir_to_unpack'))
|
||||
}).then(stats => t.true(stats.isDirectory(), 'dir_to_unpack should exist under app.asar.unpacked subdirectory when opts.asar-unpack-dir is set dir_to_unpack'))
|
||||
})
|
347
node_modules/electron-packager/test/basic.js
generated
vendored
Normal file
347
node_modules/electron-packager/test/basic.js
generated
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('../common')
|
||||
const download = require('../download')
|
||||
const fs = require('fs-extra')
|
||||
const hostArch = require('../targets').hostArch
|
||||
const packager = require('..')
|
||||
const path = require('path')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
// Generates a path to the generated app that reflects the name given in the options.
|
||||
// Returns the Helper.app location on darwin since the top-level .app is already tested for the
|
||||
// resources path; on other OSes, returns the executable.
|
||||
function generateNamePath (opts) {
|
||||
if (common.isPlatformMac(opts.platform)) {
|
||||
return path.join(`${opts.name}.app`, 'Contents', 'Frameworks', `${opts.name} Helper.app`)
|
||||
}
|
||||
|
||||
return opts.name + (opts.platform === 'win32' ? '.exe' : '')
|
||||
}
|
||||
|
||||
test('setting the quiet option does not print messages', (t) => {
|
||||
const errorLog = console.error
|
||||
const warningLog = console.warn
|
||||
let output = ''
|
||||
console.error = (message) => { output += message }
|
||||
console.warn = (message) => { output += message }
|
||||
|
||||
common.warning('warning', true)
|
||||
t.is('', output, 'quieted common.warning should not call console.warn')
|
||||
common.info('info', true)
|
||||
t.is('', output, 'quieted common.info should not call console.error')
|
||||
|
||||
console.error = errorLog
|
||||
console.warn = warningLog
|
||||
})
|
||||
|
||||
test('download argument test: download.{arch,platform,version} does not overwrite {arch,platform,version}', t => {
|
||||
const opts = {
|
||||
download: {
|
||||
arch: 'ia32',
|
||||
platform: 'win32',
|
||||
version: '0.30.0'
|
||||
},
|
||||
electronVersion: '0.36.0'
|
||||
}
|
||||
|
||||
const downloadOpts = download.createDownloadOpts(opts, 'linux', 'x64')
|
||||
t.deepEqual(downloadOpts, {arch: 'x64', platform: 'linux', version: '0.36.0'})
|
||||
})
|
||||
|
||||
test('sanitize app name for use in file/directory names', t => {
|
||||
t.is('@username-package', common.sanitizeAppName('@username/package'), 'slash should be replaced')
|
||||
})
|
||||
|
||||
test('sanitize app name for use in the out directory name', t => {
|
||||
let opts = {
|
||||
arch: 'x64',
|
||||
name: '@username/package-name',
|
||||
platform: 'linux'
|
||||
}
|
||||
t.is('@username-package-name-linux-x64', common.generateFinalBasename(opts), 'generateFinalBasename output should be sanitized')
|
||||
})
|
||||
|
||||
test('cannot build apps where the name ends in " Helper"', (t) => {
|
||||
const opts = {
|
||||
arch: 'x64',
|
||||
dir: path.join(__dirname, 'fixtures', 'el-0374'),
|
||||
name: 'Bad Helper',
|
||||
platform: 'linux'
|
||||
}
|
||||
|
||||
return packager(opts)
|
||||
.then(
|
||||
() => { throw new Error('should not finish') },
|
||||
(err) => t.is(err.message, 'Application names cannot end in " Helper" due to limitations on macOS')
|
||||
)
|
||||
})
|
||||
|
||||
test('deprecatedParameter moves value in deprecated param to new param if new param is not set', (t) => {
|
||||
let opts = {
|
||||
old: 'value'
|
||||
}
|
||||
common.deprecatedParameter(opts, 'old', 'new', 'new-value')
|
||||
|
||||
t.false(opts.hasOwnProperty('old'), 'old property is not set')
|
||||
t.true(opts.hasOwnProperty('new'), 'new property is set')
|
||||
|
||||
opts.not_overwritten_old = 'another'
|
||||
common.deprecatedParameter(opts, 'not_overwritten_old', 'new', 'new-value')
|
||||
|
||||
t.false(opts.hasOwnProperty('not_overwritten_old'), 'not_overwritten_old property is not set')
|
||||
t.true(opts.hasOwnProperty('new'), 'new property is set')
|
||||
t.is('value', opts.new, 'new property is not overwritten')
|
||||
})
|
||||
|
||||
util.testSinglePlatform('defaults test', (t, opts) => {
|
||||
opts.name = 'defaultsTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
delete opts.platform
|
||||
delete opts.arch
|
||||
|
||||
let defaultOpts = {
|
||||
arch: hostArch(),
|
||||
name: opts.name,
|
||||
platform: process.platform
|
||||
}
|
||||
|
||||
let finalPath
|
||||
let resourcesPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.true(Array.isArray(paths), 'packager call should resolve to an array')
|
||||
t.is(paths.length, 1, 'Single-target run should resolve to a 1-item array')
|
||||
|
||||
finalPath = paths[0]
|
||||
t.is(finalPath, path.join(t.context.workDir, common.generateFinalBasename(defaultOpts)),
|
||||
'Path should follow the expected format and be in the cwd')
|
||||
return fs.stat(finalPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The expected output directory should exist')
|
||||
resourcesPath = path.join(finalPath, util.generateResourcesPath(defaultOpts))
|
||||
return fs.stat(path.join(finalPath, generateNamePath(defaultOpts)))
|
||||
}).then(stats => {
|
||||
if (common.isPlatformMac(defaultOpts.platform)) {
|
||||
t.true(stats.isDirectory(), 'The Helper.app should reflect opts.name')
|
||||
} else {
|
||||
t.true(stats.isFile(), 'The executable should reflect opts.name')
|
||||
}
|
||||
return fs.stat(resourcesPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The output directory should contain the expected resources subdirectory')
|
||||
return fs.pathExists(path.join(resourcesPath, 'app', 'node_modules', 'run-waterfall'))
|
||||
}).then(exists => {
|
||||
t.false(exists, 'The output directory should NOT contain devDependencies by default (prune=true)')
|
||||
return util.areFilesEqual(path.join(opts.dir, 'main.js'), path.join(resourcesPath, 'app', 'main.js'))
|
||||
}).then(equal => {
|
||||
t.true(equal, 'File under packaged app directory should match source file')
|
||||
return util.areFilesEqual(path.join(opts.dir, 'ignore', 'this.txt'),
|
||||
path.join(resourcesPath, 'app', 'ignore', 'this.txt'))
|
||||
}).then(equal => {
|
||||
t.true(equal, 'File under subdirectory of packaged app directory should match source file and not be ignored by default')
|
||||
return fs.pathExists(path.join(resourcesPath, 'default_app'))
|
||||
}).then(exists => {
|
||||
t.false(exists, 'The output directory should not contain the Electron default_app directory')
|
||||
return fs.pathExists(path.join(resourcesPath, 'default_app.asar'))
|
||||
}).then(exists => t.false(exists, 'The output directory should not contain the Electron default_app.asar file'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('out test', (t, opts) => {
|
||||
opts.name = 'outTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.out = 'dist'
|
||||
|
||||
let finalPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
finalPath = paths[0]
|
||||
t.is(finalPath, path.join('dist', common.generateFinalBasename(opts)),
|
||||
'Path should follow the expected format and be under the folder specified in `out`')
|
||||
return fs.stat(finalPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The expected output directory should exist')
|
||||
return fs.stat(path.join(finalPath, util.generateResourcesPath(opts)))
|
||||
}).then(stats => t.true(stats.isDirectory(), 'The output directory should contain the expected resources subdirectory'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('overwrite test', (t, opts) => {
|
||||
opts.name = 'overwriteTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
|
||||
let finalPath
|
||||
let testPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
finalPath = paths[0]
|
||||
return fs.stat(finalPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The expected output directory should exist')
|
||||
// Create a dummy file to detect whether the output directory is replaced in subsequent runs
|
||||
testPath = path.join(finalPath, 'test.txt')
|
||||
return fs.writeFile(testPath, 'test')
|
||||
}).then(() => packager(opts)) // Run again, defaulting to overwrite false
|
||||
.then(paths => fs.stat(testPath))
|
||||
.then(stats => {
|
||||
t.true(stats.isFile(), 'The existing output directory should exist as before (skipped by default)')
|
||||
// Run a third time, explicitly setting overwrite to true
|
||||
opts.overwrite = true
|
||||
return packager(opts)
|
||||
}).then(paths => fs.pathExists(testPath))
|
||||
.then(exists => t.false(exists, 'The output directory should be regenerated when overwrite is true'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('overwrite test sans platform/arch set', (t, opts) => {
|
||||
delete opts.platfrom
|
||||
delete opts.arch
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.overwrite = true
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => fs.pathExists(paths[0]))
|
||||
.then(exists => {
|
||||
t.true(exists, 'The output directory exists')
|
||||
return packager(opts)
|
||||
}).then(paths => fs.pathExists(paths[0]))
|
||||
.then(exists => t.true(exists, 'The output directory exists'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('tmpdir test', (t, opts) => {
|
||||
opts.name = 'tmpdirTest'
|
||||
opts.dir = path.join(__dirname, 'fixtures', 'basic')
|
||||
opts.out = 'dist'
|
||||
opts.tmpdir = path.join(t.context.workDir, 'tmp')
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => fs.stat(path.join(opts.tmpdir, 'electron-packager')))
|
||||
.then(stats => t.true(stats.isDirectory(), 'The expected temp directory should exist'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('disable tmpdir test', (t, opts) => {
|
||||
opts.name = 'disableTmpdirTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.out = 'dist'
|
||||
opts.tmpdir = false
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => fs.stat(paths[0]))
|
||||
.then(stats => t.true(stats.isDirectory(), 'The expected out directory should exist'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('deref symlink test', (t, opts) => {
|
||||
opts.name = 'disableSymlinkDerefTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.derefSymlinks = false
|
||||
|
||||
const src = path.join(opts.dir, 'main.js')
|
||||
const dest = path.join(opts.dir, 'main-link.js')
|
||||
|
||||
return fs.ensureSymlink(src, dest)
|
||||
.then(() => packager(opts))
|
||||
.then(paths => {
|
||||
const destLink = path.join(paths[0], 'resources', 'app', 'main-link.js')
|
||||
return fs.lstat(destLink)
|
||||
}).then(stats => {
|
||||
t.true(stats.isSymbolicLink(), 'The expected file should still be a symlink')
|
||||
return fs.remove(dest)
|
||||
})
|
||||
})
|
||||
|
||||
function createExtraResourceStringTest (t, opts, platform) {
|
||||
const extra1Base = 'data1.txt'
|
||||
const extra1Path = path.join(__dirname, 'fixtures', extra1Base)
|
||||
|
||||
opts.name = 'extraResourceStringTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.out = 'dist'
|
||||
opts.platform = platform
|
||||
opts.extraResource = extra1Path
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(resourcesPath => util.areFilesEqual(extra1Path, path.join(resourcesPath, extra1Base)))
|
||||
.then(equal => t.true(equal, 'resource file data1.txt should match'))
|
||||
}
|
||||
|
||||
function createExtraResourceArrayTest (t, opts, platform) {
|
||||
const extra1Base = 'data1.txt'
|
||||
const extra1Path = path.join(__dirname, 'fixtures', extra1Base)
|
||||
const extra2Base = 'extrainfo.plist'
|
||||
const extra2Path = path.join(__dirname, 'fixtures', extra2Base)
|
||||
|
||||
opts.name = 'extraResourceArrayTest'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.out = 'dist'
|
||||
opts.platform = platform
|
||||
opts.extraResource = [extra1Path, extra2Path]
|
||||
|
||||
let extra1DistPath
|
||||
let extra2DistPath
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(resourcesPath => {
|
||||
extra1DistPath = path.join(resourcesPath, extra1Base)
|
||||
extra2DistPath = path.join(resourcesPath, extra2Base)
|
||||
return fs.pathExists(extra1DistPath)
|
||||
}).then(exists => {
|
||||
t.true(exists, 'resource file data1.txt exists')
|
||||
return util.areFilesEqual(extra1Path, extra1DistPath)
|
||||
}).then(equal => {
|
||||
t.true(equal, 'resource file data1.txt should match')
|
||||
return fs.pathExists(extra2DistPath)
|
||||
}).then(exists => {
|
||||
t.true(exists, 'resource file extrainfo.plist exists')
|
||||
return util.areFilesEqual(extra2Path, extra2DistPath)
|
||||
}).then(equal => t.true(equal, 'resource file extrainfo.plist should match'))
|
||||
}
|
||||
|
||||
for (const platform of ['darwin', 'linux']) {
|
||||
util.testSinglePlatform(`extraResource test: string (${platform})`, createExtraResourceStringTest, platform)
|
||||
util.testSinglePlatform(`extraResource test: array (${platform})`, createExtraResourceArrayTest, platform)
|
||||
}
|
||||
|
||||
util.testSinglePlatform('building for Linux target sanitizes binary name', (t, opts) => {
|
||||
opts.name = '@username/package-name'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.is(1, paths.length, '1 bundle created')
|
||||
return fs.stat(path.join(paths[0], '@username-package-name'))
|
||||
}).then(stats => t.true(stats.isFile(), 'The sanitized binary filename should exist'))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('executableName honored when building for Linux target', (t, opts) => {
|
||||
opts.name = 'PackageName'
|
||||
opts.executableName = 'my-package'
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.is(1, paths.length, '1 bundle created')
|
||||
return fs.stat(path.join(paths[0], 'my-package'))
|
||||
}).then(stats => t.true(stats.isFile(), 'The executableName-based filename should exist'))
|
||||
})
|
||||
|
||||
util.packagerTest('fails with invalid version', util.invalidOptionTest({
|
||||
name: 'invalidElectronTest',
|
||||
dir: util.fixtureSubdir('el-0374'),
|
||||
electronVersion: '0.0.1',
|
||||
arch: 'x64',
|
||||
platform: 'linux',
|
||||
download: {
|
||||
quiet: !!process.env.CI
|
||||
}
|
||||
}))
|
||||
|
||||
util.testSinglePlatform('dir argument test: should work with relative path', (t, opts) => {
|
||||
opts.name = 'ElectronTest'
|
||||
opts.dir = path.join('..', 'fixtures', 'el-0374')
|
||||
opts.electronVersion = '0.37.4'
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => t.is(path.join(t.context.workDir, 'ElectronTest-linux-x64'), paths[0], 'paths returned'))
|
||||
})
|
5
node_modules/electron-packager/test/ci/_before_script.js
generated
vendored
Executable file
5
node_modules/electron-packager/test/ci/_before_script.js
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
require('../_setup').setupTestsuite()
|
34
node_modules/electron-packager/test/ci/appveyor.yml
generated
vendored
Normal file
34
node_modules/electron-packager/test/ci/appveyor.yml
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "8"
|
||||
- nodejs_version: "9"
|
||||
matrix:
|
||||
allow_failures:
|
||||
- nodejs_version: "9"
|
||||
cache:
|
||||
- 'node_modules'
|
||||
- '%USERPROFILE%\.electron'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
install:
|
||||
- ps: Install-Product node $env:nodejs_version $env:platform
|
||||
- npm install -g npm@4
|
||||
- set PATH=%APPDATA%\npm;%PATH%
|
||||
- npm install
|
||||
- npm update
|
||||
|
||||
test_script:
|
||||
- node --version
|
||||
- npm --version
|
||||
- node test/ci/_before_script.js
|
||||
- npm test
|
||||
- npm run codecov
|
||||
|
||||
build: off
|
33
node_modules/electron-packager/test/ci/before_install.sh
generated
vendored
Executable file
33
node_modules/electron-packager/test/ci/before_install.sh
generated
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash -xe
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
case "$TRAVIS_OS_NAME" in
|
||||
"linux")
|
||||
# Not using Trusty containers because it can't install wine1.6(-i386),
|
||||
# see: https://github.com/travis-ci/travis-ci/issues/6460
|
||||
sudo rm /etc/apt/sources.list.d/google-chrome.list
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y wine1.6
|
||||
;;
|
||||
"osx")
|
||||
# Create CA
|
||||
openssl req -newkey rsa:4096 -days 1 -x509 -nodes -subj \
|
||||
"/C=CI/ST=Travis/L=Developer/O=Developer/CN=Developer CA" \
|
||||
-out /tmp/root.cer -keyout /tmp/root.key
|
||||
touch /tmp/certindex
|
||||
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain \
|
||||
/tmp/root.cer
|
||||
# Create dev certificate
|
||||
openssl req -newkey rsa:1024 -nodes -subj \
|
||||
"/C=CI/ST=Travis/L=Developer/O=Developer/CN=Developer CodeCert" \
|
||||
-out codesign.csr -keyout codesign.key
|
||||
openssl ca -batch -config $(pwd)/test/ci/dev_ca.cnf -notext -create_serial \
|
||||
-in codesign.csr -out codesign.cer
|
||||
openssl pkcs12 -export -in codesign.cer -inkey codesign.key -out codesign.p12 -password pass:12345
|
||||
security import codesign.p12 -k ~/Library/Keychains/login.keychain -P 12345 -T /usr/bin/codesign
|
||||
npm install wine-darwin@1.9.17-1
|
||||
# Setup ~/.wine by running a command
|
||||
./node_modules/.bin/wine hostname
|
||||
;;
|
||||
esac
|
33
node_modules/electron-packager/test/ci/dev_ca.cnf
generated
vendored
Normal file
33
node_modules/electron-packager/test/ci/dev_ca.cnf
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
[ ca ]
|
||||
default_ca = devca
|
||||
|
||||
[ crl_ext ]
|
||||
authorityKeyIdentifier=keyid:always
|
||||
|
||||
[ devca ]
|
||||
new_certs_dir = /tmp
|
||||
unique_subject = no
|
||||
certificate = /tmp/root.cer
|
||||
database = /tmp/certindex
|
||||
private_key = /tmp/root.key
|
||||
serial = /tmp/serialfile
|
||||
default_days = 1
|
||||
default_md = sha1
|
||||
policy = devca_policy
|
||||
x509_extensions = devca_extensions
|
||||
|
||||
[ devca_policy ]
|
||||
commonName = supplied
|
||||
stateOrProvinceName = supplied
|
||||
countryName = supplied
|
||||
emailAddress = optional
|
||||
organizationName = supplied
|
||||
organizationalUnitName = optional
|
||||
|
||||
[ devca_extensions ]
|
||||
basicConstraints = CA:false
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always
|
||||
keyUsage = digitalSignature,keyEncipherment
|
||||
extendedKeyUsage = codeSigning
|
||||
crlDistributionPoints = URI:http://path.to.crl/devca.crl
|
68
node_modules/electron-packager/test/cli.js
generated
vendored
Normal file
68
node_modules/electron-packager/test/cli.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('../common')
|
||||
const test = require('ava')
|
||||
|
||||
test('CLI argument test: --electron-version populates opts.electronVersion', t => {
|
||||
let args = common.parseCLIArgs([])
|
||||
t.is(args.electronVersion, undefined)
|
||||
args = common.parseCLIArgs(['--electron-version=1.2.3'])
|
||||
t.is(args.electronVersion, '1.2.3')
|
||||
})
|
||||
|
||||
test('CLI argument test: --download.strictSSL default', t => {
|
||||
const args = common.parseCLIArgs([])
|
||||
t.true(args.download.strictSSL, 'default for --download.strictSSL is true')
|
||||
})
|
||||
|
||||
test('CLI argument test: --asar=true', t => {
|
||||
const args = common.parseCLIArgs(['--asar=true'])
|
||||
t.true(args.asar)
|
||||
})
|
||||
|
||||
test('CLI argument test: using --asar overrides other --asar.options', t => {
|
||||
let args = common.parseCLIArgs(['--asar', '--asar.unpack=*.node'])
|
||||
t.true(args.asar)
|
||||
args = common.parseCLIArgs(['--asar.unpack=*.node', '--asar'])
|
||||
t.true(args.asar)
|
||||
})
|
||||
|
||||
test('CLI argument test: --osx-sign=true', t => {
|
||||
const args = common.parseCLIArgs(['--osx-sign=true'])
|
||||
t.true(args.osxSign)
|
||||
})
|
||||
|
||||
test('CLI argument test: --tmpdir=false', t => {
|
||||
const args = common.parseCLIArgs(['--tmpdir=false'])
|
||||
t.false(args.tmpdir)
|
||||
})
|
||||
|
||||
test('CLI argument test: --deref-symlinks default', t => {
|
||||
const args = common.parseCLIArgs([])
|
||||
t.true(args.derefSymlinks)
|
||||
})
|
||||
|
||||
test('CLI argument test: --out always resolves to a string', t => {
|
||||
const args = common.parseCLIArgs(['--out=1'])
|
||||
t.is(args.out, '1')
|
||||
})
|
||||
|
||||
test('CLI argument test: --out without a value is the same as not passing --out', t => {
|
||||
const args = common.parseCLIArgs(['--out'])
|
||||
t.is(args.out, null)
|
||||
})
|
||||
|
||||
test('CLI argument test: --protocol with a corresponding --protocol-name', t => {
|
||||
const args = common.parseCLIArgs(['--protocol=foo', '--protocol-name=Foo'])
|
||||
t.deepEqual(args.protocols, [{schemes: ['foo'], name: 'Foo'}])
|
||||
})
|
||||
|
||||
test('CLI argument test: --protocol without a corresponding --protocol-name', t => {
|
||||
const args = common.parseCLIArgs(['--protocol=foo'])
|
||||
t.deepEqual(args.protocols, undefined, 'no protocols have been fully defined')
|
||||
})
|
||||
|
||||
test('CLI argument test: multiple --protocol/--protocol-name argument pairs', t => {
|
||||
const args = common.parseCLIArgs(['--protocol=foo', '--protocol-name=Foo', '--protocol=bar', '--protocol-name=Bar'])
|
||||
t.deepEqual(args.protocols, [{schemes: ['foo'], name: 'Foo'}, {schemes: ['bar'], name: 'Bar'}])
|
||||
})
|
3
node_modules/electron-packager/test/config.json
generated
vendored
Normal file
3
node_modules/electron-packager/test/config.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"version": "0.35.6"
|
||||
}
|
445
node_modules/electron-packager/test/darwin.js
generated
vendored
Normal file
445
node_modules/electron-packager/test/darwin.js
generated
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
'use strict'
|
||||
|
||||
const config = require('./config.json')
|
||||
const exec = require('mz/child_process').exec
|
||||
const fs = require('fs-extra')
|
||||
const mac = require('../mac')
|
||||
const packager = require('..')
|
||||
const path = require('path')
|
||||
const plist = require('plist')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
const darwinOpts = {
|
||||
name: 'darwinTest',
|
||||
dir: util.fixtureSubdir('basic'),
|
||||
electronVersion: config.version,
|
||||
arch: 'x64',
|
||||
platform: 'darwin'
|
||||
}
|
||||
|
||||
const el0374Opts = Object.assign({}, darwinOpts, {
|
||||
name: 'el0374Test',
|
||||
dir: util.fixtureSubdir('el-0374'),
|
||||
electronVersion: '0.37.4'
|
||||
})
|
||||
|
||||
function testWrapper (testName, extraOpts, testFunction/*, ...extraArgs */) {
|
||||
const extraArgs = Array.prototype.slice.call(arguments, 3)
|
||||
|
||||
util.packagerTest(testName, (t, baseOpts) => {
|
||||
const opts = Object.assign({}, baseOpts, extraOpts)
|
||||
|
||||
return testFunction.apply(null, [t, opts].concat(extraArgs))
|
||||
})
|
||||
}
|
||||
|
||||
function darwinTest (testName, testFunction/*, ...extraArgs */) {
|
||||
const extraArgs = Array.prototype.slice.call(arguments, 2)
|
||||
return testWrapper.apply(null, [testName, darwinOpts, testFunction].concat(extraArgs))
|
||||
}
|
||||
|
||||
function electron0374Test (testName, testFunction) {
|
||||
const extraArgs = Array.prototype.slice.call(arguments, 2)
|
||||
return testWrapper.apply(null, [testName, el0374Opts, testFunction].concat(extraArgs))
|
||||
}
|
||||
|
||||
function getHelperExecutablePath (helperName) {
|
||||
return path.join(`${helperName}.app`, 'Contents', 'MacOS', helperName)
|
||||
}
|
||||
|
||||
function parseInfoPlist (t, opts, basePath) {
|
||||
const plistPath = path.join(basePath, `${opts.name}.app`, 'Contents', 'Info.plist')
|
||||
|
||||
return fs.stat(plistPath)
|
||||
.then(stats => {
|
||||
t.true(stats.isFile(), 'The expected Info.plist file should exist')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(file => plist.parse(file))
|
||||
}
|
||||
|
||||
function packageAndParseInfoPlist (t, opts) {
|
||||
return packager(opts)
|
||||
.then(paths => parseInfoPlist(t, opts, paths[0]))
|
||||
}
|
||||
|
||||
function helperAppPathsTest (t, baseOpts, extraOpts, expectedName) {
|
||||
const opts = Object.assign(baseOpts, extraOpts)
|
||||
let frameworksPath
|
||||
|
||||
if (!expectedName) {
|
||||
expectedName = opts.name
|
||||
}
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
frameworksPath = path.join(paths[0], `${expectedName}.app`, 'Contents', 'Frameworks')
|
||||
// main Helper.app is already tested in basic test suite; test its executable and the other helpers
|
||||
return fs.stat(path.join(frameworksPath, getHelperExecutablePath(`${expectedName} Helper`)))
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The Helper.app executable should reflect sanitized opts.name')
|
||||
return fs.stat(path.join(frameworksPath, `${expectedName} Helper EH.app`))
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The Helper EH.app should reflect sanitized opts.name')
|
||||
return fs.stat(path.join(frameworksPath, getHelperExecutablePath(`${expectedName} Helper EH`)))
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The Helper EH.app executable should reflect sanitized opts.name')
|
||||
return fs.stat(path.join(frameworksPath, `${expectedName} Helper NP.app`))
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The Helper NP.app should reflect sanitized opts.name')
|
||||
return fs.stat(path.join(frameworksPath, getHelperExecutablePath(`${expectedName} Helper NP`)))
|
||||
}).then(stats => t.true(stats.isFile(), 'The Helper NP.app executable should reflect sanitized opts.name'))
|
||||
}
|
||||
|
||||
function iconTest (t, opts, icon, iconPath) {
|
||||
opts.icon = icon
|
||||
|
||||
let resourcesPath
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(generatedResourcesPath => {
|
||||
resourcesPath = generatedResourcesPath
|
||||
const outputPath = resourcesPath.replace(`${path.sep}${util.generateResourcesPath(opts)}`, '')
|
||||
return parseInfoPlist(t, opts, outputPath)
|
||||
}).then(obj => {
|
||||
return util.areFilesEqual(iconPath, path.join(resourcesPath, obj.CFBundleIconFile))
|
||||
}).then(equal => t.true(equal, 'installed icon file should be identical to the specified icon file'))
|
||||
}
|
||||
|
||||
function extendInfoTest (t, baseOpts, extraPathOrParams) {
|
||||
const opts = Object.assign({}, baseOpts, {
|
||||
appBundleId: 'com.electron.extratest',
|
||||
appCategoryType: 'public.app-category.music',
|
||||
buildVersion: '3.2.1',
|
||||
extendInfo: extraPathOrParams
|
||||
})
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(obj => {
|
||||
t.is(obj.TestKeyString, 'String data', 'TestKeyString should come from extendInfo')
|
||||
t.is(obj.TestKeyInt, 12345, 'TestKeyInt should come from extendInfo')
|
||||
t.is(obj.TestKeyBool, true, 'TestKeyBool should come from extendInfo')
|
||||
t.deepEqual(obj.TestKeyArray, ['public.content', 'public.data'], 'TestKeyArray should come from extendInfo')
|
||||
t.deepEqual(obj.TestKeyDict, { Number: 98765, CFBundleVersion: '0.0.0' }, 'TestKeyDict should come from extendInfo')
|
||||
t.is(obj.CFBundleVersion, opts.buildVersion, 'CFBundleVersion should reflect buildVersion argument')
|
||||
t.is(obj.CFBundleIdentifier, 'com.electron.extratest', 'CFBundleIdentifier should reflect appBundleId argument')
|
||||
t.is(obj.LSApplicationCategoryType, 'public.app-category.music', 'LSApplicationCategoryType should reflect appCategoryType argument')
|
||||
return t.is(obj.CFBundlePackageType, 'APPL', 'CFBundlePackageType should be Electron default')
|
||||
})
|
||||
}
|
||||
|
||||
function binaryNameTest (t, baseOpts, extraOpts, expectedExecutableName, expectedAppName) {
|
||||
const opts = Object.assign({}, baseOpts, extraOpts)
|
||||
const appName = expectedAppName || expectedExecutableName || opts.name
|
||||
const executableName = expectedExecutableName || opts.name
|
||||
|
||||
let binaryPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
binaryPath = path.join(paths[0], `${appName}.app`, 'Contents', 'MacOS')
|
||||
return fs.stat(path.join(binaryPath, executableName))
|
||||
}).then(stats => t.true(stats.isFile(), 'The binary should reflect a sanitized opts.name'))
|
||||
}
|
||||
|
||||
function appVersionTest (t, opts, appVersion, buildVersion) {
|
||||
opts.appVersion = appVersion
|
||||
opts.buildVersion = buildVersion || appVersion
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(obj => {
|
||||
t.is(obj.CFBundleVersion, '' + opts.buildVersion, 'CFBundleVersion should reflect buildVersion')
|
||||
t.is(obj.CFBundleShortVersionString, '' + opts.appVersion, 'CFBundleShortVersionString should reflect appVersion')
|
||||
t.is(typeof obj.CFBundleVersion, 'string', 'CFBundleVersion should be a string')
|
||||
return t.is(typeof obj.CFBundleShortVersionString, 'string', 'CFBundleShortVersionString should be a string')
|
||||
})
|
||||
}
|
||||
|
||||
function appBundleTest (t, opts, appBundleId) {
|
||||
if (appBundleId) {
|
||||
opts.appBundleId = appBundleId
|
||||
}
|
||||
|
||||
const defaultBundleName = `com.electron.${opts.name.toLowerCase()}`
|
||||
const appBundleIdentifier = mac.filterCFBundleIdentifier(opts.appBundleId || defaultBundleName)
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(obj => {
|
||||
t.is(obj.CFBundleDisplayName, opts.name, 'CFBundleDisplayName should reflect opts.name')
|
||||
t.is(obj.CFBundleName, opts.name, 'CFBundleName should reflect opts.name')
|
||||
t.is(obj.CFBundleIdentifier, appBundleIdentifier, 'CFBundleName should reflect opts.appBundleId or fallback to default')
|
||||
t.is(typeof obj.CFBundleDisplayName, 'string', 'CFBundleDisplayName should be a string')
|
||||
t.is(typeof obj.CFBundleName, 'string', 'CFBundleName should be a string')
|
||||
t.is(typeof obj.CFBundleIdentifier, 'string', 'CFBundleIdentifier should be a string')
|
||||
return t.is(/^[a-zA-Z0-9-.]*$/.test(obj.CFBundleIdentifier), true, 'CFBundleIdentifier should allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)')
|
||||
})
|
||||
}
|
||||
|
||||
function appHelpersBundleTest (t, opts, helperBundleId, appBundleId) {
|
||||
let tempPath, plistPath
|
||||
|
||||
if (helperBundleId) {
|
||||
opts.helperBundleId = helperBundleId
|
||||
}
|
||||
if (appBundleId) {
|
||||
opts.appBundleId = appBundleId
|
||||
}
|
||||
const defaultBundleName = `com.electron.${opts.name.toLowerCase()}`
|
||||
const appBundleIdentifier = mac.filterCFBundleIdentifier(opts.appBundleId || defaultBundleName)
|
||||
const helperBundleIdentifier = mac.filterCFBundleIdentifier(opts.helperBundleId || appBundleIdentifier + '.helper')
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
tempPath = paths[0]
|
||||
plistPath = path.join(tempPath, opts.name + '.app', 'Contents', 'Frameworks', opts.name + ' Helper.app', 'Contents', 'Info.plist')
|
||||
return fs.stat(plistPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The expected Info.plist file should exist in helper app')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(file => {
|
||||
const obj = plist.parse(file)
|
||||
t.is(obj.CFBundleName, opts.name, 'CFBundleName should reflect opts.name in helper app')
|
||||
t.is(obj.CFBundleIdentifier, helperBundleIdentifier, 'CFBundleIdentifier should reflect opts.helperBundleId, opts.appBundleId or fallback to default in helper app')
|
||||
t.is(typeof obj.CFBundleName, 'string', 'CFBundleName should be a string in helper app')
|
||||
t.is(typeof obj.CFBundleIdentifier, 'string', 'CFBundleIdentifier should be a string in helper app')
|
||||
t.is(/^[a-zA-Z0-9-.]*$/.test(obj.CFBundleIdentifier), true, 'CFBundleIdentifier should allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)')
|
||||
// check helper EH
|
||||
plistPath = path.join(tempPath, opts.name + '.app', 'Contents', 'Frameworks', opts.name + ' Helper EH.app', 'Contents', 'Info.plist')
|
||||
return fs.stat(plistPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The expected Info.plist file should exist in helper EH app')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(file => {
|
||||
const obj = plist.parse(file)
|
||||
t.is(obj.CFBundleName, opts.name + ' Helper EH', 'CFBundleName should reflect opts.name in helper EH app')
|
||||
t.is(obj.CFBundleDisplayName, opts.name + ' Helper EH', 'CFBundleDisplayName should reflect opts.name in helper EH app')
|
||||
t.is(obj.CFBundleExecutable, opts.name + ' Helper EH', 'CFBundleExecutable should reflect opts.name in helper EH app')
|
||||
t.is(obj.CFBundleIdentifier, helperBundleIdentifier + '.EH', 'CFBundleName should reflect opts.helperBundleId, opts.appBundleId or fallback to default in helper EH app')
|
||||
t.is(typeof obj.CFBundleName, 'string', 'CFBundleName should be a string in helper EH app')
|
||||
t.is(typeof obj.CFBundleDisplayName, 'string', 'CFBundleDisplayName should be a string in helper EH app')
|
||||
t.is(typeof obj.CFBundleExecutable, 'string', 'CFBundleExecutable should be a string in helper EH app')
|
||||
t.is(typeof obj.CFBundleIdentifier, 'string', 'CFBundleIdentifier should be a string in helper EH app')
|
||||
t.is(/^[a-zA-Z0-9-.]*$/.test(obj.CFBundleIdentifier), true, 'CFBundleIdentifier should allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)')
|
||||
// check helper NP
|
||||
plistPath = path.join(tempPath, opts.name + '.app', 'Contents', 'Frameworks', opts.name + ' Helper NP.app', 'Contents', 'Info.plist')
|
||||
return fs.stat(plistPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The expected Info.plist file should exist in helper NP app')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(file => {
|
||||
const obj = plist.parse(file)
|
||||
t.is(obj.CFBundleName, opts.name + ' Helper NP', 'CFBundleName should reflect opts.name in helper NP app')
|
||||
t.is(obj.CFBundleDisplayName, opts.name + ' Helper NP', 'CFBundleDisplayName should reflect opts.name in helper NP app')
|
||||
t.is(obj.CFBundleExecutable, opts.name + ' Helper NP', 'CFBundleExecutable should reflect opts.name in helper NP app')
|
||||
t.is(obj.CFBundleIdentifier, helperBundleIdentifier + '.NP', 'CFBundleName should reflect opts.helperBundleId, opts.appBundleId or fallback to default in helper NP app')
|
||||
t.is(typeof obj.CFBundleName, 'string', 'CFBundleName should be a string in helper NP app')
|
||||
t.is(typeof obj.CFBundleDisplayName, 'string', 'CFBundleDisplayName should be a string in helper NP app')
|
||||
t.is(typeof obj.CFBundleExecutable, 'string', 'CFBundleExecutable should be a string in helper NP app')
|
||||
t.is(typeof obj.CFBundleIdentifier, 'string', 'CFBundleIdentifier should be a string in helper NP app')
|
||||
return t.is(/^[a-zA-Z0-9-.]*$/.test(obj.CFBundleIdentifier), true, 'CFBundleIdentifier should allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)')
|
||||
})
|
||||
}
|
||||
|
||||
if (!(process.env.CI && process.platform === 'win32')) {
|
||||
darwinTest('helper app paths test', helperAppPathsTest)
|
||||
darwinTest('helper app paths test with app name needing sanitization', helperAppPathsTest, {name: '@username/package-name'}, '@username-package-name')
|
||||
|
||||
const iconBase = path.join(__dirname, 'fixtures', 'monochrome')
|
||||
const icnsPath = `${iconBase}.icns`
|
||||
|
||||
darwinTest('icon test: .icns specified', iconTest, icnsPath, icnsPath)
|
||||
// This test exists because the .icns file basename changed as of 0.37.4
|
||||
electron0374Test('icon test: Electron 0.37.4, .icns specified', iconTest, icnsPath, icnsPath)
|
||||
darwinTest('icon test: .ico specified (should replace with .icns)', iconTest, `${iconBase}.ico`, icnsPath)
|
||||
darwinTest('icon test: basename only (should add .icns)', iconTest, iconBase, icnsPath)
|
||||
|
||||
const extraInfoPath = path.join(__dirname, 'fixtures', 'extrainfo.plist')
|
||||
const extraInfoParams = plist.parse(fs.readFileSync(extraInfoPath).toString())
|
||||
|
||||
darwinTest('extendInfo by filename test', extendInfoTest, extraInfoPath)
|
||||
darwinTest('extendInfo by params test', extendInfoTest, extraInfoParams)
|
||||
|
||||
darwinTest('protocol/protocol-name argument test', (t, opts) => {
|
||||
opts.protocols = [
|
||||
{
|
||||
name: 'Foo',
|
||||
schemes: ['foo']
|
||||
},
|
||||
{
|
||||
name: 'Bar',
|
||||
schemes: ['bar', 'baz']
|
||||
}
|
||||
]
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(obj =>
|
||||
t.deepEqual(obj.CFBundleURLTypes, [{
|
||||
CFBundleURLName: 'Foo',
|
||||
CFBundleURLSchemes: ['foo']
|
||||
}, {
|
||||
CFBundleURLName: 'Bar',
|
||||
CFBundleURLSchemes: ['bar', 'baz']
|
||||
}], 'CFBundleURLTypes did not contain specified protocol schemes and names')
|
||||
)
|
||||
})
|
||||
|
||||
test('osxSign argument test: default args', t => {
|
||||
const args = true
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {identity: null, app: 'out', platform: 'darwin', version: 'version'})
|
||||
})
|
||||
|
||||
test('osxSign argument test: identity=true sets autodiscovery mode', t => {
|
||||
const args = {identity: true}
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {identity: null, app: 'out', platform: 'darwin', version: 'version'})
|
||||
})
|
||||
|
||||
test('osxSign argument test: entitlements passed to electron-osx-sign', t => {
|
||||
const args = {entitlements: 'path-to-entitlements'}
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {app: 'out', platform: 'darwin', version: 'version', entitlements: args.entitlements})
|
||||
})
|
||||
|
||||
test('osxSign argument test: app not overwritten', t => {
|
||||
const args = {app: 'some-other-path'}
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {app: 'out', platform: 'darwin', version: 'version'})
|
||||
})
|
||||
|
||||
test('osxSign argument test: platform not overwritten', t => {
|
||||
const args = {platform: 'mas'}
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {app: 'out', platform: 'darwin', version: 'version'})
|
||||
})
|
||||
|
||||
test('osxSign argument test: binaries not set', t => {
|
||||
const args = {binaries: ['binary1', 'binary2']}
|
||||
const signOpts = mac.createSignOpts(args, 'darwin', 'out', 'version')
|
||||
t.deepEqual(signOpts, {app: 'out', platform: 'darwin', version: 'version'})
|
||||
})
|
||||
|
||||
darwinTest('codesign test', (t, opts) => {
|
||||
opts.osxSign = {identity: 'Developer CodeCert'}
|
||||
|
||||
let appPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
appPath = path.join(paths[0], opts.name + '.app')
|
||||
return fs.stat(appPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The expected .app directory should exist')
|
||||
return exec(`codesign -v ${appPath}`)
|
||||
}).then(
|
||||
(stdout, stderr) => t.pass('codesign should verify successfully'),
|
||||
err => {
|
||||
const notFound = err && err.code === 127
|
||||
|
||||
if (notFound) {
|
||||
console.log('codesign not installed; skipped')
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
darwinTest('binary naming test', binaryNameTest)
|
||||
darwinTest('sanitized binary naming test', binaryNameTest, {name: '@username/package-name'}, '@username-package-name')
|
||||
darwinTest('executableName test', binaryNameTest, {executableName: 'app-name', name: 'MyAppName'}, 'app-name', 'MyAppName')
|
||||
|
||||
darwinTest('CFBundleName is the sanitized app name and CFBundleDisplayName is the non-sanitized app name', (t, opts) => {
|
||||
const appBundleIdentifier = 'com.electron.username-package-name'
|
||||
const expectedSanitizedName = '@username-package-name'
|
||||
|
||||
let plistPath
|
||||
|
||||
opts.name = '@username/package-name'
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
plistPath = path.join(paths[0], `${expectedSanitizedName}.app`, 'Contents', 'Info.plist')
|
||||
return fs.stat(plistPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isFile(), 'The expected Info.plist file should exist')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(file => {
|
||||
const obj = plist.parse(file)
|
||||
t.is(typeof obj.CFBundleDisplayName, 'string', 'CFBundleDisplayName should be a string')
|
||||
t.is(obj.CFBundleDisplayName, opts.name, 'CFBundleDisplayName should reflect opts.name')
|
||||
t.is(typeof obj.CFBundleName, 'string', 'CFBundleName should be a string')
|
||||
t.is(obj.CFBundleName, expectedSanitizedName, 'CFBundleName should reflect a sanitized opts.name')
|
||||
t.is(typeof obj.CFBundleIdentifier, 'string', 'CFBundleIdentifier should be a string')
|
||||
t.is(/^[a-zA-Z0-9-.]*$/.test(obj.CFBundleIdentifier), true, 'CFBundleIdentifier should allow only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.)')
|
||||
return t.is(obj.CFBundleIdentifier, appBundleIdentifier, 'CFBundleIdentifier should reflect the sanitized opts.name')
|
||||
})
|
||||
})
|
||||
|
||||
darwinTest('app and build version test', appVersionTest, '1.1.0', '1.1.0.1234')
|
||||
darwinTest('app version test', appVersionTest, '1.1.0')
|
||||
darwinTest('app and build version integer test', appVersionTest, 12, 1234)
|
||||
darwinTest('infer app version from package.json test', (t, opts) =>
|
||||
packageAndParseInfoPlist(t, opts)
|
||||
.then(obj => {
|
||||
t.is(obj.CFBundleVersion, '4.99.101', 'CFBundleVersion should reflect package.json version')
|
||||
return t.is(obj.CFBundleShortVersionString, '4.99.101', 'CFBundleShortVersionString should reflect package.json version')
|
||||
})
|
||||
)
|
||||
|
||||
darwinTest('app categoryType test', (t, opts) => {
|
||||
const appCategoryType = 'public.app-category.developer-tools'
|
||||
opts.appCategoryType = appCategoryType
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(obj => t.is(obj.LSApplicationCategoryType, appCategoryType, 'LSApplicationCategoryType should reflect opts.appCategoryType'))
|
||||
})
|
||||
|
||||
darwinTest('app bundle test', appBundleTest, 'com.electron.basetest')
|
||||
darwinTest('app bundle (w/ special characters) test', appBundleTest, 'com.electron."bãśè tëßt!@#$%^&*()?\'')
|
||||
darwinTest('app bundle app-bundle-id fallback test', appBundleTest)
|
||||
|
||||
darwinTest('app bundle framework symlink test', (t, opts) => {
|
||||
let frameworkPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
frameworkPath = path.join(paths[0], `${opts.name}.app`, 'Contents', 'Frameworks', 'Electron Framework.framework')
|
||||
return fs.stat(frameworkPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'Expected Electron Framework.framework to be a directory')
|
||||
return fs.lstat(path.join(frameworkPath, 'Electron Framework'))
|
||||
}).then(stats => {
|
||||
t.true(stats.isSymbolicLink(), 'Expected Electron Framework.framework/Electron Framework to be a symlink')
|
||||
return fs.lstat(path.join(frameworkPath, 'Versions', 'Current'))
|
||||
}).then(stats => t.true(stats.isSymbolicLink(), 'Expected Electron Framework.framework/Versions/Current to be a symlink'))
|
||||
})
|
||||
|
||||
darwinTest('app helpers bundle test', appHelpersBundleTest, 'com.electron.basetest.helper')
|
||||
darwinTest('app helpers bundle (w/ special characters) test', appHelpersBundleTest, 'com.electron."bãśè tëßt!@#$%^&*()?\'.hęłpėr')
|
||||
darwinTest('app helpers bundle helper-bundle-id fallback to app-bundle-id test', appHelpersBundleTest, null, 'com.electron.basetest')
|
||||
darwinTest('app helpers bundle helper-bundle-id fallback to app-bundle-id (w/ special characters) test', appHelpersBundleTest, null, 'com.electron."bãśè tëßt!!@#$%^&*()?\'')
|
||||
darwinTest('app helpers bundle helper-bundle-id & app-bundle-id fallback test', appHelpersBundleTest)
|
||||
|
||||
darwinTest('appCopyright/NSHumanReadableCopyright test', (t, baseOpts) => {
|
||||
const copyright = 'Copyright © 2003–2015 Organization. All rights reserved.'
|
||||
const opts = Object.assign({}, baseOpts, {appCopyright: copyright})
|
||||
|
||||
return packageAndParseInfoPlist(t, opts)
|
||||
.then(info => t.is(info.NSHumanReadableCopyright, copyright, 'NSHumanReadableCopyright should reflect opts.appCopyright'))
|
||||
})
|
||||
|
||||
darwinTest('app named Electron packaged successfully', (t, baseOpts) => {
|
||||
const opts = Object.assign({}, baseOpts, {name: 'Electron'})
|
||||
let appPath
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
appPath = path.join(paths[0], 'Electron.app')
|
||||
return fs.stat(appPath)
|
||||
}).then(stats => {
|
||||
t.true(stats.isDirectory(), 'The Electron.app folder exists')
|
||||
return fs.stat(path.join(appPath, 'Contents', 'MacOS', 'Electron'))
|
||||
}).then(stats => t.true(stats.isFile(), 'The Electron.app/Contents/MacOS/Electron binary exists'))
|
||||
})
|
||||
}
|
4
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/index.html
generated
vendored
Normal file
4
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/index.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>Hello, world!</body>
|
||||
</html>
|
24
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/main.js
generated
vendored
Normal file
24
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/main.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
const app = require('app')
|
||||
const BrowserWindow = require('browser-window')
|
||||
let mainWindow
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
app.on('ready', function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
center: true,
|
||||
title: 'Basic Test',
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
mainWindow.loadUrl('file://' + require('path').resolve(__dirname, 'index.html'))
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null
|
||||
})
|
||||
})
|
12
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/package.json
generated
vendored
Normal file
12
node_modules/electron-packager/test/fixtures/basic-renamed-to-electron/package.json
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"description": "A test of the renamed from `electron-prebuilt` to `electron`",
|
||||
"dependencies": {
|
||||
"electron-prebuilt": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "1.3.1",
|
||||
"electron-prebuilt": "1.3.0"
|
||||
}
|
||||
}
|
0
node_modules/electron-packager/test/fixtures/basic/dir_to_unpack/file1.txt
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/dir_to_unpack/file1.txt
generated
vendored
Normal file
2
node_modules/electron-packager/test/fixtures/basic/electron-packager/readme.txt
generated
vendored
Normal file
2
node_modules/electron-packager/test/fixtures/basic/electron-packager/readme.txt
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
This file exists to test ability to ignore paths under app, without also
|
||||
ignoring the entire app folder due to a match above it (#54 / #55).
|
1
node_modules/electron-packager/test/fixtures/basic/file_to_unpack.pac
generated
vendored
Normal file
1
node_modules/electron-packager/test/fixtures/basic/file_to_unpack.pac
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
This file is used for testing asar unpack option
|
0
node_modules/electron-packager/test/fixtures/basic/ignore.o
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/ignore.o
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/ignore.obj
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/ignore.obj
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/ignore/this.txt
generated
vendored
Normal file
0
node_modules/electron-packager/test/fixtures/basic/ignore/this.txt
generated
vendored
Normal file
1
node_modules/electron-packager/test/fixtures/basic/ignorethis.txt
generated
vendored
Normal file
1
node_modules/electron-packager/test/fixtures/basic/ignorethis.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
|
4
node_modules/electron-packager/test/fixtures/basic/index.html
generated
vendored
Normal file
4
node_modules/electron-packager/test/fixtures/basic/index.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>Hello, world!</body>
|
||||
</html>
|
24
node_modules/electron-packager/test/fixtures/basic/main.js
generated
vendored
Normal file
24
node_modules/electron-packager/test/fixtures/basic/main.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
const app = require('app')
|
||||
const BrowserWindow = require('browser-window')
|
||||
let mainWindow
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
app.on('ready', function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
center: true,
|
||||
title: 'Basic Test',
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
mainWindow.loadUrl('file://' + require('path').resolve(__dirname, 'index.html'))
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null
|
||||
})
|
||||
})
|
16
node_modules/electron-packager/test/fixtures/basic/package.json
generated
vendored
Normal file
16
node_modules/electron-packager/test/fixtures/basic/package.json
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"version": "4.99.101",
|
||||
"productName": "MainJS",
|
||||
"dependencies": {
|
||||
"@types/node": "^8.0.0",
|
||||
"run-series": "^1.1.1"
|
||||
},
|
||||
"//": "ncp used to test https://github.com/electron-userland/electron-packager/pull/186",
|
||||
"///": "(a module (with zero dependencies) that creates a file in node_modules/.bin)",
|
||||
"devDependencies": {
|
||||
"ncp": "^2.0.0",
|
||||
"run-waterfall": "^1.1.1",
|
||||
"electron-prebuilt": "0.35.6"
|
||||
}
|
||||
}
|
1
node_modules/electron-packager/test/fixtures/data1.txt
generated
vendored
Normal file
1
node_modules/electron-packager/test/fixtures/data1.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
This is a text file.
|
4
node_modules/electron-packager/test/fixtures/el-0374/index.html
generated
vendored
Normal file
4
node_modules/electron-packager/test/fixtures/el-0374/index.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>Hello, world!</body>
|
||||
</html>
|
24
node_modules/electron-packager/test/fixtures/el-0374/main.js
generated
vendored
Normal file
24
node_modules/electron-packager/test/fixtures/el-0374/main.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
const app = require('app')
|
||||
const BrowserWindow = require('browser-window')
|
||||
let mainWindow
|
||||
|
||||
app.on('window-all-closed', function () {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
app.on('ready', function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
center: true,
|
||||
title: 'Basic Test',
|
||||
width: 800,
|
||||
height: 600
|
||||
})
|
||||
|
||||
mainWindow.loadUrl('file://' + require('path').resolve(__dirname, 'index.html'))
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
mainWindow = null
|
||||
})
|
||||
})
|
12
node_modules/electron-packager/test/fixtures/el-0374/package.json
generated
vendored
Normal file
12
node_modules/electron-packager/test/fixtures/el-0374/package.json
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"dependencies": {
|
||||
"run-series": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ncp": "^2.0.0",
|
||||
"run-waterfall": "^1.1.1",
|
||||
"electron-prebuilt": "0.37.4"
|
||||
}
|
||||
}
|
4
node_modules/electron-packager/test/fixtures/electron-in-dependencies/index.html
generated
vendored
Normal file
4
node_modules/electron-packager/test/fixtures/electron-in-dependencies/index.html
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>Hello, world!</body>
|
||||
</html>
|
1
node_modules/electron-packager/test/fixtures/electron-in-dependencies/main.js
generated
vendored
Normal file
1
node_modules/electron-packager/test/fixtures/electron-in-dependencies/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
'use strict'
|
8
node_modules/electron-packager/test/fixtures/electron-in-dependencies/package.json
generated
vendored
Normal file
8
node_modules/electron-packager/test/fixtures/electron-in-dependencies/package.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"description": "Removing electron from dependencies",
|
||||
"dependencies": {
|
||||
"electron": "1.3.1"
|
||||
}
|
||||
}
|
30
node_modules/electron-packager/test/fixtures/extrainfo.plist
generated
vendored
Normal file
30
node_modules/electron-packager/test/fixtures/extrainfo.plist
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.0</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>x.y.z.z.y</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>TestKeyString</key>
|
||||
<string>String data</string>
|
||||
<key>TestKeyBool</key>
|
||||
<true/>
|
||||
<key>TestKeyInt</key>
|
||||
<integer>12345</integer>
|
||||
<key>TestKeyArray</key>
|
||||
<array>
|
||||
<string>public.content</string>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>TestKeyDict</key>
|
||||
<dict>
|
||||
<key>Number</key>
|
||||
<integer>98765</integer>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
9
node_modules/electron-packager/test/fixtures/infer-bad-fields/package.json
generated
vendored
Normal file
9
node_modules/electron-packager/test/fixtures/infer-bad-fields/package.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"productName": "InferBadFields",
|
||||
"dependencies": {
|
||||
"run-series": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron-prebuilt": false
|
||||
}
|
||||
}
|
7
node_modules/electron-packager/test/fixtures/infer-electron-prebuilt-compile/package.json
generated
vendored
Normal file
7
node_modules/electron-packager/test/fixtures/infer-electron-prebuilt-compile/package.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"devDependencies": {
|
||||
"electron-prebuilt-compile": "1.4.15"
|
||||
}
|
||||
}
|
2
node_modules/electron-packager/test/fixtures/infer-malformed-json/package.json
generated
vendored
Normal file
2
node_modules/electron-packager/test/fixtures/infer-malformed-json/package.json
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
{
|
||||
"productName": "InferMalformedJSON",
|
5
node_modules/electron-packager/test/fixtures/infer-missing-fields/package.json
generated
vendored
Normal file
5
node_modules/electron-packager/test/fixtures/infer-missing-fields/package.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"run-series": "^1.1.1"
|
||||
}
|
||||
}
|
7
node_modules/electron-packager/test/fixtures/infer-missing-version-only/package.json
generated
vendored
Normal file
7
node_modules/electron-packager/test/fixtures/infer-missing-version-only/package.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"devDependencies": {
|
||||
"electron": "1.3.1"
|
||||
}
|
||||
}
|
7
node_modules/electron-packager/test/fixtures/infer-non-specific-electron-prebuilt-compile/package.json
generated
vendored
Normal file
7
node_modules/electron-packager/test/fixtures/infer-non-specific-electron-prebuilt-compile/package.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"devDependencies": {
|
||||
"electron-prebuilt-compile": "^1.4.15"
|
||||
}
|
||||
}
|
9
node_modules/electron-packager/test/fixtures/infer-win32metadata/package.json
generated
vendored
Normal file
9
node_modules/electron-packager/test/fixtures/infer-win32metadata/package.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"main": "main.js",
|
||||
"productName": "MainJS",
|
||||
"author": "Foo Bar <foo.bar@example.com>",
|
||||
"description": "Some description",
|
||||
"devDependencies": {
|
||||
"electron-prebuilt-compile": "1.4.15"
|
||||
}
|
||||
}
|
BIN
node_modules/electron-packager/test/fixtures/monochrome.icns
generated
vendored
Normal file
BIN
node_modules/electron-packager/test/fixtures/monochrome.icns
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/electron-packager/test/fixtures/monochrome.ico
generated
vendored
Normal file
BIN
node_modules/electron-packager/test/fixtures/monochrome.ico
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
80
node_modules/electron-packager/test/hooks.js
generated
vendored
Normal file
80
node_modules/electron-packager/test/hooks.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
'use strict'
|
||||
|
||||
const config = require('./config.json')
|
||||
const hooks = require('../hooks')
|
||||
const packager = require('..')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
function hookTest (wantHookCalled, hookName, t, opts) {
|
||||
let hookCalled = false
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
opts.electronVersion = config.version
|
||||
opts.arch = 'ia32'
|
||||
opts.platform = 'all'
|
||||
|
||||
opts[hookName] = [(buildPath, electronVersion, platform, arch, callback) => {
|
||||
hookCalled = true
|
||||
t.is(electronVersion, opts.electronVersion, `${hookName} electronVersion should be the same as the options object`)
|
||||
t.is(arch, opts.arch, `${hookName} arch should be the same as the options object`)
|
||||
callback()
|
||||
}]
|
||||
|
||||
// 2 packages will be built during this test
|
||||
return packager(opts)
|
||||
.then(finalPaths => {
|
||||
t.is(finalPaths.length, 2, 'packager call should resolve with expected number of paths')
|
||||
t.is(wantHookCalled, hookCalled, `${hookName} methods ${wantHookCalled ? 'should' : 'should not'} have been called`)
|
||||
return util.verifyPackageExistence(finalPaths)
|
||||
}).then(exists => t.deepEqual(exists, [true, true], 'Packages should be generated for both 32-bit platforms'))
|
||||
}
|
||||
|
||||
function createHookTest (hookName) {
|
||||
util.packagerTest(`platform=all test (one arch) (${hookName} hook)`,
|
||||
(t, opts) => hookTest(true, hookName, t, opts))
|
||||
}
|
||||
|
||||
createHookTest('afterCopy')
|
||||
createHookTest('afterPrune')
|
||||
createHookTest('afterExtract')
|
||||
|
||||
test('promisifyHooks executes functions in parallel', t => {
|
||||
let output = '0'
|
||||
const timeoutFunc = (number, msTimeout) => {
|
||||
return done => {
|
||||
setTimeout(() => {
|
||||
output += ` ${number}`
|
||||
done()
|
||||
}, msTimeout)
|
||||
}
|
||||
}
|
||||
const testHooks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(number =>
|
||||
timeoutFunc(number, number % 2 === 0 ? 1000 : 0)
|
||||
)
|
||||
|
||||
return hooks.promisifyHooks(testHooks)
|
||||
.then(() => t.not(output, '0 1 2 3 4 5 6 7 8 9 10', 'should not be in sequential order'))
|
||||
})
|
||||
|
||||
test('serialHooks executes functions serially', t => {
|
||||
let output = '0'
|
||||
const timeoutFunc = (number, msTimeout) => {
|
||||
return () => new Promise(resolve => { // eslint-disable-line promise/avoid-new
|
||||
setTimeout(() => {
|
||||
output += ` ${number}`
|
||||
resolve()
|
||||
}, msTimeout)
|
||||
})
|
||||
}
|
||||
const testHooks = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(number =>
|
||||
timeoutFunc(number, number % 2 === 0 ? 1000 : 0)
|
||||
)
|
||||
|
||||
return hooks.serialHooks(testHooks)(() => output)
|
||||
.then(result => t.is(result, '0 1 2 3 4 5 6 7 8 9 10', 'should be in sequential order'))
|
||||
})
|
||||
|
||||
util.packagerTest('prune hook does not get called when prune=false', (t, opts) => {
|
||||
opts.prune = false
|
||||
return hookTest(false, 'afterPrune', t, opts)
|
||||
})
|
113
node_modules/electron-packager/test/ignore.js
generated
vendored
Normal file
113
node_modules/electron-packager/test/ignore.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
'use strict'
|
||||
|
||||
const common = require('../common')
|
||||
const fs = require('fs-extra')
|
||||
const ignore = require('../ignore')
|
||||
const path = require('path')
|
||||
const packager = require('..')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
function ignoreTest (t, opts, ignorePattern, ignoredFile) {
|
||||
opts.dir = util.fixtureSubdir('basic')
|
||||
if (ignorePattern) {
|
||||
opts.ignore = ignorePattern
|
||||
}
|
||||
|
||||
const targetDir = path.join(t.context.tempDir, 'result')
|
||||
ignore.generateIgnores(opts)
|
||||
|
||||
return fs.copy(opts.dir, targetDir, {
|
||||
dereference: false,
|
||||
filter: ignore.userIgnoreFilter(opts)
|
||||
}).then(() => fs.pathExists(path.join(targetDir, 'package.json')))
|
||||
.then(exists => {
|
||||
t.true(exists, 'The expected output directory should exist and contain files')
|
||||
return fs.pathExists(path.join(targetDir, ignoredFile))
|
||||
}).then(exists => t.false(exists, `Ignored file '${ignoredFile}' should not exist in copied directory`))
|
||||
}
|
||||
|
||||
function ignoreOutDirTest (t, opts, distPath) {
|
||||
opts.name = 'ignoreOutDirTest'
|
||||
opts.dir = t.context.workDir
|
||||
|
||||
// we don't use path.join here to avoid normalizing
|
||||
const outDir = opts.dir + path.sep + distPath
|
||||
opts.out = outDir
|
||||
|
||||
return fs.copy(util.fixtureSubdir('basic'), t.context.workDir, {
|
||||
dereference: true,
|
||||
stopOnErr: true,
|
||||
filter: file => { return path.basename(file) !== 'node_modules' }
|
||||
}).then(() =>
|
||||
// create out dir before packager (real world issue - when second run includes unignored out dir)
|
||||
fs.ensureDir(outDir)
|
||||
).then(() =>
|
||||
// create file to ensure that directory will be not ignored because empty
|
||||
fs.open(path.join(outDir, 'ignoreMe'), 'w')
|
||||
).then(fd => fs.close(fd))
|
||||
.then(() => packager(opts))
|
||||
.then(() => fs.pathExists(path.join(outDir, common.generateFinalBasename(opts), util.generateResourcesPath(opts), 'app', path.basename(outDir))))
|
||||
.then(exists => t.false(exists, 'Out dir must not exist in output app directory'))
|
||||
}
|
||||
|
||||
function ignoreImplicitOutDirTest (t, opts) {
|
||||
opts.name = 'ignoreImplicitOutDirTest'
|
||||
opts.dir = t.context.workDir
|
||||
delete opts.out
|
||||
|
||||
const testFilename = 'ignoreMe'
|
||||
let previousPackedResultDir
|
||||
|
||||
return fs.copy(util.fixtureSubdir('basic'), t.context.workDir, {
|
||||
dereference: true,
|
||||
stopOnErr: true,
|
||||
filter: file => { return path.basename(file) !== 'node_modules' }
|
||||
}).then(() => {
|
||||
previousPackedResultDir = path.join(opts.dir, `${common.sanitizeAppName(opts.name)}-linux-ia32`)
|
||||
return fs.ensureDir(previousPackedResultDir)
|
||||
}).then(() =>
|
||||
// create file to ensure that directory will be not ignored because empty
|
||||
fs.open(path.join(previousPackedResultDir, testFilename), 'w')
|
||||
).then(fd => fs.close(fd))
|
||||
.then(() => packager(opts))
|
||||
.then(() => fs.pathExists(path.join(opts.dir, common.generateFinalBasename(opts), util.generateResourcesPath(opts), 'app', testFilename)))
|
||||
.then(exists => t.false(exists, 'Out dir must not exist in output app directory'))
|
||||
}
|
||||
|
||||
test('generateIgnores ignores the generated temporary directory only on Linux', t => {
|
||||
const tmpdir = '/foo/bar'
|
||||
const expected = path.join(tmpdir, 'electron-packager')
|
||||
let opts = {tmpdir}
|
||||
|
||||
ignore.generateIgnores(opts)
|
||||
|
||||
// Array.prototype.includes is added (not behind a feature flag) in Node 6
|
||||
if (process.platform === 'linux') {
|
||||
t.false(opts.ignore.indexOf(expected) === -1, 'temporary dir in opts.ignore')
|
||||
} else {
|
||||
t.true(opts.ignore.indexOf(expected) === -1, 'temporary dir not in opts.ignore')
|
||||
}
|
||||
})
|
||||
|
||||
test('generateOutIgnores ignores all possible platform/arch permutations', (t) => {
|
||||
const ignores = ignore.generateOutIgnores({name: 'test'})
|
||||
t.is(ignores.length, util.allPlatformArchCombosCount)
|
||||
})
|
||||
|
||||
util.testSinglePlatformParallel('ignore default test: .o files', ignoreTest, null, 'ignore.o')
|
||||
util.testSinglePlatformParallel('ignore default test: .obj files', ignoreTest, null, 'ignore.obj')
|
||||
util.testSinglePlatformParallel('ignore test: string in array', ignoreTest, ['ignorethis'],
|
||||
'ignorethis.txt')
|
||||
util.testSinglePlatformParallel('ignore test: string', ignoreTest, 'ignorethis', 'ignorethis.txt')
|
||||
util.testSinglePlatformParallel('ignore test: RegExp', ignoreTest, /ignorethis/, 'ignorethis.txt')
|
||||
util.testSinglePlatformParallel('ignore test: Function', ignoreTest,
|
||||
file => file.match(/ignorethis/), 'ignorethis.txt')
|
||||
util.testSinglePlatformParallel('ignore test: string with slash', ignoreTest, 'ignore/this',
|
||||
path.join('ignore', 'this.txt'))
|
||||
util.testSinglePlatformParallel('ignore test: only match subfolder of app', ignoreTest,
|
||||
'electron-packager', path.join('electron-packager', 'readme.txt'))
|
||||
util.testSinglePlatform('ignore out dir test', ignoreOutDirTest, 'ignoredOutDir')
|
||||
util.testSinglePlatform('ignore out dir test: unnormalized path', ignoreOutDirTest,
|
||||
'./ignoredOutDir')
|
||||
util.testSinglePlatform('ignore out dir test: implicit path', ignoreImplicitOutDirTest)
|
19
node_modules/electron-packager/test/index.js
generated
vendored
Normal file
19
node_modules/electron-packager/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
require('./_util')
|
||||
|
||||
require('./basic')
|
||||
require('./asar')
|
||||
require('./cli')
|
||||
require('./ignore')
|
||||
require('./infer')
|
||||
require('./hooks')
|
||||
require('./prune')
|
||||
require('./targets')
|
||||
require('./win32')
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
// Perform additional tests specific to building for OS X
|
||||
require('./darwin')
|
||||
require('./mas')
|
||||
}
|
121
node_modules/electron-packager/test/infer.js
generated
vendored
Normal file
121
node_modules/electron-packager/test/infer.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const getMetadataFromPackageJSON = require('../infer')
|
||||
const packager = require('..')
|
||||
const path = require('path')
|
||||
const pkgUp = require('pkg-up')
|
||||
const util = require('./_util')
|
||||
|
||||
function inferElectronVersionTest (t, opts, fixture, packageName) {
|
||||
delete opts.electronVersion
|
||||
opts.dir = util.fixtureSubdir(fixture)
|
||||
|
||||
return getMetadataFromPackageJSON([], opts, opts.dir)
|
||||
.then(() => {
|
||||
const packageJSON = require(path.join(opts.dir, 'package.json'))
|
||||
return t.is(opts.electronVersion, packageJSON.devDependencies[packageName], `The version should be inferred from installed ${packageName} version`)
|
||||
})
|
||||
}
|
||||
|
||||
function copyFixtureToTempDir (t, fixtureSubdir) {
|
||||
const tmpdir = path.join(t.context.tempDir, fixtureSubdir)
|
||||
const fixtureDir = util.fixtureSubdir(fixtureSubdir)
|
||||
const tmpdirPkg = pkgUp.sync(path.join(tmpdir, '..'))
|
||||
|
||||
if (tmpdirPkg) {
|
||||
throw new Error(`Found package.json in parent of temp directory, which will interfere with test results. Please remove package.json at ${tmpdirPkg}`)
|
||||
}
|
||||
|
||||
return fs.emptyDir(tmpdir)
|
||||
.then(() => fs.copy(fixtureDir, tmpdir))
|
||||
.then(() => tmpdir)
|
||||
}
|
||||
|
||||
function inferFailureTest (t, opts, fixtureSubdir) {
|
||||
return copyFixtureToTempDir(t, fixtureSubdir)
|
||||
.then(dir => {
|
||||
delete opts.name
|
||||
delete opts.electronVersion
|
||||
opts.dir = dir
|
||||
|
||||
return t.throws(packager(opts))
|
||||
})
|
||||
}
|
||||
|
||||
function inferMissingVersionTest (t, opts) {
|
||||
return copyFixtureToTempDir(t, 'infer-missing-version-only')
|
||||
.then(dir => {
|
||||
delete opts.electronVersion
|
||||
opts.dir = dir
|
||||
|
||||
return getMetadataFromPackageJSON([], opts, dir)
|
||||
}).then(() => {
|
||||
const packageJSON = require(path.join(opts.dir, 'package.json'))
|
||||
return t.is(opts.electronVersion, packageJSON.devDependencies['electron'], 'The version should be inferred from installed electron module version')
|
||||
})
|
||||
}
|
||||
|
||||
function testInferWin32metadata (t, opts, expected, assertionMessage) {
|
||||
return copyFixtureToTempDir(t, 'infer-win32metadata')
|
||||
.then(dir => {
|
||||
opts.dir = dir
|
||||
|
||||
return getMetadataFromPackageJSON(['win32'], opts, dir)
|
||||
}).then(() => t.deepEqual(opts.win32metadata, expected, assertionMessage))
|
||||
}
|
||||
|
||||
function testInferWin32metadataAuthorObject (t, opts, author, expected, assertionMessage) {
|
||||
let packageJSONFilename
|
||||
|
||||
delete opts.name
|
||||
|
||||
return copyFixtureToTempDir(t, 'infer-win32metadata')
|
||||
.then(dir => {
|
||||
opts.dir = dir
|
||||
|
||||
packageJSONFilename = path.join(dir, 'package.json')
|
||||
return fs.readJson(packageJSONFilename)
|
||||
}).then(packageJSON => {
|
||||
packageJSON.author = author
|
||||
return fs.writeJson(packageJSONFilename, packageJSON)
|
||||
}).then(() => getMetadataFromPackageJSON(['win32'], opts, opts.dir))
|
||||
.then(() => t.deepEqual(opts.win32metadata, expected, assertionMessage))
|
||||
}
|
||||
|
||||
util.testSinglePlatformParallel('infer using `electron-prebuilt` package', inferElectronVersionTest, 'basic', 'electron-prebuilt')
|
||||
util.testSinglePlatformParallel('infer using `electron-prebuilt-compile` package', inferElectronVersionTest, 'infer-electron-prebuilt-compile', 'electron-prebuilt-compile')
|
||||
util.testSinglePlatformParallel('infer using `electron` package only', inferMissingVersionTest)
|
||||
util.testSinglePlatformParallel('infer where `electron` version is preferred over `electron-prebuilt`', inferElectronVersionTest, 'basic-renamed-to-electron', 'electron')
|
||||
util.testSinglePlatformParallel('infer win32metadata', (t, opts) => {
|
||||
const expected = {CompanyName: 'Foo Bar'}
|
||||
|
||||
return testInferWin32metadata(t, opts, expected, 'win32metadata matches package.json values')
|
||||
})
|
||||
util.testSinglePlatformParallel('do not infer win32metadata if it already exists', (t, opts) => {
|
||||
opts.win32metadata = {CompanyName: 'Existing'}
|
||||
const expected = Object.assign({}, opts.win32metadata)
|
||||
|
||||
return testInferWin32metadata(t, opts, expected, 'win32metadata did not update with package.json values')
|
||||
})
|
||||
util.testSinglePlatformParallel('infer win32metadata when author is an object', (t, opts) => {
|
||||
const author = {
|
||||
name: 'Foo Bar Object',
|
||||
email: 'foobar@example.com'
|
||||
}
|
||||
const expected = {CompanyName: 'Foo Bar Object'}
|
||||
|
||||
return testInferWin32metadataAuthorObject(t, opts, author, expected, 'win32metadata did not update with package.json values')
|
||||
})
|
||||
util.testSinglePlatformParallel('do not infer win32metadata.CompanyName when author is an object without a name', (t, opts) => {
|
||||
const author = {
|
||||
email: 'foobar@example.com'
|
||||
}
|
||||
const expected = {}
|
||||
|
||||
return testInferWin32metadataAuthorObject(t, opts, author, expected, 'win32metadata.CompanyName should not have been inferred')
|
||||
})
|
||||
util.testSinglePlatformParallel('infer missing fields test', inferFailureTest, 'infer-missing-fields')
|
||||
util.testSinglePlatformParallel('infer with bad fields test', inferFailureTest, 'infer-bad-fields')
|
||||
util.testSinglePlatformParallel('infer with malformed JSON test', inferFailureTest, 'infer-malformed-json')
|
||||
util.testSinglePlatformParallel('infer using a non-specific `electron-prebuilt-compile` package version', inferFailureTest, 'infer-non-specific-electron-prebuilt-compile')
|
58
node_modules/electron-packager/test/mas.js
generated
vendored
Normal file
58
node_modules/electron-packager/test/mas.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const packager = require('..')
|
||||
const path = require('path')
|
||||
const plist = require('plist')
|
||||
const util = require('./_util')
|
||||
|
||||
if (!(process.env.CI && process.platform === 'win32')) {
|
||||
const masOpts = {
|
||||
name: 'masTest',
|
||||
dir: util.fixtureSubdir('basic'),
|
||||
electronVersion: '2.0.0-beta.1',
|
||||
arch: 'x64',
|
||||
platform: 'mas'
|
||||
}
|
||||
|
||||
util.packagerTest('warn if building for mas and not signing', (t, baseOpts) => {
|
||||
const warningLog = console.warn
|
||||
let output = ''
|
||||
console.warn = message => { output += message }
|
||||
|
||||
const finalize = err => {
|
||||
console.warn = warningLog
|
||||
if (err) throw err
|
||||
}
|
||||
|
||||
return packager(Object.assign({}, baseOpts, masOpts))
|
||||
.then(() =>
|
||||
t.truthy(output.match(/signing is required for mas builds/), 'the correct warning is emitted')
|
||||
).then(finalize)
|
||||
.catch(finalize)
|
||||
})
|
||||
|
||||
util.packagerTest('update Login Helper if it exists', (t, baseOpts) => {
|
||||
let contentsPath
|
||||
let plistPath
|
||||
const helperName = `${masOpts.name} Login Helper`
|
||||
return packager(Object.assign({}, baseOpts, masOpts))
|
||||
.then(paths => {
|
||||
contentsPath = path.join(paths[0], `${masOpts.name}.app`, 'Contents', 'Library', 'LoginItems', `${helperName}.app`, 'Contents')
|
||||
return fs.pathExists(contentsPath)
|
||||
}).then(exists => {
|
||||
t.true(exists, 'renamed Login Helper app exists')
|
||||
plistPath = path.join(contentsPath, 'Info.plist')
|
||||
return fs.pathExists(contentsPath)
|
||||
}).then(exists => {
|
||||
t.true(exists, 'Login Helper Info.plist exists')
|
||||
return fs.readFile(plistPath, 'utf8')
|
||||
}).then(plistXML => {
|
||||
const plistData = plist.parse(plistXML)
|
||||
t.is(plistData.CFBundleExecutable, helperName, 'CFBundleExecutable is renamed Login Helper')
|
||||
t.is(plistData.CFBundleName, helperName, 'CFBundleName is renamed Login Helper')
|
||||
t.is(plistData.CFBundleIdentifier, 'com.electron.mastest.loginhelper')
|
||||
return fs.pathExists(path.join(contentsPath, 'MacOS', helperName))
|
||||
}).then(exists => t.true(exists, 'renamed Login Helper executable exists'))
|
||||
})
|
||||
}
|
65
node_modules/electron-packager/test/prune.js
generated
vendored
Normal file
65
node_modules/electron-packager/test/prune.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const prune = require('../prune')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
function checkDependency (t, resourcesPath, moduleName, moduleExists) {
|
||||
const assertion = moduleExists ? 'should' : 'should NOT'
|
||||
const message = `module dependency '${moduleName}' ${assertion} exist under app/node_modules`
|
||||
const modulePath = path.join(resourcesPath, 'app', 'node_modules', moduleName)
|
||||
return fs.pathExists(modulePath)
|
||||
.then(exists => t.is(moduleExists, exists, message))
|
||||
.then(() => modulePath)
|
||||
}
|
||||
|
||||
function assertDependencyExists (t, resourcesPath, moduleName) {
|
||||
return checkDependency(t, resourcesPath, moduleName, true)
|
||||
.then(modulePath => fs.stat(modulePath))
|
||||
.then(stats => t.true(stats.isDirectory(), 'module is a directory'))
|
||||
}
|
||||
|
||||
function createPruneOptionTest (t, baseOpts, prune, testMessage) {
|
||||
const opts = Object.assign({}, baseOpts, {
|
||||
name: 'pruneTest',
|
||||
dir: util.fixtureSubdir('basic'),
|
||||
prune: prune
|
||||
})
|
||||
|
||||
let resourcesPath
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(generatedResourcesPath => {
|
||||
resourcesPath = generatedResourcesPath
|
||||
return assertDependencyExists(t, resourcesPath, 'run-series')
|
||||
}).then(() => assertDependencyExists(t, resourcesPath, '@types/node'))
|
||||
.then(() => checkDependency(t, resourcesPath, 'run-waterfall', !prune))
|
||||
.then(() => checkDependency(t, resourcesPath, 'electron-prebuilt', !prune))
|
||||
}
|
||||
|
||||
util.testSinglePlatform('prune test', (t, baseOpts) => {
|
||||
return createPruneOptionTest(t, baseOpts, true, 'package.json devDependency should NOT exist under app/node_modules')
|
||||
})
|
||||
|
||||
util.testSinglePlatform('prune electron in dependencies', (t, baseOpts) => {
|
||||
const opts = Object.assign({}, baseOpts, {
|
||||
name: 'pruneElectronTest',
|
||||
dir: util.fixtureSubdir('electron-in-dependencies')
|
||||
})
|
||||
|
||||
return util.packageAndEnsureResourcesPath(t, opts)
|
||||
.then(resourcesPath => checkDependency(t, resourcesPath, 'electron', false))
|
||||
})
|
||||
|
||||
util.testSinglePlatform('prune: false test', createPruneOptionTest, false,
|
||||
'package.json devDependency should exist under app/node_modules')
|
||||
|
||||
test('isModule only detects modules inside a node_modules parent folder', t =>
|
||||
prune.isModule(util.fixtureSubdir(path.join('prune-is-module', 'node_modules', 'module')))
|
||||
.then(isModule => {
|
||||
t.true(isModule, 'module folder should be detected as module')
|
||||
return prune.isModule(util.fixtureSubdir(path.join('prune-is-module', 'node_modules', 'module', 'not-module')))
|
||||
}).then(isModule => t.false(isModule, 'not-module folder should not be detected as module'))
|
||||
)
|
133
node_modules/electron-packager/test/targets.js
generated
vendored
Normal file
133
node_modules/electron-packager/test/targets.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
'use strict'
|
||||
|
||||
const config = require('./config.json')
|
||||
const sinon = require('sinon')
|
||||
const targets = require('../targets')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
|
||||
function createMultiTargetOptions (extraOpts) {
|
||||
return Object.assign({
|
||||
name: 'targetTest',
|
||||
dir: util.fixtureSubdir('basic'),
|
||||
electronVersion: config.version
|
||||
}, extraOpts)
|
||||
}
|
||||
|
||||
function testMultiTarget (testcaseDescription, extraOpts, expectedPackageCount, packageExistenceMessage) {
|
||||
test(testcaseDescription, t => {
|
||||
const opts = createMultiTargetOptions(extraOpts)
|
||||
const platforms = targets.validateListFromOptions(opts, 'platform')
|
||||
const archs = targets.validateListFromOptions(opts, 'arch')
|
||||
const combinations = targets.createPlatformArchPairs(opts, platforms, archs)
|
||||
|
||||
t.is(combinations.length, expectedPackageCount, packageExistenceMessage)
|
||||
})
|
||||
}
|
||||
|
||||
function testCombinations (testcaseDescription, arch, platform) {
|
||||
testMultiTarget(testcaseDescription, {arch: arch, platform: platform}, 4,
|
||||
'Packages should be generated for all combinations of specified archs and platforms')
|
||||
}
|
||||
|
||||
test('allOfficialArchsForPlatformAndVersion is undefined for unknown platforms', t => {
|
||||
t.is(targets.allOfficialArchsForPlatformAndVersion('unknown', '1.0.0'), undefined)
|
||||
})
|
||||
|
||||
test('allOfficialArchsForPlatformAndVersion returns the correct arches for a known platform', t => {
|
||||
t.deepEqual(targets.allOfficialArchsForPlatformAndVersion('darwin', '1.0.0'), ['x64'])
|
||||
})
|
||||
|
||||
test('allOfficialArchsForPlatformAndVersion returns arm64 when the correct version is specified', t => {
|
||||
t.not(targets.allOfficialArchsForPlatformAndVersion('linux', '1.8.0').indexOf('arm64'), -1,
|
||||
'should be found when version is >= 1.8.0')
|
||||
t.is(targets.allOfficialArchsForPlatformAndVersion('linux', '1.7.0').indexOf('arm64'), -1,
|
||||
'should not be found when version is < 1.8.0')
|
||||
})
|
||||
|
||||
test('allOfficialArchsForPlatformAndVersion returns mips64el when the correct version is specified', t => {
|
||||
t.not(targets.allOfficialArchsForPlatformAndVersion('linux', '1.8.2').indexOf('mips64el'), -1,
|
||||
'should be found when version is >= 1.8.2-beta.5')
|
||||
t.is(targets.allOfficialArchsForPlatformAndVersion('linux', '1.8.0').indexOf('mips64el'), -1,
|
||||
'should not be found when version is < 1.8.2-beta.5')
|
||||
})
|
||||
|
||||
test('validateListFromOptions does not take non-Array/String values', t => {
|
||||
targets.supported.digits = new Set(['64', '65'])
|
||||
t.false(targets.validateListFromOptions({digits: 64}, 'digits') instanceof Array,
|
||||
'should not be an Array')
|
||||
delete targets.supported.digits
|
||||
})
|
||||
|
||||
test('validateListFromOptions works for armv7l host and target arch', t => {
|
||||
sinon.stub(process, 'arch').value('arm')
|
||||
sinon.stub(process, 'config').value({variables: {arm_version: '7'}})
|
||||
|
||||
t.deepEqual(targets.validateListFromOptions({}, 'arch'), ['armv7l'])
|
||||
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
testMultiTarget('build for all available official targets', {all: true, electronVersion: '1.8.2'},
|
||||
util.allPlatformArchCombosCount,
|
||||
'Packages should be generated for all possible platforms')
|
||||
testMultiTarget('build for all available official targets for a version without arm64 or mips64el support',
|
||||
{all: true},
|
||||
util.allPlatformArchCombosCount - 2,
|
||||
'Packages should be generated for all possible platforms (except arm64 and mips64el)')
|
||||
testMultiTarget('platform=all (one arch)', {arch: 'ia32', platform: 'all'}, 2,
|
||||
'Packages should be generated for both 32-bit platforms')
|
||||
testMultiTarget('arch=all test (one platform)', {arch: 'all', platform: 'linux'}, 3,
|
||||
'Packages should be generated for all expected architectures')
|
||||
|
||||
testCombinations('multi-platform / multi-arch test, from arrays', ['ia32', 'x64'], ['linux', 'win32'])
|
||||
testCombinations('multi-platform / multi-arch test, from strings', 'ia32,x64', 'linux,win32')
|
||||
testCombinations('multi-platform / multi-arch test, from strings with spaces', 'ia32, x64', 'linux, win32')
|
||||
|
||||
test('fails with invalid arch', util.invalidOptionTest({
|
||||
arch: 'z80',
|
||||
platform: 'linux'
|
||||
}))
|
||||
test('fails with invalid platform', util.invalidOptionTest({
|
||||
arch: 'ia32',
|
||||
platform: 'dos'
|
||||
}))
|
||||
|
||||
test('hostArch detects incorrectly configured armv7l Node', t => {
|
||||
sinon.stub(targets, 'unameArch').returns('armv7l')
|
||||
sinon.stub(process, 'arch').value('arm')
|
||||
sinon.stub(process, 'config').value({variables: {arm_version: '6'}})
|
||||
|
||||
t.is(targets.hostArch(), 'armv7l')
|
||||
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
test('hostArch detects correctly configured armv7l Node', t => {
|
||||
sinon.stub(process, 'arch').value('arm')
|
||||
sinon.stub(process, 'config').value({variables: {arm_version: '7'}})
|
||||
|
||||
t.is(targets.hostArch(), 'armv7l')
|
||||
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
test('hostArch cannot determine ARM version', t => {
|
||||
sinon.stub(process, 'arch').value('arm')
|
||||
sinon.stub(process, 'config').value({variables: {arm_version: '99'}})
|
||||
|
||||
t.is(targets.hostArch(), 'arm')
|
||||
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
testMultiTarget('invalid official combination', {arch: 'ia32', platform: 'darwin'}, 0, 'Package should not be generated for invalid official combination')
|
||||
testMultiTarget('platform=linux and arch=arm64 with a supported official Electron version', {arch: 'arm64', platform: 'linux', electronVersion: '1.8.0'}, 1, 'Package should be generated for arm64')
|
||||
testMultiTarget('platform=linux and arch=arm64 with an unsupported official Electron version', {arch: 'arm64', platform: 'linux'}, 0, 'Package should not be generated for arm64')
|
||||
testMultiTarget('platform=linux and arch=mips64el with a supported official Electron version', {arch: 'mips64el', platform: 'linux', electronVersion: '1.8.2-beta.5'}, 1, 'Package should be generated for mips64el')
|
||||
testMultiTarget('platform=linux and arch=mips64el with an unsupported official Electron version', {arch: 'mips64el', platform: 'linux'}, 0, 'Package should not be generated for mips64el')
|
||||
testMultiTarget('platform=linux and arch=mips64el with an unsupported official Electron version (2.0.0)', {arch: 'mips64el', platform: 'linux', electronVersion: '2.0.0'}, 0, 'Package should not be generated for mips64el')
|
||||
testMultiTarget('unofficial arch', {arch: 'z80', platform: 'linux', download: {mirror: 'mirror'}}, 1,
|
||||
'Package should be generated for non-standard arch from non-official mirror')
|
||||
testMultiTarget('unofficial platform', {arch: 'ia32', platform: 'minix', download: {mirror: 'mirror'}}, 1,
|
||||
'Package should be generated for non-standard platform from non-official mirror')
|
215
node_modules/electron-packager/test/win32.js
generated
vendored
Normal file
215
node_modules/electron-packager/test/win32.js
generated
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
'use strict'
|
||||
|
||||
const config = require('./config.json')
|
||||
const fs = require('fs-extra')
|
||||
const packager = require('..')
|
||||
const path = require('path')
|
||||
const test = require('ava')
|
||||
const util = require('./_util')
|
||||
const win32 = require('../win32')
|
||||
|
||||
const win32Opts = {
|
||||
name: 'basicTest',
|
||||
dir: util.fixtureSubdir('basic'),
|
||||
electronVersion: config.version,
|
||||
arch: 'x64',
|
||||
platform: 'win32'
|
||||
}
|
||||
|
||||
function generateRceditOptionsSansIcon (opts) {
|
||||
return new win32.App(opts).generateRceditOptionsSansIcon()
|
||||
}
|
||||
|
||||
function generateVersionStringTest (metadataProperties, extraOpts, expectedValues, assertionMsgs) {
|
||||
return t => {
|
||||
const opts = Object.assign({}, win32Opts, extraOpts)
|
||||
const rcOpts = generateRceditOptionsSansIcon(opts)
|
||||
|
||||
metadataProperties = [].concat(metadataProperties)
|
||||
expectedValues = [].concat(expectedValues)
|
||||
assertionMsgs = [].concat(assertionMsgs)
|
||||
metadataProperties.forEach((property, i) => {
|
||||
const value = expectedValues[i]
|
||||
const msg = assertionMsgs[i]
|
||||
if (property === 'version-string') {
|
||||
for (const subkey in value) {
|
||||
t.is(rcOpts[property][subkey], value[subkey], `${msg} (${subkey})`)
|
||||
}
|
||||
} else {
|
||||
t.is(rcOpts[property], value, msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function setFileVersionTest (buildVersion) {
|
||||
const appVersion = '4.99.101.0'
|
||||
const opts = {
|
||||
appVersion: appVersion,
|
||||
buildVersion: buildVersion
|
||||
}
|
||||
|
||||
return generateVersionStringTest(
|
||||
['product-version', 'file-version'],
|
||||
opts,
|
||||
[appVersion, buildVersion],
|
||||
['Product version should match app version',
|
||||
'File version should match build version']
|
||||
)
|
||||
}
|
||||
|
||||
function setProductVersionTest (appVersion) {
|
||||
return generateVersionStringTest(
|
||||
['product-version', 'file-version'],
|
||||
{ appVersion: appVersion },
|
||||
[appVersion, appVersion],
|
||||
['Product version should match app version',
|
||||
'File version should match app version']
|
||||
)
|
||||
}
|
||||
|
||||
function setCopyrightTest (appCopyright) {
|
||||
const opts = {
|
||||
appCopyright: appCopyright
|
||||
}
|
||||
|
||||
return generateVersionStringTest('version-string', opts, {LegalCopyright: appCopyright}, 'Legal copyright should match app copyright')
|
||||
}
|
||||
|
||||
function setCopyrightAndCompanyNameTest (appCopyright, companyName) {
|
||||
const opts = {
|
||||
appCopyright: appCopyright,
|
||||
win32metadata: {
|
||||
CompanyName: companyName
|
||||
}
|
||||
}
|
||||
|
||||
return generateVersionStringTest(
|
||||
'version-string',
|
||||
opts,
|
||||
{LegalCopyright: appCopyright, CompanyName: companyName},
|
||||
'Legal copyright should match app copyright and Company name should match win32metadata value'
|
||||
)
|
||||
}
|
||||
|
||||
function setRequestedExecutionLevelTest (requestedExecutionLevel) {
|
||||
const opts = {
|
||||
win32metadata: {
|
||||
'requested-execution-level': requestedExecutionLevel
|
||||
}
|
||||
}
|
||||
|
||||
return generateVersionStringTest(
|
||||
'requested-execution-level',
|
||||
opts,
|
||||
requestedExecutionLevel,
|
||||
'requested-execution-level in win32metadata should match rcOpts value'
|
||||
)
|
||||
}
|
||||
|
||||
function setApplicationManifestTest (applicationManifest) {
|
||||
const opts = {
|
||||
win32metadata: {
|
||||
'application-manifest': applicationManifest
|
||||
}
|
||||
}
|
||||
|
||||
return generateVersionStringTest(
|
||||
'application-manifest',
|
||||
opts,
|
||||
applicationManifest,
|
||||
'application-manifest in win32metadata should match rcOpts value'
|
||||
)
|
||||
}
|
||||
|
||||
function setCompanyNameTest (companyName) {
|
||||
const opts = {
|
||||
win32metadata: {
|
||||
CompanyName: companyName
|
||||
}
|
||||
}
|
||||
|
||||
return generateVersionStringTest('version-string',
|
||||
opts,
|
||||
{CompanyName: companyName},
|
||||
`Company name should match win32metadata value`)
|
||||
}
|
||||
|
||||
test('better error message when wine is not found', (t) => {
|
||||
let err = Error('spawn wine ENOENT')
|
||||
err.code = 'ENOENT'
|
||||
err.syscall = 'spawn wine'
|
||||
|
||||
t.is(err.message, 'spawn wine ENOENT')
|
||||
err = win32.updateWineMissingException(err)
|
||||
t.not(err.message, 'spawn wine ENOENT')
|
||||
})
|
||||
|
||||
test('error message unchanged when error not about wine', t => {
|
||||
let errNotEnoent = Error('unchanged')
|
||||
errNotEnoent.code = 'ESOMETHINGELSE'
|
||||
errNotEnoent.syscall = 'spawn wine'
|
||||
|
||||
t.is(errNotEnoent.message, 'unchanged')
|
||||
errNotEnoent = win32.updateWineMissingException(errNotEnoent)
|
||||
t.is(errNotEnoent.message, 'unchanged')
|
||||
|
||||
let errNotSpawnWine = Error('unchanged')
|
||||
errNotSpawnWine.code = 'ENOENT'
|
||||
errNotSpawnWine.syscall = 'spawn foo'
|
||||
|
||||
t.is(errNotSpawnWine.message, 'unchanged')
|
||||
errNotSpawnWine = win32.updateWineMissingException(errNotSpawnWine)
|
||||
t.is(errNotSpawnWine.message, 'unchanged')
|
||||
})
|
||||
|
||||
test('win32metadata defaults', t => {
|
||||
const opts = { name: 'Win32 App' }
|
||||
const rcOpts = generateRceditOptionsSansIcon(opts)
|
||||
|
||||
t.is(rcOpts['version-string'].FileDescription, opts.name, 'default FileDescription')
|
||||
t.is(rcOpts['version-string'].InternalName, opts.name, 'default InternalName')
|
||||
t.is(rcOpts['version-string'].OriginalFilename, 'Win32 App.exe', 'default OriginalFilename')
|
||||
t.is(rcOpts['version-string'].ProductName, opts.name, 'default ProductName')
|
||||
})
|
||||
|
||||
util.packagerTest('win32 executable name is based on sanitized app name', (t, opts) => {
|
||||
Object.assign(opts, win32Opts, { name: '@username/package-name' })
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.is(1, paths.length, '1 bundle created')
|
||||
const appExePath = path.join(paths[0], '@username-package-name.exe')
|
||||
return fs.pathExists(appExePath)
|
||||
}).then(exists => t.true(exists, 'The sanitized EXE filename should exist'))
|
||||
})
|
||||
|
||||
util.packagerTest('win32 executable name uses executableName when available', (t, opts) => {
|
||||
Object.assign(opts, win32Opts, { name: 'PackageName', executableName: 'my-package' })
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.is(1, paths.length, '1 bundle created')
|
||||
const appExePath = path.join(paths[0], 'my-package.exe')
|
||||
return fs.pathExists(appExePath)
|
||||
}).then(exists => t.true(exists, 'the executableName-based filename should exist'))
|
||||
})
|
||||
|
||||
util.packagerTest('win32 icon set', (t, opts) => {
|
||||
Object.assign(opts, win32Opts, { executableName: 'iconTest', arch: 'ia32', icon: path.join(__dirname, 'fixtures', 'monochrome') })
|
||||
|
||||
return packager(opts)
|
||||
.then(paths => {
|
||||
t.is(1, paths.length, '1 bundle created')
|
||||
const appExePath = path.join(paths[0], 'iconTest.exe')
|
||||
return fs.pathExists(appExePath)
|
||||
}).then(exists => t.true(exists, 'the Electron executable should exist'))
|
||||
})
|
||||
|
||||
test('win32 build version sets FileVersion test', setFileVersionTest('2.3.4.5'))
|
||||
test('win32 app version sets ProductVersion test', setProductVersionTest('5.4.3.2'))
|
||||
test('win32 app copyright sets LegalCopyright test', setCopyrightTest('Copyright Bar'))
|
||||
test('win32 set LegalCopyright and CompanyName test', setCopyrightAndCompanyNameTest('Copyright Bar', 'MyCompany LLC'))
|
||||
test('win32 set CompanyName test', setCompanyNameTest('MyCompany LLC'))
|
||||
test('win32 set requested-execution-level test', setRequestedExecutionLevelTest('asInvoker'))
|
||||
test('win32 set application-manifest test', setApplicationManifestTest('/path/to/manifest.xml'))
|
100
node_modules/electron-packager/usage.txt
generated
vendored
Normal file
100
node_modules/electron-packager/usage.txt
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
Usage: electron-packager <sourcedir> <appname> [options...]
|
||||
|
||||
Required parameters
|
||||
|
||||
sourcedir the base directory of the application source
|
||||
|
||||
Examples: electron-packager ./
|
||||
electron-packager ./ --all
|
||||
|
||||
Optional parameters
|
||||
|
||||
appname the name of the app, if it needs to be different from the "productName" or "name"
|
||||
in the nearest package.json
|
||||
|
||||
Options
|
||||
|
||||
version prints the version of Electron Packager and Node, plus the target platform and
|
||||
arch, for bug reporting purposes, and exits immediately
|
||||
|
||||
* All platforms *
|
||||
|
||||
all equivalent to --platform=all --arch=all
|
||||
app-copyright human-readable copyright line for the app
|
||||
app-version release version to set for the app
|
||||
arch all, or one or more of: ia32, x64, armv7l, arm64, mips64el (comma-delimited if
|
||||
multiple). Defaults to the host arch
|
||||
asar whether to package the source code within your app into an archive. You can either
|
||||
pass --asar by itself to use the default configuration, OR use dot notation to
|
||||
configure a list of sub-properties, e.g. --asar.unpackDir=sub_dir - do not use
|
||||
--asar and its sub-properties simultaneously.
|
||||
|
||||
Properties supported:
|
||||
- ordering: path to an ordering file for file packing
|
||||
- unpack: unpacks the files to the app.asar.unpacked directory whose filenames
|
||||
regex .match this string
|
||||
- unpackDir: unpacks the dir to the app.asar.unpacked directory whose names glob
|
||||
pattern or exactly match this string. It's relative to the <sourcedir>.
|
||||
build-version build version to set for the app
|
||||
download a list of sub-options to pass to electron-download. They are specified via dot
|
||||
notation, e.g., --download.cache=/tmp/cache
|
||||
Properties supported:
|
||||
- cache: directory of cached Electron downloads. Defaults to `$HOME/.electron`
|
||||
- mirror: alternate URL to download Electron zips
|
||||
- strictSSL: whether SSL certs are required to be valid when downloading
|
||||
Electron. Defaults to true, use --no-download.strictSSL to disable checks.
|
||||
electron-version the version of Electron that is being packaged, see
|
||||
https://github.com/electron/electron/releases
|
||||
executable-name the name of the executable file, sans file extension. Defaults to appname
|
||||
extra-resource a file to copy into the app's resources directory
|
||||
icon the local path to an icon file to use as the icon for the app.
|
||||
Note: Format depends on platform.
|
||||
ignore do not copy files into app whose filenames RegExp.match this string. See also:
|
||||
https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#ignore
|
||||
and --no-prune. Can be specified multiple times
|
||||
no-deref-symlinks make sure symlinks are not dereferenced within the app source
|
||||
no-prune do not prune devDependencies from the packaged app
|
||||
out the dir to put the app into at the end. Defaults to current working dir
|
||||
overwrite if output directory for a platform already exists, replaces it rather than
|
||||
skipping it
|
||||
platform all, or one or more of: darwin, linux, mas, win32 (comma-delimited if multiple).
|
||||
Defaults to the host platform
|
||||
quiet Do not print informational or warning messages
|
||||
tmpdir temp directory. Defaults to system temp directory, use --no-tmpdir to disable
|
||||
use of a temporary directory.
|
||||
|
||||
* darwin/mas target platforms only *
|
||||
|
||||
app-bundle-id bundle identifier to use in the app plist
|
||||
app-category-type the application category type
|
||||
For example, `app-category-type=public.app-category.developer-tools` will set the
|
||||
application category to 'Developer Tools'.
|
||||
extend-info a plist file to merge into the app plist
|
||||
helper-bundle-id bundle identifier to use in the app helper plist
|
||||
osx-sign (OSX host platform only) Whether to sign the OSX app packages. You can either
|
||||
pass --osx-sign by itself to use the default configuration, or use dot notation
|
||||
to configure a list of sub-properties, e.g. --osx-sign.identity="My Name"
|
||||
Properties supported:
|
||||
- identity: should contain the identity to be used when running `codesign`
|
||||
- entitlements: the path to entitlements used in signing
|
||||
- entitlements-inherit: the path to the 'child' entitlements
|
||||
protocol URL protocol scheme to register the app as an opener of.
|
||||
For example, `--protocol=myapp` would register the app to open
|
||||
URLs such as `myapp://path`. This argument requires a `--protocol-name`
|
||||
argument to also be specified.
|
||||
protocol-name Descriptive name of URL protocol scheme specified via `--protocol`
|
||||
|
||||
* win32 target platform only *
|
||||
|
||||
win32metadata a list of sub-properties used to set the application metadata embedded into
|
||||
the executable. They are specified via dot notation,
|
||||
e.g. --win32metadata.CompanyName="Company Inc."
|
||||
or --win32metadata.ProductName="Product"
|
||||
Properties supported:
|
||||
- CompanyName (default: author name from nearest package.json)
|
||||
- FileDescription (default: appname)
|
||||
- OriginalFilename (default: renamed exe)
|
||||
- ProductName (default: appname)
|
||||
- InternalName (default: appname)
|
||||
- requested-execution-level (user, asInvoker, or requireAdministrator)
|
||||
- application-manifest
|
114
node_modules/electron-packager/win32.js
generated
vendored
Normal file
114
node_modules/electron-packager/win32.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
'use strict'
|
||||
|
||||
const debug = require('debug')('electron-packager')
|
||||
const path = require('path')
|
||||
const pify = require('pify')
|
||||
|
||||
const App = require('./platform')
|
||||
const common = require('./common')
|
||||
|
||||
function updateWineMissingException (err) {
|
||||
if (err && err.code === 'ENOENT' && err.syscall === 'spawn wine') {
|
||||
err.message = 'Could not find "wine" on your system.\n\n' +
|
||||
'Wine is required to use the appCopyright, appVersion, buildVersion, icon, and \n' +
|
||||
'win32metadata parameters for Windows targets.\n\n' +
|
||||
'Make sure that the "wine" executable is in your PATH.\n\n' +
|
||||
'See https://github.com/electron-userland/electron-packager#building-windows-apps-from-non-windows-platforms for details.'
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
class WindowsApp extends App {
|
||||
get originalElectronName () {
|
||||
return 'electron.exe'
|
||||
}
|
||||
|
||||
get newElectronName () {
|
||||
return `${common.sanitizeAppName(this.executableName)}.exe`
|
||||
}
|
||||
|
||||
get electronBinaryPath () {
|
||||
return path.join(this.stagingPath, this.newElectronName)
|
||||
}
|
||||
|
||||
generateRceditOptionsSansIcon () {
|
||||
const win32metadata = Object.assign({
|
||||
FileDescription: this.opts.name,
|
||||
InternalName: this.opts.name,
|
||||
OriginalFilename: this.newElectronName,
|
||||
ProductName: this.opts.name
|
||||
}, this.opts.win32metadata)
|
||||
|
||||
let rcOpts = {'version-string': win32metadata}
|
||||
|
||||
if (this.opts.appVersion) {
|
||||
rcOpts['product-version'] = rcOpts['file-version'] = this.opts.appVersion
|
||||
}
|
||||
|
||||
if (this.opts.buildVersion) {
|
||||
rcOpts['file-version'] = this.opts.buildVersion
|
||||
}
|
||||
|
||||
if (this.opts.appCopyright) {
|
||||
rcOpts['version-string'].LegalCopyright = this.opts.appCopyright
|
||||
}
|
||||
|
||||
const manifestProperties = ['application-manifest', 'requested-execution-level']
|
||||
for (const manifestProperty of manifestProperties) {
|
||||
if (win32metadata[manifestProperty]) {
|
||||
rcOpts[manifestProperty] = win32metadata[manifestProperty]
|
||||
}
|
||||
}
|
||||
|
||||
return rcOpts
|
||||
}
|
||||
|
||||
getIconPath () {
|
||||
if (!this.opts.icon) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
return this.normalizeIconExtension('.ico')
|
||||
}
|
||||
|
||||
needsRcedit () {
|
||||
return this.opts.icon || this.opts.win32metadata || this.opts.appCopyright || this.opts.appVersion || this.opts.buildVersion
|
||||
}
|
||||
|
||||
runRcedit () {
|
||||
/* istanbul ignore if */
|
||||
if (!this.needsRcedit()) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
const rcOpts = this.generateRceditOptionsSansIcon()
|
||||
|
||||
return this.getIconPath()
|
||||
.then(icon => {
|
||||
// Icon might be omitted or only exist in one OS's format, so skip it if normalizeExt reports an error
|
||||
if (icon) {
|
||||
rcOpts.icon = icon
|
||||
}
|
||||
|
||||
debug(`Running rcedit with the options ${JSON.stringify(rcOpts)}`)
|
||||
return pify(require('rcedit'))(this.electronBinaryPath, rcOpts)
|
||||
}).catch(err => {
|
||||
/* istanbul ignore next */
|
||||
throw updateWineMissingException(err)
|
||||
})
|
||||
}
|
||||
|
||||
create () {
|
||||
return this.initialize()
|
||||
.then(() => this.renameElectron())
|
||||
.then(() => this.copyExtraResources())
|
||||
.then(() => this.runRcedit())
|
||||
.then(() => this.move())
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
App: WindowsApp,
|
||||
updateWineMissingException: updateWineMissingException
|
||||
}
|
Reference in New Issue
Block a user