-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8191ea6
commit 6c583d3
Showing
4 changed files
with
108 additions
and
4 deletions.
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 |
---|---|---|
|
@@ -25,3 +25,4 @@ test/videos | |
test/dev.html | ||
yarn-debug.log | ||
yarn-error.log | ||
verdaccio |
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,17 +1,95 @@ | ||
#!/bin/bash | ||
|
||
|
||
set -e | ||
|
||
VERDACCIO_PORT=4873 | ||
VERDACCIO_REGISTRY="http://localhost:$VERDACCIO_PORT" | ||
PACKAGE_NAME="box-ui-elements" | ||
TEST_APP_NAME="test-app" | ||
TEST_APP_PORT=3000 | ||
|
||
echo "Setting up..." | ||
npm install -g verdaccio | ||
npm install -g create-next-app --registry https://registry.npmjs.org/ | ||
npm install -g verdaccio --registry https://registry.npmjs.org/ | ||
verdaccio --version | ||
|
||
echo "Starting Verdaccio..." | ||
verdaccio --config scripts/app-testing/verdaccio.yaml & | ||
verdaccio --config ./scripts/app-testing/verdaccio.yaml & | ||
VERDACCIO_PID=$! | ||
echo "Verdaccio is running on PID: $VERDACCIO_PID" | ||
|
||
echo "Setting npm registry to Verdaccio..." | ||
echo "registry=$VERDACCIO_REGISTRY" > .npmrc | ||
echo "npm registry is set to: " | ||
npm get registry | ||
|
||
echo "registry \"$VERDACCIO_REGISTRY\"" > .yarnrc | ||
echo "yarn registry is set to: " | ||
yarn config get registry | ||
|
||
echo "Adding user to Verdaccio..." | ||
expect -c " | ||
spawn npm adduser --registry $VERDACCIO_REGISTRY | ||
expect \"Username:\" { send \"testuser\r\"; exp_continue } | ||
expect \"Password:\" { send \"testpass\r\"; exp_continue } | ||
expect \"Email: \" { send \"[email protected]\r\"; exp_continue } | ||
" | ||
npm whoami --registry $VERDACCIO_REGISTRY | ||
|
||
echo "Publishing package to Verdaccio..." | ||
yarn install --force | ||
yarn build:npm | ||
npm publish --registry $VERDACCIO_REGISTRY | ||
mkdir -p ~/test-apps | ||
cd ~/test-apps | ||
pwd | ||
|
||
echo "Create test app..." | ||
pwd | ||
create-next-app $TEST_APP_NAME --yes | ||
cd ./$TEST_APP_NAME | ||
pwd | ||
echo "registry=$VERDACCIO_REGISTRY" > .npmrc | ||
echo "registry \"$VERDACCIO_REGISTRY\"" > .yarnrc | ||
yarn add $PACKAGE_NAME | ||
|
||
echo "Modify test app..." | ||
pwd | ||
cat > ./src/app/page.js <<EOL | ||
import styles from "./page.module.css"; | ||
export default function Home() { | ||
return ( | ||
<div className={styles.page}> | ||
<main className={styles.main}> | ||
HELLO WORLD | ||
</main> | ||
</div> | ||
); | ||
} | ||
EOL | ||
|
||
echo "Building test app..." | ||
pwd | ||
yarn build | ||
|
||
echo "Starting test app..." | ||
pwd | ||
yarn start & | ||
APP_PID=$! | ||
|
||
sleep 10 | ||
|
||
echo "Verifying test app..." | ||
curl --fail http://localhost:$TEST_APP_PORT || (echo "Test app failed to start" && exit 1) | ||
|
||
echo "Resetting npm registry..." | ||
npm set registry https://registry.npmjs.org/ | ||
yarn config set registry https://registry.yarnpkg.com/ | ||
|
||
echo "Stopping test app..." | ||
kill $APP_PID | ||
|
||
echo "Stopping Verdaccio..." | ||
kill $VERDACCIO_PID | ||
|
||
echo "Complete successfully!" |
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,6 @@ | ||
#!/bin/bash | ||
|
||
echo "Cleaning up..." | ||
rm -rf ./scripts/app-testing/verdaccio | ||
rm -rf ~/test-apps | ||
npm cache clean --force || true |
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,19 @@ | ||
storage: ./verdaccio/storage | ||
|
||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
auth: | ||
htpasswd: | ||
file: ./verdaccio/htpasswd | ||
max_users: 1 | ||
packages: | ||
'**': | ||
access: $all | ||
publish: $all | ||
proxy: npmjs | ||
allow_offline_publish: true | ||
log: | ||
- { type: stdout, format: pretty, level: http } | ||
|
||
max_body_size: 100mb |