From 604fdd699009d81d8c1f3441a8a1284de62d4c07 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Thu, 23 Apr 2020 19:32:26 -0700 Subject: [PATCH] chore: update npm scripts and synth.py (#433) Update npm scripts: add clean, prelint, prefix; make sure that lint and fix are set properly. Use post-process feature of synthtool. --- package.json | 5 +++-- synth.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 36d962bc..3e5085e9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ ], "scripts": { "docs": "jsdoc -c .jsdoc.js", - "lint": "gts fix", + "lint": "gts check", "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", "system-test": "c8 mocha build/system-test --timeout 600000", "test": "c8 mocha build/test", @@ -40,7 +40,8 @@ "clean": "gts clean", "compile": "tsc -p . && cp -r protos build/", "compile-protos": "compileProtos src", - "prepare": "npm run compile" + "prepare": "npm run compile", + "precompile": "gts clean" }, "dependencies": { "google-gax": "^2.1.0" diff --git a/synth.py b/synth.py index 9269b663..6d5bc6c7 100644 --- a/synth.py +++ b/synth.py @@ -1,7 +1,7 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.node as node import logging -import subprocess logging.basicConfig(level=logging.DEBUG) @@ -30,7 +30,4 @@ templates = common_templates.node_library(source_location='build/src') s.copy(templates) -# Node.js specific cleanup -subprocess.run(["npm", "install"]) -subprocess.run(["npm", "run", "lint"]) -subprocess.run(['npx', 'compileProtos', 'src']) +node.postprocess_gapic_library()