From 11392033966b2ebbd5af70ab354823b8bc05e2f8 Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 11 Apr 2019 15:17:06 +0800 Subject: [PATCH 1/2] 1. Field `files` for npm publish. 2. Command `build`. --- generators/app/templates/package.json | 12 +++++++++--- generators/app/templates/package.ts.json | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/generators/app/templates/package.json b/generators/app/templates/package.json index 601c9ef..6dc50d8 100644 --- a/generators/app/templates/package.json +++ b/generators/app/templates/package.json @@ -1,10 +1,16 @@ { - "main": "lib/binding.js", + "main": "dist/binding.js", "dependencies": { "node-addon-api": "^1.1.0" }, "scripts": { - "test": "node --napi-modules ./test/test_binding.js" + "test": "node --napi-modules ./test/test_binding.js", + "build": "node-gyp rebuild" }, - "gypfile": true + "gypfile": true, + "files": [ + "binding.gyp", + "src", + "dist" + ] } diff --git a/generators/app/templates/package.ts.json b/generators/app/templates/package.ts.json index 8609bb7..01e6a6d 100644 --- a/generators/app/templates/package.ts.json +++ b/generators/app/templates/package.ts.json @@ -5,6 +5,7 @@ }, "scripts": { "pretest": "tsc", - "test": "node --napi-modules ./test/test_binding.js" + "test": "node --napi-modules ./test/test_binding.js", + "build": "node-gyp rebuild && tsc" } } \ No newline at end of file From 8c70b8d1a7f390f6820719aa3fd81b6ec5f6408c Mon Sep 17 00:00:00 2001 From: Yu Chen Date: Thu, 11 Apr 2019 15:17:32 +0800 Subject: [PATCH 2/2] Default `.gitignore`. --- src/app/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/index.ts b/src/app/index.ts index d563fff..c827cb6 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -233,6 +233,7 @@ module.exports = class extends Generator { const files = [ ["binding.gyp"], + [".gitignore"], [bindingWrapperSrc, bindingWrapperTarget], ];