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

Fixes ENEEDSAUTH errors + add more tests, options and types #44

Merged
merged 3 commits into from Oct 26, 2019

Conversation

tunnckoCore
Copy link
Collaborator

@tunnckoCore tunnckoCore commented Oct 26, 2019

Example custom run()

const run = async (pkgDir) => {
  const fp = ['packages', pkgDir, 'index.js'].join('/')
  await execa('node', [fp], { stdio: 'inherit' })
}
publishPacked(pkgDirPath, { run })

Types

export type Options = { paths?: string[] } & {
  tag?: string,
  run?: typeof run,
  npmClient?: string,
  prune?: boolean,
  verbose?: boolean,
}
export type run = (cwd: string, args: string[], opts?: Options) => Promise<void>

Default options

export const defaultOptions = {
  tag: 'latest',
  run: typeof run,
  npmClient: 'npm',
  prune: false,
  verbose: false,
}

Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
…an#42

Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
.travis.yml Outdated Show resolved Hide resolved
src/run-utils.ts Outdated Show resolved Hide resolved
src/run-utils.ts Outdated Show resolved Hide resolved
Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Yup.

Btw, consider switching to sade (by @lukeed) for the cli? A ton better with the same lines of code than Jorge's shitty stuff, as always.

@@ -5,14 +5,18 @@ import getopts = require('getopts')
const opts = getopts(process.argv.slice(2), {
alias: {
h: 'help',
n: ['npmClient', 'npm-client'],
Copy link
Owner

@zkochan zkochan Oct 26, 2019

Choose a reason for hiding this comment

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

I don't think we need two aliases. There is already a shorthand

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I use to do this cuz don't know what "the next arg parser" is doing. :D

@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

I don't care what CLI utils is used. Switch it if you want

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Awesome. It introduces only greater and prettier things. :)

@zkochan zkochan merged commit f2367d9 into zkochan:master Oct 26, 2019
@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

On my system this fails. I use nvs and it cannot find the npm CLI

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Interesting. Can you provide some paths? Are you using Windows? May still need updates to the all-module-paths.

Just to note, I tried which, npm-cli-path, npm-run-path and get-installed-path. Only the latter got some better results than the others but was still failing.

I'm going to publish new release of all-module-paths from my monorepo so you can see what results it gives you.

@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

I use Linux. My PATH is

/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/zoltan/bin:/home/zoltan/bin

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Is the /usr/share/Modules the global modules? What's in this dir, ls -al and in subdirs? I'm looking on nvs now.

@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

/usr/share/Modules/bin:
total 40
drwxr-xr-x. 2 root root 4096 Sep 11 22:22 .
drwxr-xr-x. 6 root root 4096 Sep 11 22:22 ..
-rwxr-xr-x. 1 root root 5299 Jul 29 17:30 add.modules
-rwxr-xr-x. 1 root root 8327 Jul 29 17:30 createmodule.py
-rwxr-xr-x. 1 root root 5406 Jul 26 16:37 createmodule.sh
-rwxr-xr-x. 1 root root 2887 Jul 29 17:30 mkroot

/usr/share/Modules/init:
total 124
drwxr-xr-x. 4 root root 4096 Sep 11 22:22 .
drwxr-xr-x. 6 root root 4096 Sep 11 22:22 ..
-rw-r--r--. 1 root root 4053 Jul 29 17:30 bash
-rw-r--r--. 1 root root 6376 Jul 29 17:30 bash_completion
-rw-r--r--. 1 root root 1914 Jul 29 17:30 cmake
-rw-r--r--. 1 root root 3874 Jul 29 17:30 csh
-rw-r--r--. 1 root root 1722 Jul 29 17:30 fish
-rw-r--r--. 1 root root 9445 Jul 29 17:30 fish_completion
-rw-r--r--. 1 root root 4151 Jul 29 17:30 ksh
drwxr-xr-x. 2 root root 4096 Sep 11 22:22 ksh-functions
-rw-r--r--. 1 root root 3230 Jul 29 17:30 lisp
-rw-r--r--. 1 root root 1107 Jul 29 17:30 perl.pm
-rw-r--r--. 1 root root  197 Jul 29 17:30 profile-compat.csh
-rw-r--r--. 1 root root  309 Jul 29 17:30 profile-compat.sh
-rw-r--r--. 1 root root  105 Jul 29 17:30 profile.csh
-rw-r--r--. 1 root root  382 Jul 29 17:30 profile.sh
-rw-r--r--. 1 root root 1528 Jul 29 17:30 python.py
-rw-r--r--. 1 root root  950 Jul 29 17:30 r.R
-rw-r--r--. 1 root root 1368 Jul 29 17:30 ruby.rb
-rw-r--r--. 1 root root 3914 Jul 29 17:30 sh
-rw-r--r--. 1 root root 1060 Jul 29 17:30 tcl
-rw-r--r--. 1 root root 3880 Jul 29 17:30 tcsh
-rw-r--r--. 1 root root 4951 Jul 29 17:30 tcsh_completion
-rw-r--r--. 1 root root 4140 Jul 29 17:30 zsh
drwxr-xr-x. 2 root root 4096 Sep 11 22:22 zsh-functions

/usr/share/Modules/libexec:
total 344
drwxr-xr-x. 2 root root   4096 Sep 11 22:22 .
drwxr-xr-x. 6 root root   4096 Sep 11 22:22 ..
-rwxr-xr-x. 1 root root 342769 Jul 29 17:30 modulecmd.tcl

/usr/share/Modules/modulefiles:
total 32
drwxr-xr-x. 2 root root 4096 Sep 11 22:22 .
drwxr-xr-x. 6 root root 4096 Sep 11 22:22 ..
-rw-r--r--. 1 root root  346 Jul 29 17:30 dot
-rw-r--r--. 1 root root  558 Jul 29 17:30 module-git
-rw-r--r--. 1 root root 2272 Jul 29 17:30 module-info
-rw-r--r--. 1 root root  737 Jul 29 17:30 modules
-rw-r--r--. 1 root root  340 Jul 29 17:30 null
-rw-r--r--. 1 root root 1398 Jul 29 17:30 use.own

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

So where are the packages and node versions? In the home, home bin? What's NVS_HOME and its structure?

Please try and give the output.

npm install all-module-paths@0.8

node -p "require('all-module-paths')()"

@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

Why don't just run the CLI by name?

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Didn't worked either :D That was the first try. It was still using local npm for some reason, even after I removed it.

Best would be which. BUt should debug it more.

Can you try

nvs exec 10.10 node -p "require('which').sync('yarn', {all:true})" 
nvs exec 10.10 node -p "require('which').sync('pnpm', {all:true})"
nvs exec 10.10 node -p "require('which').sync('npm', {all:true})"

no matter the node version

@zkochan
Copy link
Owner

zkochan commented Oct 26, 2019

these commands successfully find the locations of the CLIs

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Oct 26, 2019

Same here. I came with another rewrite which in first glance is working (when running just pnpm test - i'm using NVM), but when run the tests through nvs exec <version> pnpm test they doesn't work.

@tunnckoCore
Copy link
Collaborator Author

tunnckoCore commented Nov 9, 2019

Sorry for vanishing. I think using global-dirs will be better and safer. It works for nvm, nvs, nve and without such manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants