Skip to content

Commit

Permalink
Move the prepublish steps into package.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cwahbong committed Oct 20, 2024
1 parent 6c56b0c commit 7f5dd5e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module.exports = tseslint.config(
eslintConfigPrettier,
{
ignores: [
"esbuild.js",
"out/",
"src/protos/protos.js",
"src/protos/protos.d.ts",
"esbuild.js",
],
},
{
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"onCommand:bazel.info.output_path",
"onCommand:bazel.info.workspace"
],
"main": "./dist/extension.js",
"main": "./extension.js",
"contributes": {
"breakpoints": [
{
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./
36 changes: 36 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -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 ..
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"node_modules",
"out",
"eslint.config.js",
"esbuild.js",
"scripts",
]
}

0 comments on commit 7f5dd5e

Please sign in to comment.