Skip to content

Commit

Permalink
feat: Various improvements for electron/template (#950)
Browse files Browse the repository at this point in the history
* fix: Update .gitignore with more deets
* docs: Add some details to renderer.js
* feat: Improve the core index.html a little bit
  • Loading branch information
felixrieseberg authored and malept committed Jun 20, 2019
1 parent 07e24b9 commit 641f521
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 7 deletions.
91 changes: 89 additions & 2 deletions packages/api/core/tmpl/_gitignore
@@ -1,2 +1,89 @@
node_modules
out
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Electron-Forge
out/
15 changes: 12 additions & 3 deletions packages/api/core/tmpl/index.html
@@ -1,10 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 38rem;
padding: 2rem;
margin: auto;
}
</style>
</head>
<body>
Well hey there!!!
<h1>💖 Hello World!</h1>3
<p>Welcome to your Electron application.</p>
</body>
</html>
1 change: 0 additions & 1 deletion packages/template/webpack/src/WebpackTemplate.ts
Expand Up @@ -39,7 +39,6 @@ class WebpackTemplate implements ForgeTemplate {
});
});
await asyncOra('Setting up webpack configuration', async () => {
await fs.appendFile(path.resolve(directory, '.gitignore'), '.webpack\n');
await fs.copy(path.resolve(__dirname, '..', 'tmpl', 'webpack.main.config.js'), path.resolve(directory, 'webpack.main.config.js'));
await fs.copy(path.resolve(__dirname, '..', 'tmpl', 'webpack.renderer.config.js'), path.resolve(directory, 'webpack.renderer.config.js'));
await fs.copy(path.resolve(__dirname, '..', 'tmpl', 'webpack.rules.js'), path.resolve(directory, 'webpack.rules.js'));
Expand Down
30 changes: 29 additions & 1 deletion packages/template/webpack/tmpl/renderer.js
@@ -1 +1,29 @@
console.log('Heya, this is coming from a webpack bundle');
/**
* 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
* }
* });
* ```
*/

console.log(`👋 This message is being logged by "renderer.js", included via webpack`);

0 comments on commit 641f521

Please sign in to comment.