OSDN Git Service

とりあえず
authorNeko7sora <75793267+Neko7sora@users.noreply.github.com>
Wed, 5 May 2021 09:45:44 +0000 (18:45 +0900)
committerNeko7sora <75793267+Neko7sora@users.noreply.github.com>
Wed, 5 May 2021 09:45:44 +0000 (18:45 +0900)
.gitignore [new file with mode: 0644]
README.md
index.html [new file with mode: 0644]
main.js [new file with mode: 0644]
package.json [new file with mode: 0644]
preload.js [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..91da826
--- /dev/null
@@ -0,0 +1,8 @@
+.env
+node_modules
+package-lock.json
+*.lock
+.vscode/
+.idea/
+vercel_token
+out/
\ No newline at end of file
index 7703c9c..13af477 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,5 +2,6 @@
 HTML5コメントジェネレーター(Re)
 
 ## 環境・使用ライブラリー
-- Node.js
-- Electron
+- Node.js v14.16.x ~ v14.x
+- yarn v1.22.10 ~ v1.x
+- Electron v12.0.6 ~ v12.x
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..bc12f6d
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+    <title>Hello World!</title>
+    <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
+</head>
+<body style="background: white;">
+    <h1>Hello World!</h1>
+    <p>
+        We are using Node.js <span id="node-version"></span>,
+        Chromium <span id="chrome-version"></span>,
+        and Electron <span id="electron-version"></span>.
+    </p>
+</body>
+</html>
\ No newline at end of file
diff --git a/main.js b/main.js
new file mode 100644 (file)
index 0000000..670a263
--- /dev/null
+++ b/main.js
@@ -0,0 +1,30 @@
+const { app, BrowserWindow } = require('electron')
+const path = require('path')
+
+function createWindow () {
+  const win = new BrowserWindow({
+    width: 800,
+    height: 600,
+    webPreferences: {
+      preload: path.join(__dirname, 'preload.js')
+    }
+  })
+
+  win.loadFile('index.html')
+}
+
+app.whenReady().then(() => {
+  createWindow()
+
+  app.on('activate', () => {
+    if (BrowserWindow.getAllWindows().length === 0) {
+      createWindow()
+    }
+  })
+})
+
+app.on('window-all-closed', () => {
+  if (process.platform !== 'darwin') {
+    app.quit()
+  }
+})
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..4f0b7fa
--- /dev/null
@@ -0,0 +1,18 @@
+{
+  "name": "commentgenerator-re",
+  "version": "0.1.0",
+  "author": "Neko7sora",
+  "description": "My Electron app",
+  "main": "main.js",
+  "scripts": {
+    "start": "electron main.js"
+  },
+  "engines": {
+    "node": ">=14.16.0"
+  },
+  "dependencies": {
+  },
+  "devDependencies": {
+    "electron": "^12.0.6"
+  }
+}
diff --git a/preload.js b/preload.js
new file mode 100644 (file)
index 0000000..86e917e
--- /dev/null
@@ -0,0 +1,10 @@
+window.addEventListener('DOMContentLoaded', () => {
+    const replaceText = (selector, text) => {
+      const element = document.getElementById(selector)
+      if (element) element.innerText = text
+    }
+  
+    for (const type of ['chrome', 'node', 'electron']) {
+      replaceText(`${type}-version`, process.versions[type])
+    }
+  })
\ No newline at end of file