diff options
-rw-r--r-- | .devcontainer/Dockerfile | 6 | ||||
-rw-r--r-- | .devcontainer/devcontainer.json | 2 | ||||
-rw-r--r-- | .github/workflows/builds.yml | 38 | ||||
-rw-r--r-- | .vscode/launch.json | 7 | ||||
-rw-r--r-- | CODE_OF_CONDUCT.md | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 116 | ||||
-rwxr-xr-x | scripts/build-unix.sh | 135 | ||||
-rw-r--r-- | scripts/build-windows.ps1 | 100 |
8 files changed, 324 insertions, 82 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 048cebe2d..1fe3880c8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile | |||
@@ -1,7 +1,7 @@ | |||
1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.174.0/containers/javascript-node/.devcontainer/base.Dockerfile | 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.174.0/containers/javascript-node/.devcontainer/base.Dockerfile |
2 | 2 | ||
3 | # [Choice] Node.js version: 14, 12, 10 | 3 | # [Choice] Node.js version: 18 |
4 | ARG VARIANT="14-buster" | 4 | ARG VARIANT="18-buster" |
5 | FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} | 5 | FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} |
6 | 6 | ||
7 | # [Optional] Uncomment this section to install additional OS packages. | 7 | # [Optional] Uncomment this section to install additional OS packages. |
@@ -13,4 +13,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} | |||
13 | # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" | 13 | # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" |
14 | 14 | ||
15 | # [Optional] Uncomment if you want to install more global node modules | 15 | # [Optional] Uncomment if you want to install more global node modules |
16 | # RUN su node -c "npm install -g <your-package-list-here>" | 16 | # RUN su node -c "npm i -g <your-package-list-here>" |
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 85a9c5a3b..54d7c459b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json | |||
@@ -24,7 +24,7 @@ | |||
24 | // "forwardPorts": [], | 24 | // "forwardPorts": [], |
25 | 25 | ||
26 | // Use 'postCreateCommand' to run commands after the container is created. | 26 | // Use 'postCreateCommand' to run commands after the container is created. |
27 | // "postCreateCommand": "npm install", | 27 | // "postCreateCommand": "npm i", |
28 | 28 | ||
29 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | 29 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. |
30 | "remoteUser": "node" | 30 | "remoteUser": "node" |
diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 914f2fefd..b84729522 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml | |||
@@ -23,10 +23,10 @@ on: | |||
23 | workflow_dispatch: | 23 | workflow_dispatch: |
24 | inputs: | 24 | inputs: |
25 | message: | 25 | message: |
26 | description: 'Message for build' | 26 | description: "Message for build" |
27 | required: true | 27 | required: true |
28 | schedule: | 28 | schedule: |
29 | - cron: '15 0 * * *' # every night at 12:15 am (to allow for dependency builds to complete) | 29 | - cron: "15 0 * * *" # every night at 12:15 am (to allow for dependency builds to complete) |
30 | 30 | ||
31 | env: | 31 | env: |
32 | USE_HARD_LINKS: false | 32 | USE_HARD_LINKS: false |
@@ -35,7 +35,7 @@ env: | |||
35 | jobs: | 35 | jobs: |
36 | check_updates: | 36 | check_updates: |
37 | runs-on: ubuntu-latest | 37 | runs-on: ubuntu-latest |
38 | name: 'Check latest commit: ${{ github.event.inputs.message }}' | 38 | name: "Check latest commit: ${{ github.event.inputs.message }}" |
39 | outputs: | 39 | outputs: |
40 | should_run: ${{ steps.should_run.outputs.should_run }} | 40 | should_run: ${{ steps.should_run.outputs.should_run }} |
41 | steps: | 41 | steps: |
@@ -51,7 +51,7 @@ jobs: | |||
51 | uses: actions/setup-node@v3 | 51 | uses: actions/setup-node@v3 |
52 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} | 52 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} |
53 | with: | 53 | with: |
54 | node-version-file: '.nvmrc' | 54 | node-version-file: ".nvmrc" |
55 | - id: should_run | 55 | - id: should_run |
56 | name: Check whether there are any commits since this run was last triggered and push them and/or set the output | 56 | name: Check whether there are any commits since this run was last triggered and push them and/or set the output |
57 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} | 57 | if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }} |
@@ -93,7 +93,7 @@ jobs: | |||
93 | fi | 93 | fi |
94 | 94 | ||
95 | build_mac: | 95 | build_mac: |
96 | name: 'macos ${{ github.event.inputs.message }}' | 96 | name: "macos ${{ github.event.inputs.message }}" |
97 | needs: check_updates | 97 | needs: check_updates |
98 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[macOS]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} | 98 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[macOS]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
99 | runs-on: macos-latest | 99 | runs-on: macos-latest |
@@ -136,13 +136,11 @@ jobs: | |||
136 | - name: Use Node.js specified in the '.nvmrc' file | 136 | - name: Use Node.js specified in the '.nvmrc' file |
137 | uses: actions/setup-node@v3 | 137 | uses: actions/setup-node@v3 |
138 | with: | 138 | with: |
139 | node-version-file: '.nvmrc' | 139 | node-version-file: ".nvmrc" |
140 | - name: Install npm | 140 | - name: Install npm |
141 | run: npm i -gf npm@8.7.0 | 141 | run: npm i -gf "npm@$(jq --raw-output .engines.npm ./package.json)" && npm -v |
142 | - name: Install pnpm | 142 | - name: Install pnpm |
143 | uses: pnpm/action-setup@v2.0.1 | 143 | run: npm i -gf "pnpm@$(jq --raw-output .engines.pnpm ./recipes/package.json)" && pnpm -v |
144 | with: | ||
145 | version: 6.32.8 | ||
146 | - name: Install node dependencies | 144 | - name: Install node dependencies |
147 | run: npm i | 145 | run: npm i |
148 | - name: Package recipes | 146 | - name: Package recipes |
@@ -180,7 +178,7 @@ jobs: | |||
180 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | 178 | # CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} |
181 | 179 | ||
182 | build_linux: | 180 | build_linux: |
183 | name: 'ubuntu ${{ github.event.inputs.message }}' | 181 | name: "ubuntu ${{ github.event.inputs.message }}" |
184 | needs: check_updates | 182 | needs: check_updates |
185 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Linux]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} | 183 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Linux]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
186 | runs-on: ubuntu-20.04 | 184 | runs-on: ubuntu-20.04 |
@@ -223,13 +221,11 @@ jobs: | |||
223 | - name: Use Node.js specified in the '.nvmrc' file | 221 | - name: Use Node.js specified in the '.nvmrc' file |
224 | uses: actions/setup-node@v3 | 222 | uses: actions/setup-node@v3 |
225 | with: | 223 | with: |
226 | node-version-file: '.nvmrc' | 224 | node-version-file: ".nvmrc" |
227 | - name: Install npm | 225 | - name: Install npm |
228 | run: npm i -gf npm@8.7.0 | 226 | run: npm i -gf "npm@$(jq --raw-output .engines.npm ./package.json)" && npm -v |
229 | - name: Install pnpm | 227 | - name: Install pnpm |
230 | uses: pnpm/action-setup@v2.0.1 | 228 | run: npm i -gf "pnpm@$(jq --raw-output .engines.pnpm ./recipes/package.json)" && pnpm -v |
231 | with: | ||
232 | version: 6.32.8 | ||
233 | - name: Install node dependencies | 229 | - name: Install node dependencies |
234 | run: npm i | 230 | run: npm i |
235 | - name: Figure out used package.json version | 231 | - name: Figure out used package.json version |
@@ -288,7 +284,7 @@ jobs: | |||
288 | shell: bash | 284 | shell: bash |
289 | 285 | ||
290 | build_windows: | 286 | build_windows: |
291 | name: 'windows ${{ github.event.inputs.message }}' | 287 | name: "windows ${{ github.event.inputs.message }}" |
292 | needs: check_updates | 288 | needs: check_updates |
293 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Windows]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} | 289 | if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, '[Windows]') || (!contains(github.event.inputs.message, '[macOS]') && !contains(github.event.inputs.message, '[Linux]') && !contains(github.event.inputs.message, '[Windows]'))))) }} |
294 | runs-on: windows-latest | 290 | runs-on: windows-latest |
@@ -315,13 +311,11 @@ jobs: | |||
315 | - name: Use Node.js specified in the '.nvmrc' file | 311 | - name: Use Node.js specified in the '.nvmrc' file |
316 | uses: actions/setup-node@v3 | 312 | uses: actions/setup-node@v3 |
317 | with: | 313 | with: |
318 | node-version-file: '.nvmrc' | 314 | node-version-file: ".nvmrc" |
319 | - name: Install npm | 315 | - name: Install npm |
320 | run: npm i -gf npm@8.7.0 | 316 | run: npm i -gf "npm@$(jq --raw-output .engines.npm package.json)" && npm -v |
321 | - name: Install pnpm | 317 | - name: Install pnpm |
322 | uses: pnpm/action-setup@v2.0.1 | 318 | run: npm i -gf "pnpm@$(jq --raw-output .engines.pnpm ./recipes/package.json)" && pnpm -v |
323 | with: | ||
324 | version: 6.32.8 | ||
325 | - name: Install node dependencies | 319 | - name: Install node dependencies |
326 | uses: nick-invision/retry@v2.4.0 | 320 | uses: nick-invision/retry@v2.4.0 |
327 | with: | 321 | with: |
diff --git a/.vscode/launch.json b/.vscode/launch.json index 78db6562c..24002a53b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json | |||
@@ -2,6 +2,13 @@ | |||
2 | "version": "0.2.0", | 2 | "version": "0.2.0", |
3 | "configurations": [ | 3 | "configurations": [ |
4 | { | 4 | { |
5 | "name": "PowerShell Launch Current File", | ||
6 | "type": "PowerShell", | ||
7 | "request": "launch", | ||
8 | "script": "${file}", | ||
9 | "cwd": "${workspaceFolder}" | ||
10 | }, | ||
11 | { | ||
5 | "type": "node", | 12 | "type": "node", |
6 | "request": "launch", | 13 | "request": "launch", |
7 | "name": "Ferdium - Test API", | 14 | "name": "Ferdium - Test API", |
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 93d858182..ab89b2307 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | As contributors and maintainers of the Ferdium project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. | 3 | As contributors and maintainers of the Ferdium project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. |
4 | 4 | ||
5 | Communication through GitHub, Slack, email or any other channel must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. | 5 | Communication through GitHub, Discord, email or any other channel must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. |
6 | 6 | ||
7 | We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the project to do the same. | 7 | We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the project to do the same. |
8 | 8 | ||
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index abcbac9f2..78b9a36be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md | |||
@@ -1,4 +1,4 @@ | |||
1 | # Contributing to Ferdium 5 | 1 | # Contributing to Ferdium 6 |
2 | 2 | ||
3 | :tada: First off, thanks for taking the time and your effort to make Ferdium better! :tada: | 3 | :tada: First off, thanks for taking the time and your effort to make Ferdium better! :tada: |
4 | 4 | ||
@@ -6,95 +6,99 @@ | |||
6 | 6 | ||
7 | <!-- TOC depthFrom:2 depthTo:2 withLinks:1 updateOnSave:1 orderedList:0 --> | 7 | <!-- TOC depthFrom:2 depthTo:2 withLinks:1 updateOnSave:1 orderedList:0 --> |
8 | 8 | ||
9 | - [Contributing to Ferdium 5](#contributing-to-ferdium-5) | 9 | - [Table of contents](#table-of-contents) |
10 | - [Table of contents](#table-of-contents) | 10 | - [Code of Conduct](#code-of-conduct) |
11 | - [Code of Conduct](#code-of-conduct) | 11 | - [What should I know before I get started?](#what-should-i-know-before-i-get-started) |
12 | - [What should I know before I get started?](#what-should-i-know-before-i-get-started) | 12 | - [How can I contribute?](#how-can-i-contribute) |
13 | - [How Can I Contribute?](#how-can-i-contribute) | 13 | - [Setting up your development machine](#setting-up-your-development-machine) |
14 | - [Setting up your Development machine](#setting-up-your-development-machine) | 14 | - [Install system-level dependencies](#install-system-level-dependencies) |
15 | - [Install System-level dependencies](#install-system-level-dependencies) | 15 | - [Node.js, npm, pnpm](#nodejs-npm-pnpm) |
16 | - [Node.js, npm, pnpm](#nodejs-npm-pnpm) | 16 | - [Git](#git) |
17 | - [Git](#git) | 17 | - [On Debian/Ubuntu](#on-debianubuntu) |
18 | - [Debian/Ubuntu](#debianubuntu) | 18 | - [On Fedora](#on-fedora) |
19 | - [Fedora](#fedora) | 19 | - [On Windows](#on-windows) |
20 | - [Windows](#windows) | 20 | - [Clone repository with submodule](#clone-repository-with-submodule) |
21 | - [Clone repository with submodule](#clone-repository-with-submodule) | 21 | - [Local caching of dependencies](#local-caching-of-dependencies) |
22 | - [Local caching of dependencies](#local-caching-of-dependencies) | 22 | - [Install dependencies](#install-dependencies) |
23 | - [Install dependencies](#install-dependencies) | 23 | - [Fix native modules to match current electron node version](#fix-native-modules-to-match-current-electron-node-version) |
24 | - [Fix native modules to match current electron node version](#fix-native-modules-to-match-current-electron-node-version) | 24 | - [Package recipe repository](#package-recipe-repository) |
25 | - [Package recipe repository](#package-recipe-repository) | 25 | - [Using Docker to build a linux-targetted packaged app](#using-docker-to-build-a-linux-targetted-packaged-app) |
26 | - [Using Docker to build a linux-targetted packaged app](#using-docker-to-build-a-linux-targetted-packaged-app) | 26 | - [Code Signing on a mac](#code-signing-on-a-mac) |
27 | - [Code Signing on a mac](#code-signing-on-a-mac) | 27 | - [Start development app](#start-development-app) |
28 | - [Start development app](#start-development-app) | 28 | - [Styleguide](#styleguide) |
29 | - [Styleguide](#styleguide) | 29 | - [Git Commit Messages format](#git-commit-messages-format) |
30 | - [Git Commit Messages format](#git-commit-messages-format) | 30 | - [Javascript Coding style-checker](#javascript-coding-style-checker) |
31 | - [Javascript Coding style-checker](#javascript-coding-style-checker) | 31 | - [Packaging](#packaging) |
32 | - [Packaging](#packaging) | 32 | - [Release](#release) |
33 | - [Release](#release) | 33 | - [Nightly releases](#nightly-releases) |
34 | - [Nightly releases](#nightly-releases) | 34 | - [Updating the code after a hiatus](#updating-the-code-after-a-hiatus) |
35 | - [Updating the code after a hiatus](#updating-the-code-after-a-hiatus) | ||
36 | 35 | ||
37 | <!-- /TOC --> | 36 | <!-- /TOC --> |
38 | 37 | ||
39 | ## Code of Conduct | 38 | ## Code of Conduct |
40 | 39 | ||
41 | This project and everyone participating in it is governed by the [Ferdium Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [hello@ferdium.org](mailto:hello@ferdium.org). | 40 | This project and everyone participating in it is governed by the [Ferdium Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. |
41 | Please report unacceptable behavior to [hello@ferdium.org](mailto:hello@ferdium.org). | ||
42 | 42 | ||
43 | ## What should I know before I get started? | 43 | ## What should I know before I get started? |
44 | 44 | ||
45 | For the moment, Ferdium's development is a bit slow but all contributions are highly appreciated. [Check this issue for discussion](https://github.com/ferdium/ferdium-app/issues/956). | 45 | For the moment, Ferdium's development is only starting, aiming at releasing a 6.0.0 version with the rebranded assets and tooling upgrade completed. |
46 | You can join the Discord official chat here : https://discord.com/invite/xpNTzgKmHM. | ||
46 | 47 | ||
47 | ## How Can I Contribute? | 48 | ## How can I contribute? |
48 | 49 | ||
49 | As a basic rule, before filing issues, feature requests or anything else. Take a look at the issues and check if this has not already been reported by another user. If so, engage in the already existing discussion. | 50 | As a basic rule, before filing issues, feature requests or anything else : take a look at the existing issues and check if this has not already been reported by another user. |
51 | If so, engage in the already existing discussion. | ||
50 | 52 | ||
51 | ## Setting up your Development machine | 53 | ## Setting up your development machine |
52 | 54 | ||
53 | ### Install System-level dependencies | 55 | ### Install system-level dependencies |
56 | |||
57 | _Note:_ This list can likely get outdated. If so, please refer to the specific version of the [electronuserland builder](https://hub.docker.com/r/electronuserland/builder) that we use in our [Dockerfile](./Dockerfile). | ||
54 | 58 | ||
55 | #### Node.js, npm, pnpm | 59 | #### Node.js, npm, pnpm |
56 | 60 | ||
57 | Please make sure you are conforming to the `engines` requirements used by the developers/contributors as specified in the [package.json file](./package.json#engines). | 61 | Please make sure you are conforming to the `engines` requirements used by the developers/contributors as specified in the [`package.json`](./package.json#engines) and [`recipes/package.json`](./recipes/package.json#engine) files. |
58 | 62 | ||
59 | Currently, these are the combinations of system dependencies that work for MacOS/Linux/Windows: | 63 | Currently, these are the combinations of system dependencies that work for MacOS/Linux/Windows: |
60 | 64 | ||
61 | ```bash | 65 | ```bash |
62 | node -v | 66 | $ jq --null-input '[inputs.engines] | add' < ./package.json < ./recipes/package.json |
63 | v18.0.0 | 67 | { |
64 | npm -v | 68 | "node": "18.0.0", |
65 | 8.7.0 | 69 | "npm": "8.7.0", |
66 | pnpm -v | 70 | "pnpm": "6.32.8" |
67 | 6.32.8 | 71 | } |
68 | python -v | 72 | |
69 | 3.10.4 | 73 | $ python --version |
74 | Python 3.10.4 | ||
70 | ``` | 75 | ``` |
71 | 76 | ||
72 | _Note:_ You can choose any package manager to manage multiple versions of `node` and `npm`. For eg, [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://github.com/asdf-vm/asdf). | 77 | _Note:_ You can choose any version manager to manage multiple versions of `node` and `npm`. For eg, [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://github.com/asdf-vm/asdf). |
73 | 78 | ||
74 | #### Git | 79 | #### Git |
75 | 80 | ||
76 | The version [2.23.0](https://github.com/git-for-windows/git/releases/tag/v2.23.0.windows.1) for Git is working fine for development. You can then use the console from Git to do the development procedure. | 81 | The version [2.23.0](https://github.com/git-for-windows/git/releases/tag/v2.23.0.windows.1) for Git is working fine for development. You can then use the console from Git to do the development procedure. |
77 | 82 | ||
78 | _Note:_ This list can likely get outdated. If so, please refer to the specific version of the [electronuserland builder](https://hub.docker.com/r/electronuserland/builder) that we use in our [Dockerfile](./Dockerfile). | 83 | #### On Debian/Ubuntu |
79 | |||
80 | #### Debian/Ubuntu | ||
81 | 84 | ||
82 | ```bash | 85 | ```bash |
83 | apt-get update -y && apt-get install --no-install-recommends -y rpm ruby gem && gem install fpm --no-ri --no-rdoc --no-document | 86 | apt-get update -y && apt-get install --no-install-recommends -y rpm ruby gem && gem install fpm --no-ri --no-rdoc --no-document |
84 | ``` | 87 | ``` |
85 | 88 | ||
86 | #### Fedora | 89 | #### On Fedora |
87 | 90 | ||
88 | ```bash | 91 | ```bash |
89 | dnf install libX11-devel libXext-devel libXScrnSaver-devel libxkbfile-devel rpm | 92 | dnf install libX11-devel libXext-devel libXScrnSaver-devel libxkbfile-devel rpm |
90 | ``` | 93 | ``` |
91 | 94 | ||
92 | #### Windows | 95 | #### On Windows |
93 | 96 | ||
94 | Please make sure you have the following installed: | 97 | Please make sure you have the following installed: |
95 | 98 | ||
96 | - Python 3 or higher (we recommend the latest version: [3.10.4](https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe)) | 99 | - Python 3 or higher (we recommend the latest version: [3.10.4](https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe)) |
97 | - Microsoft Visual Studio Build Tools (2019 or higher) - Only tested with 2019 so far. | 100 | - Microsoft Visual Studio Build Tools (2019 or higher) - Only tested with 2019 so far. |
101 | |||
98 | ### Clone repository with submodule | 102 | ### Clone repository with submodule |
99 | 103 | ||
100 | ```bash | 104 | ```bash |
@@ -103,20 +107,18 @@ cd ferdium | |||
103 | git submodule update --init --recursive --remote --rebase --force | 107 | git submodule update --init --recursive --remote --rebase --force |
104 | ``` | 108 | ``` |
105 | 109 | ||
106 | It is important you execute the last command to get the required submodules (recipes). | 110 | It is important you execute the last command to get the required submodule (ferdium-recipes). |
107 | 111 | ||
108 | ### Local caching of dependencies | 112 | ### Local caching of dependencies |
109 | 113 | ||
110 | Set these env vars into your profile (or if you use [direnv](https://direnv.net/), you can manage them via the respective `.envrc` file) | 114 | Set these env vars into your profile (or if you use [direnv](https://direnv.net/), you can manage them via the respective `.envrc` file) |
111 | 115 | ||
112 | ```bash | 116 | ```bash |
117 | # On bash or equivalent | ||
113 | export ELECTRON_CACHE=$HOME/.cache/electron | 118 | export ELECTRON_CACHE=$HOME/.cache/electron |
114 | export ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder | 119 | export ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder |
115 | ``` | ||
116 | 120 | ||
117 | #### If you are using Powershell: | 121 | # On Powershell |
118 | If you are using Powershell make sure you set the following env vars | ||
119 | ``` | ||
120 | $env:CI = $true | 122 | $env:CI = $true |
121 | $env:ELECTRON_CACHE = $HOME + '\.cache\electron' | 123 | $env:ELECTRON_CACHE = $HOME + '\.cache\electron' |
122 | $env:ELECTRON_BUILDER_CACHE = $HOME + '\.cache\electron-builder' | 124 | $env:ELECTRON_BUILDER_CACHE = $HOME + '\.cache\electron-builder' |
@@ -218,7 +220,11 @@ Note: please prefer [`debug()`](https://github.com/visionmedia/debug) over `cons | |||
218 | ## Packaging | 220 | ## Packaging |
219 | 221 | ||
220 | ```bash | 222 | ```bash |
221 | npm run build | 223 | # On Unix |
224 | ./scripts/build-unix.sh | ||
225 | |||
226 | # On Windows | ||
227 | .\scripts\build-windows.ps1 | ||
222 | ``` | 228 | ``` |
223 | 229 | ||
224 | Assets will be available in the `out` folder. | 230 | Assets will be available in the `out` folder. |
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh new file mode 100755 index 000000000..e80c38059 --- /dev/null +++ b/scripts/build-unix.sh | |||
@@ -0,0 +1,135 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # INTRO: | ||
4 | # This file is used to build ferdium on both x64 and arm-based for macos and linux (not tested on arm for linux). | ||
5 | # It also handles any corrupted node modules with the 'CLEAN' env var (set it to 'true' for cleaning) | ||
6 | # It will install the system dependencies except for node (which is still verified) | ||
7 | # I sometimes symlink my 'recipes' folder so that any changes that I need to do in it can also be committed and pushed | ||
8 | # This file can live anywhere in your PATH | ||
9 | |||
10 | set -e | ||
11 | |||
12 | export ELECTRON_CACHE=$HOME/.cache/electron | ||
13 | export ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder | ||
14 | export CSC_IDENTITY_AUTO_DISCOVERY=false | ||
15 | export CI=true | ||
16 | |||
17 | # ----------------------------------------------------------------------------- | ||
18 | # Utility functions | ||
19 | fail_with_docs() { | ||
20 | printf "\n*************** FAILING ***************\n" | ||
21 | echo "$1" | ||
22 | echo "" | ||
23 | echo "Please read the developer documentation in CONTRIBUTING.md" | ||
24 | exit 1 | ||
25 | } | ||
26 | |||
27 | command_exists() { | ||
28 | type "$1" &>/dev/null 2>&1 | ||
29 | } | ||
30 | |||
31 | # ----------------------------------------------------------------------------- | ||
32 | # Checking the developer environment | ||
33 | # checking for installed programmes | ||
34 | command_exists node || fail_with_docs "Node is not installed" | ||
35 | command_exists jq || fail_with_docs "jq is not installed" | ||
36 | |||
37 | EXPECTED_NODE_VERSION=$(cat .nvmrc) | ||
38 | ACTUAL_NODE_VERSION=$(node -v) | ||
39 | if [ "v$EXPECTED_NODE_VERSION" != "$ACTUAL_NODE_VERSION" ]; then | ||
40 | fail_with_docs "You are not running the expected version of node! | ||
41 | expected: [v$EXPECTED_NODE_VERSION] | ||
42 | actual : [$ACTUAL_NODE_VERSION]" | ||
43 | fi | ||
44 | |||
45 | # Check if the 'recipes' folder is present either as a git submodule or a symbolic link | ||
46 | if ! [ -f "recipes/package.json" ]; then | ||
47 | fail_with_docs "'recipes' folder is missing or submodule has not been checked out" | ||
48 | fi | ||
49 | |||
50 | # This log statement is only to remind me which 'recipes' folder I am using (symlink or git submodule) | ||
51 | if [[ -L recipes ]]; then | ||
52 | printf "\n*************** CONTINUING for 'recipes' symlinked ***************\n" | ||
53 | else | ||
54 | printf "\n*************** CONTINUING for 'recipes' submodule ***************\n" | ||
55 | fi | ||
56 | |||
57 | # ----------------------------------------------------------------------------- | ||
58 | # If you are moving to a new version of node or any other system dependency, then cleaning is recommended | ||
59 | # so that there's no irregular results due to cached modules | ||
60 | if [ "$CLEAN" != "true" ]; then | ||
61 | printf "\n*************** SKIPPING Cleaning ***************\n" | ||
62 | else | ||
63 | printf "\n*************** Cleaning!!!!!! ***************\n" | ||
64 | npm cache clean --force | ||
65 | rm -rf ~/.npm ~/.node-gyp ~/.asdf/installs/nodejs/*/.npm/ | ||
66 | if [[ -s 'pnpm-lock.yaml' ]]; then | ||
67 | pnpm store prune || true # in case the pnpm executable itself is not present | ||
68 | rm -rf ~/.pnpm-store ~/.pnpm-state | ||
69 | fi | ||
70 | |||
71 | git -C recipes clean -fxd # Clean recipes folder/submodule | ||
72 | git clean -fxd # Note: This will blast away the 'recipes' folder if you have symlinked it | ||
73 | fi | ||
74 | |||
75 | # ----------------------------------------------------------------------------- | ||
76 | printf "\n*************** Installing node dependencies ***************\n" | ||
77 | # If 'asdf' is installed, reshim for new nodejs if necessary | ||
78 | command_exists asdf && asdf reshim nodejs | ||
79 | |||
80 | # Ensure that the system dependencies are at the correct version | ||
81 | EXPECTED_NPM_VERSION=$(jq --raw-output .engines.npm <"package.json") | ||
82 | EXPECTED_PNPM_VERSION=$(jq --raw-output .engines.pnpm <"./recipes/package.json") | ||
83 | if [[ "$(npm --version)" != "$EXPECTED_NPM_VERSION" ]]; then | ||
84 | npm i -gf "npm@$EXPECTED_NPM_VERSION" | ||
85 | fi | ||
86 | if [[ "$(pnpm --version)" != "$EXPECTED_PNPM_VERSION" ]]; then | ||
87 | npm i -gf "pnpm@$EXPECTED_PNPM_VERSION" | ||
88 | fi | ||
89 | |||
90 | # If 'asdf' is installed, reshim for new nodejs if necessary | ||
91 | command_exists asdf && asdf reshim nodejs | ||
92 | |||
93 | # This is useful if we move from 'npm' to 'pnpm' for the main repo as well | ||
94 | if [[ -s 'pnpm-lock.yaml' ]]; then | ||
95 | BASE_CMD=pnpm | ||
96 | else | ||
97 | BASE_CMD=npm | ||
98 | fi | ||
99 | |||
100 | # Now the meat..... | ||
101 | $BASE_CMD i | ||
102 | $BASE_CMD run prepare-code | ||
103 | |||
104 | # ----------------------------------------------------------------------------- | ||
105 | printf "\n*************** Building recipes ***************\n" | ||
106 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
107 | pushd recipes | ||
108 | pnpm i | ||
109 | pnpm run package | ||
110 | popd | ||
111 | |||
112 | # ----------------------------------------------------------------------------- | ||
113 | printf "\n*************** Building app ***************\n" | ||
114 | if [[ "$(uname -m)" =~ "arm" ]]; then | ||
115 | TARGET_ARCH=arm64 | ||
116 | else | ||
117 | TARGET_ARCH=x64 | ||
118 | fi | ||
119 | |||
120 | if [[ "$(uname)" =~ "Darwin" ]]; then | ||
121 | TARGET_OS="mac" | ||
122 | else | ||
123 | TARGET_OS="linux" | ||
124 | fi | ||
125 | |||
126 | $BASE_CMD run build -- "--$TARGET_ARCH" --"$TARGET_OS" --dir | ||
127 | |||
128 | printf "\n*************** App successfully built! ***************\n" | ||
129 | # Final check to ensure that the version built is the same as the latest commit | ||
130 | cat build/buildInfo.json | ||
131 | git --no-pager log -1 | ||
132 | if [[ $(git rev-parse --short HEAD) != $(jq --raw-output .gitHashShort <"build/buildInfo.json") ]]; then | ||
133 | echo "The built version is not on the latest commit" | ||
134 | exit 1 | ||
135 | fi | ||
diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1 new file mode 100644 index 000000000..9d4219ffb --- /dev/null +++ b/scripts/build-windows.ps1 | |||
@@ -0,0 +1,100 @@ | |||
1 | # INTRO: | ||
2 | # This file is used to build ferdium on windows. | ||
3 | # It also handles any corrupted node modules with the 'CLEAN' env var (set it to 'true' for cleaning) | ||
4 | # It will install the system dependencies except for node (which is still verified) | ||
5 | # I sometimes symlink my 'recipes' folder so that any changes that I need to do in it can also be committed and pushed | ||
6 | # This file can live anywhere in your PATH | ||
7 | |||
8 | #CHECK PYTHON | ||
9 | #CHECK NODE.JS | ||
10 | #CHECK NPM | ||
11 | #CHECK MSVS_VERSION and MSVS Tools | ||
12 | |||
13 | $USERHOME = "${env:HOMEDRIVE}${env:HOMEPATH}" | ||
14 | |||
15 | $env:ELECTRON_CACHE = $USERHOME + '/.cache/electron' | ||
16 | $env:ELECTRON_BUILDER_CACHE = $USERHOME + '/.cache/electron-builder' | ||
17 | $env:CSC_IDENTITY_AUTO_DISCOVERY = $false | ||
18 | |||
19 | $env:CI = $true | ||
20 | |||
21 | $EXPECTED_NODE_VERSION = (Get-Content .\.nvmrc) | ||
22 | $ACTUAL_NODE_VERSION = (node -v) | ||
23 | |||
24 | if ( "v$EXPECTED_NODE_VERSION" -ne $ACTUAL_NODE_VERSION) | ||
25 | { | ||
26 | Write-Host "You are not running the expected version of node!" | ||
27 | Write-Host " expected: [v$EXPECTED_NODE_VERSION]" | ||
28 | Write-Host " actual : [$ACTUAL_NODE_VERSION]" | ||
29 | exit 1 | ||
30 | } | ||
31 | |||
32 | if ( $env:CLEAN -eq "true" ) | ||
33 | { | ||
34 | $NPM_PATH = "$USERHOME\.npm" | ||
35 | $NODE_GYP = "$USERHOME\.node-gyp" | ||
36 | |||
37 | Write-Host "Cleaning!" | ||
38 | npm cache clean --force | ||
39 | Remove-Item -Path $NPM_PATH -Recurse | ||
40 | Remove-Item -Path $NODE_GYP -Recurse | ||
41 | |||
42 | if ( Test-Path -Path ".\pnpm-lock.yaml" -and (Get-Command -ErrorAction Ignore -Type Application pnpm) ) | ||
43 | { | ||
44 | $PNPM_STORE = "$USERHOME\.pnpm-store" | ||
45 | $PNPM_STATE = "$USERHOME\.pnpm-state" | ||
46 | |||
47 | pnpm store prune | ||
48 | |||
49 | Remove-Item -Path $PNPM_STORE -Recurse | ||
50 | Remove-Item -Path $PNPM_STATE -Recurse | ||
51 | } | ||
52 | |||
53 | git -C recipes clean -fxd | ||
54 | git clean -fxd # Note: This will blast away the 'recipes' folder if you have symlinked it | ||
55 | } | ||
56 | |||
57 | # Ensure that the system dependencies are at the correct version | ||
58 | npm i -gf npm@8.7.0 | ||
59 | npm i -gf pnpm@6.32.8 | ||
60 | |||
61 | # This is useful if we move from 'npm' to 'pnpm' for the main repo as well | ||
62 | if ( (Test-Path -Path ".\pnpm-lock.yaml") -and (Get-Command -ErrorAction Ignore -Type Application pnpm) ) | ||
63 | { | ||
64 | $BASE_CMD="pnpm" | ||
65 | $env:EXEC_CMD="pnpm dlx" | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | $BASE_CMD="npm" | ||
70 | $env:EXEC_CMD="npx" | ||
71 | } | ||
72 | |||
73 | # Now the meat..... | ||
74 | & $BASE_CMD i | ||
75 | & $BASE_CMD run prepare-code | ||
76 | |||
77 | # Check if the 'recipes' folder is present either as a git submodule or a symbolic link | ||
78 | if (-not (Test-Path -Path ".\recipes\package.json")) | ||
79 | { | ||
80 | try { | ||
81 | git submodule update --init --recursive --remote --rebase --force | ||
82 | } catch { | ||
83 | Write-Host "FAILING since 'recipes' folder/submodule has not been checked out" | ||
84 | exit 1 | ||
85 | } | ||
86 | } | ||
87 | |||
88 | # Note: 'recipes' is already using only pnpm - can switch to $BASE_CMD AFTER both repos are using pnpm | ||
89 | Set-Location recipes | ||
90 | pnpm i | ||
91 | pnpm run package | ||
92 | Set-Location .. | ||
93 | |||
94 | $TARGET_ARCH="x64" | ||
95 | & $BASE_CMD run build -- --$TARGET_ARCH --dir | ||
96 | |||
97 | # Final check to ensure that the version built is the same as the latest commit | ||
98 | # TODO: Need to make this an assertion similar to tthe unix-equivalent | ||
99 | Get-Content "build/buildInfo.json" | ConvertFrom-Json | ||
100 | git log -1 | ||