feat: add desktop repo (#1071)

This commit is contained in:
Mo
2022-06-07 11:52:15 -05:00
committed by GitHub
parent 0bb12db948
commit 0b7ce82aaa
135 changed files with 17821 additions and 180 deletions

View File

@@ -6,12 +6,9 @@
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:react-hooks/recommended",
"./../../node_modules/@standardnotes/config/src/.eslintrc"
"../../node_modules/@standardnotes/config/src/.eslintrc"
],
"plugins": ["@typescript-eslint", "react", "react-hooks"],
"parserOptions": {
"project": "./tsconfig.json"
},
"ignorePatterns": [".eslintrc.js", "webpack.*.js", "webpack-defaults.js", "jest.config.js", "__mocks__"],
"rules": {
"standard/no-callback-literal": 0, // Disable this as we have too many callbacks relying on literals
@@ -32,8 +29,6 @@
"browser": true
},
"globals": {
"SFJS": true,
"__VERSION__": true,
"zip": true
"__WEB_VERSION__": true
}
}

View File

@@ -14,7 +14,7 @@ module.exports = {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
globals: {
__VERSION__: '1.0.0',
__WEB_VERSION__: '1.0.0',
__DESKTOP__: false,
__WEB__: true,
self: {}, // fixes error happening on `import { SKAlert } from 'sn-stylekit'`

View File

@@ -0,0 +1,3 @@
{
"extends": "../../node_modules/@standardnotes/config/src/linter.tsconfig.json"
}

View File

@@ -8,14 +8,11 @@
"dist"
],
"scripts": {
"start": "webpack-dev-server --config webpack.dev.js",
"watch": "webpack -w --config webpack.dev.js",
"watch:desktop": "webpack -w --config webpack.dev.js --env platform='desktop'",
"start": "webpack-dev-server --config web.webpack.dev.js",
"watch": "webpack -w --config web.webpack.dev.js",
"clean": "rm -fr dist",
"prebuild": "yarn clean",
"build": "webpack --config webpack.prod.js && yarn tsc",
"build:desktop": "webpack --config webpack.prod.js --env platform='desktop'",
"build:desktop:beta": "webpack --config webpack.prod.js --env platform='desktop' --env public_beta='true'",
"build": "webpack --config web.webpack.prod.js && yarn tsc",
"lint": "eslint src/javascripts",
"tsc": "tsc --project tsconfig.json",
"test": "jest --config jest.config.js --coverage",

View File

@@ -14,6 +14,7 @@ declare global {
websocketUrl: string
electronAppVersion?: string
webClient?: DesktopManagerInterface
electronRemoteBridge?: unknown
application?: WebApplication
mainApplicationGroup?: ApplicationGroup

View File

@@ -1,8 +1,6 @@
/** Declared in webpack config */
declare const __VERSION__: string
declare const __DESKTOP__: boolean
declare const __WEB__: boolean
declare const __WEB_VERSION__: string
export const WebAppVersion = __VERSION__
export const IsDesktopPlatform = __DESKTOP__
export const IsWebPlatform = __WEB__
export const WebAppVersion = __WEB_VERSION__
export const IsDesktopPlatform = window.electronRemoteBridge != undefined
export const IsWebPlatform = window.electronRemoteBridge == undefined

View File

@@ -2,7 +2,7 @@ const path = require('path')
const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CircularDependencyPlugin = require('circular-dependency-plugin')
const mergeWithEnvDefaults = require('./webpack-defaults')
const mergeWithEnvDefaults = require('./web.webpack-defaults')
require('dotenv').config()
module.exports = (env) => {
@@ -27,9 +27,7 @@ module.exports = (env) => {
cwd: process.cwd(),
}),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(require('./package.json').version),
__WEB__: JSON.stringify(env.platform === 'web'),
__DESKTOP__: JSON.stringify(env.platform === 'desktop'),
__WEB_VERSION__: JSON.stringify(require('./package.json').version),
}),
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output

View File

@@ -1,7 +1,7 @@
const { merge } = require('webpack-merge');
const config = require('./webpack.config.js');
const config = require('./web.webpack.config.js');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const mergeWithEnvDefaults = require('./webpack-defaults.js');
const mergeWithEnvDefaults = require('./web.webpack-defaults.js');
module.exports = (env, argv) => {
const port = argv.port || 3001;

View File

@@ -1,6 +1,6 @@
const { merge } = require('webpack-merge')
const mergeWithEnvDefaults = require('./webpack-defaults.js')
const config = require('./webpack.config.js')
const mergeWithEnvDefaults = require('./web.webpack-defaults.js')
const config = require('./web.webpack.config.js')
module.exports = (env, argv) => {
mergeWithEnvDefaults(env)