Skip to content

Commit 6654504

Browse files
authored
Merge pull request #29 from aws/04-17-script-update
Added postinstall script and updated script handling
2 parents e25a34b + a7bc6f4 commit 6654504

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This script will:
1616
- use `quilt` to pop any existing patches.
1717
- update the submodule to verify the local version is in parity with source
1818
- apply all patches with `quilt` from `./patches`
19+
- runs `./scripts/postinstall.sh` that will comment out 2 breaking `git config` lines from `./vscode/build/npm/postinstall.js`
1920
- runs `./scripts/copy-resource.sh` that will copy patched version of code - oss from `./vscode` into `./patched-vscode` folder along with icon(s) and svg(s) from `./resources` folder
2021
- runs `yarn install` and downloads built in extensions on patched submodule
2122

scripts/copy-resources.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# Exit immediately if a command exits with a non-zero status.
44
set -ex
55

6+
# Set current project root
7+
PROJ_ROOT=$(pwd)
8+
69
# Define the source directory for the resources
7-
SOURCE_DIR="resources"
10+
SOURCE_DIR="${PROJ_ROOT}/resources"
811

912
# Define the destination base directory
10-
DEST_DIR="vscode"
13+
DEST_DIR="${PROJ_ROOT}/vscode"
1114

1215
# Define paths for each file relative to the base directories
1316
# Format: "source_file_path:destination_file_path"

scripts/install.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
2-
set -e
2+
3+
# set +e to prevent quilt from exiting when no patches popped
4+
set +e
35

46
# Set current project root
57
PROJ_ROOT=$(pwd)
@@ -8,6 +10,9 @@ PROJ_ROOT=$(pwd)
810
printf "\n======== Cleaning out patches ========\n"
911
quilt pop -a
1012

13+
# re-enable -e to allow exiting on error
14+
set -e
15+
1116
# make sure module is current
1217
printf "\n======== Updating submodule ========\n"
1318
git submodule update --init
@@ -22,10 +27,18 @@ printf "\n======== Applying patches ========\n"
2227
exit 1
2328
}
2429

30+
# Comment out breaking lines in postinstall.js
31+
printf "\n======== Comment out breaking git config lines in postinstall.js ========\n"
32+
sh ${PROJ_ROOT}/scripts/postinstall.sh
33+
2534
# Copy resources
2635
printf "\n======== Copy resources ========\n"
2736
sh ${PROJ_ROOT}/scripts/copy-resources.sh
2837

38+
# Delete node_modules to prevent node-gyp build error
39+
printf "\n======== Deleting vscode/node_modules ========\n"
40+
rm -rf "${PROJ_ROOT}/vscode/node_modules"
41+
2942
# Build the project
3043
printf "\n======== Building project in ${PROJ_ROOT}/vscode ========\n"
3144
yarn --cwd "${PROJ_ROOT}/vscode" install --pure-lockfile --verbose

scripts/postinstall.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status.
4+
set -ex
5+
6+
# Set current project root
7+
PROJ_ROOT=$(pwd)
8+
9+
# Define the destination base directory
10+
POSTINSTALL_JS_PATH="${PROJ_ROOT}/vscode/build/npm/postinstall.js"
11+
12+
# Check if the postinstall.js file exists
13+
if [ ! -f "$POSTINSTALL_JS_PATH" ]; then
14+
echo "Error: $POSTINSTALL_JS_PATH does not exist." >&2
15+
exit 1
16+
fi
17+
18+
# Use sed to comment out the specific lines
19+
sed -i '' '/cp\.execSync('"'"'git config pull\.rebase merges'"'"');/s/^/\/\/ /' "$POSTINSTALL_JS_PATH"
20+
sed -i '' '/cp\.execSync('"'"'git config blame\.ignoreRevsFile \.git-blame-ignore'"'"');/s/^/\/\/ /' "$POSTINSTALL_JS_PATH"
21+
22+
echo "Specified git config lines have been commented out in $POSTINSTALL_JS_PATH."

0 commit comments

Comments
 (0)