Skip to content

Commit f35f973

Browse files
chore: fix local package publishing (#84)
1 parent aecae61 commit f35f973

File tree

7 files changed

+1946
-41
lines changed

7 files changed

+1946
-41
lines changed

.verdaccio/config.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# path to a directory with all packages
2+
storage: ../tmp/local-registry/storage
3+
4+
auth: # TODO
5+
htpasswd:
6+
file: ./htpasswd
7+
8+
# a list of other known repositories we can talk to
9+
uplinks:
10+
npmjs:
11+
url: https://registry.npmjs.org/
12+
cache: true
13+
yarn:
14+
url: https://registry.yarnpkg.com
15+
cache: true
16+
17+
packages:
18+
'@*/*':
19+
# scoped packages
20+
access: $all
21+
publish: $all
22+
unpublish: $all
23+
proxy: npmjs
24+
25+
'**':
26+
# allow all users (including non-authenticated users) to read and
27+
# publish all packages
28+
access: $all
29+
30+
# allow all users (including non-authenticated users) to publish/publish packages
31+
publish: $all
32+
unpublish: $all
33+
34+
# if package is not available locally, proxy requests to 'yarn' registry
35+
proxy: npmjs
36+
37+
# log settings
38+
logs:
39+
type: stdout
40+
format: pretty
41+
level: http

.verdaccio/htpasswd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test:5Y30XDhEQaJmQ:autocreated 2023-02-19T13:45:24.361Z

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,19 @@ After your pull request is merged, you can safely delete your branch and pull th
141141
## ▶ 9. Publishing to a local registry
142142

143143
To test if your changes will actually work once the changes are published,
144-
it can be useful to publish locally to *Verdaccio*, a lightweight Node.js private proxy registry.
144+
it can be useful to publish to a local registry.
145145

146-
**In Terminal 1, Install and launch Verdaccio**
147-
- Run `npm i -g verdaccio` in Terminal 1 (keep it running)
148-
- Run `verdaccio`
146+
- Run `pnpm run local-registry start` in Terminal 1 (keep it running)
147+
- Run `npm adduser --registry http://localhost:4873` in Terminal 2 (real credentials are not required, you just need to
148+
be logged in. You can use test/test/[email protected].)
149+
- Run `pnpm run local-registry enable` in Terminal 2
150+
- Run `pnpm run nx run qwik-nx:publish:local` in Terminal 2. You can set the version you want to publish in the package's package.json file.
149151

150-
**In Terminal 2, Add a user and execute Nx commands to populate the local Verdaccio repository**
151-
- Run `npm adduser --registry http://localhost:4873 --auth-type=legacy`
152-
153-
*(real credentials are not required, you just need to be logged in. You can use your own login details.)*
152+
If you have problems publishing, make sure you use Node 18 and NPM 8. Alternatively to running the project's "publish" target you can build and publish manually by running `pnpm run nx build:qwik-nx && cd dist/projects/qwik-nx && npm publish --registry=http://localhost:4873`
154153

155-
- Run `nx publish [package] --registry=http://localhost:4873`
156-
- Run `nx publish qwik-nx --registry=http://localhost:4873`
154+
**NOTE:** After you finish with local testing don't forget to stop the local registry (e.g. closing the Terminal 1) and disabling the local registry using `pnpm run local-registry disable`. Keeping local registry enabled will change your lock file resolutions to `localhost:4873` on the next `pnpm install`. You can also run `pnpm run local-registry clear` to clean all packages in that local registry.
155+
156+
**NOTE:** To use this newly published local version, you need to make a new workspace or change your target package to this new version, eg: `"qwik-nx": "^1.0.0",` and re-run `pnpm install` in your testing project.
157157

158158
### ▶ 10. That's it! Thank you for your contribution! 🙏💓
159159

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"build": "nx build",
77
"commit": "git-cz",
88
"format:fix": "pretty-quick --staged",
9+
"local-registry": "./scripts/local-registry.sh",
910
"prepare": "husky install",
1011
"start": "nx serve",
1112
"test": "nx test"
@@ -52,7 +53,7 @@
5253
"jest-environment-jsdom": "28.1.1",
5354
"jsonc-eslint-parser": "^2.1.0",
5455
"kill-port": "2.0.1",
55-
"ngx-deploy-npm": "^4.3.11",
56+
"ngx-deploy-npm": "^5.2.0",
5657
"nx": "15.6.1",
5758
"prettier": "^2.8.0",
5859
"pretty-quick": "^3.1.3",
@@ -61,6 +62,7 @@
6162
"ts-jest": "28.0.5",
6263
"ts-node": "10.9.1",
6364
"typescript": "~4.8.2",
65+
"verdaccio": "5.21.1",
6466
"vite": "4.1.1"
6567
},
6668
"dependencies": {

packages/qwik-nx/project.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
"executor": "ngx-deploy-npm:deploy",
8585
"options": {
8686
"access": "public"
87+
},
88+
"configurations": {
89+
"local": {
90+
"registry": "http://localhost:4873"
91+
}
8792
}
8893
},
8994
"push-to-github": {

0 commit comments

Comments
 (0)