Skip to content

Commit

Permalink
add commands to link local Vulcan NPM using yalc
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed May 7, 2021
1 parent 1415c89 commit ac61f0a
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ storybook-static

# next-sitemap
/public/sitemap.xml
/public/robots.txt
/public/robots.txt.yalc
yalc.lock
.yalc/
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"debug": "NODE_OPTIONS='--inspect' next",
"build": "next build",
"start": "next start",
"link-vulcan": "./scripts/link-vulcan.sh # for linking a local copy of Vulcan NPM monorepo (don't forget to publish in Vulcan NPM first)",
"update-link-vulcan": "yalc update",
"typecheck": "tsc --noEmit --p src/tsconfig.json # in case of error with @vulcanjs/* package, check that src/types (eg simpl-schema) are up-to-date with vulcan-npm",
"typecheck-watch": "tsc --noEmit --p src/tsconfig.json -w",
"postbuild": "next-sitemap --config vulcan-next-sitemap.js",
Expand Down Expand Up @@ -117,7 +119,8 @@
"storybook-css-modules-preset": "^1.0.5",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"typescript": "^3.9.0"
"typescript": "^3.9.0",
"yalc": "^1.0.0-pre.53"
},
"optionalDependencies": {
"@cypress/code-coverage": "^3.8.1",
Expand Down
43 changes: 21 additions & 22 deletions scripts/link-vulcan.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#! /bin/bash
yarn link @vulcanjs/core
yarn link @vulcanjs/demo
yarn link @vulcanjs/graphql
yarn link @vulcanjs/mdx
yarn link @vulcanjs/meteor-legacy
yarn link @vulcanjs/model
yarn link @vulcanjs/mongo
yarn link @vulcanjs/multi-env-demo
# Those packages are not published yet
# @see https://github.com/VulcanJS/vulcan-npm/issues/6
# yarn link @vulcanjs/next-apollo
# yarn link @vulcanjs/next-config
# yarn link @vulcanjs/next-material-ui
# yarn link @vulcanjs/next-style-collector
# yarn link @vulcanjs/next-styled-components
# yarn link @vulcanjs/next-utils
# yarn link @vulcanjs/next-webpack
yarn link @vulcanjs/react-hooks
yarn link @vulcanjs/schema
yarn link @vulcanjs/utils

# Link other packages that we don't want to duplicate when using Lerna
yarn link react
yarn link react-dom
# yarn link react
# yarn link react-dom

# Use list-packages script from Vulcan NPM repo to update the list
# We prefer yalc to yarn, because it has a more consistent behaviour regarding linking
# => in particular it will use your local install of React instead of the install from Vulcan NPM
# which prevents duplicating React and thus breaking the rule of hooks
./node_modules/.bin/yalc link @vulcanjs/core
./node_modules/.bin/yalc link @vulcanjs/demo
./node_modules/.bin/yalc link @vulcanjs/graphql
./node_modules/.bin/yalc link @vulcanjs/i18n
./node_modules/.bin/yalc link @vulcanjs/mdx
./node_modules/.bin/yalc link @vulcanjs/meteor-legacy
./node_modules/.bin/yalc link @vulcanjs/model
./node_modules/.bin/yalc link @vulcanjs/mongo
./node_modules/.bin/yalc link @vulcanjs/multi-env-demo
./node_modules/.bin/yalc link @vulcanjs/permissions
./node_modules/.bin/yalc link @vulcanjs/react-components
./node_modules/.bin/yalc link @vulcanjs/react-hooks
./node_modules/.bin/yalc link @vulcanjs/schema
./node_modules/.bin/yalc link @vulcanjs/utils
14 changes: 13 additions & 1 deletion src/content/docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ We follow the Git Flow model.
## Vulcan NPM local installation

If you want to use the bleeding edge version of Vulcan, you'll need to install the Vulcan NPM packages locally.
Vulcan NPM is relying on Lerna
Vulcan NPM is relying on Lerna.

We rely on Yalc to set a local registry that simulates NPM behaviour. This palliates limitations of `yarn link`, which is simpler, but creates unexpected issues with duplicate `node_modules` (the symlinked package keeps using `node_modules` from the monorepo instead of your app, leading to duplicate React instance, wrong Webpack version...).

- In Vulcan NPM, run `yarn run local-publish`. This will use `yalc` to simulate a local NPM registry (quite similarly to METEOR_PACKAGE_DIRS)
- In Vulcan Next, run `yarn run link-vulcan`. This will symlink Vulcan packages to the local registry.

If you modify Vulcan NPM:

- In Vulcan NPM, run `yarn run build`
- Rerun the workflow (local publish in Vulcan NPM ; and link in Vulcan Next)

It's exactly as publishing on NPM, but locally. You need to republish the updated package, and reinstall it again.

### Troubleshoot

Expand Down
100 changes: 97 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6047,6 +6047,15 @@ cliui@^6.0.0:
strip-ansi "^6.0.0"
wrap-ansi "^6.2.0"

cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"

clone@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f"
Expand Down Expand Up @@ -6968,6 +6977,11 @@ [email protected]:
dependencies:
repeat-string "^1.5.4"

detect-indent@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd"
integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==

detect-newline@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
Expand Down Expand Up @@ -8293,7 +8307,7 @@ fs-capacitor@^2.0.4:
resolved "https://registry.yarnpkg.com/fs-capacitor/-/fs-capacitor-2.0.4.tgz#5a22e72d40ae5078b4fe64fe4d08c0d3fc88ad3c"
integrity sha512-8S4f4WsCryNw2mJJchi46YgB6CR5Ze+4L1h8ewl9tEpL4SJ3ZO+c/bS4BWhB8bK+O3TMqhuZarTitd0S0eh2pA==

[email protected]:
[email protected], fs-extra@^8.0.1:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
Expand Down Expand Up @@ -8427,7 +8441,7 @@ get-assigned-identifiers@^1.2.0:
resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1"
integrity sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==

get-caller-file@^2.0.1:
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
Expand Down Expand Up @@ -9222,12 +9236,19 @@ iferr@^0.1.5:
resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501"
integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE=

ignore-walk@^3.0.3:
version "3.0.4"
resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335"
integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==
dependencies:
minimatch "^3.0.4"

ignore@^4.0.3, ignore@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==

ignore@^5.1.4:
ignore@^5.0.4, ignore@^5.1.4:
version "5.1.8"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
Expand Down Expand Up @@ -9325,6 +9346,11 @@ ini@^1.3.4, ini@^1.3.5, ini@~1.3.0:
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==

ini@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5"
integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==

inline-source-map@~0.6.0:
version "0.6.2"
resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5"
Expand Down Expand Up @@ -11879,6 +11905,28 @@ normalize-scroll-left@^0.1.2:
resolved "https://registry.yarnpkg.com/normalize-scroll-left/-/normalize-scroll-left-0.1.2.tgz#6b79691ba79eb5fb107fa5edfbdc06b55caee2aa"
integrity sha512-F9YMRls0zCF6BFIE2YnXDRpHPpfd91nOIaNdDgrx5YMoPLo8Wqj+6jNXHQsYBavJeXP4ww8HCt0xQAKc5qk2Fg==

npm-bundled@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1"
integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==
dependencies:
npm-normalize-package-bin "^1.0.1"

npm-normalize-package-bin@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2"
integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==

npm-packlist@^2.1.5:
version "2.2.2"
resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-2.2.2.tgz#076b97293fa620f632833186a7a8f65aaa6148c8"
integrity sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg==
dependencies:
glob "^7.1.6"
ignore-walk "^3.0.3"
npm-bundled "^1.1.1"
npm-normalize-package-bin "^1.0.1"

npm-run-path@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
Expand Down Expand Up @@ -16180,6 +16228,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
Expand Down Expand Up @@ -16249,6 +16306,25 @@ y18n@^4.0.0:
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==

y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==

yalc@^1.0.0-pre.53:
version "1.0.0-pre.53"
resolved "https://registry.yarnpkg.com/yalc/-/yalc-1.0.0-pre.53.tgz#c51db2bb924a6908f4cb7e82af78f7e5606810bc"
integrity sha512-tpNqBCpTXplnduzw5XC+FF8zNJ9L/UXmvQyyQj7NKrDNavbJtHvzmZplL5ES/RCnjX7JR7W9wz5GVDXVP3dHUQ==
dependencies:
chalk "^4.1.0"
detect-indent "^6.0.0"
fs-extra "^8.0.1"
glob "^7.1.4"
ignore "^5.0.4"
ini "^2.0.0"
npm-packlist "^2.1.5"
yargs "^16.1.1"

yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
Expand Down Expand Up @@ -16277,6 +16353,11 @@ yargs-parser@^18.1.2:
camelcase "^5.0.0"
decamelize "^1.2.0"

yargs-parser@^20.2.2:
version "20.2.7"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a"
integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==

yargs@^15.0.2, yargs@^15.4.1:
version "15.4.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
Expand All @@ -16294,6 +16375,19 @@ yargs@^15.0.2, yargs@^15.4.1:
y18n "^4.0.0"
yargs-parser "^18.1.2"

yargs@^16.1.1:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"

[email protected], yauzl@^2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9"
Expand Down

0 comments on commit ac61f0a

Please sign in to comment.