diff --git a/eslint.config.js b/eslint.config.js index 2348cdb0..4965dbea 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,10 +12,10 @@ module.exports = tseslint.config( eslintConfigPrettier, { ignores: [ + "esbuild.js", "out/", "src/protos/protos.js", "src/protos/protos.d.ts", - "esbuild.js", ], }, { diff --git a/package.json b/package.json index 4f9aa98d..fbb5205c 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "onCommand:bazel.info.output_path", "onCommand:bazel.info.workspace" ], - "main": "./dist/extension.js", + "main": "./extension.js", "contributes": { "breakpoints": [ { @@ -465,9 +465,8 @@ "format-check": "prettier --check .", "format-fix": "prettier --write .", "test": "./scripts/test.sh", - "package": "vsce package", + "package": "./scripts/package.sh", "update-snapshot": "./scripts/test.sh -u", - "vscode:prepublish": "./scripts/build.sh && node esbuild.js", "watch": "./scripts/build.sh -watch" }, "devDependencies": { diff --git a/scripts/build.sh b/scripts/build.sh index b803fe5a..70341ffc 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -34,5 +34,5 @@ fi # Convert yaml language definition to json form requred by vscode. js-yaml syntaxes/bazelrc.tmLanguage.yaml > syntaxes/bazelrc.tmLanguage.json -# Compile the rest of the project. +# Compile the rest of the project for non-release development flow. tsc "$@" -p ./ diff --git a/scripts/package.sh b/scripts/package.sh new file mode 100755 index 00000000..84a80809 --- /dev/null +++ b/scripts/package.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +# Move into the top-level directory of the project. +cd "$(dirname "${BASH_SOURCE[0]}")/.." > /dev/null + +./scripts/build.sh + +# Prepare dist/ content besides the entry js. +mkdir -p dist +cp ./package.json ./dist/package.json +cp ./LICENSE ./dist/LICENSE +cp ./README.md ./dist/README.md +cp -r ./icons ./dist/icons +cp -r ./media ./dist/media +cp -r ./syntaxes ./dist/syntaxes + +node esbuild.js --production + +cd dist +vsce package --no-dependencies -o .. diff --git a/tsconfig.json b/tsconfig.json index dc937994..d7cd7024 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,6 @@ "node_modules", "out", "eslint.config.js", - "esbuild.js", + "scripts", ] }