Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
fix: find yarn.lock in a yarn workspace (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens authored Dec 2, 2020
1 parent 4da752a commit fd59d36
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@oclif/plugin-help": "^3.2.0",
"cli-ux": "^5.2.1",
"debug": "^4.1.1",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^8.1",
"github-slugger": "^1.2.1",
"lodash": "^4.17.11",
Expand Down
6 changes: 4 additions & 2 deletions src/tarballs/build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {ArchTypes, PlatformTypes} from '@oclif/config'
import * as Errors from '@oclif/errors'
import * as findYarnWorkspaceRoot from 'find-yarn-workspace-root'
import * as path from 'path'
import * as qq from 'qqjs'

Expand Down Expand Up @@ -52,9 +53,10 @@ export async function build(c: IConfig, options: {
}
const addDependencies = async () => {
qq.cd(c.workspace())
const yarn = await qq.exists.sync([c.root, 'yarn.lock'])
const yarnRoot = findYarnWorkspaceRoot(c.root) || c.root
const yarn = await qq.exists([yarnRoot, 'yarn.lock'])
if (yarn) {
await qq.cp([c.root, 'yarn.lock'], '.')
await qq.cp([yarnRoot, 'yarn.lock'], '.')
await qq.x('yarn --no-progress --production --non-interactive')
} else {
let lockpath = qq.join(c.root, 'package-lock.json')
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,13 @@ find-up@^4.0.0, find-up@^4.1.0:
locate-path "^5.0.0"
path-exists "^4.0.0"

find-yarn-workspace-root@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd"
integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==
dependencies:
micromatch "^4.0.2"

flat-cache@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"
Expand Down

0 comments on commit fd59d36

Please sign in to comment.