diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..214388f --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/.gitignore b/.gitignore index 20128fc..46762a2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ crash.log # local env files .env.local .env.*.local -.env # Log files npm-debug.log* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c0d22c..fe8056b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,9 +5,7 @@ stages: build: stage: Build - tags: - # Use a macos runner to build. - - darwin + image: electronuserland/builder:wine before_script: - yarn script: @@ -21,18 +19,15 @@ build: dotenv: variables.env name: $CI_COMMIT_REF_SLUG paths: - - dist_electron/*.dmg - - dist_electron/*.zip - - dist_electron/*.yml + - $CI_PROJECT_DIR/dist/*.* when: on_success only: - main variables: - PACKAGE: '${APPNAME}-${VERSION}.dmg' + WIN_BINARY: '${APPNAME}-${VERSION}.exe' PACKAGE_REGISTRY_URL: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${APPNAME}/${VERSION}' -# Upload package to gitlab registry. upload: stage: Upload needs: @@ -43,8 +38,7 @@ upload: when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch script: - # Take the package we built and place it in the package registry. - - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist_electron/${PACKAGE}" "${PACKAGE_REGISTRY_URL}/${PACKAGE}"' + - 'curl --header "JOB-TOKEN: $CI_DEPLOY_PASSWORD" --upload-file "./dist/${WIN_BINARY}" "${PACKAGE_REGISTRY_URL}/${WIN_BINARY}"' auto-release-master: image: registry.gitlab.com/gitlab-org/release-cli @@ -60,4 +54,7 @@ auto-release-master: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch script: - echo "Release $VERSION" - - release-cli create --name "Release $VERSION" --tag-name v$VERSION --description "Release $CI_COMMIT_TITLE" --ref $CI_COMMIT_SHA --assets-link "{\"name\":\"${APPNAME}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${PACKAGE}\"}" + - | + release-cli create --name "Release $VERSION" --tag-name v$VERSION \ + --description 'Created using the release-cli. $CI_COMMIT_TITLE' --ref $CI_COMMIT_SHA \ + --assets-link "{\"name\":\"${APPNAME}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_BINARY}\"}" diff --git a/README.md b/README.md index c13a8ab..6fb4b27 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ yarn install ### Compiles and hot-reloads for development ``` -yarn electron:serve +yarn dev ``` ### Compiles and minifies for production @@ -15,7 +15,7 @@ yarn electron:serve yarn electron:build ``` - +``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/build/config.gypi b/build/config.gypi new file mode 100644 index 0000000..6f84ed7 --- /dev/null +++ b/build/config.gypi @@ -0,0 +1,79 @@ +# Do not edit. File was generated by node-gyp's "configure" step +{ + "target_defaults": { + "cflags": [], + "default_configuration": "Release", + "defines": [], + "include_dirs": [], + "libraries": [] + }, + "variables": { + "asan": 0, + "build_v8_with_gn": "false", + "coverage": "false", + "dcheck_always_on": 0, + "debug_nghttp2": "false", + "debug_node": "false", + "enable_lto": "false", + "enable_pgo_generate": "false", + "enable_pgo_use": "false", + "error_on_warn": "false", + "force_dynamic_crt": 0, + "host_arch": "x64", + "icu_data_in": "../../deps/icu-tmp/icudt67l.dat", + "icu_endianness": "l", + "icu_gyp_path": "tools/icu/icu-generic.gyp", + "icu_path": "deps/icu-small", + "icu_small": "false", + "icu_ver_major": "67", + "is_debug": 0, + "llvm_version": "0.0", + "napi_build_version": "6", + "node_byteorder": "little", + "node_debug_lib": "false", + "node_enable_d8": "false", + "node_install_npm": "true", + "node_module_version": 83, + "node_no_browser_globals": "false", + "node_prefix": "/", + "node_release_urlbase": "https://nodejs.org/download/release/", + "node_shared": "false", + "node_shared_brotli": "false", + "node_shared_cares": "false", + "node_shared_http_parser": "false", + "node_shared_libuv": "false", + "node_shared_nghttp2": "false", + "node_shared_openssl": "false", + "node_shared_zlib": "false", + "node_tag": "", + "node_target_type": "executable", + "node_use_bundled_v8": "true", + "node_use_dtrace": "true", + "node_use_etw": "false", + "node_use_node_code_cache": "true", + "node_use_node_snapshot": "true", + "node_use_openssl": "true", + "node_use_v8_platform": "true", + "node_with_ltcg": "false", + "node_without_node_options": "false", + "openssl_fips": "", + "openssl_is_fips": "false", + "shlib_suffix": "83.dylib", + "target_arch": "x64", + "v8_enable_31bit_smis_on_64bit_arch": 0, + "v8_enable_gdbjit": 0, + "v8_enable_i18n_support": 1, + "v8_enable_inspector": 1, + "v8_enable_pointer_compression": 0, + "v8_no_strict_aliasing": 1, + "v8_optimized_debug": 1, + "v8_promise_internal_field_count": 1, + "v8_random_seed": 0, + "v8_trace_maps": 0, + "v8_use_siphash": 1, + "want_separate_host_toolset": 0, + "xcode_version": "11.0", + "nodedir": "/Users/Enrique/Library/Caches/node-gyp/14.4.0", + "standalone_static_library": 1 + } +} diff --git a/electron.builder.yml b/electron.builder.yml new file mode 100644 index 0000000..2590695 --- /dev/null +++ b/electron.builder.yml @@ -0,0 +1,51 @@ +electronVersion: 9.0.0 +compression: normal +npmRebuild: false +# TODO: enable this in the future once we sign all the linux builds. +#forceCodeSigning: true +directories: + output: dist + buildResources: build + app: . + +mac: + category: Reference + icon: ./icons/icon.icns + target: + - target: dmg + - target: zip + + # steps for notarizing the MacOS builds: + # https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/ + + hardenedRuntime: true + gatekeeperAssess: false + entitlements: build/macos/entitlements.mac.plist + entitlementsInherit: build/macos/entitlements.mac.plist + +dmg: + # The inner app inside the .dmg is signed and there is some broken logic + # which requires that the DMG itself is not signed. + sign: false + + +nsis: + artifactName: ${name}-${version}-${arch}.${ext} + +appx: + artifactName: ${name}-${version}-${arch}.${ext} + applicationId: polar + identityName: 25130KevinBurton.PolarBookshelf + publisher: CN=D3591277-F57D-4C75-B342-D158E6C4AAF5 + publisherDisplayName: Kevin Burton + + +# https://www.electron.build/configuration/publish +# https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ +publish: + provider: github + publishAutoUpdate: true + +asar: true +afterPack: "./electron-builder-afterpack.js" +afterSign: "./build/macos/notarize.js" diff --git a/package.json b/package.json index 24d13b1..5e70fc9 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,48 @@ { "name": "Crimata", - "version": "0.9.9", - "private": true, + "productName": "Crimata Messenger", "description": "Cross-platform messenger application built with electron, vue3, and TS.", + "version": "0.9.0", + "private": true, "author": { "name": "Enrique Hernandez" }, + "main": "./src/background.ts", "scripts": { - "build": "vue-cli-service electron:build", "dev": "vue-cli-service electron:serve", + "serve": "vue-cli-service serve", + "build": "electron-builder --win", + "test:unit": "vue-cli-service test:unit", + "lint": "vue-cli-service lint", + "electron:build": "vue-cli-service electron:build", + "electron:serve": "vue-cli-service electron:serve", "postinstall": "electron-builder install-app-deps", - "postuninstall": "electron-builder install-app-deps" + "postuninstal": "electron-builder install-app-deps", + "dist": "electron-builder --publish always" + }, + "repository": { + "type": "git", + "url": "https://gitlab.com/crimata/electron-app.git", + "release": "latest" + }, + "build": { + "artifactName": "${productName}-${version}.${ext}", + "publish": { + "provider": "generic", + "url": "https://gitlab.com/api/v4/projects/25637892/jobs/artifacts/master/raw/dist?job=build" + }, + "win": { + "target": [ + "nsis" + ], + "verifyUpdateCodeSignature": false + }, + "linux": { + "target": [ + "AppImage" + ] + } }, - "main": "init.js", "dependencies": { "@google-cloud/speech": "^4.2.0", "@types/animejs": "^3.1.2", @@ -22,10 +52,8 @@ "@types/uuid": "^8.3.0", "@types/ws": "^7.2.7", "animejs": "^3.2.0", - "axios": "^0.21.1", "core-js": "^3.6.5", "electron-is-dev": "^2.0.0", - "electron-store": "^8.0.0", "electron-updater": "^4.3.8", "mitt": "^2.1.0", "naudiodon": "^2.3.2", @@ -38,8 +66,6 @@ "ws": "^7.3.1" }, "devDependencies": { - "@types/axios": "^0.14.0", - "@types/electron-devtools-installer": "^2.2.0", "@types/jest": "^24.0.19", "@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/parser": "^2.33.0", @@ -63,29 +89,11 @@ "node-sass": "^4.12.0", "optimize-wasm-webpack-plugin": "^1.0.12", "sass-loader": "^8.0.2", - "spectron": "11.0.0", + "spectron": "^11.0.0", "typescript": "~3.9.3", - "vue-cli-plugin-electron-builder": "~2.0.0-rc.6", + "vue-cli-plugin-electron-builder": "~2.0.0-rc.4", "vue-jest": "^5.0.0-0" }, - "vue": { - "lintOnSave": false, - "pluginOptions": { - "electronBuilder": { - "mainProcessFile": "./src/init.ts", - "rendererProcessFile": "./src/render/main.ts", - "preload": "./src/render/preload.ts", - "builderOptions": { - "appId": "com.crimata.ElectronUpdaterApp", - "artifactName": "${productName}-${version}.${ext}", - "publish": { - "provider": "generic", - "url": "https://gitlab.com/api/v4/projects/25637892/jobs/artifacts/main/raw/dist_electron?job=build" - } - } - } - } - }, "gitHooks": { "pre-commit": "lint-staged" }, @@ -94,11 +102,5 @@ "vue-cli-service lint", "git add" ] - }, - "productName": "crimata-messenger", - "repository": { - "type": "git", - "url": "https://gitlab.com/crimata/electron-app.git", - "release": "latest" } } diff --git a/public/index.html b/public/index.html index 8f79d27..48809d8 100644 --- a/public/index.html +++ b/public/index.html @@ -11,7 +11,11 @@ -
+ +