diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 6e57683795..0000000000 --- a/.dockerignore +++ /dev/null @@ -1,28 +0,0 @@ -.DS_Store -/node_modules -/bower_components -/platforms -/coverage -/release-builds -/www -/.idea -/docs-build -/plugins -/.git - -npm-debug.log* -yarn-debug.log* -yarn-error.log* -yarn.lock -build.json - -*.zip -plugins/**/*.pbxproj -Icon^M^M - -.devserver -config.xml.original - -# Xcode (Cordova plugin) -xcuserdata/ -IDEWorkspaceChecks.plist diff --git a/.eslintrc.json b/.eslintrc.json index 2efb0a6b38..81d5e078f0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -115,7 +115,16 @@ "dyad", "Dyad", "hostname", - "searchable" + "searchable", + "ios", + "mailto", + "nodebuffer", + "preload", + "reduxstore", + "renderer", + "utils", + "loopback", + "unicast" ], "skipIfMatch": [ "http(s)?://[^s]*", @@ -139,5 +148,25 @@ "minLength": 3 } ] - } + }, + "overrides": [ + { + "files": ["**/*.test.js", "**/__tests__/**", "**/__mocks__/**", "vitest.setup.js"], + "rules": { + "react/no-unknown-property": "off" + }, + "globals": { + "vi": "readonly", + "describe": "readonly", + "it": "readonly", + "test": "readonly", + "expect": "readonly", + "beforeAll": "readonly", + "afterAll": "readonly", + "beforeEach": "readonly", + "afterEach": "readonly", + "vitest": "readonly" + } + } + ] } diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 246912188b..721715a6cb 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -11,36 +11,16 @@ jobs: dist: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - submodules: recursive - # Set python version to 2.x due to node-gyp and sass - - uses: actions/setup-python@v4 - with: - python-version: "3.10.12" - # Set node version - - uses: actions/setup-node@v4 - with: - node-version: "14.21.3" - - name: Set NPM 7 - run: npm install -g npm@8.19.4 - # Cache node_modules - - uses: actions/cache@v4 - env: - cache-name: cache-node-modules - with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} - - - name: Install MDNS build dependencies - run: | - sudo apt-get update - sudo apt-get install libavahi-compat-libdnssd-dev + node-version: "24" + cache: npm - - name: Install node modules - run: npm install + - name: Install dependencies + run: npm ci - - name: Dist + - name: Dist (Linux) run: npm run dist:linux -- --publish always env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index debd856ccc..8fa7731360 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,73 +11,33 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - submodules: recursive - # Set python version to 2.x due to node-gyp and sass - - uses: actions/setup-python@v4 - with: - python-version: "3.10.12" - # Set node version - - uses: actions/setup-node@v4 - with: - node-version: "14.21.3" - - name: Set NPM 7 - run: npm install -g npm@8.19.4 - # Cache node_modules - - uses: actions/cache@v4 - env: - cache-name: cache-node-modules - with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} - - - name: Install MDNS build dependencies - run: | - sudo apt-get update - sudo apt-get install libavahi-compat-libdnssd-dev + node-version: "24" + cache: npm - - name: Install node modules - run: npm install + - name: Install dependencies + run: npm ci - name: Lint run: npm run lint -- --max-warnings 0 && npm run sass-lint -- --max-warnings 0 - - name: Run tests - run: npm run test + - name: Test + run: npm run test:ci build: needs: test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 + - uses: actions/setup-node@v6 with: - submodules: recursive - # Set python version to 2.x due to node-gyp and sass - - uses: actions/setup-python@v4 - with: - python-version: "3.10.12" - # Set node version - - uses: actions/setup-node@v4 - with: - node-version: "14.21.3" - - name: Set NPM 7 - run: npm install -g npm@8.19.4 - # Cache node_modules - - uses: actions/cache@v4 - env: - cache-name: cache-node-modules - with: - path: "**/node_modules" - key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} - - - name: Install MDNS build dependencies - run: | - sudo apt-get update - sudo apt-get install libavahi-compat-libdnssd-dev + node-version: "24" + cache: npm - - name: Install node modules - run: npm install + - name: Install dependencies + run: npm ci - - name: Build - run: npm run build:electron + - name: Build (Vite + Electron) + run: npm run build diff --git a/.gitignore b/.gitignore index 8a73b0875a..b32e2fb937 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,10 @@ /docs-build /plugins +# Build output +/out +/dist + npm-debug.log* yarn-debug.log* yarn-error.log* diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 434e4987cf..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "src/utils/networkQuery"] - path = src/utils/networkQuery - url = https://github.com/complexdatacollective/networkQuery -[submodule "src/utils/protocol/protocol-validation"] - path = src/utils/protocol/protocol-validation - url = https://github.com/complexdatacollective/protocol-validation.git -[submodule "src/utils/network-exporters"] - path = src/utils/network-exporters - url = https://github.com/complexdatacollective/network-exporters diff --git a/.node-version b/.node-version index f46d5e3942..a45fd52cc5 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -14.21.3 +24 diff --git a/.npmrc b/.npmrc index 5a89ce15d7..84b7e9d0a5 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ save-prefix=~ -arch=x64 \ No newline at end of file +legacy-peer-deps=true \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24 diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..90fc88f7ec --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Dev: Vite + Electron", + "detail": "Start the Vite dev server and launch Electron (electron-vite dev)", + "type": "npm", + "script": "dev", + "problemMatcher": [], + "isBackground": true, + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "clear": true + } + } + ] +} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ea6b990f76..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -# FROM node:8.16-jessie as base -# Pull base image. -FROM ubuntu:16.04 as base - -# Install Node.js -RUN apt-get update -RUN apt-get install -y curl -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - -RUN apt-get update -# Things we want -RUN apt-get install -y nodejs build-essential git xvfb -# Things we seem to need -RUN apt-get install -y libavahi-compat-libdnssd-dev libxtst6 libxss1 libgtk2.0-0 libgtk-3-0 libnss3 libasound2 libgconf-2-4 -RUN apt-get install -y avahi-daemon avahi-discover libnss-mdns -# RUN apt-get install g++-multilib lib32z1 lib32ncurses5 -y -# RUN apt-get install rpm fakeroot dpkg libdbus-1-dev libx11-dev -y -# RUN apt-get install libavahi-compat-libdnssd-dev g++ -y -# RUN apt-get install gcc-4.8-multilib g++-4.8-multilib -y -# RUN apt-get install libgtk2.0-0 libgtk2.0-dev xvfb -y -# RUN apt-get install libxtst6 -y -# RUN apt-get install libxss1 libnss3 libasound2 libgconf-2-4 -y - -FROM base as environment -ENV ELECTRON_ENABLE_STACK_DUMPING true -ENV ELECTRON_ENABLE_LOGGING true -ENV DISPLAY :99.0 -ENV SCREEN_GEOMETRY "1440x900x24" -ENV CHROMEDRIVER_WHITELISTED_IPS "127.0.0.1" -# ENV CHROMEDRIVER_PORT 4444 -# ENV CHROMEDRIVER_URL_BASE '' -# ENV CHROMEDRIVER_EXTRA_ARGS '' - -FROM environment as build -WORKDIR /app - -# Npm install -COPY package.json /app -COPY package-lock.json /app -RUN npm install - -# Necessary config for builds -COPY .eslintrc.json /app -COPY .eslintignore /app -COPY babel.config.js /app - -CMD ["/usr/bin/env bash"] diff --git a/README.md b/README.md index 67d347e421..d0a49c5690 100644 --- a/README.md +++ b/README.md @@ -1,175 +1,84 @@ # Network Canvas Interviewer [](https://travis-ci.org/codaco/Network-Canvas) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fcodaco%2FNetwork-Canvas?ref=badge_shield) Technologies used: -ES6 (via Babel) React Redux -Electron -Cordova +Electron 42 (desktop) +Capacitor (iOS / Android) +Vite + electron-vite (build) SCSS -Jest (Testing suite) -React Scripts +Vitest (testing suite) # Operation -## Node/NPM Version +## Requirements -This project currently requires version `14.21.3` of node, and version `8.3.2` of npm. These are the only supported versions for this project. - -As a convenience, the repository contains a `.node-version` file that enables convinient use of a node environment manager. - -## Windows Environment - -There are some additional requirements for the [MDNS](https://www.npmjs.com/package/mdns) native dependency. - -### Before running `npm install` - -1. Run powershell as admin (right-click option) and then run: -``` -npm --add-python-to-path install --global windows-build-tools -``` -2. Install [Bonjour SDK for Windows](https://developer.apple.com/download/more/?=Bonjour%20SDK%20for%20Windows) -(requires an apple id associated with a paid team account). Select "Bonjour SDK for Windows v.3.0". `BONJOUR_SDK_HOME` should be set for you after installation completes. -3. Restart powershell and continue with [project installation](#installation). - -### After running `npm install` - -Once you've completed `npm install`, you will need to rebuild MDNS with the Electron headers: - -``` -cd node_modules\mdns -npx node-gyp rebuild --target=9.0.0 --arch=x64 --dist-url=https://electronjs.org/headers -``` - -`target` must match the electron version installed by npm - -#### Linux MDNS - -On Debian like systems, you may need to enable ipv6 dns resolution. Do this by ensuring: - -``` -hosts: files mdns4_minimal mdns6_minimal [NOTFOUND=return] dns -``` - -Is added to to `/etc/msswitch.conf`. - -### Troubleshooting - -- Native dependencies won't compile - + `windows-build-tools` should have installed the required compilers - + [MS notes on config for native modules](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) - + ...You could install python and VS Build Tools manually; you should *not* need all of Visual Studio -- Runtime error related to DLL initialization - + Make sure the "rebuild" step above works - + [More Info](https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md#using-native-node-modules) -- MDNS doesn't work on linux (getaddr - + Try adding `hosts: files mdns4_minimal mdns6_minimal [NOTFOUND=return] dns` to `/etc/msswitch.conf` +This project requires Node.js 24 (LTS). A `.node-version` / `.nvmrc` file is provided for use with a node version manager (fnm, nvm). ## Installation -0. Install the correct node and npm versions. +0. Install Node.js 24 LTS. A `.node-version` / `.nvmrc` file is provided for use with a node version manager (fnm, nvm). 1. Clone this repository. -2. Fetch submodules by typing `git submodule update --init --recursive -f`. -3. Enter the directory where the repository is cloned, and install the project dependencies by typing `npm install`. -4. Refer to the development tasks section below to learn how to test and build the app. +2. Install the project dependencies by typing `npm install`. +3. Refer to the development tasks section below to learn how to test and build the app. -Note: for Apple Silicon users, you need to install the `electron` package manually: - -```sh - npm install electron --arch=x64 -``` +> **Note:** As of recent versions, Electron no longer downloads its binary during `npm install` (the `postinstall` step was removed for supply-chain security). The binary is fetched automatically the first time Electron is launched (e.g. `npm run dev`). To pre-download it explicitly, run `npm run download:electron`. Use `ELECTRON_INSTALL_PLATFORM` / `ELECTRON_INSTALL_ARCH` to fetch a binary for a different target. ## Development Tasks |`npm run
+