From 8d005a0897341a5fe0290301591edc6496f81fb5 Mon Sep 17 00:00:00 2001 From: Gregor Date: Wed, 8 May 2019 10:54:02 -0700 Subject: [PATCH 1/2] build(package): publish to `@latest` --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 38f4b289..9baf95b2 100644 --- a/package.json +++ b/package.json @@ -85,8 +85,7 @@ "trailingComma": "es5" }, "publishConfig": { - "access": "public", - "tag": "next" + "access": "public" }, "repository": { "type": "git", From feefb94a1838fc25ca62fc81faf7974b0bb24714 Mon Sep 17 00:00:00 2001 From: Gregor Date: Tue, 4 Jun 2019 16:41:28 -0700 Subject: [PATCH 2/2] WIP just debuggingk nevermind me --- lib/set-npmrc-auth.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/set-npmrc-auth.js b/lib/set-npmrc-auth.js index 40f65c92..0a2a598d 100644 --- a/lib/set-npmrc-auth.js +++ b/lib/set-npmrc-auth.js @@ -8,20 +8,34 @@ const getError = require('./get-error'); module.exports = async ( registry, - {cwd, env: {NPM_TOKEN, NPM_CONFIG_USERCONFIG, NPM_USERNAME, NPM_PASSWORD, NPM_EMAIL}, logger} + {cwd, env: {NPM_TOKEN, NPM_CONFIG_USERCONFIG, NPM_USERNAME, NPM_PASSWORD, NPM_EMAIL, GITHUB_TOKEN}, logger} ) => { logger.log('Verify authentication for registry %s', registry); const config = NPM_CONFIG_USERCONFIG || path.resolve(cwd, '.npmrc'); + + console.log( + `-------- getAuthToken(registry, {npmrc: rc('npm', {registry: 'https://registry.npmjs.org/'}, {config})}) -------- ` + ); + console.log(Boolean(getAuthToken(registry, {npmrc: rc('npm', {registry: 'https://registry.npmjs.org/'}, {config})}))); + if (getAuthToken(registry, {npmrc: rc('npm', {registry: 'https://registry.npmjs.org/'}, {config})})) { return; } + console.log(`-------- GITHUB_TOKEN? -------- `); + console.log(Boolean(GITHUB_TOKEN)); + console.log(`-------- registry -------- `); + console.log(registry); + if (NPM_USERNAME && NPM_PASSWORD && NPM_EMAIL) { await appendFile(config, `\n_auth = \${LEGACY_TOKEN}\nemail = \${NPM_EMAIL}`); logger.log(`Wrote NPM_USERNAME, NPM_PASSWORD and NPM_EMAIL to ${config}`); } else if (NPM_TOKEN) { await appendFile(config, `\n${nerfDart(registry)}:_authToken = \${NPM_TOKEN}`); logger.log(`Wrote NPM_TOKEN to ${config}`); + } else if (GITHUB_TOKEN && registry === 'https://npm.pkg.github.com/') { + await appendFile(config, `\n${nerfDart(registry)}:_authToken = \${GITHUB_TOKEN}`); + logger.log(`Wrote GITHUB_TOKEN to ${config}`); } else { throw new AggregateError([getError('ENONPMTOKEN', {registry})]); }