diff options
author | Balaji Vijayakumar <kuttibalaji.v6@gmail.com> | 2022-11-25 05:31:46 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 00:01:46 +0000 |
commit | c04b71b2c79bdc5b1612ef0e98f351d1193bdec9 (patch) | |
tree | b46106d37f6d4ecc2bb366fcf5418ac3f478fe42 /scripts/build-unix.sh | |
parent | Pull in new version of 'recipes' submodule (diff) | |
download | ferdium-app-c04b71b2c79bdc5b1612ef0e98f351d1193bdec9.tar.gz ferdium-app-c04b71b2c79bdc5b1612ef0e98f351d1193bdec9.tar.zst ferdium-app-c04b71b2c79bdc5b1612ef0e98f351d1193bdec9.zip |
Switch npm to pnpm (#714)
Diffstat (limited to 'scripts/build-unix.sh')
-rwxr-xr-x | scripts/build-unix.sh | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh index 15e9f26c8..42de96a1a 100755 --- a/scripts/build-unix.sh +++ b/scripts/build-unix.sh | |||
@@ -83,38 +83,33 @@ fi | |||
83 | command_exists asdf && asdf reshim nodejs | 83 | command_exists asdf && asdf reshim nodejs |
84 | 84 | ||
85 | # Ensure that the system dependencies are at the correct version | 85 | # Ensure that the system dependencies are at the correct version |
86 | # Check npm version | ||
87 | EXPECTED_NPM_VERSION=$(node -p 'require("./package.json").engines.npm') | ||
88 | ACTUAL_NPM_VERSION=$(npm --version) | ||
89 | if [[ "$ACTUAL_NPM_VERSION" != "$EXPECTED_NPM_VERSION" ]]; then | ||
90 | npm i -gf npm@$EXPECTED_NPM_VERSION | ||
91 | fi | ||
92 | |||
93 | # Check pnpm version | 86 | # Check pnpm version |
94 | EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') | 87 | EXPECTED_PNPM_VERSION=$(node -p 'require("./package.json").engines.pnpm') |
95 | ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present | 88 | ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present |
96 | if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then | 89 | if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then |
97 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION | 90 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION |
98 | fi | 91 | fi |
99 | 92 | ||
93 | # Check pnpm version of the recipes submodule | ||
94 | EXPECTED_RECIPES_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') | ||
95 | if [[ "$EXPECTED_PNPM_VERSION" != "$EXPECTED_RECIPES_PNPM_VERSION" ]]; then | ||
96 | fail_with_docs "The expected versions of pnpm are not the same in the main repo and in the recipes submodule, please sync them. | ||
97 | expected in recipes : [$EXPECTED_RECIPES_PNPM_VERSION] | ||
98 | expected in main repo: [$EXPECTED_PNPM_VERSION] | ||
99 | actual : [$EXPECTED_PNPM_VERSION]" | ||
100 | fi | ||
101 | |||
100 | # If 'asdf' is installed, reshim for new nodejs if necessary | 102 | # If 'asdf' is installed, reshim for new nodejs if necessary |
101 | command_exists asdf && asdf reshim nodejs | 103 | command_exists asdf && asdf reshim nodejs |
102 | 104 | ||
103 | # ----------------------------------------------------------------------------- | 105 | # ----------------------------------------------------------------------------- |
104 | # This is useful if we move from 'npm' to 'pnpm' for the main repo as well | ||
105 | if [[ -s 'pnpm-lock.yaml' ]]; then | ||
106 | BASE_CMD=pnpm | ||
107 | else | ||
108 | BASE_CMD=npm | ||
109 | fi | ||
110 | |||
111 | # Now the meat..... | 106 | # Now the meat..... |
112 | $BASE_CMD i | 107 | pnpm i |
113 | $BASE_CMD run prepare-code | 108 | pnpm prepare-code |
109 | pnpm test | ||
114 | 110 | ||
115 | # ----------------------------------------------------------------------------- | 111 | # ----------------------------------------------------------------------------- |
116 | printf "\n*************** Building recipes ***************\n" | 112 | printf "\n*************** Building recipes ***************\n" |
117 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
118 | pushd recipes | 113 | pushd recipes |
119 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package | 114 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package |
120 | popd | 115 | popd |
@@ -133,7 +128,7 @@ else | |||
133 | TARGET_OS="linux" | 128 | TARGET_OS="linux" |
134 | fi | 129 | fi |
135 | 130 | ||
136 | $BASE_CMD run build -- --$TARGET_ARCH --$TARGET_OS --dir | 131 | pnpm build --$TARGET_ARCH --$TARGET_OS --dir |
137 | 132 | ||
138 | printf "\n*************** App successfully built! ***************\n" | 133 | printf "\n*************** App successfully built! ***************\n" |
139 | 134 | ||