From 3bada3eb060bf150eb19c1edc84bf92fae7beab7 Mon Sep 17 00:00:00 2001
From: PoppinL <poppinlp@gmail.com>
Date: Tue, 16 Apr 2019 00:14:20 +0800
Subject: [PATCH 1/3] Use files field to specify what we want in npm package

---
 .gitignore   | 58 +++++++++++++++++++++++++++++++++++++++++++++++-----
 .npmignore   |  7 -------
 .travis.yml  |  4 ++++
 package.json |  8 +++++++-
 4 files changed, 64 insertions(+), 13 deletions(-)
 delete mode 100644 .npmignore

diff --git a/.gitignore b/.gitignore
index c08d1d39..027fffe5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,11 +2,18 @@
 logs
 *.log
 npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
 
 # Runtime data
 pids
 *.pid
 *.seed
+*.pid.lock
 
 # Directory for instrumented libs generated by jscoverage/JSCover
 lib-cov
@@ -17,26 +24,67 @@ coverage
 # nyc test coverage
 .nyc_output
 
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
 .grunt
 
+# Bower dependency directory (https://bower.io/)
+bower_components
+
 # node-waf configuration
 .lock-wscript
 
-# Compiled binary addons (http://nodejs.org/api/addons.html)
+# Compiled binary addons (https://nodejs.org/api/addons.html)
 build/Release
 
 # Dependency directories
-node_modules
-jspm_packages
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
 
 # Optional npm cache directory
 .npm
 
+# Optional eslint cache
+.eslintcache
+
 # Optional REPL history
 .node_repl_history
 
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+
 dist/
 tmp/
 *.swp
-.DS_Store
+.DS_Store
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 775e9f7e..00000000
--- a/.npmignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.github/
-docs/
-test/
-.eslintrc.js
-.travis.yml
-Dockerfile
-.dockerignore
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 247f9281..62486655 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,10 @@
 language: node_js
 node_js:
+  - 4
+  - 6
+  - 8
   - 10
+  - stable
 
 os:
   - linux
diff --git a/package.json b/package.json
index 4a3bb43c..22c9b15d 100644
--- a/package.json
+++ b/package.json
@@ -2,13 +2,19 @@
   "name": "vsc-leetcode-cli",
   "version": "2.6.3",
   "description": "A cli tool to enjoy leetcode!",
-  "preferGlobal": "true",
   "engines": {
     "node": ">=4"
   },
   "bin": {
     "leetcode": "./bin/leetcode"
   },
+  "files": [
+    "bin",
+    "colors",
+    "icons",
+    "lib",
+    "templates"
+  ],
   "scripts": {
     "lint": "eslint lib/ test/",
     "test": "npm run lint && nyc mocha test test/plugins && nyc report --reporter=lcov",

From b3e13ab5553aab1726025daca913c628dc236965 Mon Sep 17 00:00:00 2001
From: PoppinL <poppinlp@gmail.com>
Date: Tue, 16 Apr 2019 00:28:25 +0800
Subject: [PATCH 2/3] Fix some lint errors

---
 lib/plugins/cache.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/plugins/cache.js b/lib/plugins/cache.js
index 3c2194e7..c224a27e 100644
--- a/lib/plugins/cache.js
+++ b/lib/plugins/cache.js
@@ -28,16 +28,14 @@ plugin.getProblem = function(problem, cb) {
   const k = h.KEYS.problem(problem);
   const _problem = cache.get(k);
   if (_problem) {
-    // do not hit problem without html tags in desc (<pre> always exists for presenting testcase)
-    if (!_problem.desc.includes("<pre>")) {
+    if (!_problem.desc.includes('<pre>')) {
+      // do not hit problem without html tags in desc (<pre> always exists for presenting testcase)
       log.debug('cache discarded for being no longer valid: ' + k + '.json');
-    }
-    // do not hit problem without likes & dislikes (logic will be improved in new lib)
-    else if (!['likes', 'dislikes'].every(p => p in _problem)) {
+    } else if (!['likes', 'dislikes'].every(p => p in _problem)) {
+      // do not hit problem without likes & dislikes (logic will be improved in new lib)
       log.debug('cache discarded for being too old: ' + k + '.json');
-    }
-    // cache hit
-    else {
+    } else {
+      // cache hit
       log.debug('cache hit: ' + k + '.json');
       _.extendOwn(problem, _problem);
       return cb(null, problem);

From 8f72f3a9170b92cfd2c92adf4c226e86532ad7c3 Mon Sep 17 00:00:00 2001
From: PoppinL <poppinlp@gmail.com>
Date: Wed, 24 Apr 2019 16:59:33 +0700
Subject: [PATCH 3/3] Remove nodejs 4 and 6 in travis test

---
 .travis.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 62486655..43a64d0f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,5 @@
 language: node_js
 node_js:
-  - 4
-  - 6
   - 8
   - 10
   - stable