-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for private npm repo for testing #370
Open
ekdeveloper
wants to merge
7
commits into
master
Choose a base branch
from
369-add-support-for-private-npm-repo-for-testing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dbedc2f
v1.1.6
ekdeveloper 5a6fc58
draft
ekdeveloper ee9e50f
Merge remote-tracking branch 'origin/master' into 369-add-support-for…
ekdeveloper 97a51b7
v1.1.7
ekdeveloper d3e2bbb
update yarn lock
ekdeveloper a137d11
update yarn lock and make prettier
ekdeveloper 314bd2f
Update package.json
ekdeveloper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"packages": ["packages/*"], | ||
"version": "independent", | ||
"command": { | ||
"publish": { | ||
"npmClient": "npm" | ||
} | ||
} | ||
"npmClient": "yarn", | ||
"packages": ["packages/*"], | ||
"version": "independent", | ||
"command": { | ||
"publish": { | ||
"npmClient": "npm" | ||
} | ||
}, | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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,105 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Define the subprojects in deployment order | ||
subprojects=( | ||
"fhir-gql-schema-utils" | ||
"fhir-json-schema-validator" | ||
"fhir-sanitize-param" | ||
"fhir-qb-mongo" | ||
"fhir-qb" | ||
"fhir-response-util" | ||
"fhir-secrets" | ||
"sof-scope-checker" | ||
"sof-graphql-invariant" | ||
"node-fhir-server-core" | ||
) | ||
|
||
current_directory="$(dirname "$(realpath "$0")")" | ||
parent_directory="$(dirname "$current_directory")" | ||
packages_dir="$current_directory/../packages" | ||
|
||
cd $current_directory | ||
NPM_REGISTRY="https://registry.npmjs.org/" | ||
VERDACCIO_REGISTRY="http://localhost:4873/" | ||
|
||
# For dev or prod | ||
read -p "Is this for production? (Enter lowercase 'y' or 'n'): " is_prod | ||
|
||
if [ "$is_prod" = "y" ]; then | ||
echo "This is for production." | ||
REGISTRY_URL=$NPM_REGISTRY | ||
|
||
else | ||
echo "This is for development." | ||
REGISTRY_URL=$VERDACCIO_REGISTRY | ||
|
||
# Check if verdaccio is running on port 4873 | ||
is_verdaccio_running=$(lsof -i :4873 > /dev/null; echo $?) | ||
if [ "$is_verdaccio_running" -eq 0 ]; then | ||
echo " > Assuming verdaccio is running on port 4873" | ||
else | ||
cd "$parent_directory/scripts/verdaccio" | ||
echo " > Start verdaccio private npm repo under $(pwd)" | ||
docker compose up -d | ||
|
||
# Wait for Verdaccio to be ready | ||
sleep 10 | ||
fi | ||
fi | ||
|
||
# Log in to npm via browser | ||
echo "Please log in to npm via the browser if not already logged in." | ||
npm login --scope @bluehalo --registry=$REGISTRY_URL | ||
|
||
# Process each subproject | ||
for subproject in "${subprojects[@]}"; do | ||
sub_project_path="$packages_dir/$subproject" | ||
echo "Processing subproject $subproject..." | ||
|
||
# Check subproject exists | ||
if [ ! -d "$sub_project_path" ]; then | ||
echo " > The subproject '$sub_project_path' does not exist." | ||
exit 1 | ||
fi | ||
|
||
cd "$sub_project_path" || { echo "Failed to enter directory $sub_project_path"; exit 1; } | ||
# Make path prettier | ||
sub_project_path=$(pwd) | ||
echo " > Current dir $sub_project_path" | ||
|
||
# Pre publish cleanup | ||
echo " > Installing dependencies in $sub_project_path..." | ||
if [ -f "yarn.lock" ]; then | ||
rm yarn.lock | ||
fi | ||
|
||
# Pre publish install dependencies | ||
yarn install | ||
|
||
# Pre publish for node-fhir-server-core only | ||
if [ "$var" = "node-fhir-server-core" ]; then | ||
echo " > Running prepublish in $sub_project_path..." | ||
yarn prepublish | ||
fi | ||
|
||
# Publish the subproject | ||
yarn publish --access restricted | ||
|
||
# Give it some time. The next subproject might require it as a dependency | ||
sleep 2 | ||
|
||
# Return to the original directory | ||
cd - || { echo "Failed to return to the original directory"; exit 1; } | ||
done | ||
|
||
if [ "$is_prod" != "y" ]; then | ||
echo "=============== NOTES =================" | ||
echo "You have published to local npm repo" | ||
echo "When you are done testing: " | ||
echo " > run `yarn config set registry ${NPM_REGISTRY}`" | ||
echo " > Stop verdaccio service via `docker compose down` from ./scripts/verdaccio directory" | ||
echo "=======================================" | ||
fi | ||
|
||
echo "Done." |
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,59 @@ | ||
# The configuration file for Verdaccio | ||
# Documentation: https://verdaccio.org/docs/en/configuration | ||
|
||
# This section defines the base URL and port for your Verdaccio server | ||
listen: | ||
- 127.0.0.1:4873 | ||
|
||
# URL to the upstream registry to proxy (npmjs.org) | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
|
||
# This section defines the local storage path for Verdaccio | ||
storage: ./storage | ||
|
||
# Log level and settings | ||
logs: | ||
- { type: stdout, format: pretty, level: http } | ||
|
||
# The list of users and their roles | ||
auth: | ||
htpasswd: | ||
file: ./htpasswd | ||
max_users: 1000 | ||
|
||
# Access control configuration | ||
packages: | ||
'@bluehalo/*': | ||
access: $all | ||
publish: $authenticated | ||
proxy: npmjs | ||
'@*/*': | ||
access: $all | ||
publish: $authenticated | ||
proxy: npmjs | ||
'**': | ||
access: $all | ||
publish: $authenticated | ||
proxy: npmjs | ||
|
||
web: | ||
enable: true | ||
darkMode: true | ||
login: false | ||
showInfo: true | ||
showSettings: true | ||
showSearch: true | ||
showDownloadTarball: true | ||
showRaw: true | ||
pkgManagers: | ||
- npm | ||
- yarn | ||
- pnpm | ||
|
||
server: | ||
# host for the server | ||
host: 0.0.0.0 | ||
# port for the server | ||
port: 4873 |
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 @@ | ||
services: | ||
verdaccio: | ||
image: verdaccio/verdaccio | ||
ports: | ||
- '4873:4873' | ||
volumes: | ||
- './config:/verdaccio/conf' | ||
networks: | ||
- node-network | ||
networks: | ||
node-network: | ||
driver: bridge |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leverage yarn and lerna for monorepo versioning