Skip to content

Instantly share code, notes, and snippets.

@danmaq
Created February 27, 2018 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danmaq/0af64a0b6f3e795010c444d5f27e9d14 to your computer and use it in GitHub Desktop.
Save danmaq/0af64a0b6f3e795010c444d5f27e9d14 to your computer and use it in GitHub Desktop.
The Expect script for publishing package on npmjs.
#!/usr/bin/expect
set NPM_USER [lindex $argv 0]
set NPM_EMAIL [lindex $argv 1]
set NPM_PASS [lindex $argv 2]
set PROMPT "\[#%>\]"
spawn yarn publish
expect {
"New version" {
send "\n"
exp_continue
}
"npm username" {
send "${NPM_USER}\n"
exp_continue
}
"npm email" {
send "${NPM_EMAIL}\n"
exp_continue
}
"npm password" {
send "${NPM_PASS}\n"
}
}
expect {
-glob "${PROMPT}" {
interact
exit 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment