diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/add-crowdin-contributors.ts | 2 | ||||
-rwxr-xr-x | scripts/build-unix.sh | 33 | ||||
-rw-r--r-- | scripts/build-windows.ps1 | 48 |
3 files changed, 51 insertions, 32 deletions
diff --git a/scripts/add-crowdin-contributors.ts b/scripts/add-crowdin-contributors.ts index eadedbcc4..d6f36b06d 100644 --- a/scripts/add-crowdin-contributors.ts +++ b/scripts/add-crowdin-contributors.ts | |||
@@ -49,7 +49,7 @@ console.clear(); | |||
49 | console.log(JSON.stringify(members)); | 49 | console.log(JSON.stringify(members)); |
50 | 50 | ||
51 | * 3. Paste the output of the script (JSON Array) below to set 'list' to that value | 51 | * 3. Paste the output of the script (JSON Array) below to set 'list' to that value |
52 | * 4. Execute this script using 'pnpm add-crowdin-contributors' | 52 | * 4. Execute this script using 'npm run add-crowdin-contributors' |
53 | * 5. Regenerate the README table using the CLI ('all-contributors generate') | 53 | * 5. Regenerate the README table using the CLI ('all-contributors generate') |
54 | * Please check if the generated data is ok and no data is lost. | 54 | * Please check if the generated data is ok and no data is lost. |
55 | */ | 55 | */ |
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh index 42de96a1a..15e9f26c8 100755 --- a/scripts/build-unix.sh +++ b/scripts/build-unix.sh | |||
@@ -83,33 +83,38 @@ 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 | |||
86 | # Check pnpm version | 93 | # Check pnpm version |
87 | EXPECTED_PNPM_VERSION=$(node -p 'require("./package.json").engines.pnpm') | 94 | EXPECTED_PNPM_VERSION=$(node -p 'require("./recipes/package.json").engines.pnpm') |
88 | ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present | 95 | ACTUAL_PNPM_VERSION=$(pnpm --version || true) # in case the pnpm executable itself is not present |
89 | if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then | 96 | if [[ "$ACTUAL_PNPM_VERSION" != "$EXPECTED_PNPM_VERSION" ]]; then |
90 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION | 97 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION |
91 | fi | 98 | fi |
92 | 99 | ||
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 | |||
102 | # If 'asdf' is installed, reshim for new nodejs if necessary | 100 | # If 'asdf' is installed, reshim for new nodejs if necessary |
103 | command_exists asdf && asdf reshim nodejs | 101 | command_exists asdf && asdf reshim nodejs |
104 | 102 | ||
105 | # ----------------------------------------------------------------------------- | 103 | # ----------------------------------------------------------------------------- |
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 | |||
106 | # Now the meat..... | 111 | # Now the meat..... |
107 | pnpm i | 112 | $BASE_CMD i |
108 | pnpm prepare-code | 113 | $BASE_CMD run prepare-code |
109 | pnpm test | ||
110 | 114 | ||
111 | # ----------------------------------------------------------------------------- | 115 | # ----------------------------------------------------------------------------- |
112 | printf "\n*************** Building recipes ***************\n" | 116 | printf "\n*************** Building recipes ***************\n" |
117 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
113 | pushd recipes | 118 | pushd recipes |
114 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package | 119 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package |
115 | popd | 120 | popd |
@@ -128,7 +133,7 @@ else | |||
128 | TARGET_OS="linux" | 133 | TARGET_OS="linux" |
129 | fi | 134 | fi |
130 | 135 | ||
131 | pnpm build --$TARGET_ARCH --$TARGET_OS --dir | 136 | $BASE_CMD run build -- --$TARGET_ARCH --$TARGET_OS --dir |
132 | 137 | ||
133 | printf "\n*************** App successfully built! ***************\n" | 138 | printf "\n*************** App successfully built! ***************\n" |
134 | 139 | ||
diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1 index 13cbacb85..d0c394647 100644 --- a/scripts/build-windows.ps1 +++ b/scripts/build-windows.ps1 | |||
@@ -96,7 +96,7 @@ if ($env:CLEAN -eq "true") | |||
96 | # Check MSVS Tools through MSVS_VERSION | 96 | # Check MSVS Tools through MSVS_VERSION |
97 | 97 | ||
98 | 98 | ||
99 | $EXPECTED_MSVST_VERSION = @("2017","2019","2022") | 99 | $EXPECTED_MSVST_VERSION = @("2019","2022") |
100 | $NPM_CONFIG_MSVS_VERSION = npm config get msvs_version | 100 | $NPM_CONFIG_MSVS_VERSION = npm config get msvs_version |
101 | if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $NPM_CONFIG_MSVS_VERSION)){ | 101 | if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $NPM_CONFIG_MSVS_VERSION)){ |
102 | Write-Host "Your Microsoft Visual Studio Tools isn't set properly or it's not the right version! | 102 | Write-Host "Your Microsoft Visual Studio Tools isn't set properly or it's not the right version! |
@@ -131,30 +131,44 @@ if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $ | |||
131 | 131 | ||
132 | # ----------------------------------------------------------------------------- | 132 | # ----------------------------------------------------------------------------- |
133 | # Ensure that the system dependencies are at the correct version - recover if not | 133 | # Ensure that the system dependencies are at the correct version - recover if not |
134 | # Check npm version | ||
135 | $EXPECTED_NPM_VERSION = (Get-Content package.json | ConvertFrom-Json).engines.npm | ||
136 | $ACTUAL_NPM_VERSION = (npm -v) | ||
137 | if ($EXPECTED_NPM_VERSION -ne $ACTUAL_NPM_VERSION) { | ||
138 | Write-Host "You are not running the expected version of npm! | ||
139 | expected: [$EXPECTED_NPM_VERSION] | ||
140 | actual : [$ACTUAL_NPM_VERSION]" | ||
141 | Write-Host "Changing version of npm to [$EXPECTED_NPM_VERSION]" | ||
142 | npm i -gf npm@$EXPECTED_NPM_VERSION | ||
143 | } | ||
144 | |||
134 | # Check pnpm version | 145 | # Check pnpm version |
135 | $EXPECTED_PNPM_VERSION = (Get-Content package.json | ConvertFrom-Json).engines.pnpm | 146 | $EXPECTED_PNPM_VERSION = (Get-Content recipes\package.json | ConvertFrom-Json).engines.pnpm |
136 | $ACTUAL_PNPM_VERSION = pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present | 147 | $ACTUAL_PNPM_VERSION = Get-Command pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present |
137 | if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) { | 148 | if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) { |
138 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION | 149 | npm i -gf pnpm@$EXPECTED_PNPM_VERSION |
139 | } | 150 | } |
140 | 151 | ||
141 | # Check pnpm version of the recipes submodule | 152 | # ----------------------------------------------------------------------------- |
142 | $EXPECTED_RECIPES_PNPM_VERSION = (Get-Content .\recipes\package.json | ConvertFrom-Json).engines.pnpm | 153 | # This is useful if we move from 'npm' to 'pnpm' for the main repo as well |
143 | if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_RECIPES_PNPM_VERSION) { | 154 | if ((Test-Path -Path ".\pnpm-lock.yaml") -and (Get-Command -ErrorAction Ignore -Type Application pnpm)) |
144 | fail_with_docs "The expected versions of pnpm are not the same in the main repo and in the recipes submodule, please sync them. | 155 | { |
145 | expected in recipes : [$EXPECTED_RECIPES_PNPM_VERSION] | 156 | $BASE_CMD="pnpm" |
146 | expected in main repo: [$EXPECTED_RECIPES_PNPM_VERSION] | 157 | $env:EXEC_CMD="pnpm dlx" |
147 | actual : [$EXPECTED_PNPM_VERSION]" | 158 | } |
159 | else | ||
160 | { | ||
161 | $BASE_CMD="npm" | ||
162 | $env:EXEC_CMD="npx" | ||
148 | } | 163 | } |
149 | 164 | ||
150 | # ----------------------------------------------------------------------------- | ||
151 | # Now the meat..... | 165 | # Now the meat..... |
152 | & pnpm i | 166 | & $BASE_CMD i |
153 | & pnpm prepare-code | 167 | & $BASE_CMD run prepare-code |
154 | & pnpm test | ||
155 | 168 | ||
156 | # ----------------------------------------------------------------------------- | 169 | # ----------------------------------------------------------------------------- |
157 | Write-Host "*************** Building recipes ***************" | 170 | Write-Host "*************** Building recipes ***************" |
171 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
158 | Push-Location recipes | 172 | Push-Location recipes |
159 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package | 173 | pnpm i && pnpm lint && pnpm reformat-files && pnpm package |
160 | Pop-Location | 174 | Pop-Location |
@@ -162,13 +176,13 @@ Pop-Location | |||
162 | # ----------------------------------------------------------------------------- | 176 | # ----------------------------------------------------------------------------- |
163 | Write-Host "*************** Building app ***************" | 177 | Write-Host "*************** Building app ***************" |
164 | if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { | 178 | if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { |
165 | $TARGET_ARCH="arm64" | 179 | $TARGET_ARCH="arm64" |
166 | } | 180 | } |
167 | else | 181 | else |
168 | { | 182 | { |
169 | $TARGET_ARCH="x64" | 183 | $TARGET_ARCH="x64" |
170 | } | 184 | } |
171 | & pnpm build -- --$TARGET_ARCH --dir | 185 | & $BASE_CMD run build -- --$TARGET_ARCH --dir |
172 | 186 | ||
173 | Write-Host "*************** App successfully built! ***************" | 187 | Write-Host "*************** App successfully built! ***************" |
174 | 188 | ||