feat(repo): create local registry scripts

This commit is contained in:
Jason Jean 2020-02-01 12:42:12 -05:00 committed by Victor Savkin
parent 3944d55f8c
commit 4f29fb45a5
4 changed files with 703 additions and 67 deletions

View File

@ -42,6 +42,25 @@ To build all the packages, run:
yarn build
```
## Publishing to a local registry
To test if your changes will actually work once the changes are published,
it can be useful to publish to a local registry.
Here are some useful commands for doing so:
```bash
# Starts the local registry. Keep this running in a separate terminal.
yarn local-registry start
# Set npm and yarn to use the local registry.
# Note: This reroutes your installs to your local registry
yarn local-registry enable
# Revert npm and yarn to use their default registries
yarn local-registry disable
```
### Running Unit Tests
To make sure your changes do not break any unit tests, run the following:

View File

@ -23,6 +23,7 @@
"checkformat": "./scripts/check_format.sh",
"checkimports": "node ./scripts/check-imports.js",
"checkversions": "ts-node ./scripts/check-versions.ts",
"local-registry": "./scripts/local-registry.sh",
"documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh"
},
"devDependencies": {
@ -218,6 +219,7 @@
"tslint": "5.11.0",
"typescript": "~3.7.4",
"url-loader": "^2.2.0",
"verdaccio": "^4.4.2",
"webpack": "4.41.2",
"webpack-dev-middleware": "3.7.0",
"webpack-dev-server": "3.9.0",

26
scripts/local-registry.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
ENABLE=$1
if [[ $ENABLE == "enable" ]]; then
echo "Setting registry to local registry"
echo "To Disable: yarn local-registry disable"
npm config set registry http://localhost:4873/
yarn config set registry http://localhost:4873/
fi
if [[ $ENABLE == "disable" ]]; then
npm config delete registry
yarn config delete registry
CURRENT_NPM_REGISTRY=`npm config get registry`
CURRENT_YARN_REGISTRY=`yarn config get registry`
echo "Reverting registries"
echo " > NPM: $CURRENT_NPM_REGISTRY"
echo " > YARN: $CURRENT_YARN_REIGSTRY"
fi
if [[ $ENABLE == "start" ]]; then
echo "Starting Local Registry"
npx verdaccio
fi

723
yarn.lock

File diff suppressed because it is too large Load Diff