Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#52827 closed submission (duplicate)

yarn @0.16.1

Reported by: isomarcte (David Strawn) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: yarn

Description

This is a new Port for https://yarnpkg.com/

This is the first Portfile I have created from scratch and I have attempted to follow the best practices, but any feedback on the Portfile is greatly appreciated.

In particular, I would appreciate an audit of the destroot phase and the install note. Since this is a JavaScript package there is nothing to build, we just unpack and copy the files into the correct locations in the destroot phase. There is nothing to build.

The note informs the user that they should probably avoid using yarn as a global package manager, and if they do so what they might expect to have happen and how to handle it. I borrowed a bit of the opening wording from the NPM packages, since it has the same issue and the the note there was well written. I expanded it a bit with how one might "fix" their system if they do choose to install stuff locally.

Attachments (3)

patch-symbolic-link-fix.diff (312 bytes) - added by isomarcte (David Strawn) 8 years ago.
Patch to allow for using the yarn bash wrapper from a symbolic link (credit goes to jambonrose)
Portfile.2 (3.4 KB) - added by isomarcte (David Strawn) 8 years ago.
Update to 0.18.0
Portfile (3.4 KB) - added by isomarcte (David Strawn) 8 years ago.
Update to 0.18.0

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

You should use the github portgroup; this will let you remove many lines of code that relate to fetching from github.

comment:2 in reply to:  1 Changed 8 years ago by isomarcte (David Strawn)

Replying to ryandesign:

You should use the github portgroup; this will let you remove many lines of code that relate to fetching from github.

Thanks for the feedback ryandesign! I have updated the Portfile to use the github PortGroup.

comment:3 Changed 8 years ago by jambonrose (Andrew Pinkham)

This is somewhat embarrassing: I created a Portfile for yarn, having somehow missed this issue when I started work on this yesterday. Sorry about that, David. I did not mean to step on anybody's toes.

I've opened a PR for my Portfile on Github: https://github.com/macports/macports-ports/pull/48

The Portfile in the PR (PPR) and the Portfile in this issue (PI) are quite different.

  1. PI downloads package from Github; PPR uses the yarn website
  2. PI installs into lib and links yarn.js directly; PPR installs in libexec and links to the yarn shell script that calls yarn.js
  3. PI does not patch the code; PPR does (to allow for sym-linking)
  4. PPR supports variants of Node, allows for installations of Node outside of Macports

I suspect there may be some discussion about the decisions each of us has made, and the pros and cons here. Feedback appreciated.

David: would you like me to add you as a maintainer to the Portfile in the PR?

comment:4 in reply to:  3 Changed 8 years ago by isomarcte (David Strawn)

Replying to jambonrose:

This is somewhat embarrassing: I created a Portfile for yarn, having somehow missed this issue when I started work on this yesterday. Sorry about that, David. I did not mean to step on anybody's toes.

I've opened a PR for my Portfile on Github: https://github.com/macports/macports-ports/pull/48

The Portfile in the PR (PPR) and the Portfile in this issue (PI) are quite different.

  1. PI downloads package from Github; PPR uses the yarn website
  2. PI installs into lib and links yarn.js directly; PPR installs in libexec and links to the yarn shell script that calls yarn.js
  3. PI does not patch the code; PPR does (to allow for sym-linking)
  4. PPR supports variants of Node, allows for installations of Node outside of Macports

I suspect there may be some discussion about the decisions each of us has made, and the pros and cons here. Feedback appreciated.

David: would you like me to add you as a maintainer to the Portfile in the PR?

Hey jambonrose,

Thanks for the comment. I am not worried about you stepping on my toes. I like many of the decisions you made, perhaps we can combine efforts.

  1. PI downloads package from Github; PPR uses the yarn website

I have no strong opinion on this. I noticed that your version lacks a livecheck, which is very nice to have. We get it for free by using the github PortGroup. If you want to get yarn directly from their site, you might consider adding a livecheck.

  1. PI installs into lib and links yarn.js directly; PPR installs in libexec and links to the yarn shell script that calls yarn.js

Well, to be more accurate, the version I created installs it into lib/node_modules. This is where it would get installed if you ran npm -g install yarn and where npm itself is installed. I certainly don't think that there is anything wrong with installing it into libexec, but the lib/node_modules location seems to adhear to the "Principle of Least Astonishment".

  1. PI does not patch the code; PPR does (to allow for sym-linking)

Great idea! I noticed on the PR that it was suggested you put the modification into a patch. I have gone ahead with this.

  1. PPR supports variants of Node, allows for installations of Node outside of Macports

Derp. I had the wrong depends_run line my PortFile. I have updated it to,

depends_run         bin:node:nodejs7

This way as along as they have a node binary in one of the standard bin folders, they won't be prompted to install nodejs7.

Last edited 8 years ago by isomarcte (David Strawn) (previous) (diff)

Changed 8 years ago by isomarcte (David Strawn)

Patch to allow for using the yarn bash wrapper from a symbolic link (credit goes to jambonrose)

Changed 8 years ago by isomarcte (David Strawn)

Attachment: Portfile.2 added

Update to 0.18.0

Changed 8 years ago by isomarcte (David Strawn)

Attachment: Portfile added

Update to 0.18.0

comment:5 Changed 8 years ago by mf2k (Frank Schima)

Some comments:

  • Since you are using the Github portgroup, you should be able to remove the distname and worksrcdir lines because they should be set correctly already by the portgroup.
  • Can openmaintainer be added?

comment:6 Changed 8 years ago by jambonrose (Andrew Pinkham)

Hi Frank,

Thanks for your feedback!

I've got a PR open that integrates many of David's changes: https://github.com/macports/macports-ports/pull/48

I added the openmaintainer line you requested.

I attempted to remove distname and worksrcdir, but this resulted in errors.

Removing worksrcdir:

Error: org.macports.extract for port yarn returned: no files matched glob pattern "/opt/local/var/macports/build/_Users_magus_Ports_devel_yarn/yarn/work/yarnpkg-yarn-*"
Please see the log file for port yarn for details:
    /opt/local/var/macports/logs/_Users_magus_Ports_devel_yarn/yarn/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port yarn failed

Removing distname:

--->  Computing dependencies for yarn
--->  Fetching distfiles for yarn
--->  Attempting to fetch yarn-0.18.0.tar.gz from https://distfiles.macports.org/yarn
--->  Attempting to fetch yarn-0.18.0.tar.gz from https://github.com/yarnpkg/yarn/releases/download/v0.18.0
--->  Attempting to fetch yarn-0.18.0.tar.gz from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/yarn
--->  Attempting to fetch yarn-0.18.0.tar.gz from http://lil.fr.distfiles.macports.org/yarn
... etc ...

I will take another stab at the problem later, but would appreciate any guidance/feedback you might have.

Thanks!

comment:7 Changed 8 years ago by isomarcte (David Strawn)

This ticket should be closed. The PR on github should be considered the authoritative source.

https://github.com/macports/macports-ports/pull/48

comment:8 Changed 8 years ago by mojca (Mojca Miklavec)

Resolution: duplicate
Status: newclosed
Version: 2.3.4

comment:9 Changed 8 years ago by jambonrose (Andrew Pinkham)

In cbc85540/macports-ports:

yarn: new port, version 0.18.1

JavaScript dependency manager

Note: See TracTickets for help on using tickets.