Navigation Menu

Skip to content

Commit

Permalink
?no
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Feb 3, 2021
1 parent 19c836e commit aff400d
Show file tree
Hide file tree
Showing 29 changed files with 3,260 additions and 262 deletions.
15 changes: 15 additions & 0 deletions packages/app/.eslintrc.json
@@ -0,0 +1,15 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings"
],
"parser": "@typescript-eslint/parser"
}
44 changes: 37 additions & 7 deletions packages/app/package.json
@@ -1,15 +1,15 @@
{
"name": "@mayonnaise/app",
"name": "app",
"productName": "app",
"version": "1.0.0",
"description": "My Electron application description",
"main": "src/index.js",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
"lint": "eslint --ext .ts ."
},
"keywords": [],
"author": {
Expand Down Expand Up @@ -41,18 +41,48 @@
"name": "@electron-forge/maker-rpm",
"config": {}
}
],
"plugins": [
[
"@electron-forge/plugin-webpack",
{
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"html": "./src/index.html",
"js": "./src/renderer.ts",
"name": "main_window"
}
]
}
}
]
]
}
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"electron": "11.2.0"
"@electron-forge/plugin-webpack": "6.0.0-beta.54",
"@marshallofsound/webpack-asset-relocator-loader": "^0.5.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"css-loader": "^4.2.1",
"electron": "11.2.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "^2.20.0",
"fork-ts-checker-webpack-plugin": "^5.0.14",
"node-loader": "^1.0.1",
"style-loader": "^1.2.1",
"ts-loader": "^8.0.2",
"typescript": "^4.0.2"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/app/src/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" href="index.css">

</head>
<body>
<h1>💖 Hello World!</h1>
Expand Down
49 changes: 0 additions & 49 deletions packages/app/src/index.js

This file was deleted.

46 changes: 46 additions & 0 deletions packages/app/src/index.ts
@@ -0,0 +1,46 @@
import { app, BrowserWindow } from 'electron';
declare const MAIN_WINDOW_WEBPACK_ENTRY: any;

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
app.quit();
}

const createWindow = (): void => {
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 600,
width: 800,
});

// and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);

// Open the DevTools.
mainWindow.webContents.openDevTools();
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});

app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.
31 changes: 31 additions & 0 deletions packages/app/src/renderer.ts
@@ -0,0 +1,31 @@
/**
* This file will automatically be loaded by webpack and run in the "renderer" context.
* To learn more about the differences between the "main" and the "renderer" context in
* Electron, visit:
*
* https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
*
* By default, Node.js integration in this file is disabled. When enabling Node.js integration
* in a renderer process, please be aware of potential security implications. You can read
* more about security risks here:
*
* https://electronjs.org/docs/tutorial/security
*
* To enable Node.js integration in this file, open up `main.js` and enable the `nodeIntegration`
* flag:
*
* ```
* // Create the browser window.
* mainWindow = new BrowserWindow({
* width: 800,
* height: 600,
* webPreferences: {
* nodeIntegration: true
* }
* });
* ```
*/

import './index.css';

console.log('👋 This message is being logged by "renderer.js", included via webpack');
20 changes: 20 additions & 0 deletions packages/app/tsconfig.json
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowJs": true,
"module": "commonjs",
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": true,
"sourceMap": true,
"baseUrl": ".",
"outDir": "dist",
"moduleResolution": "node",
"resolveJsonModule": true,
"paths": {
"*": ["node_modules/*"]
}
},
"include": [
"src/**/*"
]
}
14 changes: 14 additions & 0 deletions packages/app/webpack.main.config.js
@@ -0,0 +1,14 @@
module.exports = {
/**
* This is the main entry point for your application, it's the first file
* that runs in the main process.
*/
entry: './src/index.ts',
// Put your normal webpack config below here
module: {
rules: require('./webpack.rules'),
},
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json']
},
};
5 changes: 5 additions & 0 deletions packages/app/webpack.plugins.js
@@ -0,0 +1,5 @@
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = [
new ForkTsCheckerWebpackPlugin()
];
17 changes: 17 additions & 0 deletions packages/app/webpack.renderer.config.js
@@ -0,0 +1,17 @@
const rules = require('./webpack.rules');
const plugins = require('./webpack.plugins');

rules.push({
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
});

module.exports = {
module: {
rules,
},
plugins: plugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css']
},
};
27 changes: 27 additions & 0 deletions packages/app/webpack.rules.js
@@ -0,0 +1,27 @@
module.exports = [
// Add support for native node modules
{
test: /\.node$/,
use: 'node-loader',
},
{
test: /\.(m?js|node)$/,
parser: { amd: false },
use: {
loader: '@marshallofsound/webpack-asset-relocator-loader',
options: {
outputAssetBase: 'native_modules',
},
},
},
{
test: /\.tsx?$/,
exclude: /(node_modules|\.webpack)/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true
}
}
},
];
5 changes: 5 additions & 0 deletions packages/editor/.parcelrc
Expand Up @@ -2,5 +2,10 @@
"extends": "@parcel/config-default",
"transformers": {
"*.{ts,tsx}": ["@parcel/transformer-typescript-tsc"]
},
"runtimes": {
"node": ["@parcel/runtime-js"],
"electron-renderer": ["@parcel/runtime-js"],
"electron-main": ["@parcel/runtime-js"]
}
}
24 changes: 17 additions & 7 deletions packages/editor/package.json
@@ -1,18 +1,16 @@
{
"private": false,
"name": "@mayonnaise/editor",
"version": "1.0.0-alpha.0",
"module": "dist/mayo.js",
"source": "src/mayo.ts",
"types": "dist/mayo.d.ts",
"main": "dist/index.html",
"electron-main": "dist/electron.js",
"description": "the mayo markdown what-you-see-is-what-you-mean editor",
"repository": "https://git.snoot.club/chee/mayo",
"author": "chee",
"license": "GPL-3.0+",
"scripts": {
"test": "jest",
"start": "parcel serve src/index.html",
"build": "parcel build src/index.html"
"start": "concurrently 'parcel watch src/index.html' 'electron dist'",
"build": "parcel build electron src/index.html"
},
"devDependencies": {
"@babel/preset-typescript": "^7.12.7",
Expand All @@ -23,6 +21,8 @@
"@types/jest": "^26.0.20",
"@types/node": "^14.14.21",
"@types/webpack-env": "^1.16.0",
"concurrently": "^5.3.0",
"electron": "^11.2.0",
"jest": "^26.6.3",
"parcel": "^2.0.0-beta.1",
"prettier": "^2.2.1",
Expand All @@ -37,6 +37,7 @@
"@types/mdast": "^3.0.3",
"@types/shortid": "^0.0.29",
"@types/unist": "^2.0.3",
"@webcomponents/webcomponentsjs": "^2.5.0",
"clone-deep": "^4.0.1",
"hast-util-to-html": "^7.1.2",
"lit-element": "^2.4.0",
Expand All @@ -58,6 +59,15 @@
"unist-util-select": "^3.0.4",
"unist-util-visit": "^2.0.3",
"unist-util-visit-parents": "^3.1.1",
"unist-utils-core": "^1.0.5"
"unist-utils-core": "^1.0.5",
"vfile": "^4.2.1"
},
"targets": {
"default": {
"context": "electron-renderer"
},
"electron-main": {
"context": "electron-main"
}
}
}

0 comments on commit aff400d

Please sign in to comment.