Skip to content

Commit

Permalink
feat(repo): create local registry scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed Feb 4, 2020
1 parent 3944d55 commit 4f29fb4
Show file tree
Hide file tree
Showing 4 changed files with 703 additions and 67 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
26 changes: 26 additions & 0 deletions scripts/local-registry.sh
@@ -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

0 comments on commit 4f29fb4

Please sign in to comment.