Skip to content

Commit faded40

Browse files
committed
chore: improve local:init and local:reset
- now these commands clears data if exists and don't ask for confirmation
1 parent e9b48b3 commit faded40

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@
117117
npm run local:init
118118
```
119119

120-
This command will do 2 things:
120+
This command will do 3 things:
121121

122-
- create Database table
123-
- create Elasticsearch indexes
122+
- create Database tables (drop if exists)
123+
- create Elasticsearch indexes (drop if exists)
124+
- import demo data to Database and index it to ElasticSearch (clears any existent data if exist)
124125

125126
5. 🚀 Start Topcoder TaaS API
126127

@@ -148,7 +149,8 @@
148149
| `npm run services:up` | Start services via docker-compose for local development. |
149150
| `npm run services:down` | Stop services via docker-compose for local development. |
150151
| `npm run services:logs -- -f <service_name>` | View logs of some service inside docker-compose. |
151-
| `npm run local:init` | Creates Elasticsearch indexes and initializes Database. |
152+
| `npm run local:init` | Recreate Database and Elasticsearch indexes and populate demo data for local development (removes any existent data). |
153+
| `npm run local:reset` | Recreate Database and Elasticsearch indexes (removes any existent data). |
152154
| `npm run cov` | Code Coverage Report. |
153155
| `npm run migrate` | Run any migration files which haven't run yet. |
154156
| `npm run migrate:undo` | Revert most recent migration. |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"services:up": "docker-compose -f ./local/docker-compose.yml up -d",
1919
"services:down": "docker-compose -f ./local/docker-compose.yml down",
2020
"services:logs": "docker-compose -f ./local/docker-compose.yml logs",
21-
"local:init": "npm run create-index && npm run init-db",
21+
"local:init": "npm run local:reset && npm run data:import -- --force",
22+
"local:reset": "npm run delete-index -- --force && npm run create-index -- --force && npm run init-db force",
2223
"cov": "nyc --reporter=html --reporter=text mocha test/unit/*.test.js --timeout 30000 --exit"
2324
},
2425
"keywords": [],

0 commit comments

Comments
 (0)