Default product.json for enabling Electron builds (#323)

This commit is contained in:
Guillaume Jenkins 2016-12-16 12:16:06 -08:00 committed by Peli de Halleux
parent 300a98b858
commit fa3e33dab9
6 changed files with 14 additions and 75 deletions

View File

@ -1,2 +0,0 @@
node_modules
projects

View File

@ -1,5 +0,0 @@
# PXT micro:bit Electron app
A very basic wrapper around the web app. To install, copy the contents of this
directory to somewhere outside the main `pxt-microbit` repository. Then run `npm
install && npm start`.

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>code the micro:bit</title>
</head>
<body>
<webview id="webview" style="position:absolute; left:0; top:0; right:0; bottom:0"/>
<script>
const webview = document.getElementById("webview")
const url = `http://localhost:3232/${window.location.hash}`
webview.src = url
</script>
</body>
</html>

View File

@ -1,39 +0,0 @@
const {app, BrowserWindow, Menu} = require('electron')
const pxt = require('pxt-core')
const path = require('path')
let win
const cliPath = path.join(process.cwd(), "node_modules/pxt-microbit")
function startServerAndCreateWindow() {
pxt.mainCli(cliPath, ["serve", "-no-browser"])
createWindow()
}
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
title: "code the micro:bit"
})
Menu.setApplicationMenu(null)
win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
win.on('closed', () => {
win = null
})
}
app.on('ready', startServerAndCreateWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})

View File

@ -1,14 +0,0 @@
{
"name" : "code-the-microbit",
"version" : "1.0.0",
"description": "Blocks / Javascript editor",
"author": "Microsoft",
"main" : "main.js",
"scripts": {
"start": "node_modules/.bin/electron ."
},
"devDependencies": {
"electron": "*",
"pxt-microbit": "*"
}
}

14
electron/product.json Normal file
View File

@ -0,0 +1,14 @@
{
"applicationName": "pxt-microbit-oss",
"dataFolderName": ".pxt-microbit-oss",
"darwinBundleIdentifier": "com.microsoft.pxtoss",
"nameShort": "PXT Microbit - OSS",
"nameLong": "PXT Microbit - OSS",
"targetId": "pxt-microbit",
"win32AppId": "{{92db071a-6f58-4938-8c97-13c873f4da13}",
"win32AppUserModelId": "Microsoft.PXTMicrobitOss",
"win32DirName": "Microsoft PXT-Microbit - OSS",
"win32MutexName": "pxtmicrobitoss",
"win32NameVersion": "Microsoft PXT-Microbit-OSS",
"win32RegValueName": "PXTMicrobitOss"
}