chore: 🤖 Add ember electron v3.0.0-beta.3 app

This commit is contained in:
Susmitha Girumala committed 2020-06-29 18:14:36 -04:00
1 parent 33dc2f7feb
commit efbaed31be
13 files changed
+4885 -57

No files matched your search

+3
View File
@@ -18,3 +18,6 @@
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
# ember-electron
/electron-app/
+2
View File
@@ -31,6 +31,8 @@ module.exports = {
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'testem-electron.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
+6
View File
@@ -7,6 +7,9 @@ dist: trusty
addons:
chrome: stable
apt:
packages:
- xvfb
cache:
yarn: true
@@ -26,6 +29,9 @@ before_install:
install:
- yarn install --non-interactive
- cd electron-app && yarn install --non-interactive
- export DISPLAY=':99.0'
- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
script:
- yarn lint:hbs
+2 -2
View File
@@ -4,8 +4,8 @@ module.exports = function(environment) {
let ENV = {
modulePrefix: 'connect-client',
environment,
rootURL: '/',
locationType: 'auto',
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : '/',
locationType: process.env.EMBER_CLI_ELECTRON ? 'hash' : 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
+93
View File
@@ -0,0 +1,93 @@
# 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/
# Ember build
ember-dist/
ember-test/
@@ -0,0 +1,63 @@
{
"name": "connect-client",
"productName": "connect-client",
"version": "0.0.0",
"description": "Small description for connect-client goes here",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": "",
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {
"ignore": [
"/ember-test(/|$)",
"/tests(/|$)"
]
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "connect_client"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"electron-devtools-installer": "^3.1.0",
"electron-is-dev": "^1.2.0",
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {
"@electron-forge/cli": "6.0.0-beta.51",
"@electron-forge/maker-deb": "6.0.0-beta.51",
"@electron-forge/maker-rpm": "6.0.0-beta.51",
"@electron-forge/maker-squirrel": "6.0.0-beta.51",
"@electron-forge/maker-zip": "6.0.0-beta.51",
"devtron": "^1.4.0",
"electron": "9.0.5"
}
}
@@ -0,0 +1,29 @@
const { protocol } = require('electron');
const { fileURLToPath } = require('url');
const path = require('path');
const fs = require('fs');
const { promisify } = require('util');
const access = promisify(fs.access);
//
// Patch asset loading -- Ember apps use absolute paths to reference their
// assets, e.g. `<img src="/images/foo.jpg">`. When the current URL is a `file:`
// URL, that ends up resolving to the absolute filesystem path `/images/foo.jpg`
// rather than being relative to the root of the Ember app. So, we intercept
// `file:` URL request and look to see if they point to an asset when
// interpreted as being relative to the root of the Ember app. If so, we return
// that path, and if not we leave them as-is, as their absolute path.
//
module.exports = function handleFileURLs(emberAppDir) {
protocol.interceptFileProtocol('file', async ({ url }, callback) => {
let urlPath = fileURLToPath(url);
let appPath = path.join(emberAppDir, urlPath);
try {
await access(appPath);
callback(appPath);
} catch (e) {
callback(urlPath);
}
});
};
@@ -0,0 +1,99 @@
/* eslint-disable no-console */
const { default: installExtension, EMBER_INSPECTOR } = require('electron-devtools-installer');
const { pathToFileURL } = require('url');
const { app, BrowserWindow } = require('electron');
const path = require('path');
const isDev = require('electron-is-dev');
const handleFileUrls = require('./handle-file-urls');
const emberAppDir = path.resolve(__dirname, '..', 'ember-dist');
const emberAppURL = pathToFileURL(path.join(emberAppDir, 'index.html')).toString();
let mainWindow = null;
// Uncomment the lines below to enable Electron's crash reporter
// For more information, see http://electron.atom.io/docs/api/crash-reporter/
// electron.crashReporter.start({
// productName: 'YourName',
// companyName: 'YourCompany',
// submitURL: 'https://your-domain.com/url-to-submit',
// autoSubmit: true
// });
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('ready', async () => {
if (isDev) {
try {
require('devtron').install();
} catch (err) {
console.log('Failed to install Devtron: ', err);
}
try {
await installExtension(EMBER_INSPECTOR);
} catch (err) {
console.log('Failed to install Ember Inspector: ', err);
}
}
await handleFileUrls(emberAppDir);
mainWindow = new BrowserWindow({
width: 800,
height: 600,
});
// If you want to open up dev tools programmatically, call
// mainWindow.openDevTools();
// Load the ember application
mainWindow.loadURL(emberAppURL);
// If a loading operation goes wrong, we'll send Electron back to
// Ember App entry point
mainWindow.webContents.on('did-fail-load', () => {
mainWindow.loadURL(emberAppURL);
});
mainWindow.webContents.on('crashed', () => {
console.log('Your Ember app (or other code) in the main window has crashed.');
console.log('This is a serious issue that needs to be handled and/or debugged.');
});
mainWindow.on('unresponsive', () => {
console.log('Your Ember app (or other code) has made the window unresponsive.');
});
mainWindow.on('responsive', () => {
console.log('The main window has become responsive again.');
});
mainWindow.on('closed', () => {
mainWindow = null;
});
});
// Handle an unhandled error in the main thread
//
// Note that 'uncaughtException' is a crude mechanism for exception handling intended to
// be used only as a last resort. The event should not be used as an equivalent to
// "On Error Resume Next". Unhandled exceptions inherently mean that an application is in
// an undefined state. Attempting to resume application code without properly recovering
// from the exception can cause additional unforeseen and unpredictable issues.
//
// Attempting to resume normally after an uncaught exception can be similar to pulling out
// of the power cord when upgrading a computer -- nine out of ten times nothing happens -
// but the 10th time, the system becomes corrupted.
//
// The correct use of 'uncaughtException' is to perform synchronous cleanup of allocated
// resources (e.g. file descriptors, handles, etc) before shutting down the process. It is
// not safe to resume normal operation after 'uncaughtException'.
process.on('uncaughtException', (err) => {
console.log('An exception in the main thread was not handled.');
console.log('This is a serious issue that needs to be handled and/or debugged.');
console.log(`Exception: ${err}`);
});
@@ -0,0 +1,30 @@
const { default: installExtension, EMBER_INSPECTOR } = require('electron-devtools-installer');
const path = require('path');
const { app } = require('electron');
const handleFileUrls = require('../src/handle-file-urls');
const { setupTestem, openTestWindow } = require('ember-electron/lib/test-support');
const emberAppDir = path.resolve(__dirname, '..', 'ember-test');
app.on('ready', async function onReady() {
try {
require('devtron').install();
} catch (err) {
console.log('Failed to install Devtron: ', err);
}
try {
await installExtension(EMBER_INSPECTOR);
} catch (err) {
console.log('Failed to install Ember Inspector: ', err);
}
await handleFileUrls(emberAppDir);
setupTestem();
openTestWindow(emberAppDir);
});
app.on('window-all-closed', function onWindowAllClosed() {
if (process.platform !== 'darwin') {
app.quit();
}
});
File diff suppressed because it is too large. Load diff
+1
View File
@@ -35,6 +35,7 @@
"ember-cli-template-lint": "^1.0.0-beta.3",
"ember-cli-uglify": "^3.0.0",
"ember-data": "~3.16.0",
"ember-electron": "https://github.com/adopted-ember-addons/ember-electron#v3.0.0-beta.3",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^7.0.0",
"ember-load-initializers": "^2.1.1",
+29
View File
@@ -0,0 +1,29 @@
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launchers: {
Electron: require('ember-electron/lib/test-runner'),
},
launch_in_ci: [
'Electron',
],
launch_in_dev: [
'Electron',
],
browser_args: {
Electron: {
// Note: Some these Chrome options may not be supported in Electron
// See https://electronjs.org/docs/api/chrome-command-line-switches
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
}
};
+1216 -55
View File
File diff suppressed because it is too large. Load diff