tink: Implement ancillary subcommands

help-wanted
good-first-patch
tink

(Kat Marchán) #21

incidentally, I picked up tink org and have finished the command set :+1:


(Beni Von Cheni) #22

Hi @zkat, can I claim the “think access” subcommand from the unclaimed items from the checklist? Would like to learn more and help out.


(Kat Marchán) #23

got for it. It’s all yours!


(Noelle Leigh) #24

This is all pretty new to me, but I’d like to take a shot at tink deprecate if that’s okay!


(Kat Marchán) #25

wow there’s some hot competition for deprecate, but you ended up being the first to actually post about it, so it’s all yours!


(Kat Marchán) #26

aaaaand with that, all ancillary commands are spoken for! I look forward to seeing everyone’s PRs! Thanks a bunch, y’all! I’ll be having some nice installer-related treats for you soon that I’m working on, too. Coming Soon™ ;)


(Alex Zherdev) #27

Haha I was having difficulties signing up here - @noelleleigh enjoy!


(Kat Marchán) #28

Keep an eye out. Someone may drop out and in that case, there will be some commands free for the taking~


(Miguel Alejandro Bolivar Portilla) #29

@zkat I was working today adding the “team” command. I already add some utils and the initial files. I got a question about running tink, I’m sorry for the newbie question I think. I try to run the tink command with:

node bin/tink.js

When I first ran like that, I got an error regarding the function: “internalModuleReadJSON”, I had to modify that in the file: “lib/node/module.js” to be like:

const { internalModuleReadFile: interModuleReadJSON, internalModuleStat } = process.binding('fs');

Doing that I can get tink running, I can see the help and the other commands, I can even run the ping. Well far from being a question, I was wondering if that’s ok, I don’t know if maybe I have a wrong env, I’m running the project with node v9.10.1 and npm v6.4.1. Thanks a lot for letting me help, and my apologies again for maybe a newbie question :sweat:


(Kat Marchán) #30

You’ll need to update to node 10. Also, I recommend running npm link in the tink repo and you’ll have $ tink ... available from then on


(Beni Von Cheni) #31

@zkat, when trying node bin/tink.js org ls, I could see a helpful message (“Not enough non-option arguments: got 0, need at least 1”).

Would like to try the same approach to ensure arg(s) are provided correctly, i.e. node bin/tink.js access ls could receive the same validation message.

Would you mind sharing some tips?

(I could try when finishing the stubs in this WIP access PR.


(Kat Marchán) #32

Check out the docs for yargs. tl;dr defining a command like this does the trick:

.command('ls <org>', ...)


(Noelle Leigh) #33

If I’m reading the OP right, the deprecate command will have to use libnpm.fetch to send a command an API endpoint. This repo appears to be the location where such endpoints would be documented, but I can find nothing in there beyond GET'ing information, no POST'ing.

Looking at how the npm CLI does it, it uses npm-registry-client, which exposes a deprecate method. Tink currently doesn’t have npm-registry-client as a dependency. Is it alright if I add it?


(Kat Marchán) #34

https://github.com/npm/cli/blob/9a564a55c016642bff3e4ae58ed05a0d6370aaf3/lib/deprecate.js is the implementation to reference for deprecate, which no longer uses n-r-c.


(Beni Von Cheni) #35

@zkat et al,

Implemented tink access ls-collaborators [<package> [<user>]] in these 2 commits (652897e & 5639535) in this WIP PR tonight. Seems to work in quick test:

→ tink access ls-collaborators npm
┌─────────┬────────────┐
│ collab  │ role       │
├─────────┼────────────┤
│ isaacs  │ read-write │
├─────────┼────────────┤
│ ceejbot │ read-write │
├─────────┼────────────┤
│ iarna   │ read-write │
├─────────┼────────────┤
│ zkat    │ read-write │
└─────────┴────────────┘

Have a test case, where [<package>|<user>] is not provided. When trying regular npm access ls-collaborators without providing a package name or user name, it seems to use the package.json. Still trying to figure out in a stab.

Temporarily checked the ls-collaborators item off from the PR’s checklost, but would like to hear your thoughts/advice to “overcome” the test case, when option(s) are not provided to the tink access ls-collaborators command. :pray:


(Kat Marchán) #36

Should be able to use libnpm.getPrefix() to find the package.json (and libnpm.readJSON to read it)


(Noelle Leigh) #37

Should semver be added as a dependency? Or does one of the existing dependencies include its functionality?


(Kat Marchán) #38

yes. I thought it already was. But go ahead and add it.


(Michael Matuzak) #39

@zkat just fyi this week has been terrible. I’m still down to do hook, but also don’t want to hold it up so if someone else wants to jump in and take it I’m totally cool with giving it up.


(Kat Marchán) #40

take your time. I’m expecting all this to take another week or two!

But noted – I might just end up doing hook myself if I’m bored for tasks and need a change of pace, but it’s still all yours for now.