fix(medusa-dev-cli): Avoid dev cli auth (#2360)

This commit is contained in:
Sebastian Rindom
2022-10-12 09:45:45 +02:00
committed by GitHub
parent 5efbee32b9
commit 196595cb65
4 changed files with 19 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"medusa-dev-cli": patch
---
Avoid dev cli auth
@@ -49,6 +49,7 @@ exports.publishPackagesLocallyAndInstall = async ({
ignorePackageJSONChanges, ignorePackageJSONChanges,
yarnWorkspaceRoot, yarnWorkspaceRoot,
externalRegistry, externalRegistry,
root,
}) => { }) => {
await startServer() await startServer()
@@ -63,6 +64,7 @@ exports.publishPackagesLocallyAndInstall = async ({
packageNameToPath, packageNameToPath,
versionPostFix, versionPostFix,
ignorePackageJSONChanges, ignorePackageJSONChanges,
root,
}) })
} }
@@ -87,12 +87,16 @@ const adjustPackageJson = ({
* This is `npm publish` (as in linked comment) and `yarn publish` requirement. * This is `npm publish` (as in linked comment) and `yarn publish` requirement.
* This is not verdaccio restriction. * This is not verdaccio restriction.
*/ */
const createTemporaryNPMRC = ({ pathToPackage }) => { const createTemporaryNPMRC = ({ pathToPackage, root }) => {
const NPMRCPath = path.join(pathToPackage, `.npmrc`) const NPMRCPathInPackage = path.join(pathToPackage, `.npmrc`)
fs.outputFileSync(NPMRCPath, NPMRCContent) fs.outputFileSync(NPMRCPathInPackage, NPMRCContent)
const NPMRCPathInRoot = path.join(root, `.npmrc`)
fs.outputFileSync(NPMRCPathInRoot, NPMRCContent)
return registerCleanupTask(() => { return registerCleanupTask(() => {
fs.removeSync(NPMRCPath) fs.removeSync(NPMRCPathInPackage)
fs.removeSync(NPMRCPathInRoot)
}) })
} }
@@ -102,6 +106,7 @@ const publishPackage = async ({
versionPostFix, versionPostFix,
ignorePackageJSONChanges, ignorePackageJSONChanges,
packageNameToPath, packageNameToPath,
root,
}) => { }) => {
const monoRepoPackageJsonPath = getMonorepoPackageJsonPath({ const monoRepoPackageJsonPath = getMonorepoPackageJsonPath({
packageName, packageName,
@@ -119,7 +124,7 @@ const publishPackage = async ({
const pathToPackage = path.dirname(monoRepoPackageJsonPath) const pathToPackage = path.dirname(monoRepoPackageJsonPath)
const uncreateTemporaryNPMRC = createTemporaryNPMRC({ pathToPackage }) const uncreateTemporaryNPMRC = createTemporaryNPMRC({ pathToPackage, root })
// npm publish // npm publish
const publishCmd = [ const publishCmd = [
+2
View File
@@ -157,6 +157,7 @@ async function watch(
ignorePackageJSONChanges, ignorePackageJSONChanges,
yarnWorkspaceRoot, yarnWorkspaceRoot,
externalRegistry, externalRegistry,
root,
}) })
} else { } else {
// run `yarn` // run `yarn`
@@ -342,6 +343,7 @@ async function watch(
localPackages, localPackages,
ignorePackageJSONChanges, ignorePackageJSONChanges,
externalRegistry, externalRegistry,
root,
}) })
packagesToPublish.clear() packagesToPublish.clear()
isPublishing = false isPublishing = false