Skip to content

Commit

Permalink
chore: enable easier electron builds by hosting some packages (#4383)
Browse files Browse the repository at this point in the history
* decompose shell and api into smaller types

* nest plugin pages under bot scope

* simplify webpack config

* make extension client external

* add mechanism to sync client shell to iframe plugin host

* only fetch extensions when app mounts

* add plugin pages selector

* output source maps with extension bundles

* rename file

* clean up manifest after loading extensions

* add project api hook

* update sample plugin to use project api

* disable sample-ui-plugin

* do not sync store to window

* prepare test-utils and types for publishing

* update package references to published pacakges

* add types package

* remove shared dependency from extension-client

* remove data from shell

* more types updates

* add useFormHook to expose current form data

* re-order useEffects

* add missing import

* move types to dependencies

* fix type errors

* add missing dependency

* fix tests

* remove old comments

* update lockfile

* use stub currentDialog when none found

* fix build:dev

* fix merge conflict

* add @botframework-composer/types to client
  • Loading branch information
a-b-r-o-w-n committed Oct 15, 2020
1 parent 2ea3f45 commit 27345fe
Show file tree
Hide file tree
Showing 251 changed files with 704 additions and 632 deletions.
34 changes: 17 additions & 17 deletions .vscode/snippets.json.code-snippets
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
// Place your BotFramework-Composer workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"React component test scaffolding": {
"prefix": "rct",
"body": [
"import React from 'react';",
"import { render } from '@bfc/test-utils';",
// Place your BotFramework-Composer workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"React component test scaffolding": {
"prefix": "rct",
"body": [
"import React from 'react';",
"import { render } from '@botframework-composer/test-utils';",
"import assign from 'lodash/assign';\n",
"import { $1 } from '$2';\n",
"const defaultProps = {\n $3\n};\n",
"function renderSubject(overrides = {}) {",
" const props = assign({}, defaultProps, overrides);",
" return render(<$1 {...props} />);",
"}\n",
"describe('<$1 />', () => {",
" it.todo('$0');",
"});\n"
],
"description": "React component test scaffolding"
}
"describe('<$1 />', () => {",
" it.todo('$0');",
"});\n"
],
"description": "React component test scaffolding"
}
}
1 change: 0 additions & 1 deletion Composer/.npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@bfcomposer:registry=https://botbuilder.myget.org/F/botbuilder-declarative/npm/
scripts-prepend-node-path=true
4 changes: 2 additions & 2 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
"scripts": {
"build": "node scripts/begin.js && yarn build:prod && yarn l10n",
"build:prod": "yarn build:dev && yarn build:client && yarn build:server && yarn build:electron",
"build:dev": "wsrun -ltm -x @bfc/electron-server -x @bfc/client -x @bfc/server -p @bfc/* -c build && yarn build:plugins",
"build:dev": "wsrun -ltm -x @bfc/electron-server -x @bfc/client -x @bfc/server -p @botframework-composer/* -p @bfc/* -c build && yarn build:plugins",
"build:electron": "yarn workspace @bfc/electron-server build && yarn workspace @bfc/electron-server l10n",
"build:server": "yarn workspace @bfc/server build",
"build:client": "yarn workspace @bfc/client build",
"build:plugins": "yarn build:plugins:localpublish && yarn build:plugins:samples && yarn build:plugins:azurePublish && yarn build:plugins:runtimes & yarn build:plugins:vacore",
"build:plugins": "yarn build:plugins:localpublish && yarn build:plugins:samples && yarn build:plugins:azurePublish && yarn build:plugins:runtimes && yarn build:plugins:vacore",
"build:plugins:localpublish": "cd plugins/localPublish && yarn install && yarn build",
"build:plugins:samples": "cd plugins/samples && yarn install && yarn build",
"build:plugins:azurePublish": "cd plugins/azurePublish && yarn install && yarn build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';
import { EditorExtensionContext } from '@bfc/extension-client';

import AdaptiveFlowEditor from '../../src/adaptive-flow-editor/AdaptiveFlowEditor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render, fireEvent, findByText } from '@bfc/test-utils';
import { render, fireEvent, findByText } from '@botframework-composer/test-utils';

import { IconMenu } from '../../../src/adaptive-flow-editor/components/IconMenu';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render, fireEvent } from '@bfc/test-utils';
import { render, fireEvent } from '@botframework-composer/test-utils';

import { enableKeyboardCommandAttributes } from '../../../src/adaptive-flow-editor/components/KeyboardZone';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React, { useContext } from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';
import { DialogFactory } from '@bfc/shared';

import { NodeRendererContext } from '../../../src/adaptive-flow-editor/contexts/NodeRendererContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React, { useContext } from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { SelectionContext } from '../../../src/adaptive-flow-editor/contexts/SelectionContext';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { renderHook } from '@bfc/test-utils/lib/hooks';
import { renderHook } from '@botframework-composer/test-utils/lib/hooks';

import { useEditorEventApi } from '../../../src/adaptive-flow-editor/hooks/useEditorEventApi';
import { ShellApiStub } from '../stubs/ShellApiStub';
import { defaultRendererContextValue } from '../../../src/adaptive-flow-editor/contexts/NodeRendererContext';
import { defaultSelectionContextValue } from '../../../src/adaptive-flow-editor/contexts/SelectionContext';
import { NodeEventTypes } from '../../../src/adaptive-flow-renderer/constants/NodeEventTypes';

describe('useSelectionEffect', () => {
describe('useEditorEventApi', () => {
const hook = renderHook(() =>
useEditorEventApi(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';
import { DialogGroup } from '@bfc/shared';

import { EdgeMenu } from '../../../src/adaptive-flow-editor/renderers/EdgeMenu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { ElementWrapper } from '../../../src/adaptive-flow-editor/renderers/ElementWrapper';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render, fireEvent, findAllByText } from '@bfc/test-utils';
import { render, fireEvent, findAllByText } from '@botframework-composer/test-utils';

import { NodeMenu } from '../../../src/adaptive-flow-editor/renderers/NodeMenu';
import { NodeEventTypes } from '../../../src/adaptive-flow-renderer/constants/NodeEventTypes';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render, fireEvent } from '@bfc/test-utils';
import { render, fireEvent } from '@botframework-composer/test-utils';
import { EditorExtensionContext } from '@bfc/extension-client';

import { ActionNodeWrapper } from '../../../src/adaptive-flow-editor/renderers/NodeWrapper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ export const ShellApiStub: ShellApi = {
updateLgTemplate: fnPromise,
removeLgTemplate: fnPromise,
removeLgTemplates: fnPromise,
updateLgFile: fnPromise,
debouncedUpdateLgTemplate: fnPromise,
getLuIntent: fn,
getLuIntents: fnList,
addLuIntent: fnPromise,
updateLuIntent: fnPromise,
removeLuIntent: fn,
updateLuFile: fnPromise,
debouncedUpdateLuIntent: fnPromise,
renameLuIntent: fnPromise,
updateRegExIntent: fn,
createDialog: fnPromise,
addCoachMarkRef: fn,
Expand All @@ -36,6 +41,21 @@ export const ShellApiStub: ShellApi = {
addSkillDialog: fnPromise,
announce: fn,
displayManifestModal: fn,
constructAction: fnPromise,
constructActions: fnPromise,
copyAction: fnPromise,
copyActions: fnPromise,
deleteAction: fnPromise,
deleteActions: fnPromise,
actionsContainLuIntent: fn,
updateQnaContent: fnPromise,
renameRegExIntent: fnPromise,
updateIntentTrigger: fnPromise,
commitChanges: fnPromise,
updateDialogSchema: fnPromise,
createTrigger: fnPromise,
updateSkillSetting: fnPromise,
updateFlowZoomRate: fnPromise,
};

describe('ShellApiStub', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
import { AdaptiveDialog } from '../../../src/adaptive-flow-renderer/adaptive/AdaptiveDialog';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { AdaptiveTrigger } from '../../../src/adaptive-flow-renderer/adaptive/AdaptiveTrigger';
import { SchemaContext } from '../../../src/adaptive-flow-renderer/contexts/SchemaContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { ArrowLine } from '../../../src/adaptive-flow-renderer/components/ArrowLine';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { Diamond } from '../../../src/adaptive-flow-renderer/components/Diamond';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { ElementMeasurer } from '../../../src/adaptive-flow-renderer/components/ElementMeasurer';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { FlowEdges } from '../../../src/adaptive-flow-renderer/components/FlowEdges';
import { Edge } from '../../../src/adaptive-flow-renderer/models/EdgeData';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { IconBrick } from '../../../src/adaptive-flow-renderer/components/IconBrick';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { LoopIndicator } from '../../../src/adaptive-flow-renderer/components/LoopIndicator';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { OffsetContainer } from '../../../src/adaptive-flow-renderer/components/OffsetContainer';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { SVGContainer } from '../../../src/adaptive-flow-renderer/components/SVGContainer';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { drawSVGEdge } from '../../../src/adaptive-flow-renderer/utils/visual/EdgeUtil';
import { EdgeDirection } from '../../../src/adaptive-flow-renderer/models/EdgeData';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';
import { WidgetComponent, FlowEditorWidgetMap, FlowWidget } from '@bfc/extension-client';

import { renderUIWidget, UIWidgetContext } from '../../../src/adaptive-flow-renderer/utils/visual/widgetRenderer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { ActionCard } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { DialogRef } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { ForeachWidget } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { IfConditionWidget } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { PromptWidget } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { SwitchConditionWidget } from '../../../src/adaptive-flow-renderer/widgets';
import { AdaptiveKinds } from '../../../src/adaptive-flow-renderer/constants/AdaptiveKinds';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

import React from 'react';
import { render } from '@bfc/test-utils';
import { render } from '@botframework-composer/test-utils';

import { Icon } from '../../../src/adaptive-flow-renderer/widgets/ActionHeader/icon';

Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/adaptive-flow/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const { createConfig } = require('@bfc/test-utils');
const { createConfig } = require('@botframework-composer/test-utils');

module.exports = createConfig('adaptive-form', 'react');
2 changes: 1 addition & 1 deletion Composer/packages/adaptive-flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"react": "16.13.1"
},
"devDependencies": {
"@bfc/test-utils": "*",
"@botframework-composer/test-utils": "*",
"@types/lodash": "^4.14.146",
"@types/react": "16.9.23",
"format-message": "^6.2.3",
Expand Down
Loading

0 comments on commit 27345fe

Please sign in to comment.