kanasimi / wikiapi

JavaScript MediaWiki API for node.js
https://kanasimi.github.io/wikiapi/
BSD 3-Clause "New" or "Revised" License
49 stars 6 forks source link

SyntaxError: Unexpected token '.' #46

Closed strefethen closed 3 years ago

strefethen commented 3 years ago

After yarn upgrade from 1.14.1 to 1.15.1 resulted in the following error:

[Node] /Users/strefethen/github/traffic-graphql/node_modules/wikiapi/Wikiapi.js:1371
[Node]          no_message: options?.no_edit,

node --version v12.18.3

kanasimi commented 3 years ago

Please tell me the result of v1.15.2, thank you.

strefethen commented 3 years ago

Still failing.

package.json

{
        "name": "wikiapi",
        "title": "JavaScript MediaWiki API for node.js",
        "version": "1.15.2",

Error:

[Node] /Users/strefethen/github/traffic-graphql/node_modules/wikiapi/Wikiapi.js:1379
[Node]          no_message: options?.no_edit,
[Node]                              ^
[Node]
[Node] SyntaxError: Unexpected token '.'
kanasimi commented 3 years ago

Ohhhhh... yes, I forgot this. The package uses more modern technology, so you need at least 14.0. I am sorry that the change will not revert since newer node.js and browers support the syntax. However, if you need run in a old platform, you may use https://github.com/kanasimi/CeJS/tree/master/application/net/wiki .

strefethen commented 3 years ago

Ok thanks, I think this is unfortunate. Of course, this is entirely your choice but do recognize you're narrowing the usability of this package as a result. I'm running Node 12.18.3 because that's what supported in my production environment on Amazon and I suspect is likely very common. Node v12 is in maintenance through April '22 (EOL). Even then it will still work, it will just no longer be maintained.

Regardless, the version number should follow semver and get bumped too 2.x and I would perhaps suggest adding some notes to the README.md about the breaking compatibility of 1.15.1 & 2.

strefethen commented 3 years ago

Just want to add that I really appreciate having this package available and didn't want this point to get lost in my comment above.

One more note, it would be very helpful to see a changelog as there's currently no way to easily see what the latest improvements are sort of diffing the code.

Regards, -Steve

kanasimi commented 3 years ago

Hmmm... I do not have a AWS environment, so it will be helpful for me to test it on AWS. I will try backward compatible with node 12.0. And yes, I should document the change. I will add a test case for node 12.0 so I will not forget this again.

However, it seems AWS also supports node.js 14.0? Can you try this? https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platform-history-nodejs.html

kanasimi commented 3 years ago

Please upgrade to 1.16.0.

strefethen commented 3 years ago

1v16.0 compiles fine for me. Thank you.

I'm not using Elastic Beanstalk (link above) so that's not applicable in my case.

I'm using Lambda where v12 is supported and will be for quite some time considering EOL isn't until April 2022.

https://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html

Btw, you could test with lambda using the AWS free tier as well.

I'm not in a position where I can afford to bump to Node v14 so I'm not going to get there for awhile which is why this isn't just a simple change.