-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use camelCase identifiers in the JS API #580
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, I had no idea when I was going to get to this.
Some general comments:
- I'm not really a fan of having a separate list of parameters that need to be maintained. I think what I want to do here is in the next major version, get rid of that and use the
camelize
module. - In the meantime, can we have a few tests for
camelCase
?
common.js
Outdated
Object.keys(module.exports.kebabProperties).forEach(function (key) { | ||
var value = module.exports.kebabProperties[key] | ||
if (properties.hasOwnProperty(key)) { | ||
warn && warning(`The ${key} parameter is deprecated when used from JS, use ${value} instead`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer it if this was a full-fledged if
statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it should be mentioned that the old property is going to be removed in the next major version.
@j-f1 It looks like there's a problem in Also, what part of the testsuite is not running locally? |
Could you also add a NEWS entry? (An entry under both "Changed" and "Deprecated".) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The tests are still broken: https://travis-ci.org/electron-userland/electron-packager/jobs/199956707#L4331
- For new tests, I would take one of the attributes that you know will be converted and directly test the
camelCase
function. (I guess intest/basic.js
?) - Regarding your local tests problem: Try running the tests with the environment variable
DEBUG="*"
set, and paste the output somewhere accessible.
NEWS.md
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
## Unreleased | |||
|
|||
### Changed | |||
* The JS API now uses camelCase identifiers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options previously formatted in kebab-case (i.e., with hyphens) are now available in camelCase, per JavaScript naming standards (#580)
NEWS.md
Outdated
* The JS API now uses camelCase identifiers. | ||
|
||
### Deprecated | ||
* Using kebab-case keys for the JS API is deprecated. Please use camelCase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options currently formatted in kebab-case (i.e., with hyphens) are deprecated in favor of their camelCase variants, per JavaScript naming standards (#580)
docs/api.md
Outdated
@@ -51,13 +51,13 @@ An array of functions to be called after Electron has been extracted to a tempor | |||
|
|||
When `true`, sets both [`arch`](#arch) and [`platform`](#platform) to `all`. | |||
|
|||
##### `app-copyright` | |||
##### `appCopyright` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the docs, what I typically do when I'm renaming an option is add an entry for the old name with the type and a deprecated message (for example: version-string
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malept Should I place the deprecated names right underneath the new one, or should I group them at the bottom?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the options alphabetized, so probably place the deprecated options somewhere above their respective new names.
common.js
Outdated
'helper-bundle-id': 'helperBundleId', | ||
'osx-sign': 'osxSign', | ||
'protocol-name': 'protocolName', | ||
'version-string': 'versionString' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no point in camel-casing version-string
, it's deprecated.
I think this is an artifact of the code coverage module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out what caused the test failure.
win32.js
Outdated
if (opts['app-copyright']) { | ||
rcOpts['version-string'].LegalCopyright = opts['app-copyright'] | ||
if (opts.appCopyright) { | ||
rcOpts.versionString.LegalCopyright = opts.appCopyright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect, rcOpts
is for the rcedit
module. I take it you did a global search/replace?
win32.js
Outdated
} | ||
|
||
if (opts.icon || opts.win32metadata || opts['version-string'] || opts['app-copyright'] || opts['app-version'] || opts['build-version']) { | ||
if (opts.icon || opts.win32metadata || opts.versionString || opts.appCopyright || opts.appVersion || opts.buildVersion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert the opts.versionString
change, please.
docs/api.md
Outdated
*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. | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary whitespace
docs/api.md
Outdated
|
||
*String* (**deprecated** and will be removed in a future major version, please use the | ||
[`electronVersion`](#electronVersion) parameter instead) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This never existed as a JavaScript API option.
a913f78
to
b4cac1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've squashed your commits, fixed up the NEWS entries, and added a separate test for camelCase
. I'll merge once the tests run satisfactorily.
Thanks for your work on this!
This fixes #325.