Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Update Tern & Acorn #11569

Merged
merged 15 commits into from
Aug 26, 2016
Merged

Update Tern & Acorn #11569

merged 15 commits into from
Aug 26, 2016

Conversation

marcelgerber
Copy link
Contributor

Since Acorn's build process changed (there are no more prebuilt dist files in the repo, but in the npm package), I've switched from having it available as a submodule to just having the files in the file tree. Hope that's fine.
The build is based on my fork https://github.com/MarcelGerber/acorn, where I removed a build step that doesn't quite work with Brackets.

Fixes #11568, and hopefully some others, too.

Commit logs:
Tern + Release notes
Acorn

@marcelgerber
Copy link
Contributor Author

All tests pass now.

@marcelgerber
Copy link
Contributor Author

Woah. Looks like this upgrade actually finally fixes the problems we had with Ionic/Cordova apps (cc @MiguelCastillo - would be very kind of you if you could test that). That'd be awesome.
(At least I cannot repro any longer with an example project where I can repro on master)

@ficristo
Copy link
Collaborator

Out of curiosity, can I know why they can't be dependencies in package.json?

@marcelgerber
Copy link
Contributor Author

The two libraries have to be located in the extension's folder, thus they cannot be part of the root package.json.
I don't know for sure why they are not part of a package.json in the thirdparty folder itself, but I guess it's just so you can start "hacking" Brackets in as few steps as possible, where npm install is not needed.

@marcelgerber marcelgerber mentioned this pull request Aug 30, 2015
7 tasks
@marcelgerber
Copy link
Contributor Author

I just now updated this to feature the latest Acorn & Tern versions, where Tern now has ES6 support (#11644).
If you'd rather have the "normal" Tern upgrade first (it's presumably more stable), let me know and I'll factor the ES6 one out into a new PR.

cc @redmunds @nethip for review. Would like to get this in fast so it has a long testing phase on master.

@MiguelCastillo
Copy link
Contributor

@marcelgerber - tern 0.15 is just released a few hours ago. I think that it will be worth doing that version since ES6 has been more thoroughly tested and bugs fixed. That should definitely improve things.

Some things to keep in mind is that there is a new plugin called module, which needs to be enabled in order to es6 to work well. For example, this is what my tern config looks like now.

{
    "libs": [
        "browser",
        "chai",
        "ecma5",
        "ecma6",
        "browser",
        "jquery"
    ],
    "loadEagerly": [],
    "async": true,
    "plugins": {
        "doc_comment": {},
        "requirejs": {},
        "es_modules": {},
        "modules": {}
    }
}

@marcelgerber
Copy link
Contributor Author

Thanks @MiguelCastillo
Updating Tern was already on my agenda, and I just committed and pushed that upgrade.

I'll try to look at the modules plugin after my 4-day-trip to Berlin, on Sunday/Monday.
Or if you feel like it, feel free to do this yourself :)

@abose abose modified the milestones: Release 1.6, Release 1.5 Sep 11, 2015
@abose
Copy link
Contributor

abose commented Sep 11, 2015

As this is a core change, Moving to next release as all external integrations happen at the beginning of the cycle.
@marcelgerber Will target this immediately after rel 1.5 is out.

@ingorichter
Copy link
Contributor

@abose what is the timeline for the 1.5 release? I'm just asking, since it's not clear to me, if this means we are holding off PR's for days, weeks or months.

@abose
Copy link
Contributor

abose commented Sep 15, 2015

1.5 is due within the next 2 weeks and the move to release branch is by next week.
So the holdoff is probably till next week :)

@ingorichter
Copy link
Contributor

That's great @abose! Then let's hold it off until then.

@marcelgerber marcelgerber force-pushed the marcel/update-tern-acorn branch from 4d7640e to 1f89f7b Compare December 12, 2015 01:02
@marcelgerber
Copy link
Contributor Author

Updated once again to include the latest & greatest.

@busykai
Copy link
Contributor

busykai commented Feb 19, 2016

@marcelgerber, accidentally tried more or less the same and hit the unfortunate change in acorn as well. I think replacing it with a copy is the right thing to do, except these doubts:

  1. why do we need all the rest of the files in thirdparty/acorn? perhaps we only need to keep the LICENSE.md, remove the rest except dist/*, and move all the files from dist/ to the root (or leave it there if tern relies on them being in dist).
  2. we need to be explicit in the comments which version/commit id of acorn is being committed. since it's not a submodule any longer, it's needed for the bookkeeping.

@marcelgerber
Copy link
Contributor Author

@busykai Where'd you suggest putting the commit SHA (we already have the version embedded in code)?
Otherwise, we could also simply settle with release versions, so we can rely on the version number by itself, not having to worry about the SHA.

@busykai
Copy link
Contributor

busykai commented Feb 19, 2016

@marcelgerber, I was thinking additionally a version tag/sha in the commit comment. So that you could see with git log the history of the versions.

@marcelgerber
Copy link
Contributor Author

Ah yes, that makes sense.
But considering I'll rebase these commits away anyhow at some point, we can do that later on.
For now, I'd like to see whether this actually works as expected.

@busykai
Copy link
Contributor

busykai commented Feb 20, 2016

@marcelgerber, understood. What about removing all the acorn junk? We don't need it there (provided we know where to take it from): since it's no longer a submodule, having it in thirdparty/acorn does not make any sense.

I'll take a look at it functionally and run some tests this weekend. @MiguelCastillo also was going to get back to this.

@MiguelCastillo
Copy link
Contributor

@marcelgerber @busykai Ok, I had to read the whole thing again. :)

I'd really prefer using npm packages. It just makes our lives easier because we don't need to worry maintaining yet another repo.

One thing that I think we can do as a separate PR is to move thirdparty deps into the package.json as way to manage dependency upgrades. And we can manage copying these modules from node_modules into thirdparty (or any other place) in our gruntfile.js, which we already do for a few other things. I can look into that separately. But for now, adding tern as a dependency and adding a config in the gruntfile.js to copy the needed files to the right place will be a more straight forward workflow for future upgrades. I see that there are concerns with setting up brackets for hacking. I am not too concerned about that because we will be checking in the dependencies into the thirdparty directory anyways. Upgrades will continue to be a manual process of running npm install and putting out a PR to merge the new stuff into the correct place. No more git submodule init -u ... -whtver please :D

I am going to pull this down right now and take it out for test.

@ficristo
Copy link
Collaborator

@MiguelCastillo you should take a look at #12006

@MiguelCastillo
Copy link
Contributor

@ficristo Well thank you very much sir!

travis builds on node 0.10 which doesn't have promise
@zaggino zaggino force-pushed the marcel/update-tern-acorn branch from 6b7b4bb to f1ba730 Compare August 25, 2016 22:00
@zaggino
Copy link
Contributor

zaggino commented Aug 25, 2016

Rebased, squashed & ready to review.

@marcelgerber
Copy link
Contributor Author

Hm, there's a merge conflict in npm-install.js now. As you definitely know that code better than I do, I'll leave it to you, ok?

@zaggino
Copy link
Contributor

zaggino commented Aug 25, 2016

Resolved the conflict @marcelgerber

@marcelgerber
Copy link
Contributor Author

Another failure: Use the global "use strict" for fix-acorn.js

@zaggino
Copy link
Contributor

zaggino commented Aug 26, 2016

🤦 fixed

@ficristo
Copy link
Collaborator

If using node_modules or requirejs is too hard maybe we could go with browserify?
Just throwing the idea.

@zaggino
Copy link
Contributor

zaggino commented Aug 26, 2016

a) introducing a new tool when you can fix the script with 6 lines of code doesn't appeal to me
b) this should be ported to NodeDomain for improved performance and then you won't have to fix acorn for requirejs

"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file supposed to have all these packages in there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - that's how shrinkwrap works, it's generated by npm shrinkwrap command, I'd write more about it but it's easy to google

@marcelgerber
Copy link
Contributor Author

LGTM, just keen to know if npm-shrinkwrap.json is supposed to contain all these modules.

@zaggino
Copy link
Contributor

zaggino commented Aug 26, 2016

LGTM +1

@marcelgerber marcelgerber merged commit 1ed6c04 into master Aug 26, 2016
@marcelgerber marcelgerber deleted the marcel/update-tern-acorn branch August 26, 2016 12:22
@marcelgerber
Copy link
Contributor Author

Thank you @zaggino for the work you have done these last few days to bring this up to par and make it mergeable!

@ficristo
Copy link
Collaborator

I've run the Extensions \ JavaScript Code Hinting on Windows, OSX and Linux.
While on Windows everything seems smooth, on the other platforms the tests fails.
Could you check?
(There are other tests that do not pass, like JSQuickEdit but I think the problem is the same)

@zaggino zaggino mentioned this pull request Aug 29, 2016
@zaggino
Copy link
Contributor

zaggino commented Aug 29, 2016

PR here #12732

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants