diff --git a/.changeset/lemon-peaches-protect.md b/.changeset/lemon-peaches-protect.md new file mode 100644 index 0000000000000..750f068825e60 --- /dev/null +++ b/.changeset/lemon-peaches-protect.md @@ -0,0 +1,5 @@ +--- +"medusa-dev-cli": patch +--- + +Avoid dev cli auth diff --git a/packages/medusa-dev-cli/src/local-npm-registry/index.js b/packages/medusa-dev-cli/src/local-npm-registry/index.js index 25e1d009e4d99..2794b864e6f7e 100644 --- a/packages/medusa-dev-cli/src/local-npm-registry/index.js +++ b/packages/medusa-dev-cli/src/local-npm-registry/index.js @@ -49,6 +49,7 @@ exports.publishPackagesLocallyAndInstall = async ({ ignorePackageJSONChanges, yarnWorkspaceRoot, externalRegistry, + root, }) => { await startServer() @@ -63,6 +64,7 @@ exports.publishPackagesLocallyAndInstall = async ({ packageNameToPath, versionPostFix, ignorePackageJSONChanges, + root, }) } diff --git a/packages/medusa-dev-cli/src/local-npm-registry/publish-package.js b/packages/medusa-dev-cli/src/local-npm-registry/publish-package.js index b88b0d7336616..e3285e8fece4c 100644 --- a/packages/medusa-dev-cli/src/local-npm-registry/publish-package.js +++ b/packages/medusa-dev-cli/src/local-npm-registry/publish-package.js @@ -87,12 +87,16 @@ const adjustPackageJson = ({ * This is `npm publish` (as in linked comment) and `yarn publish` requirement. * This is not verdaccio restriction. */ -const createTemporaryNPMRC = ({ pathToPackage }) => { - const NPMRCPath = path.join(pathToPackage, `.npmrc`) - fs.outputFileSync(NPMRCPath, NPMRCContent) +const createTemporaryNPMRC = ({ pathToPackage, root }) => { + const NPMRCPathInPackage = path.join(pathToPackage, `.npmrc`) + fs.outputFileSync(NPMRCPathInPackage, NPMRCContent) + + const NPMRCPathInRoot = path.join(root, `.npmrc`) + fs.outputFileSync(NPMRCPathInRoot, NPMRCContent) return registerCleanupTask(() => { - fs.removeSync(NPMRCPath) + fs.removeSync(NPMRCPathInPackage) + fs.removeSync(NPMRCPathInRoot) }) } @@ -102,6 +106,7 @@ const publishPackage = async ({ versionPostFix, ignorePackageJSONChanges, packageNameToPath, + root, }) => { const monoRepoPackageJsonPath = getMonorepoPackageJsonPath({ packageName, @@ -119,7 +124,7 @@ const publishPackage = async ({ const pathToPackage = path.dirname(monoRepoPackageJsonPath) - const uncreateTemporaryNPMRC = createTemporaryNPMRC({ pathToPackage }) + const uncreateTemporaryNPMRC = createTemporaryNPMRC({ pathToPackage, root }) // npm publish const publishCmd = [ diff --git a/packages/medusa-dev-cli/src/watch.js b/packages/medusa-dev-cli/src/watch.js index b9cd91d06947a..4eb13e8f88483 100644 --- a/packages/medusa-dev-cli/src/watch.js +++ b/packages/medusa-dev-cli/src/watch.js @@ -157,6 +157,7 @@ async function watch( ignorePackageJSONChanges, yarnWorkspaceRoot, externalRegistry, + root, }) } else { // run `yarn` @@ -342,6 +343,7 @@ async function watch( localPackages, ignorePackageJSONChanges, externalRegistry, + root, }) packagesToPublish.clear() isPublishing = false