diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index e447237..fc0ba0f 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -45,7 +45,7 @@ jobs: node-version: ${{ matrix.node-version }} - run: | npm install - npm run make-linux + npm run make-snap - uses: actions/upload-artifact@v4 with: diff --git a/config/forge.config.appstore.js b/config/forge.config.appstore.js index ec16e7b..9063101 100644 --- a/config/forge.config.appstore.js +++ b/config/forge.config.appstore.js @@ -1,4 +1,4 @@ -const updateWebBundle = require('./scripts/update-web-bundle') +const updateWebBundle = require('../scripts/update-web-bundle') module.exports = { packagerConfig: { diff --git a/config/forge.config.incyclist.js b/config/forge.config.incyclist.js index 358de23..1b60fcc 100644 --- a/config/forge.config.incyclist.js +++ b/config/forge.config.incyclist.js @@ -1,4 +1,4 @@ -const updateWebBundle = require('./scripts/update-web-bundle') +const updateWebBundle = require('../scripts/update-web-bundle') module.exports = { packagerConfig: { diff --git a/config/forge.config.snap.js b/config/forge.config.snap.js new file mode 100644 index 0000000..4c46cf9 --- /dev/null +++ b/config/forge.config.snap.js @@ -0,0 +1,41 @@ +const updateWebBundle = require('../scripts/update-web-bundle') + +module.exports = { + packagerConfig: { + hooks: { + beforePack: async (options) => { + await updateWebBundle() + } + }, + asar: true, + appBundleId: 'com.incyclist.desktop', + name: 'Incyclist', + icon: 'res/icons/incyclist', + ignore: [ '^/.github','^/.gitignore', '^/app-tests','^coverage','^/certs', '^/entitlements','^/profiles','^/bin','^/installer','^/release','scripts','^/config','^/test','^/test-results','^/testdata','README.MD','electron-builder.yml','^/.env'] + }, + makers: [ + { + name: '@electron-forge/maker-snap', + config: { + "category":"Game", + "confinement":"devmode", + "plugs" : [ + "bluez", + "bluetooth-control", + "alsa", + "audio-playback", + "cpu-control", + "display-control", + "locale-control", + "network", + "network-bind", + "home", + "serial-port", + "removable-media" + ] + + } + + } + ] +}; diff --git a/config/linux64-installer.json b/config/linux64-installer.json index 6a94683..eace892 100644 --- a/config/linux64-installer.json +++ b/config/linux64-installer.json @@ -6,7 +6,6 @@ }, "appId": "com.incyclist.desktop", "productName": "Incyclist", - "nodeGypRebuild": false, "directories": { "app": "./", "output": "out/make", @@ -23,7 +22,22 @@ }, "snap": { "category":"Game", - "confinement":"devmode" + "confinement":"devmode", + "buildPackages": ["libusb"], + "plugs" : [ + "bluez", + "bluetooth-control", + "alsa", + "audio-playback", + "cpu-control", + "display-control", + "locale-control", + "network", + "network-bind", + "home", + "serial-port", + "removable-media" + ] }, "files": [ diff --git a/package-lock.json b/package-lock.json index b82858d..d975c86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "@electron-forge/maker-dmg": "^7.6.0", "@electron-forge/maker-pkg": "^7.6.0", "@electron-forge/maker-rpm": "^7.6.0", + "@electron-forge/maker-snap": "^7.6.0", "@electron-forge/maker-squirrel": "^7.6.0", "@electron-forge/maker-zip": "^7.6.0", "@electron-forge/plugin-auto-unpack-natives": "^7.6.0", @@ -788,6 +789,22 @@ "electron-installer-redhat": "^3.2.0" } }, + "node_modules/@electron-forge/maker-snap": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-snap/-/maker-snap-7.6.0.tgz", + "integrity": "sha512-4GTHA9XkdKWauMkJ4bXrQOx+vUlbwn3Ao524nS/fOT40BPb1/QFdFPheNnAr0SsGKuGbKuQ0W/Y22+6s5EkSQw==", + "dev": true, + "dependencies": { + "@electron-forge/maker-base": "7.6.0", + "@electron-forge/shared-types": "7.6.0" + }, + "engines": { + "node": ">= 16.4.0" + }, + "optionalDependencies": { + "electron-installer-snap": "^5.2.0" + } + }, "node_modules/@electron-forge/maker-squirrel": { "version": "7.6.0", "dev": true, @@ -5305,6 +5322,163 @@ "node": ">=10" } }, + "node_modules/electron-installer-snap": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/electron-installer-snap/-/electron-installer-snap-5.2.0.tgz", + "integrity": "sha512-SRm7pCpNHMXV545JjScV8fLC9NhFli5r8L8Ju4EHdXwRh76+mwrJoUEDLItixBudZ5Mcgz1SJcDPJfWpEQWX7Q==", + "dev": true, + "optional": true, + "dependencies": { + "@malept/cross-spawn-promise": "^1.0.0", + "debug": "^4.3.4", + "electron-installer-common": "^0.10.2", + "fs-extra": "^9.0.0", + "js-yaml": "^3.10.0", + "lodash": "^4.17.15", + "semver": "^7.1.1", + "tmp-promise": "^3.0.2", + "which": "^2.0.1", + "yargs": "^16.0.2" + }, + "bin": { + "electron-installer-snap": "src/cli.js" + }, + "engines": { + "node": ">= 10.0" + }, + "funding": { + "url": "https://github.com/electron-userland/electron-installer-snap?sponsor=1" + } + }, + "node_modules/electron-installer-snap/node_modules/@malept/cross-spawn-promise": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", + "integrity": "sha512-RTBGWL5FWQcg9orDOCcp4LvItNzUPcyEU9bwaeJX0rJ1IQxzucC48Y0/sQLp/g6t99IQgAlGIaesJS+gTn7tVQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/malept" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/subscription/pkg/npm-.malept-cross-spawn-promise?utm_medium=referral&utm_source=npm_fund" + } + ], + "optional": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/electron-installer-snap/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "optional": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/electron-installer-snap/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "optional": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/electron-installer-snap/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "optional": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/electron-installer-snap/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "optional": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/electron-installer-snap/node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "optional": true + }, + "node_modules/electron-installer-snap/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/electron-installer-snap/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "optional": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/electron-installer-snap/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "optional": true, + "engines": { + "node": ">=10" + } + }, "node_modules/electron-is-dev": { "version": "3.0.1", "license": "MIT", diff --git a/package.json b/package.json index 0601bc2..c7c875a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "package": "electron-forge package", "make": "electron-forge make", "make-linux": "electron-builder --linux --config ./config/linux64-installer.json", - "make-mas": "BUILD_TARGET=appstore && electron-forge make" + "make-mas": "BUILD_TARGET=appstore && electron-forge make", + "make-snap": "BUILD_TARGET=snap && electron-forge make" }, "repository": { "type": "git", @@ -52,6 +53,7 @@ "@electron-forge/maker-dmg": "^7.6.0", "@electron-forge/maker-pkg": "^7.6.0", "@electron-forge/maker-rpm": "^7.6.0", + "@electron-forge/maker-snap": "^7.6.0", "@electron-forge/maker-squirrel": "^7.6.0", "@electron-forge/maker-zip": "^7.6.0", "@electron-forge/plugin-auto-unpack-natives": "^7.6.0",