-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error with Yarn Workspaces (#511)
- Loading branch information
1 parent
d019dc3
commit 89625c1
Showing
9 changed files
with
439 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@sample/sample-monorepo-app", | ||
"repository": "git@github.com:giedrioks/sample-monorepo.git", | ||
"main": "packages/sample-app/index.js", | ||
"scripts": { | ||
"start": "node packages/sample-app/index.js", | ||
"start:app": "cd packages/sample-app && exec npm start" | ||
}, | ||
"private": true, | ||
"engines": { | ||
"yarn": "1.x" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
fixtures/yarn/workspaces-array/packages/sample-app/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const express = require('express'); | ||
const app = express(); | ||
const config = require('@sample/sample-config'); | ||
|
||
app.get('/check', (req, res) => { | ||
res.send({ | ||
config: config(), | ||
}); | ||
}); | ||
|
||
const port = process.env.PORT || 3000; | ||
|
||
app.listen(port, () => console.log(`Sample app listening on port ${ port }!`)); |
12 changes: 12 additions & 0 deletions
12
fixtures/yarn/workspaces-array/packages/sample-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "@sample/sample-app", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"dependencies": { | ||
"@sample/sample-config": "^1.0.0", | ||
"express": "^4.16.3" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
fixtures/yarn/workspaces-array/packages/sample-config/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const config = () => { | ||
return { | ||
prop1: 'Package A value 1', | ||
prop2: 'Package A value 2', | ||
}; | ||
}; | ||
|
||
module.exports = config; |
5 changes: 5 additions & 0 deletions
5
fixtures/yarn/workspaces-array/packages/sample-config/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@sample/sample-config", | ||
"version": "1.0.0", | ||
"main": "index.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Sample monorepo application. It has 2 packages - express app (`packages/sample-app`) and separate config package (`packages/sample-config`). Express application uses config package. | ||
|
||
**Prerequisites** | ||
- Yarn `1.x` | ||
|
||
**Build project** | ||
``` | ||
yarn install | ||
``` | ||
|
||
**Run locally** | ||
``` | ||
yarn start:app | ||
``` | ||
|
||
**Smoke test locally** | ||
|
||
Locally URL `http://localhost:3000/check` should return valid JSON: | ||
``` | ||
{ | ||
"config": { | ||
"prop1": "value1", | ||
"prop2": "value2" | ||
} | ||
} | ||
``` | ||
|
||
**Push to CF** | ||
``` | ||
cf push sample-monorepo-app -b https://github.com/cloudfoundry/nodejs-buildpack | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,306 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
accepts@~1.3.5: | ||
version "1.3.5" | ||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" | ||
dependencies: | ||
mime-types "~2.1.18" | ||
negotiator "0.6.1" | ||
|
||
array-flatten@1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" | ||
|
||
body-parser@1.18.2: | ||
version "1.18.2" | ||
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454" | ||
dependencies: | ||
bytes "3.0.0" | ||
content-type "~1.0.4" | ||
debug "2.6.9" | ||
depd "~1.1.1" | ||
http-errors "~1.6.2" | ||
iconv-lite "0.4.19" | ||
on-finished "~2.3.0" | ||
qs "6.5.1" | ||
raw-body "2.3.2" | ||
type-is "~1.6.15" | ||
|
||
bytes@3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" | ||
|
||
content-disposition@0.5.2: | ||
version "0.5.2" | ||
resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" | ||
|
||
content-type@~1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" | ||
|
||
cookie-signature@1.0.6: | ||
version "1.0.6" | ||
resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" | ||
|
||
cookie@0.3.1: | ||
version "0.3.1" | ||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" | ||
|
||
debug@2.6.9: | ||
version "2.6.9" | ||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" | ||
dependencies: | ||
ms "2.0.0" | ||
|
||
depd@1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" | ||
|
||
depd@~1.1.1, depd@~1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" | ||
|
||
destroy@~1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" | ||
|
||
ee-first@1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" | ||
|
||
encodeurl@~1.0.2: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" | ||
|
||
escape-html@~1.0.3: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" | ||
|
||
etag@~1.8.1: | ||
version "1.8.1" | ||
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" | ||
|
||
express@^4.16.3: | ||
version "4.16.3" | ||
resolved "https://registry.yarnpkg.com/express/-/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53" | ||
dependencies: | ||
accepts "~1.3.5" | ||
array-flatten "1.1.1" | ||
body-parser "1.18.2" | ||
content-disposition "0.5.2" | ||
content-type "~1.0.4" | ||
cookie "0.3.1" | ||
cookie-signature "1.0.6" | ||
debug "2.6.9" | ||
depd "~1.1.2" | ||
encodeurl "~1.0.2" | ||
escape-html "~1.0.3" | ||
etag "~1.8.1" | ||
finalhandler "1.1.1" | ||
fresh "0.5.2" | ||
merge-descriptors "1.0.1" | ||
methods "~1.1.2" | ||
on-finished "~2.3.0" | ||
parseurl "~1.3.2" | ||
path-to-regexp "0.1.7" | ||
proxy-addr "~2.0.3" | ||
qs "6.5.1" | ||
range-parser "~1.2.0" | ||
safe-buffer "5.1.1" | ||
send "0.16.2" | ||
serve-static "1.13.2" | ||
setprototypeof "1.1.0" | ||
statuses "~1.4.0" | ||
type-is "~1.6.16" | ||
utils-merge "1.0.1" | ||
vary "~1.1.2" | ||
|
||
finalhandler@1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" | ||
dependencies: | ||
debug "2.6.9" | ||
encodeurl "~1.0.2" | ||
escape-html "~1.0.3" | ||
on-finished "~2.3.0" | ||
parseurl "~1.3.2" | ||
statuses "~1.4.0" | ||
unpipe "~1.0.0" | ||
|
||
forwarded@~0.1.2: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" | ||
|
||
fresh@0.5.2: | ||
version "0.5.2" | ||
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" | ||
|
||
http-errors@1.6.2: | ||
version "1.6.2" | ||
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.2.tgz#0a002cc85707192a7e7946ceedc11155f60ec736" | ||
dependencies: | ||
depd "1.1.1" | ||
inherits "2.0.3" | ||
setprototypeof "1.0.3" | ||
statuses ">= 1.3.1 < 2" | ||
|
||
http-errors@~1.6.2: | ||
version "1.6.3" | ||
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" | ||
dependencies: | ||
depd "~1.1.2" | ||
inherits "2.0.3" | ||
setprototypeof "1.1.0" | ||
statuses ">= 1.4.0 < 2" | ||
|
||
iconv-lite@0.4.19: | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" | ||
|
||
inherits@2.0.3: | ||
version "2.0.3" | ||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" | ||
|
||
ipaddr.js@1.8.0: | ||
version "1.8.0" | ||
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" | ||
|
||
media-typer@0.3.0: | ||
version "0.3.0" | ||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" | ||
|
||
merge-descriptors@1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" | ||
|
||
methods@~1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" | ||
|
||
mime-db@~1.35.0: | ||
version "1.35.0" | ||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.35.0.tgz#0569d657466491283709663ad379a99b90d9ab47" | ||
|
||
mime-types@~2.1.18: | ||
version "2.1.19" | ||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.19.tgz#71e464537a7ef81c15f2db9d97e913fc0ff606f0" | ||
dependencies: | ||
mime-db "~1.35.0" | ||
|
||
mime@1.4.1: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" | ||
|
||
ms@2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" | ||
|
||
negotiator@0.6.1: | ||
version "0.6.1" | ||
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" | ||
|
||
on-finished@~2.3.0: | ||
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" | ||
dependencies: | ||
ee-first "1.1.1" | ||
|
||
parseurl@~1.3.2: | ||
version "1.3.2" | ||
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" | ||
|
||
path-to-regexp@0.1.7: | ||
version "0.1.7" | ||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" | ||
|
||
proxy-addr@~2.0.3: | ||
version "2.0.4" | ||
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" | ||
dependencies: | ||
forwarded "~0.1.2" | ||
ipaddr.js "1.8.0" | ||
|
||
qs@6.5.1: | ||
version "6.5.1" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" | ||
|
||
range-parser@~1.2.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" | ||
|
||
raw-body@2.3.2: | ||
version "2.3.2" | ||
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" | ||
dependencies: | ||
bytes "3.0.0" | ||
http-errors "1.6.2" | ||
iconv-lite "0.4.19" | ||
unpipe "1.0.0" | ||
|
||
safe-buffer@5.1.1: | ||
version "5.1.1" | ||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" | ||
|
||
send@0.16.2: | ||
version "0.16.2" | ||
resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" | ||
dependencies: | ||
debug "2.6.9" | ||
depd "~1.1.2" | ||
destroy "~1.0.4" | ||
encodeurl "~1.0.2" | ||
escape-html "~1.0.3" | ||
etag "~1.8.1" | ||
fresh "0.5.2" | ||
http-errors "~1.6.2" | ||
mime "1.4.1" | ||
ms "2.0.0" | ||
on-finished "~2.3.0" | ||
range-parser "~1.2.0" | ||
statuses "~1.4.0" | ||
|
||
serve-static@1.13.2: | ||
version "1.13.2" | ||
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" | ||
dependencies: | ||
encodeurl "~1.0.2" | ||
escape-html "~1.0.3" | ||
parseurl "~1.3.2" | ||
send "0.16.2" | ||
|
||
setprototypeof@1.0.3: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" | ||
|
||
setprototypeof@1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" | ||
|
||
"statuses@>= 1.3.1 < 2", "statuses@>= 1.4.0 < 2": | ||
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" | ||
|
||
statuses@~1.4.0: | ||
version "1.4.0" | ||
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" | ||
|
||
type-is@~1.6.15, type-is@~1.6.16: | ||
version "1.6.16" | ||
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" | ||
dependencies: | ||
media-typer "0.3.0" | ||
mime-types "~2.1.18" | ||
|
||
unpipe@1.0.0, unpipe@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" | ||
|
||
utils-merge@1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" | ||
|
||
vary@~1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" |
Oops, something went wrong.