The Wayback Machine - https://web.archive.org/web/20201230120135/https://github.com/atom/package-generator/pull/36
Skip to content
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

Support JS package generation #36

Merged
merged 3 commits into from Mar 15, 2016
Merged

Support JS package generation #36

merged 3 commits into from Mar 15, 2016

Conversation

@stevenhauser
Copy link
Contributor

@stevenhauser stevenhauser commented Nov 22, 2015

Addresses #14

Now that atom/apm#417 has been merged, JS package generation can be done from the UI, so that's what happens here. I ran with the third idea I mentioned in #14 because it made the most sense to me.

image

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Nov 22, 2015

The code is pretty simple here and all specs pass, but I had problems using my version of apm with atom/apm#417 in it, so I wasn't able to 100% 🌽firm that this works. Going to look into it further, but any tips on using an apm outside of Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm? Every time I change the symlink, Atom seems to change it back to that.

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Nov 22, 2015

Update on actual testing of this feature: since initPackage uses atom.packages.getApmPath() and that uses atom.packages.apmPath (at least on OSX), I just set that to my local apm path in the dev tools 🌽sole to test this. It worked as expected. Let me know if there's a better way.

@@ -89,6 +97,9 @@ class PackageGeneratorView extends View

@runCommand(atom.packages.getApmPath(), args, callback)

isInPackageMode: ->

This comment has been minimized.

@50Wliu

50Wliu Nov 22, 2015
Member

Is this necessary? if @mode is 'package' seems fine to me, and it's also similar to what vim-mode does.

This comment has been minimized.

@stevenhauser

stevenhauser Nov 22, 2015
Author Contributor

Yeah that's what it was here but since we're doing the same check in two places now, a method for the check seems better than a constant or string duplication to me.

expect(apmExecute.argsForCall[0][1]).toEqual packageInitCommandFor "#{packagePath}", 'coffeescript'

describe "when the package is a javascript package", ->
it "calls `apm init` with the correct syntax option", ->

This comment has been minimized.

@50Wliu

50Wliu Nov 22, 2015
Member

extra space after apm init

This comment has been minimized.

@stevenhauser

stevenhauser Nov 22, 2015
Author Contributor

Good 👀


describe 'when creating a package', ->

This comment has been minimized.

@50Wliu

50Wliu Nov 22, 2015
Member

This newline isn't needed

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Nov 22, 2015

@50Wliu Is there a preference for separate commits for fixing things like spacing issues vs squashing and force pushing? I tend to do the latter but know that can be a PITA for collaboration.

@50Wliu
Copy link
Member

@50Wliu 50Wliu commented Nov 22, 2015

@stevenhauser I don't think the Atom team has a definitive preference, but maybe a slight lean towards not squashing.

@vinkla
Copy link

@vinkla vinkla commented Dec 2, 2015

👍

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Mar 4, 2016

Hey it's been a few months—is there still interest in this? There was some conversation in #14 about different ways to approach this, but I think it'd be nice to go this simple route to at least have something available and we could enhance it later? Happy to update this and fix any conflicts.

@MadLittleMods
Copy link

@MadLittleMods MadLittleMods commented Mar 4, 2016

@stevenhauser I am still interested in having this available 😀! The package syntax option seems good to me.

@lee-dohm lee-dohm added the atom label Mar 4, 2016
stevenhauser added 2 commits Mar 6, 2016
Source changes:

- Add `isInPackageMode` method to minimize string comparisons of `@mode`
- Add `getInitOptions` method to facilitate differentiating options
between modes and to keep `initPackage` simple. Add `--syntax` option
here, too.

Spec changes:

- Add `packageInitCommand` helper to clean up init command test
argument duplication and to prevent it from getting even longer with
the new `--syntax` addition.
- Move `generateOutside` into more generic `generatePackage` to clean
up duplication b/w the inside/outside specs, and leverage `_.partial`
to create more readable helper functions. This is also to prevent
further duplication in the new syntax specs.
- Write specs to check `--syntax` option.
@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Mar 6, 2016

@lee-dohm I've resolved the merge conflicts here. The problem was that the configuration was moved out of main.coffee into package.json, so I moved this new config option in there as well.

However I'm having problems actually getting this to load into Atom that I didn't have before. Here are the steps I've taken:

  1. Clone my fork
  2. npm install within fork directory
  3. apm link within fork directory
  4. atom . or atom . --dev within fork directory

When I first opened this PR, I believe that step 4 loaded my dev version of package-generator in as expected, but that's not happening for me anymore. Has something changed where I need to do another step or something?

@lee-dohm
Copy link
Member

@lee-dohm lee-dohm commented Mar 6, 2016

No, you shouldn't need to do another step, though I would recommend revising your steps to this:

  1. Clone
  2. apm install (there are subtle differences between how apm and npm work and apm will do the installation of any Node dependencies)
  3. apm link --dev
  4. atom --dev . (not sure the order of the parameters matters, just being pedantic 😀)
@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Mar 6, 2016

Thanks for the tip @lee-dohm but that didn't work either. I think something might be messed up on my machine due to multiple user accounts or something because I'm still stuck on Atom 1.3.3 and updates won't install. Regardless, I still think this PR is good to review because it was fine before and the only real change I made recently was to move config to package.json.

@lee-dohm
Copy link
Member

@lee-dohm lee-dohm commented Mar 7, 2016

I've added it to the queue for review. We're still trying to catch up on the backlog, so I can't give you an ETA. Just know that we're working on it 😀

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Mar 7, 2016

Coolio, I'm in no rush. Thanks!

@joshaber joshaber self-assigned this Mar 14, 2016
@@ -28,6 +28,12 @@
"default": false,
"type": "boolean",
"description": "When disabled, generated packages are linked into Atom in both normal mode and dev mode. When enabled, generated packages are linked into Atom only in dev mode."
},
"packageSyntax": {
"default": "coffeescript",

This comment has been minimized.

@joshaber

joshaber Mar 14, 2016
Contributor

I think we should default to JavaScript since it's the future.

This comment has been minimized.

@stevenhauser

stevenhauser Mar 15, 2016
Author Contributor

Hey that's great, I defaulted to CS purely for the sake of "backwards compatibility." Changing.

This comment has been minimized.

@joshaber

joshaber Mar 15, 2016
Contributor

That's almost always the right choice, but if we can push people away from CS and to JS... 😄

@joshaber
Copy link
Contributor

@joshaber joshaber commented Mar 14, 2016

@stevenhauser This looks good! Just one comment.

@stevenhauser
Copy link
Contributor Author

@stevenhauser stevenhauser commented Mar 15, 2016

Updated @joshaber. Thanks for the review!

@joshaber
Copy link
Contributor

@joshaber joshaber commented Mar 15, 2016

Awesome, thanks @stevenhauser!

joshaber added a commit that referenced this pull request Mar 15, 2016
Support JS package generation
@joshaber joshaber merged commit 6d7238d into atom:master Mar 15, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
7 participants
You can’t perform that action at this time.