Skip to content

Commit

Permalink
Merge pull request IQSS#112 from IQSS/feature/95-invoke-js-dataverse-…
Browse files Browse the repository at this point in the history
…use-cases-in-the-dataset-page

95 - Invoke js dataverse use cases in the dataset page
  • Loading branch information
kcondon authored Jun 13, 2023
2 parents 38f5d64 + 26109af commit a4baede
Show file tree
Hide file tree
Showing 75 changed files with 8,744 additions and 4,599 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_DATAVERSE_BACKEND_URL=https://demo.dataverse.org
VITE_DATAVERSE_BACKEND_URL=http://localhost:8000
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@
}
}
],
"ignorePatterns": ["packages/design-system/dist/**"]
"ignorePatterns": ["packages/design-system/dist/**", "dev-env/vite.config.ts"]
}
4 changes: 4 additions & 0 deletions .github/workflows/chromatic-design-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
# Job steps
steps:
- uses: actions/checkout@v1
- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install dependencies
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm
run: rm package-lock.json && npm install
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
# Job steps
steps:
- uses: actions/checkout@v1
- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install dependencies
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm
run: rm package-lock.json && npm install
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install Dependencies
run: npm install

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
node-version: 19
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down Expand Up @@ -90,6 +95,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@

# misc
.DS_Store
.env
./.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.npmrc

npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

3 changes: 3 additions & 0 deletions .npmrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
legacy-peer-deps=true
registry=https://npm.pkg.github.com/IQSS
//npm.pkg.github.com/:_authToken=<YOUR_GITHUB_AUTH_TOKEN>
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ Once the script has finished, you will be able to access Dataverse via:
- [http://localhost:8000/spa](http://localhost:8000/spa): SPA Frontend
- [http://localhost:8000](http://localhost:8000): Dataverse Backend and JSF Frontend

If you want to run the environment with aggregated test data (collections and datasets), run the following command:

```
./run-env <dataverse_branch_name> wd
```

_Note: The above command uses the dataverse-sample-data repository whose scripts occasionally fail, so the 'wd' option is currently unstable and not recommended._

### Remove the environment

To clean up your environment of any running environment containers, as well as any associated data volumes, run this script inside the `dev-env` folder:
Expand Down
5 changes: 3 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import path from 'path'
export default defineConfig({
video: false,
e2e: {
baseUrl: 'http://localhost:5173/spa',
specPattern: 'tests/e2e/**/*.spec.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:8000',
specPattern: 'tests/e2e-integration/**/*.spec.{js,jsx,ts,tsx}',
fixturesFolder: 'tests/e2e-integration/fixtures',
screenshotOnRunFailure: false,
video: false,
viewportWidth: 1920,
Expand Down
4 changes: 4 additions & 0 deletions dev-env/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POSTGRES_VERSION=13
DATAVERSE_DB_USER=dataverse
SOLR_VERSION=8.11.1
REGISTRY=ghcr.io
21 changes: 21 additions & 0 deletions dev-env/add-env-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

echo "INFO - Cloning Dataverse sample data repository..."
git clone https://github.com/IQSS/dataverse-sample-data.git

echo "INFO - Configuring Dataverse sample data repository..."
cd dataverse-sample-data
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp ../dvconfig.py ./dvconfig.py
curl -X PUT -d 'true' ${DATAVERSE_API_BASE_URL}/admin/settings/:AllowApiTokenLookupViaApi
dataverse_api_token=$(python3 get_api_token.py)
sed -i '' "s/<DATAVERSE_API_TOKEN>/${dataverse_api_token}/g" dvconfig.py

echo "INFO - Creating sample data..."
python3 create_sample_data.py

echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse-sample-data
1 change: 1 addition & 0 deletions dev-env/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
- VITE_DATAVERSE_BACKEND_URL=http://localhost:8000
volumes:
- ../:/usr/src/app
- ../dev-env/vite.config.ts:/usr/src/app/vite.config.ts
- /usr/src/app/dev-env
- /usr/src/app/node_modules

Expand Down
1 change: 1 addition & 0 deletions dev-env/rm-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

docker-compose -f "./docker-compose-dev.yml" down
rm -rf ./docker-dev-volumes
rm -rf ./dataverse
26 changes: 6 additions & 20 deletions dev-env/run-env.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

export DATAVERSE_BRANCH_NAME=$1
export WITH_DATA_OPTION_VALUE=${2:-unset}

# To avoid timeout issues on frontend container startup
export COMPOSE_HTTP_TIMEOUT=200
Expand All @@ -13,7 +14,7 @@ echo "INFO - Removing current environment if exists..."
./rm-env.sh

echo "INFO - Cloning Dataverse backend repository..."
git clone -b ${DATAVERSE_BRANCH_NAME} git@github.com:IQSS/dataverse.git
git clone -b ${DATAVERSE_BRANCH_NAME} https://github.com/IQSS/dataverse.git

echo "INFO - Running docker containers..."
docker-compose -f "./docker-compose-dev.yml" up -d --build
Expand Down Expand Up @@ -41,22 +42,7 @@ echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse

echo "INFO - Cloning Dataverse sample data repository..."
git clone git@github.com:IQSS/dataverse-sample-data.git

echo "INFO - Configuring Dataverse sample data repository..."
cd dataverse-sample-data
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp ../dvconfig.py ./dvconfig.py
curl -X PUT -d 'true' ${DATAVERSE_API_BASE_URL}/admin/settings/:AllowApiTokenLookupViaApi
dataverse_api_token=$(python3 get_api_token.py)
sed -i '' "s/<DATAVERSE_API_TOKEN>/${dataverse_api_token}/g" dvconfig.py

echo "INFO - Creating sample data..."
python3 create_sample_data.py

echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse-sample-data
if [ "$WITH_DATA_OPTION_VALUE" == "wd" ]; then
echo "INFO - Adding data to the environment..."
./add-env-data.sh
fi
24 changes: 24 additions & 0 deletions dev-env/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import istanbul from 'vite-plugin-istanbul'

export default defineConfig({
plugins: [
react(),
istanbul({
cypress: true,
requireEnv: false
})
],
preview: {
port: 5173
},
server: {
//https://github.com/vitejs/vite/discussions/3396
host: true,
port: 5173,
hmr: {
clientPort: 8000 // nginx reverse proxy port
}
}
})
15 changes: 14 additions & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
FROM node:19.6.1
FROM node:19.6.1-alpine as BUILD_IMAGE

WORKDIR /usr/src/app/packages/design-system
COPY ./packages/design-system ./
RUN npm install
RUN npm run build

WORKDIR /usr/src/app
COPY package.json ./
COPY .npmrc ./
RUN npm install

FROM node:19.6.1-alpine

WORKDIR /usr/src/app
COPY --from=BUILD_IMAGE /usr/src/app/node_modules ./node_modules

EXPOSE 5173
CMD ["npm", "start"]
Binary file removed js-dataverse-2.0.0.tgz
Binary file not shown.
Loading

0 comments on commit a4baede

Please sign in to comment.