From 14c838053ab85eee19a012cdef380ed727363e97 Mon Sep 17 00:00:00 2001 From: Emi Date: Mon, 9 Oct 2023 11:56:53 +0200 Subject: [PATCH] Revert "Adjust project bootstrap scripts to be windows-friendly (#1870)" This reverts commit ced2181572303b5cdff7edbbc40ef8e5b9065266. --- .github/actions/setup-env/action.yml | 11 ----------- CHANGELOG.md | 2 -- packages/backend/.gitattributes | 5 ----- packages/backend/electron-fetch-git.patch | 18 ------------------ packages/backend/package-lock.json | 19 +++---------------- packages/backend/package.json | 11 +++-------- packages/desktop/README.md | 14 -------------- packages/desktop/package-lock.json | 17 ----------------- packages/desktop/package.json | 5 +---- packages/mobile/package-lock.json | 17 ----------------- packages/mobile/package.json | 12 +++--------- 11 files changed, 10 insertions(+), 121 deletions(-) delete mode 100644 packages/backend/.gitattributes delete mode 100644 packages/backend/electron-fetch-git.patch diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml index d90777acdf..56af1bd3d7 100644 --- a/.github/actions/setup-env/action.yml +++ b/.github/actions/setup-env/action.yml @@ -51,7 +51,6 @@ runs: shell: bash - name: "Bootstrap project" - if: ${{ runner.os != 'Windows' }} run: | if [[ ! -z "${{ inputs.bootstrap-packages }}" ]] then @@ -60,13 +59,3 @@ runs: lerna bootstrap fi shell: bash - - - name: "Bootstrap project on windows" - if: ${{ runner.os == 'Windows' }} - run: | - if ( "${{ inputs.bootstrap-packages }}" ) { - lerna bootstrap --scope '{${{ inputs.bootstrap-packages }},}' - } else { - lerna bootstrap - } - shell: powershell diff --git a/CHANGELOG.md b/CHANGELOG.md index f8e3014843..6a35298c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,8 +23,6 @@ * Bump github actions/* to versions using node16 -* Project can now be bootstraped on Windows (powershell) - * Placeholder(...) for community name * No unregistered/duplicated label for system messages diff --git a/packages/backend/.gitattributes b/packages/backend/.gitattributes deleted file mode 100644 index 2271e38305..0000000000 --- a/packages/backend/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -# Set the default behavior, in case people don't have core.autocrlf set. -* text=auto - -# Declare files that will always have CRLF line endings on checkout. -electron-fetch-git.patch text eol=crlf \ No newline at end of file diff --git a/packages/backend/electron-fetch-git.patch b/packages/backend/electron-fetch-git.patch deleted file mode 100644 index 68534bfed9..0000000000 --- a/packages/backend/electron-fetch-git.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/packages/backend/node_modules/electron-fetch/lib/index.js b/packages/backend/node_modules/electron-fetch/lib/index.js -index c9ea590d9..74c0757a8 100644 ---- a/packages/backend/node_modules/electron-fetch/lib/index.js -+++ b/packages/backend/node_modules/electron-fetch/lib/index.js -@@ -1283,12 +1283,7 @@ function getNodeRequestOptions(request) { - - let electron; // istanbul ignore else - --if (process.versions.electron) { -- electron = require('electron'); --} -- --const isReady = electron && electron.app && !electron.app.isReady() ? new Promise(resolve => electron.app.once('ready', resolve)) : Promise.resolve(); -- -+const isReady = Promise.resolve(); - /** - * Fetch function - * diff --git a/packages/backend/package-lock.json b/packages/backend/package-lock.json index ae6e0430d6..10d0b230c5 100644 --- a/packages/backend/package-lock.json +++ b/packages/backend/package-lock.json @@ -79,7 +79,10 @@ "fetch-mock-jest": "^1.5.1", "jest": "^29.4.2", "mock-fs": "^5.1.2", +<<<<<<< HEAD "run-script-os": "1.1.6", +======= +>>>>>>> parent of ced218157 (Adjust project bootstrap scripts to be windows-friendly (#1870)) "tmp": "^0.2.1", "ts-jest": "^29.0.3", "ts-loader": "9.4.2", @@ -20050,16 +20053,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true, - "bin": { - "run-os": "index.js", - "run-script-os": "index.js" - } - }, "node_modules/rxjs": { "version": "7.8.1", "license": "Apache-2.0", @@ -35456,12 +35449,6 @@ "queue-microtask": "^1.2.2" } }, - "run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true - }, "rxjs": { "version": "7.8.1", "requires": { diff --git a/packages/backend/package.json b/packages/backend/package.json index 294568124b..5c96120f24 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -10,18 +10,14 @@ "private": true, "scripts": { "build": "tsc -p tsconfig.build.json", - "webpack": "run-script-os", - "webpack:default": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs", + "webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs", "webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs", - "webpack:windows": "webpack --env mode=development && xcopy .\\lib\\bundle.cjs ..\\backend-bundle\\ /Y", - "webpack:prod:windows": "webpack --env mode=production && xcopy .\\lib\\bundle.cjs ..\\backend-bundle\\ /Y", - "applyPatches": "run-script-os", - "applyPatches:default": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true", - "applyPatches:windows": "git apply ./electron-fetch-git.patch --whitespace=fix --reject --verbose --no-index --ignore-space-change --inaccurate-eof || cd .", + "applyPatches": "patch -f -p0 < ./electron-fetch.patch || true && patch -f -p0 --forward --binary < ./parse-duration.patch || true && patch -f -p0 --forward --binary < ./parse-duration-esm.patch || true", "prepare": "npm run applyPatches && npm run webpack", "version": "git add -A src", "lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix", "lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/", + "test2": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js", "test-nest": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js --detectOpenHandles --forceExit ./src/nest/**/*.spec.ts", "test": "cross-env NODE_OPTIONS=--experimental-vm-modules DEBUG=ipfs:*,backend:* node_modules/jest/bin/jest.js ./src/**/* --runInBand --verbose --testPathIgnorePatterns=\".src/(!?nodeTest*)|(.node_modules*)\"", "test-ci": "cross-env NODE_OPTIONS=--experimental-vm-modules jest ./src/**/* --runInBand --colors --ci --silent --verbose --testPathIgnorePatterns=\".src/nest/(!?nodeTest*)|(.node_modules*)|src/nest/.*\\.tor.spec\\.(t|j)s|src/nest/ipfs-file-manager/big-files.long.spec.ts$\"", @@ -77,7 +73,6 @@ "fetch-mock-jest": "^1.5.1", "jest": "^29.4.2", "mock-fs": "^5.1.2", - "run-script-os": "1.1.6", "tmp": "^0.2.1", "ts-jest": "^29.0.3", "ts-loader": "9.4.2", diff --git a/packages/desktop/README.md b/packages/desktop/README.md index ca80365377..c58c4b3d5c 100644 --- a/packages/desktop/README.md +++ b/packages/desktop/README.md @@ -20,20 +20,6 @@ npm run start ``` ---- -## Running dev desktop on Windows - -Bootstrap scripts has been adjusted to work on Windows (powershell or cmd) hovewer there still may be a problem with patching. -Getting error: - -``` -webpack://@quiet/backend/./node_modules/electron/index.js?:9 - throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again') -``` - -while running desktop may mean that applying patch in packages/backend (`npm run applyPatches`) did not work correctly. -If that's the case file must be patched manually according to `electron-fetch-git.patch` and backend must be rebuilt by running `npm run webpack` in packages/backend. - - ## Versioning packages Before trying to release a new version, make sure you have `GH_TOKEN` env set. diff --git a/packages/desktop/package-lock.json b/packages/desktop/package-lock.json index 12370c6f59..1128f42cf8 100644 --- a/packages/desktop/package-lock.json +++ b/packages/desktop/package-lock.json @@ -134,7 +134,6 @@ "redux-saga-test-plan": "^4.0.3", "redux-thunk": "^2.3.0", "reselect": "^4.1.5", - "run-script-os": "1.1.6", "socket.io-mock": "^1.3.2", "source-map-loader": "^4.0.1", "standard": "^12.0.1", @@ -40259,16 +40258,6 @@ "aproba": "^1.1.1" } }, - "node_modules/run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true, - "bin": { - "run-os": "index.js", - "run-script-os": "index.js" - } - }, "node_modules/rxjs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz", @@ -76835,12 +76824,6 @@ "aproba": "^1.1.1" } }, - "run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true - }, "rxjs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 57d050383c..5ac8566d23 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -120,9 +120,7 @@ "rmDist": "rimraf dist/", "setMainEnvs": "node scripts/setMainEnvs.js", "copyMainEnvs": "cp mainEnvs.json dist/main", - "copyFonts": "run-script-os", - "copyFonts:windows": "xcopy src\\renderer\\fonts\\* dist\\main /Y", - "copyFonts:default": "cp src/renderer/fonts/* dist/main" + "copyFonts": "cp src/renderer/fonts/* dist/main" }, "dependencies": { "@electron/remote": "^2.0.8", @@ -258,7 +256,6 @@ "redux-saga-test-plan": "^4.0.3", "redux-thunk": "^2.3.0", "reselect": "^4.1.5", - "run-script-os": "1.1.6", "socket.io-mock": "^1.3.2", "source-map-loader": "^4.0.1", "standard": "^12.0.1", diff --git a/packages/mobile/package-lock.json b/packages/mobile/package-lock.json index 75417add07..afc7ebbf53 100644 --- a/packages/mobile/package-lock.json +++ b/packages/mobile/package-lock.json @@ -98,7 +98,6 @@ "react-native-version": "^4.0.0", "react-test-renderer": "18.1.0", "redux-saga-test-plan": "^4.0.1", - "run-script-os": "1.1.6", "socket.io-mock": "^1.3.2", "typescript": "^4.9.3" } @@ -22419,16 +22418,6 @@ "aproba": "^1.1.1" } }, - "node_modules/run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true, - "bin": { - "run-os": "index.js", - "run-script-os": "index.js" - } - }, "node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", @@ -43257,12 +43246,6 @@ "aproba": "^1.1.1" } }, - "run-script-os": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/run-script-os/-/run-script-os-1.1.6.tgz", - "integrity": "sha512-ql6P2LzhBTTDfzKts+Qo4H94VUKpxKDFz6QxxwaUZN0mwvi7L3lpOI7BqPCq7lgDh3XLl0dpeXwfcVIitlrYrw==", - "dev": true - }, "rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 276332d4ab..ddbf82f119 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -12,18 +12,12 @@ "lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix", "lint-ci": "eslint --ext .jsx,.js,.ts,.tsx ./src/", "gen": "plop", - "prepare-backend-assets": "run-script-os", - "prepare-backend-assets:default": "mkdir -p ./nodejs-assets/nodejs-project && cp ../backend/lib/bundle.cjs ./nodejs-assets/nodejs-project/bundle.cjs", - "prepare-backend-assets:windows": "mkdir .\\nodejs-assets\\nodejs-project || cd . && xcopy ..\\backend\\lib\\bundle.cjs .\\nodejs-assets\\nodejs-project\\ /Y", + "prepare-backend-assets": "mkdir -p ./nodejs-assets/nodejs-project && cp ../backend/lib/bundle.cjs ./nodejs-assets/nodejs-project/bundle.cjs", "patch-state-manager": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || patch -f -d ../state-manager -p0 < ./factory-girl.patch || true", "patch-react-native": "patch -f -p0 --forward --binary < ./react-native.patch || true", "patch-webview-crypto": "patch -f -p0 --forward --binary < ./react-native-webview-crypto.patch || true", - "override-dlopen": "run-script-os", - "override-dlopen:default": "cd ./nodejs-assets/nodejs-project && cp ../override-dlopen-paths-preload.js ./ && cp ../override-dlopen-paths-data.json ./", - "override-dlopen:windows": "cd ./nodejs-assets/nodejs-project && xcopy ..\\override-dlopen-paths-preload.js .\\ /Y && xcopy ..\\override-dlopen-paths-data.json .\\ /Y", - "prepare": "run-script-os", - "prepare:default": "npm run prepare-backend-assets && npm run override-dlopen && npm run patch-state-manager && npm run patch-react-native && npm run patch-webview-crypto && npm run build", - "prepare:windows": "npm run prepare-backend-assets && npm run override-dlopen && npm run build", + "override-dlopen": "cd ./nodejs-assets/nodejs-project && cp ../override-dlopen-paths-preload.js ./ && cp ../override-dlopen-paths-data.json ./", + "prepare": "npm run prepare-backend-assets && npm run override-dlopen && npm run patch-state-manager && npm run patch-react-native && npm run patch-webview-crypto && npm run build", "version": "react-native-version --skip-tag" }, "dependencies": {