From faded40ea18ae921fcaa816806c71ad1723b3bd4 Mon Sep 17 00:00:00 2001 From: maxceem Date: Wed, 3 Feb 2021 15:16:03 +0200 Subject: [PATCH] chore: improve local:init and local:reset - now these commands clears data if exists and don't ask for confirmation --- README.md | 10 ++++++---- package.json | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4c1df143..8544f415 100644 --- a/README.md +++ b/README.md @@ -117,10 +117,11 @@ npm run local:init ``` - This command will do 2 things: + This command will do 3 things: - - create Database table - - create Elasticsearch indexes + - create Database tables (drop if exists) + - create Elasticsearch indexes (drop if exists) + - import demo data to Database and index it to ElasticSearch (clears any existent data if exist) 5. 🚀 Start Topcoder TaaS API @@ -148,7 +149,8 @@ | `npm run services:up` | Start services via docker-compose for local development. | | `npm run services:down` | Stop services via docker-compose for local development. | | `npm run services:logs -- -f ` | View logs of some service inside docker-compose. | -| `npm run local:init` | Creates Elasticsearch indexes and initializes Database. | +| `npm run local:init` | Recreate Database and Elasticsearch indexes and populate demo data for local development (removes any existent data). | +| `npm run local:reset` | Recreate Database and Elasticsearch indexes (removes any existent data). | | `npm run cov` | Code Coverage Report. | | `npm run migrate` | Run any migration files which haven't run yet. | | `npm run migrate:undo` | Revert most recent migration. | diff --git a/package.json b/package.json index 65029201..cc0508e0 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "services:up": "docker-compose -f ./local/docker-compose.yml up -d", "services:down": "docker-compose -f ./local/docker-compose.yml down", "services:logs": "docker-compose -f ./local/docker-compose.yml logs", - "local:init": "npm run create-index && npm run init-db", + "local:init": "npm run local:reset && npm run data:import -- --force", + "local:reset": "npm run delete-index -- --force && npm run create-index -- --force && npm run init-db force", "cov": "nyc --reporter=html --reporter=text mocha test/unit/*.test.js --timeout 30000 --exit" }, "keywords": [],