Skip to content

Commit 71ee4ab

Browse files
authored
Revamp Insert JSON Script (canada-ca#2815)
* add script to dependabot config * remove .package-lock.json * add new dependencies * create check claim count function * create check domain function * create check organization function * create createClaim function * create createDomain function * create createOrganization function * create tests for slugify function * export new functions * update current main run file * add a cloudbuild.yaml * remove dotenv setup in test files * switch from dotenv to dotenv-safe * create example .env.example file * create a jest config file * create an env setup file * update to using dotenv-safe * update import exports * add try catch for file import * update readme * update testing step id * whoops run test in the correct dir
1 parent 8e60a91 commit 71ee4ab

24 files changed

Lines changed: 7949 additions & 1457 deletions

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,10 @@ updates:
181181
interval: daily
182182
time: "11:00"
183183
open-pull-requests-limit: 5
184+
185+
- package-ecosystem: npm
186+
directory: "/scripts/insert-json"
187+
schedule:
188+
interval: daily
189+
time: "11:00"
190+
open-pull-requests-limit: 5

scripts/insert-json/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DB_PASS=
2+
DB_URL=
3+
DB_NAME=

scripts/insert-json/.package-lock.json

Lines changed: 0 additions & 201 deletions
This file was deleted.

scripts/insert-json/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Data population script
22

3-
This directory contains a program to facilitate the insertion of organization and domain data from a .json file.
3+
This directory contains a program to facilitate the insertion of organization and domain data from a `organization-domains.json` file.
44

5-
The .json file used for input must adhere to the following structure:
5+
The `organization-domains.json` file used for input must adhere to the following structure:
66

77
```
88
"<English Acronym-French Acronym>": {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
steps:
2+
- name: 'gcr.io/cloud-builders/docker'
3+
id: start_arango
4+
entrypoint: /bin/sh
5+
args:
6+
[
7+
'-c',
8+
'docker run -d --network=cloudbuild -p=8529:8529 -e ARANGO_ROOT_PASSWORD=$_DB_PASS --name=arangodb arangodb',
9+
]
10+
11+
- name: mikewilliamson/wait-for
12+
id: wait_arango
13+
args: ['arangodb:8529']
14+
15+
- name: node:alpine
16+
id: install
17+
dir: scripts/insert-json
18+
entrypoint: npm
19+
args: ['ci', '--no-optional']
20+
21+
- name: node:alpine
22+
id: lint
23+
dir: scripts/insert-json
24+
entrypoint: npm
25+
args: ['run', lint]
26+
27+
- name: node:alpine
28+
id: test
29+
dir: scripts/insert-json
30+
entrypoint: npm
31+
args: ['run', 'test']
32+
env:
33+
- DB_PASS=$_DB_PASS
34+
- DB_URL=$_DB_URL
35+
- DB_NAME=$_DB_NAME
36+
37+
timeout: 1200s
38+
options:
39+
machineType: 'E2_HIGHCPU_8'

0 commit comments

Comments
 (0)