Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
601c4ba
copy server for custom electron
Feb 28, 2020
8988685
build: add electron-server to yarn
Feb 29, 2020
1e93bb1
build(electron-server,client): build client to electron-server
Feb 29, 2020
2ec349c
feat(electron-server): add electron app support
Feb 29, 2020
4202d72
Got rid of duplicated server code.
tonyanziano Mar 9, 2020
6204488
Modified structure to use workspace imports.
tonyanziano Mar 9, 2020
03d6b9e
Configured dev workflows to work.
tonyanziano Mar 11, 2020
5591ca0
Working packaged Windows build.
tonyanziano Mar 17, 2020
641d008
Working packaged version without excessive copying.
tonyanziano Mar 17, 2020
4347981
Regenerated lockfile
tonyanziano Mar 20, 2020
cbeb202
Updated to working lockfile.
tonyanziano Mar 23, 2020
d2dd33d
Piggy backed off of master's lockfile
tonyanziano Mar 23, 2020
0e959a8
Updated builds
Mar 24, 2020
c8b4bee
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano Mar 25, 2020
a86684f
Fixed plugin paths.
tonyanziano Mar 25, 2020
a99c08f
Electron build system polish
tonyanziano Mar 26, 2020
19d0de2
Builds for mac, linux
Mar 26, 2020
290edbd
More build system polish.
tonyanziano Mar 27, 2020
23b4560
Added Mac / Linux paths for dist script.
tonyanziano Mar 27, 2020
a4c5ea4
Added flags to build scripts to produce 64-bit binaries.
tonyanziano Mar 27, 2020
00eaf1b
Added electron application icons.
tonyanziano Mar 31, 2020
c24455f
Update latest yaml scripts generation for platforms
Apr 1, 2020
75131fa
Docs updates.
tonyanziano Apr 1, 2020
1388825
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano Apr 1, 2020
7a11568
Merge branch 'master' of https://github.com/microsoft/BotFramework-Co…
tonyanziano Apr 1, 2020
f312b79
PR polish.
tonyanziano Apr 1, 2020
4b6a17f
Registering composer as a browser protocol to open it from command line
Apr 1, 2020
ac69ef7
Merge branch 'master' into toanzian/electron2
boydc2014 Apr 2, 2020
518e5da
Fixed linting errors.
tonyanziano Apr 2, 2020
558d90f
Check if removing bfc client from server stops the error
Apr 2, 2020
4ebf09f
Moving workspace dependancies
Apr 2, 2020
abde8c7
Added back client
Apr 2, 2020
3b452cd
Fixed linux icon.
tonyanziano Apr 2, 2020
9398be4
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano Apr 2, 2020
c7d56db
Added back bfc client
Apr 2, 2020
d5b1f6f
Ensure /client/ is copied to docker container
tonyanziano Apr 2, 2020
e975cee
@bfc client in server now
Apr 2, 2020
5e776c2
Push extensions
Apr 3, 2020
f2e1a46
Setting correct path for extensions
Apr 3, 2020
be4a411
Ensure ui-plugins are copied to docker container.
tonyanziano Apr 3, 2020
215ee9c
Merge branch 'master' into toanzian/electron2
cwhitten Apr 4, 2020
74b8858
Merge branch 'master' into toanzian/electron2
srinaath Apr 6, 2020
b3e0199
Change nodeIntegration to false in BrowserWindow config
cwhitten Apr 6, 2020
a376d88
Merge branch 'toanzian/electron2' of https://github.com/Microsoft/Bot…
cwhitten Apr 6, 2020
39f3c70
Adding a Plist file to verify if codesign works
Apr 6, 2020
77fc38e
Updated plist file name
Apr 6, 2020
91290f8
Separated electron-builder config out into its own file.
tonyanziano Apr 6, 2020
301fb18
Added trailing newline to `electron-builder-config.json`
tonyanziano Apr 6, 2020
8738cce
Fixed broken script.
tonyanziano Apr 7, 2020
9ca1058
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano Apr 7, 2020
cb8c1de
Merge branch 'master' of https://github.com/microsoft/BotFramework-Co…
tonyanziano Apr 7, 2020
d5eb1e0
Server now waits for the express app to be listening before starting.
tonyanziano Apr 7, 2020
64b3578
Leveraged 'debug' for logging.
tonyanziano Apr 7, 2020
8837c2b
Change console.log to log
Apr 7, 2020
13b604b
Resolve lint error
Apr 7, 2020
704c150
Merge branch 'master' into toanzian/electron2
tonyanziano Apr 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Composer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ FROM node:12-alpine as composerbasic
WORKDIR /app/Composer
COPY --from=build /src/Composer/yarn.lock .
COPY --from=build /src/Composer/package.json .
COPY --from=build /src/Composer/packages/client ./packages/client
COPY --from=build /src/Composer/packages/extensions ./packages/extensions
COPY --from=build /src/Composer/packages/server ./packages/server
COPY --from=build /src/Composer/packages/lib ./packages/lib
COPY --from=build /src/Composer/packages/tools ./packages/tools
COPY --from=build /src/Composer/packages/ui-plugins ./packages/ui-plugins
COPY --from=build /src/Composer/plugins ./plugins

ENV NODE_ENV "production"
Expand Down
6 changes: 4 additions & 2 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"node": ">=12"
},
"workspaces": [
"packages/client",
"packages/server",
"packages/electron-server",
"packages/extensions",
"packages/extensions/*",
"packages/client",
"packages/lib",
"packages/lib/*",
"packages/tools",
Expand All @@ -22,9 +23,10 @@
],
"scripts": {
"build": "node scripts/update.js && node scripts/begin.js && yarn build:prod && yarn build:plugins",
"build:prod": "yarn build:dev && yarn build:server && yarn build:client",
"build:prod": "yarn build:dev && yarn build:server && yarn build:client && yarn build:electron",
"build:dev": "yarn build:lib && yarn build:tools && yarn build:extensions && yarn build:plugins",
"build:lib": "yarn workspace @bfc/libs build:all",
"build:electron": "yarn workspace @bfc/electron-server build",
"build:extensions": "wsrun -lt -p @bfc/extension @bfc/adaptive-form @bfc/visual-designer @bfc/ui-plugin-* -c build",
"build:server": "yarn workspace @bfc/server build",
"build:client": "yarn workspace @bfc/client build",
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/client/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const resolveModule = (resolveFn, filePath) => {
module.exports = {
dotenv: resolveApp('.env'),
appPath: resolveApp('.'),
appBuild: resolveApp('../server/build/public'),
appBuild: resolveApp('build/public'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveModule(resolveApp, 'src/index'),
Expand Down
3 changes: 3 additions & 0 deletions Composer/packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@bfc/client",
"license": "MIT",
"main": "build/public/index.ejs",
"version": "0.1.0",
"private": true,
"engines": {
Expand All @@ -9,6 +10,7 @@
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"clean": "rimraf build",
"test": "jest",
"lint": "eslint --quiet --ext .js,.jsx,.ts,.tsx ./src ./__tests__",
"lint:fix": "yarn lint --fix",
Expand Down Expand Up @@ -104,6 +106,7 @@
"postcss-preset-env": "6.5.0",
"postcss-safe-parser": "4.0.1",
"react-testing-library": "^6.0.1",
"rimraf": "2.6.3",
"style-loader": "1.0.0",
"terser-webpack-plugin": "2.2.1",
"url-loader": "2.2.0",
Expand Down
7 changes: 3 additions & 4 deletions Composer/packages/client/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ process.on('unhandledRejection', err => {
// Ensure environment variables are read.
require('../config/env');

const path = require('path');

const chalk = require('react-dev-utils/chalk');
const fs = require('fs-extra');
const webpack = require('webpack');
Expand Down Expand Up @@ -63,8 +61,6 @@ checkBrowsers(paths.appPath, isInteractive)
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
fs.emptyDirSync(paths.appBuild);
// Merge with the public folder
copyPublicFolder();
// Start the webpack build
return build(previousFileSizes);
})
Expand Down Expand Up @@ -93,6 +89,8 @@ checkBrowsers(paths.appPath, isInteractive)
);
console.log();
}
// Merge with the public folder
copyPublicFolder();
},
err => {
console.log(chalk.red('Failed to compile.\n'));
Expand Down Expand Up @@ -165,6 +163,7 @@ function build(previousFileSizes) {
}

function copyPublicFolder() {
// copy to build/public folder
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => ![paths.appHtml, paths.extensionContainerHtml].includes(file),
Expand Down
10 changes: 10 additions & 0 deletions Composer/packages/electron-server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: ['../../.eslintrc.js'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'security/detect-non-literal-fs-filename': 'off',
},
};
2 changes: 2 additions & 0 deletions Composer/packages/electron-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
dist/
34 changes: 34 additions & 0 deletions Composer/packages/electron-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Composer Electron

## Summary

This package is a wrapper that will spin up the Composer web application inside of an [Electron](https://www.electronjs.org/) shell to provide an installable, cross-platform version of Composer that runs directly on your desktop.

## How to Build & Run

### Prerequisites

1. Make sure all dependencies are installed by performing a `yarn install` in the `/Composer/` directory.
2. Make sure all packages are built by performing a `yarn build` in the `/Composer/` directory.

### Run from Source (Development)

1. Run `yarn start` in the `/Composer/packages/client` directory.
2. Run `yarn start` in the `/Composer/packages/electron-server` directory.

### Build a packaged executable

**Method 1**

1. Run `yarn dist:full` in the `/Composer/package/electron-server` directory.
2. Find your portable binary inside of `/Composer/package/electron-server/dist`.

----

**Method 2**

1. Run `yarn copy-templates` in the `/Composer/package/electron-server` directory.
2. Run `yarn run pack` in the `/Composer/package/electron-server` directory.
3. Run `yarn copy-plugins` in the `/Composer/package/electron-server` directory.
4. Run `yarn dist`in the `/Composer/package/electron-server` directory.
5. Find your portable binary inside of `/Composer/package/electron-server/dist`.
96 changes: 96 additions & 0 deletions Composer/packages/electron-server/electron-builder-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"productName": "Bot Framework Composer",
"asar": true,
"appId": "com.microsoft.botframework.composer",
"copyright": "Copyright © 2020 Microsoft Corporation",
"electronDownload": {
"version": "8.0.2"
},
"directories": {
"output": "dist"
},
"asarUnpack": [
"build/assets",
"build/templates",
"resources/composerIcon_1024x1024.png"
],
"files": [
"build",
"resources/composerIcon_1024x1024.png"
],
"protocols": [
{
"name": "Bot Framework Composer",
"role": "Viewer",
"schemes": [
"bfcomposer"
]
}
],
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"icon": "resources/composerIcon.ico",
"artifactName": "BotFramework-Composer-${version}-windows-setup.${ext}"
},
"nsis": {
"perMachine": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"packElevateHelper": true,
"unicode": true,
"runAfterFinish": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "Bot Framework Composer (preview)",
"oneClick": false
},
"linux": {
"artifactName": "BotFramework-Composer-${version}-${platform}-${arch}.${ext}",
"category": "Development",
"target": [
{
"target": "AppImage",
"arch": [
"x64"
]
}
]
},
"mac": {
"artifactName": "BotFramework-Composer-${version}-mac.${ext}",
"category": "public.app-category.developer-tools",
"icon": "resources/composerIcon.icns",
"target": [
{
"target": "dmg",
"arch": [
"x64"
]
}
]
},
"dmg": {
"title": "Bot Framework Composer Installer",
"contents": [
{
"x": 140,
"y": 244
},
{
"x": 380,
"y": 244,
"type": "link",
"path": "/Applications"
}
]
},
"publish": null,
"remoteBuild": false
}
61 changes: 61 additions & 0 deletions Composer/packages/electron-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@bfc/electron-server",
"license": "MIT",
"author": "Microsoft Corporation",
"version": "1.0.0",
"description": "Electron wrapper around Composer that launches Composer as a desktop application.",
"main": "./build/main.js",
"engines": {
"node": ">=12"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"clean": "rimraf build && rimraf dist",
"copy-plugins": "node scripts/copy-plugins.js",
"copy-templates": "node scripts/copy-templates.js",
"dist": "node scripts/electronBuilderDist.js",
"dist:full": "yarn clean && yarn build && yarn copy-templates && yarn run pack && yarn copy-plugins && yarn dist",
"pack": "node scripts/electronBuilderPack.js",
"start": "cross-env NODE_ENV=development electron .",
"typecheck": "tsc --noEmit",
"lint": "eslint --quiet --ext .js,.jsx,.ts,.tsx ./src",
"lint:fix": "yarn lint --fix",
"start:electron": "./node_modules/.bin/electron --inspect=7777 --remote-debugging-port=7778 .",
"start:electron:dev": "cross-env ELECTRON_TARGET_URL=http://localhost:3000/ npm run start:electron"
},
"devDependencies": {
"@types/archiver": "^3.0.0",
"@types/body-parser": "^1.17.0",
"@types/compression": "^1.0.1",
"@types/cookie-parser": "^1.4.1",
"@types/debug": "^4.1.2",
"@types/express": "^4.16.1",
"@types/form-data": "^2.2.1",
"@types/globby": "^9.1.0",
"@types/http-errors": "^1.6.1",
"@types/jest": "^24.0.9",
"@types/jsonwebtoken": "^8.3.3",
"@types/lodash": "^4.14.146",
"@types/lru-cache": "^5.1.0",
"@types/mock-fs": "^3.6.30",
"@types/morgan": "^1.7.35",
"@types/node": "^13.7.7",
"@types/rimraf": "^2.0.2",
"electron": "8.0.2",
"electron-builder": "^22.4.1",
"fs-extra": "^9.0.0",
"js-yaml": "^3.13.1",
"mock-fs": "^4.10.1",
"nodemon": "^1.18.11",
"path": "^0.12.7",
"rimraf": "^2.6.3",
"source-map-explorer": "^2.1.0",
"ts-node": "^8.4.1"
},
"dependencies": {
"@bfc/server": "*",
"debug": "4.1.1",
"fix-path": "^3.0.0",
"lodash": "^4.17.15"
}
}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Composer/packages/electron-server/resources/entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
60 changes: 60 additions & 0 deletions Composer/packages/electron-server/scripts/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.

/** Hashes a file asynchronously */
const path = require('path');
const fsp = require('fs-extra');
const yaml = require('js-yaml');
const fs = require('fs');
const crypto = require('crypto');
const packageJson = require('../package.json');

async function writeToDist(err, files, fileName) {
if (err) {
console.log('Installer file is missing.');
return;
}
const version = packageJson.version;
const releasePath = files[0];
const releaseFileName = path.basename(releasePath);
const sha512 = await hashFileAsync(path.normalize(releasePath));
const releaseDate = new Date().toISOString();
const ymlInfo = {
version,
releaseDate,
githubArtifactName: releaseFileName,
path: releaseFileName,
sha512,
};
const ymlStr = yaml.safeDump(ymlInfo);
fsp.writeFileSync(path.normalize(`../dist/${fileName}`), ymlStr);
}

// https://github.com/electron-userland/electron-builder/issues/3913 as hashFilAsync has been removed from latest electron-builder
function hashFileAsync(file, algorithm = 'sha512', encoding = 'base64', options) {
return new Promise((resolve, reject) => {
const hash = crypto.createHash(algorithm);
hash.on('error', reject).setEncoding(encoding);
fs.createReadStream(
file,
Object.assign({}, options, {
highWaterMark: 1024 * 1024,
/* better to use more memory but hash faster */
})
)
.on('error', reject)
.on('end', () => {
hash.end();
console.log('hash done');
resolve(hash.read());
})
.pipe(hash, {
end: false,
});
});
}

module.exports = {
hashFileAsync,
writeToDist,
};
Loading