Repository: intuit/auto
Pull request #549 (2019-09-02 23:39:37)

set-token: handle when no name in root package.json
# What Changed

see title

# Why

it was causing a bug in a monorepo with no name

Todo:

- [x] Add tests
- [ ] Add docs
- [ ] Add yourself to contributors (run `yarn contributors:add`)

<!-- GITHUB_RELEASE PR BODY: canary-version -->
Published PR with canary version: `7.4.2-canary.549.7138.0`
<!-- GITHUB_RELEASE PR BODY: canary-version -->



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 358e9e32..b9a2acee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,16 +1,3 @@
-# v7.4.2 (Mon Sep 02 2019)
-
-#### 🐛  Bug Fix
-
-- `@auto-it/core`
-  - label creation is case insensitive [#548](https://github.com/intuit/auto/pull/548) ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
-#### Authors: 1
-
-- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
-
----
-
 # v7.4.1 (Sun Sep 01 2019)
 
 #### 🐛  Bug Fix
diff --git a/lerna.json b/lerna.json
index 92d5dec8..335be04d 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
 {
-  "version": "7.4.2",
+  "version": "7.4.1",
   "npmClient": "yarn",
   "useWorkspaces": true,
   "packages": [
diff --git a/packages/cli/package.json b/packages/cli/package.json
index eb31665d..e192658f 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -2,7 +2,7 @@
   "name": "auto",
   "bin": "dist/bin/auto.js",
   "description": "CLI tools to help facilitate semantic versioning based on GitHub PR labels",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "author": {
     "name": "Andrew Lisowski",
     "email": "lisowski54@gmail.com"
diff --git a/packages/core/package.json b/packages/core/package.json
index 2d4d4529..e1948a32 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/core",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "description": "Node API for using auto.",
   "main": "dist/auto.js",
   "author": {
diff --git a/plugins/chrome/package.json b/plugins/chrome/package.json
index 72d3d3b4..377209d5 100644
--- a/plugins/chrome/package.json
+++ b/plugins/chrome/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/chrome",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Chrome publishing plugin for auto",
   "author": {
diff --git a/plugins/conventional-commits/package.json b/plugins/conventional-commits/package.json
index a19995a0..f648e79a 100644
--- a/plugins/conventional-commits/package.json
+++ b/plugins/conventional-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/conventional-commits",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Conventional commit plugin for auto",
   "author": {
diff --git a/plugins/git-tag/package.json b/plugins/git-tag/package.json
index eae56576..aa95878b 100644
--- a/plugins/git-tag/package.json
+++ b/plugins/git-tag/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/git-tag",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Manage your projects version through just a git tag",
   "author": {
diff --git a/plugins/jira/package.json b/plugins/jira/package.json
index fe2acf38..e14e8346 100644
--- a/plugins/jira/package.json
+++ b/plugins/jira/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/jira",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Jira plugin for auto",
   "author": {
diff --git a/plugins/maven/package.json b/plugins/maven/package.json
index 91600b5c..b9a24aa8 100644
--- a/plugins/maven/package.json
+++ b/plugins/maven/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/maven",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Maven publishing plugin for auto",
   "author": {
diff --git a/plugins/npm/package.json b/plugins/npm/package.json
index 5a029302..d061335e 100644
--- a/plugins/npm/package.json
+++ b/plugins/npm/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/npm",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "NPM publishing plugin for auto",
   "author": {
diff --git a/plugins/npm/src/set-npm-token.ts b/plugins/npm/src/set-npm-token.ts
index 98b7d2ab..450376db 100644
--- a/plugins/npm/src/set-npm-token.ts
+++ b/plugins/npm/src/set-npm-token.ts
@@ -27,7 +27,7 @@ export default async function setTokenOnCI(logger: ILogger) {
 
   if (publishConfig.registry) {
     registry = publishConfig.registry;
-  } else if (name.startsWith('@')) {
+  } else if (name && name.startsWith('@')) {
     const scope = name.split(`/`)[0];
     registry = registryUrl(scope);
   } else {
diff --git a/plugins/omit-commits/package.json b/plugins/omit-commits/package.json
index 966cc466..aa691b0f 100644
--- a/plugins/omit-commits/package.json
+++ b/plugins/omit-commits/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-commits",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Omit commits plugin for auto",
   "author": {
diff --git a/plugins/omit-release-notes/package.json b/plugins/omit-release-notes/package.json
index 49683f18..6f0ab2c2 100644
--- a/plugins/omit-release-notes/package.json
+++ b/plugins/omit-release-notes/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/omit-release-notes",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Omit release notes plugin for auto",
   "author": {
diff --git a/plugins/released/package.json b/plugins/released/package.json
index b7ba2165..8dc97a26 100644
--- a/plugins/released/package.json
+++ b/plugins/released/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/released",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Released plugin for auto. Comments with version + extra",
   "author": {
diff --git a/plugins/slack/package.json b/plugins/slack/package.json
index 36945fed..f94f3050 100644
--- a/plugins/slack/package.json
+++ b/plugins/slack/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/slack",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Slack plugin for auto",
   "author": {
diff --git a/plugins/twitter/package.json b/plugins/twitter/package.json
index efc2f556..b52dcc75 100644
--- a/plugins/twitter/package.json
+++ b/plugins/twitter/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/twitter",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Twitter plugin for auto",
   "author": {
diff --git a/plugins/upload-assets/package.json b/plugins/upload-assets/package.json
index fc7e37b1..78540c31 100644
--- a/plugins/upload-assets/package.json
+++ b/plugins/upload-assets/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@auto-it/upload-assets",
-  "version": "7.4.2",
+  "version": "7.4.1",
   "main": "dist/index.js",
   "description": "Upload assets plugin for auto",
   "author": {


Test patch:
diff --git a/plugins/npm/__tests__/set-npm-token.test.ts b/plugins/npm/__tests__/set-npm-token.test.ts
index 2e5b1d94..3d8615c9 100644
--- a/plugins/npm/__tests__/set-npm-token.test.ts
+++ b/plugins/npm/__tests__/set-npm-token.test.ts
@@ -31,6 +31,15 @@ describe('set npm token', () => {
     );
   });
 
+  test('should write a new npmrc w/o name', async () => {
+    loadPackageJson.mockReturnValueOnce({});
+    await setNpmToken(dummyLog());
+    expect(writeFile).toHaveBeenCalledWith(
+      '/User/name/.npmrc',
+      'npm.registry.com:_authToken=${NPM_TOKEN}'
+    );
+  });
+
   test('should use registry from packageJson', async () => {
     loadPackageJson.mockReturnValueOnce({
       name: 'test',