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

View File

@@ -0,0 +1,5 @@
---
"medusa-dev-cli": patch
---
Avoid dev cli auth

View File

@@ -49,6 +49,7 @@ exports.publishPackagesLocallyAndInstall = async ({
ignorePackageJSONChanges,
yarnWorkspaceRoot,
externalRegistry,
root,
}) => {
await startServer()
@@ -63,6 +64,7 @@ exports.publishPackagesLocallyAndInstall = async ({
packageNameToPath,
versionPostFix,
ignorePackageJSONChanges,
root,
})
}

View File

@@ -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 = [

View File

@@ -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