feat(v2): allow init project via npm (#3729)

* feat(v2: allow init project via npm

* Add test-website to workspace

* Remove test-website from workspace

* Refactor
This commit is contained in:
Alexey Pyltsyn 2020-11-16 18:11:16 +03:00 committed by GitHub
parent d05d703dad
commit 5f20200661
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -10,9 +10,14 @@ set -euo pipefail
CUSTOM_REGISTRY_URL="http://localhost:4873"
NEW_VERSION="$(node -p "require('./packages/docusaurus/package.json').version").NEW"
CONTAINER_NAME="verdaccio"
EXTRA_OPTS=""
if getopts ":n" arg; then
EXTRA_OPTS="--use-npm"
fi
# Run Docker container with private npm registry Verdaccio
docker run -d --rm --name "$CONTAINER_NAME" -p 4873:4873 -v "$PWD/admin/verdaccio.yaml":/verdaccio/conf/config.yaml verdaccio/verdaccio:4
docker run -d --rm --name "$CONTAINER_NAME" -p 4873:4873 -v "$PWD/admin/verdaccio.yaml":/verdaccio/conf/config.yaml verdaccio/verdaccio:latest
# Build packages
yarn build:packages
@ -24,7 +29,7 @@ npx --no-install lerna publish --yes --no-verify-access --no-git-reset --no-git-
git diff --name-only -- '*.json' | sed 's, ,\\&,g' | xargs git checkout --
# Build skeleton website with new version
npm_config_registry="$CUSTOM_REGISTRY_URL" npx @docusaurus/init@"$NEW_VERSION" init test-website classic
npm_config_registry="$CUSTOM_REGISTRY_URL" npx @docusaurus/init@"$NEW_VERSION" init test-website classic $EXTRA_OPTS
# Stop Docker container
if [[ -z "${KEEP_CONTAINER:-}" ]] && ( $(docker container inspect "$CONTAINER_NAME" > /dev/null 2>&1) ); then