This repository was archived by the owner on Jul 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
feat: Setup infrastructure to launch and package Composer as an Electron app #2462
Merged
Merged
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
8988685
build: add electron-server to yarn
1e93bb1
build(electron-server,client): build client to electron-server
2ec349c
feat(electron-server): add electron app support
4202d72
Got rid of duplicated server code.
tonyanziano 6204488
Modified structure to use workspace imports.
tonyanziano 03d6b9e
Configured dev workflows to work.
tonyanziano 5591ca0
Working packaged Windows build.
tonyanziano 641d008
Working packaged version without excessive copying.
tonyanziano 4347981
Regenerated lockfile
tonyanziano cbeb202
Updated to working lockfile.
tonyanziano d2dd33d
Piggy backed off of master's lockfile
tonyanziano 0e959a8
Updated builds
c8b4bee
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano a86684f
Fixed plugin paths.
tonyanziano a99c08f
Electron build system polish
tonyanziano 19d0de2
Builds for mac, linux
290edbd
More build system polish.
tonyanziano 23b4560
Added Mac / Linux paths for dist script.
tonyanziano a4c5ea4
Added flags to build scripts to produce 64-bit binaries.
tonyanziano 00eaf1b
Added electron application icons.
tonyanziano c24455f
Update latest yaml scripts generation for platforms
75131fa
Docs updates.
tonyanziano 1388825
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano 7a11568
Merge branch 'master' of https://github.com/microsoft/BotFramework-Co…
tonyanziano f312b79
PR polish.
tonyanziano 4b6a17f
Registering composer as a browser protocol to open it from command line
ac69ef7
Merge branch 'master' into toanzian/electron2
boydc2014 518e5da
Fixed linting errors.
tonyanziano 558d90f
Check if removing bfc client from server stops the error
4ebf09f
Moving workspace dependancies
abde8c7
Added back client
3b452cd
Fixed linux icon.
tonyanziano 9398be4
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano c7d56db
Added back bfc client
d5b1f6f
Ensure /client/ is copied to docker container
tonyanziano e975cee
@bfc client in server now
5e776c2
Push extensions
f2e1a46
Setting correct path for extensions
be4a411
Ensure ui-plugins are copied to docker container.
tonyanziano 215ee9c
Merge branch 'master' into toanzian/electron2
cwhitten 74b8858
Merge branch 'master' into toanzian/electron2
srinaath b3e0199
Change nodeIntegration to false in BrowserWindow config
cwhitten a376d88
Merge branch 'toanzian/electron2' of https://github.com/Microsoft/Bot…
cwhitten 39f3c70
Adding a Plist file to verify if codesign works
77fc38e
Updated plist file name
91290f8
Separated electron-builder config out into its own file.
tonyanziano 301fb18
Added trailing newline to `electron-builder-config.json`
tonyanziano 8738cce
Fixed broken script.
tonyanziano 9ca1058
Merge branch 'toanzian/electron2' of https://github.com/microsoft/Bot…
tonyanziano cb8c1de
Merge branch 'master' of https://github.com/microsoft/BotFramework-Co…
tonyanziano d5eb1e0
Server now waits for the express app to be listening before starting.
tonyanziano 64b3578
Leveraged 'debug' for logging.
tonyanziano 8837c2b
Change console.log to log
13b604b
Resolve lint error
704c150
Merge branch 'master' into toanzian/electron2
tonyanziano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| build/ | ||
| dist/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
96
Composer/packages/electron-server/electron-builder-config.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.
Binary file added
BIN
+51.3 KB
Composer/packages/electron-server/resources/composerIcon_1024x1024.png
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
14
Composer/packages/electron-server/resources/entitlements.plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.