[TIMOB-26081] CLI: Fix new Buffer deprecation warnings in build scripts
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-06-12T14:35:13.000+0000 |
| Affected Version/s | Release 7.1.1, Release 7.3.0, Release 7.2.0 |
| Fix Version/s | Release 7.5.0 |
| Components | CLI |
| Labels | n/a |
| Reporter | Ewan Harris |
| Assignee | Ewan Harris |
| Created | 2018-05-31T09:56:36.000+0000 |
| Updated | 2018-10-18T21:26:18.000+0000 |
Description
Description
Node 10 produces a deprecation warning when thenew Buffer constructor is used. See https://nodesource.com/blog/understanding-the-buffer-deprecation-in-node-js-10/ if you're curious
In most cases I believe the most appropriate swap for us to do is turn new Buffer into Buffer.from
In titanium_mobile there are two instances https://github.com/appcelerator/titanium_mobile/search?l=JavaScript&q=%22new+Buffer%22
, however checking all modules (*lib, node-appc, node-titanium-sdk etc.) would also be good as there deprecation warning will not be shown for code that resides under node_modules I believe.
We might also wish to update eslint-config-axway to include the no-buffer-constructor rule
Steps to reproduce to be added as replacement happens
[~hknoechel] [~cwilliams] I've assigned you as reviewers, mainly due to the dropping of Node 4 here. cc [~emerriman] [~amukherjee], could you review my (lengthy) comment around dropping Node 4 in the PR, as I understand our [deprecation policy](https://docs.appcelerator.com/platform/latest/#!/guide/Axway_Appcelerator_Deprecation_Policy) I believe this is within our policies as Node 4 is now EOL PR: https://github.com/appcelerator/titanium_mobile/pull/10090
Verified the fix on SDK 7.5.0.v20181018071438 . don't see ERR_INVALID_CALLBACK error when building with node 10, able to built app successfully and don't see deprecation warnings from new Buffer usage.works fine. Closing.
Operating System Name = Mac OS X Version = 10.13.6 Architecture = 64bit Node.js Node.js Version = 10.12.0 npm Version = 6.4.1 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version =7.5.0.v20181018071438 Device =iPhone 6s iOS 12 ,Samsung s5 android 6.