From fcfc612728fad0533aaa63f5aaad25bae712eeb3 Mon Sep 17 00:00:00 2001
From: Jinho Bang <zino@chromium.org>
Date: Thu, 17 Jan 2019 09:02:23 +0900
Subject: [PATCH] build: new build targets for debug purposes

In this project, we can use the following command to test examples.
$ npm test

It might be very inefficient, especially, if the number of files
increases. So, this patch introduces new build targets for debugging
purpose as follows:
$ npm run-script dev                # Build with --debug option
$ npm run-script dev:incremental    # Incremental dev build

This idea comes from @DaAitch.

PR-URL: https://github.com/nodejs/node-addon-api/pull/186
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: NickNaso <nicoladelgobbo@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
---
 README.md    | 14 ++++++++++++++
 package.json |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/README.md b/README.md
index a38309f52..1116caeb6 100644
--- a/README.md
+++ b/README.md
@@ -141,6 +141,20 @@ npm install
 npm test --disable-deprecated
 ```
 
+### **Debug**
+
+To run the **node-addon-api** tests with `--debug` option:
+
+```
+npm run-script dev
+```
+
+If you want faster build, you might use the following option:
+
+```
+npm run-script dev:incremental
+```
+
 Take a look and get inspired by our **[test suite](https://github.com/nodejs/node-addon-api/tree/master/test)**
 
 <a name="resources"></a>
diff --git a/package.json b/package.json
index 2adc03edf..028b72b92 100644
--- a/package.json
+++ b/package.json
@@ -56,6 +56,10 @@
   "scripts": {
     "pretest": "node-gyp rebuild -C test",
     "test": "node test",
+    "predev": "node-gyp rebuild -C test --debug",
+    "dev": "node test",
+    "predev:incremental": "node-gyp configure build -C test --debug",
+    "dev:incremental": "node test",
     "doc": "doxygen doc/Doxyfile"
   },
   "version": "1.6.2"