Remove more designer and APP_ID code (#3040)

This commit is contained in:
Opender Singh authored and GitHub committed 2021-02-03 20:07:11 +13:00
1 parent 26fb78ab99
commit 4f062dbb28
16 files changed
+32 -59

No files matched your search

@@ -8,7 +8,7 @@
"binaryPrefix": "Insomnia.Core",
"longName": "Insomnia Core",
"synopsis": "A simple, beautiful, and free REST API client",
"icon": "https://github.com/kong/insomnia/blob/develop/packages/insomnia-app/app/icons/com.insomnia.app/icon.ico?raw=true",
"icon": "https://github.com/kong/insomnia/blob/develop/packages/insomnia-app/app/icons/icon.ico?raw=true",
"changelogBaseUrl": "https://insomnia.rest/changelog/core",
"theme": "default",
"main": "main.min.js",
@@ -9,7 +9,7 @@
"filter": "yarn-standalone.js"
},
{
"from": "./build/__APP_ID__",
"from": "./build",
"to": ".",
"filter": "opensource-licenses.txt"
}
@@ -25,14 +25,14 @@
],
"fileAssociations": [],
"directories": {
"buildResources": "build/__APP_ID__",
"app": "build/__APP_ID__",
"output": "dist/__APP_ID__"
"buildResources": "build",
"app": "build",
"output": "dist"
},
"mac": {
"hardenedRuntime": true,
"category": "public.app-category.developer-tools",
"entitlements": "./build/__APP_ID__/static/entitlements.mac.inherit.plist",
"entitlements": "./build/static/entitlements.mac.inherit.plist",
"artifactName": "__BINARY_PREFIX__-${version}.${ext}",
"target": [
"dmg",
+3 -10
View File
@@ -1,17 +1,10 @@
/*
* This file contains a helper to get the configuration for the current app
* This file contains a helper to get the configuration for the app
* NOTE: This is used during build scripts so can't reference any of the app code
*/
const coreConfig = require('./config.core.json');
const coreBuildConfig = require('./electronbuilder.core.json');
module.exports.APP_ID_INSOMNIA = 'com.insomnia.app';
const config = require('./config.json');
module.exports.appConfig = function() {
return coreConfig;
};
module.exports.electronBuilderConfig = function() {
return coreBuildConfig;
return config;
};
+2 -2
View File
@@ -33,7 +33,7 @@ module.exports.start = async function(forceFromGitRef) {
// These must be required after APP_ID environment variable is set above
const configRenderer = require('../webpack/webpack.config.production.babel');
const configMain = require('../webpack/webpack.config.electron.babel');
const buildFolder = path.join('../build', appConfig().appId);
const buildFolder = path.join('../build');
if (buildContext.smokeTest) {
console.log('[build] Starting build to smoke test');
@@ -64,7 +64,7 @@ module.exports.start = async function(forceFromGitRef) {
console.log('[build] Copying files');
await copyFiles('../bin', buildFolder);
await copyFiles('../app/static', path.join(buildFolder, 'static'));
await copyFiles(`../app/icons/${appConfig().appId}`, buildFolder);
await copyFiles('../app/icons', buildFolder);
// Generate necessary files needed by `electron-builder`
await generatePackageJson('../package.json', path.join(buildFolder, 'package.json'));
+5 -5
View File
@@ -1,4 +1,5 @@
const { appConfig, electronBuilderConfig } = require('../config');
const { appConfig } = require('../config');
const electronBuilderConfig = require('../config/electronbuilder.json');
const electronBuilder = require('electron-builder');
const path = require('path');
const rimraf = require('rimraf');
@@ -27,17 +28,16 @@ module.exports.start = async function() {
console.log('[package] Removing existing directories');
if (process.env.KEEP_DIST_FOLDER !== 'yes') {
const appId = appConfig().appId;
await emptyDir(path.join('..', 'dist', appId, '*'));
await emptyDir(path.join('..', 'dist', '*'));
}
console.log('[package] Packaging app');
await pkg(electronBuilderConfig());
await pkg();
console.log('[package] Complete!');
};
async function pkg(electronBuilderConfig) {
async function pkg() {
const app = appConfig();
// Replace some things
+2 -3
View File
@@ -27,13 +27,12 @@ if (require.main === module) {
async function start(app, version) {
console.log(`[release] Creating release for ${app} ${version}`);
const appId = appConfig().appId;
// globs should only use forward slash, so force use of path.posix
const distGlob = ext => path.posix.join('dist', appId, '**', `*${ext}`);
const distGlob = ext => path.posix.join('dist', '**', `*${ext}`);
const assetGlobs = {
darwin: [distGlob('.zip'), distGlob('.dmg')],
win32: [path.posix.join('dist', appId, 'squirrel-windows', '*')],
win32: [path.posix.join('dist', 'squirrel-windows', '*')],
linux: [
distGlob('.snap'),
distGlob('.rpm'),
-16
View File
@@ -1,16 +0,0 @@
const promptRun = require('prompt-run');
promptRun({
command: 'npm run start:dev',
options: {},
questions: {
env: [
{
type: 'list',
name: 'APP_ID',
message: 'Select app to start',
choices: ['com.insomnia.app', 'com.insomnia.designer'],
},
],
},
}).then(childProcess => {});
@@ -1,14 +1,13 @@
const webpack = require('webpack');
const path = require('path');
const pkg = require('../package.json');
const {APP_ID_INSOMNIA} = require('../config');
module.exports = {
devtool: 'source-map',
context: path.join(__dirname, '../app'),
entry: ['./renderer.js', './renderer.html'],
output: {
path: path.join(__dirname, '../build', APP_ID_INSOMNIA),
path: path.join(__dirname, '../build'),
filename: 'bundle.js',
libraryTarget: 'commonjs2',
},
@@ -2,7 +2,6 @@ const webpack = require('webpack');
const path = require('path');
const productionConfig = require('./webpack.config.production.babel');
const pkg = require('../package.json');
const {APP_ID_INSOMNIA} = require('../config');
const PORT = pkg.dev['dev-server-port'];
@@ -25,7 +24,7 @@ if (process.env.NODE_ENV === 'development') {
}),
];
} else {
output.path = path.join(__dirname, '../build', APP_ID_INSOMNIA);
output.path = path.join(__dirname, '../build');
devtool = productionConfig.devtool;
plugins = productionConfig.plugins;
}
@@ -1,6 +1,6 @@
import * as debug from '../modules/debug';
import * as client from '../modules/client';
import { launchCore, stop } from '../modules/application';
import { launchApp, stop } from '../modules/application';
import * as dropdown from '../modules/dropdown';
import * as settings from '../modules/settings';
import fs from 'fs';
@@ -11,7 +11,7 @@ describe('Application launch', function() {
let app = null;
beforeEach(async () => {
app = await launchCore();
app = await launchApp();
});
afterEach(async () => {
@@ -5,7 +5,7 @@ import * as settings from '../modules/settings';
import * as modal from '../modules/modal';
import * as dropdown from '../modules/dropdown';
import { isPackage, launchCore, stop } from '../modules/application';
import { isPackage, launchApp, stop } from '../modules/application';
const itIf = condition => (condition ? it : it.skip);
it.if = itIf;
@@ -15,7 +15,7 @@ describe('Application launch', function() {
let app = null;
beforeEach(async () => {
app = await launchCore();
app = await launchApp();
});
afterEach(async () => {
@@ -2,7 +2,6 @@ import { Application } from 'spectron';
import path from 'path';
import os from 'os';
import electronPath from '../../insomnia-app/node_modules/electron';
import { APP_ID_INSOMNIA } from '../../insomnia-app/config';
const getAppPlatform = () => process.platform;
const isMac = () => getAppPlatform() === 'darwin';
@@ -12,25 +11,25 @@ const isWindows = () => getAppPlatform() === 'win32';
export const isBuild = () => process.env.BUNDLE === 'build';
export const isPackage = () => process.env.BUNDLE === 'package';
const spectronConfig = (appId, appName) => {
const spectronConfig = () => {
let packagePathSuffix = '';
if (isWindows()) {
packagePathSuffix = path.join('win-unpacked', `${appName}.exe`);
packagePathSuffix = path.join('win-unpacked', 'Insomnia.exe');
} else if (isMac()) {
packagePathSuffix = path.join('mac', `${appName}.app`, 'Contents', 'MacOS', appName);
packagePathSuffix = path.join('mac', 'Insomnia.app', 'Contents', 'MacOS', 'Insomnia');
} else if (isLinux()) {
packagePathSuffix = ''; // TODO: find out what this is
}
const buildPath = path.join(__dirname, '../../insomnia-app/build', appId);
const packagePath = path.join(__dirname, '../../insomnia-app/dist', appId, packagePathSuffix);
const dataPath = path.join(os.tmpdir(), 'insomnia-smoke-test', appId, `${Math.random()}`);
const buildPath = path.join(__dirname, '../../insomnia-app/build');
const packagePath = path.join(__dirname, '../../insomnia-app/dist', packagePathSuffix);
const dataPath = path.join(os.tmpdir(), 'insomnia-smoke-test', `${Math.random()}`);
return { buildPath, packagePath, dataPath };
};
export const launchCore = async () => {
const config = spectronConfig(APP_ID_INSOMNIA, 'Insomnia');
export const launchApp = async () => {
const config = spectronConfig();
return await launch(config);
};