Skip to content
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
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lerna.json
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"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"lerna": "^8.1.8",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"verdaccio": "^5.32.1",
"yarn-audit-fix": "^10.0.7"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/fhir-gql-schema-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bluehalo/fhir-gql-schema-utils",
"version": "1.2.0",
"version": "1.1.7",
"description": "Suite of FHIR related utilities for GraphQL schemas.",
"homepage": "https://github.com/Bluehalo/node-fhir-server-core",
"repository": {
Expand Down
2,134 changes: 2,134 additions & 0 deletions packages/fhir-gql-schema-utils/yarn.lock

Large diffs are not rendered by default.

2,161 changes: 2,161 additions & 0 deletions packages/fhir-json-schema-validator/yarn.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/fhir-qb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"verbose": true
},
"dependencies": {
"@bluehalo/fhir-qb-mongo": "^0.13.0",
"@bluehalo/fhir-sanitize-param": "^1.2.0",
"@bluehalo/fhir-qb-mongo": "*",
Copy link
Contributor Author

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

"@bluehalo/fhir-sanitize-param": "*",
"mathjs": "^13.1.1",
"moment": "^2.30.1",
"sequelize": "^6.37.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/node-fhir-server-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"verbose": true
},
"dependencies": {
"@bluehalo/fhir-response-util": "^1.3.0",
"@bluehalo/sof-scope-checker": "^1.1.0",
"@bluehalo/fhir-response-util": "*",
"@bluehalo/sof-scope-checker": "*",
"@hapi/bourne": "^3.0.0",
"body-parser": "^1.20.2",
"compression": "^1.7.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/sof-graphql-invariant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"main": "index.js",
"dependencies": {
"@bluehalo/sof-scope-checker": "^1.1.0",
"@bluehalo/sof-scope-checker": "*",
"graphql": "^16.9.0"
},
"devDependencies": {
Expand Down
105 changes: 105 additions & 0 deletions scripts/deploy_all.sh
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."
59 changes: 59 additions & 0 deletions scripts/verdaccio/config/config.yaml
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
12 changes: 12 additions & 0 deletions scripts/verdaccio/docker-compose.yml
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
Loading
Loading