Skip to content

Commit dc27f1d

Browse files
authored
fix entry path (dojo#386)
1 parent 2716439 commit dc27f1d

6 files changed

Lines changed: 60 additions & 6 deletions

File tree

hnpwa/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"prettier": "prettier --write \"{docs,src,tests}/**/*.{ts,tsx,md}\"",
99
"test-ci": "echo \"no tests\""
1010
},
11-
"main": "src/main.ts",
11+
"main": "src/main.tsx",
1212
"dependencies": {
1313
"@dojo/framework": "^6.0.0",
1414
"tslib": "~1.9.1"

realworld/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "realworld-app",
33
"version": "1.0.0",
4-
"main": "src/main.ts",
4+
"main": "src/main.tsx",
55
"scripts": {
66
"dev": "dojo build -m dev -s -w memory",
77
"build": "dojo build",
8-
"build:ghpages": "dojo build --dojorc .dojorc-ghpages",
8+
"build:ghpages": "dojo build --dojorc .dojorc-ghpages",
99
"prettier": "prettier --write \"{docs,src,tests}/**/*.{ts,tsx,md}\"",
1010
"test": "dojo build -m unit && dojo test",
1111
"test-ci": "dojo build -m unit && dojo test -c \"browserstack\" --usr dylanschiemann2 -k 4Q2g8YAc9qeZzB2hECnS"

todo-mvc-kitchensink/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "dojo2-todo-mvc-kitchensink",
33
"version": "0.0.1",
44
"description": "TodoMVC using Dojo",
5-
"main": "src/main.ts",
5+
"main": "src/main.tsx",
66
"scripts": {
77
"build": "dojo build",
8-
"build:ghpages": "dojo build --dojorc .dojorc-ghpages",
8+
"build:ghpages": "dojo build --dojorc .dojorc-ghpages",
99
"prettier": "prettier --write \"{docs,src,tests}/**/*.{ts,tsx,md}\"",
1010
"build:tests": "dojo build -m unit && dojo build -m functional",
1111
"test": "dojo build --dojorc .dojorc-test && npm run build:tests && dojo test -a -c local",

todo-mvc/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('ts-node').register(); // This will register the TypeScript compiler
2+
require('./src/electron');

todo-mvc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dojo-todo-mvc",
33
"version": "0.0.1",
44
"description": "TodoMVC using Dojo",
5-
"main": "src/main.ts",
5+
"main": "src/main.tsx",
66
"scripts": {
77
"build": "dojo build",
88
"build:ghpages": "dojo build --dojorc .dojorc-ghpages",

todo-mvc/src/electron.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { app, BrowserWindow } from "electron";
2+
import * as path from "path";
3+
import pkgDir from 'pkg-dir';
4+
5+
let mainWindow: Electron.BrowserWindow | null;
6+
7+
function createWindow() {
8+
// Create the browser window.
9+
mainWindow = new BrowserWindow({
10+
height: 600,
11+
width: 800,
12+
});
13+
14+
// and load the index.html of the app.
15+
mainWindow.loadFile(path.join(pkgDir.sync()!, "output", "dev", "index.html"));
16+
17+
// Open the DevTools.
18+
mainWindow.webContents.openDevTools();
19+
20+
// Emitted when the window is closed.
21+
mainWindow.on("closed", () => {
22+
// Dereference the window object, usually you would store windows
23+
// in an array if your app supports multi windows, this is the time
24+
// when you should delete the corresponding element.
25+
mainWindow = null;
26+
});
27+
}
28+
29+
// This method will be called when Electron has finished
30+
// initialization and is ready to create browser windows.
31+
// Some APIs can only be used after this event occurs.
32+
app.on("ready", createWindow);
33+
34+
// Quit when all windows are closed.
35+
app.on("window-all-closed", () => {
36+
// On OS X it is common for applications and their menu bar
37+
// to stay active until the user quits explicitly with Cmd + Q
38+
if (process.platform !== "darwin") {
39+
app.quit();
40+
}
41+
});
42+
43+
app.on("activate", () => {
44+
// On OS X it"s common to re-create a window in the app when the
45+
// dock icon is clicked and there are no other windows open.
46+
if (mainWindow === null) {
47+
createWindow();
48+
}
49+
});
50+
51+
// In this file you can include the rest of your app"s specific main process
52+
// code. You can also put them in separate files and require them here.

0 commit comments

Comments
 (0)