Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mposer-1 into lgupdate
  • Loading branch information
lei9444 committed Jun 29, 2020
2 parents 81aaa2a + 9b57a16 commit 5e76024
Show file tree
Hide file tree
Showing 328 changed files with 7,675 additions and 659 deletions.
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,18 @@
"port": 9228,
"sourceMaps": true
}
{
"type": "node",
"request": "launch",
"name": "Electron Main Process",
"runtimeExecutable": "${workspaceRoot}/Composer/node_modules/.bin/electron",
"args": [
"${workspaceRoot}/Composer/packages/electron-server",
],
"env": {
"NODE_ENV": "development",
},
"outputCapture": "std"
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"files.trimTrailingWhitespace": true,
"files.associations": {
"*.dialog": "json",
"*.botproj": "json",
"*.schema": "json"
},
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/node_modules": true,
"**/build": true
},
"eslint.enable": true,
"eslint.packageManager": "yarn",
"eslint.validate": [
Expand All @@ -14,6 +21,7 @@
],
"eslint.workingDirectories": ["./Composer"],
"typescript.tsdk": "./Composer/node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
Expand Down
10 changes: 10 additions & 0 deletions Composer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ module.exports = {
yoda: 'error',
'no-bitwise': 'error',
// eqeqeq: 'error',
'no-underscore-dangle': [
'error',
{
// add special window.__foo__ names as exceptions here
allow: ['__nonce__', '__IS_ELECTRON__'],
// allow this._name so custom getters and setters can be written gracefully
allowAfterThis: true,
enforceInMethodNames: true,
},
],

// plugin: import
'import/first': 'error',
Expand Down
3 changes: 3 additions & 0 deletions Composer/cypress/integration/LGPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ context('LG Page', () => {
// back to table view
cy.get('@switchButton').click();

// click the logo to clear any stray navigation
cy.findByAltText('Composer Logo').click();

// nav to Main dialog
cy.findByTestId('ProjectTree').within(() => {
cy.findByText('__TestTodoSample').click();
Expand Down
3 changes: 3 additions & 0 deletions Composer/cypress/integration/NotificationPage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ context('Notification Page', () => {
it('can show dialog expression error ', () => {
cy.visitPage('Design');

// click the logo to clear any stray tooltips from page navigation
cy.findByAltText('Composer Logo').click();

cy.findByTestId('ProjectTree').within(() => {
cy.findByText('WelcomeUser').click();
});
Expand Down
2 changes: 1 addition & 1 deletion Composer/cypress/integration/Onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ context('Onboarding', () => {

//enable onboarding setting
cy.visitPage('Settings');
cy.findByText('App Settings').click();
cy.findByText('Application Settings').click();
cy.findByLabelText('Onboarding').click();
cy.visitPage('Design');
});
Expand Down
13 changes: 8 additions & 5 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"serialize-javascript": "^3.1.0",
"lodash": "^4.17.12",
"set-value": "^3.0.2",
"kind-of": "^6.0.3"
"kind-of": "^6.0.3",
"elliptic": "^6.5.3"
},
"engines": {
"node": ">=12"
Expand All @@ -26,9 +27,7 @@
"packages/tools",
"packages/tools/language-servers",
"packages/tools/language-servers/*",
"packages/ui-plugins/*",
"packages/plugins",
"packages/plugins/*"
"packages/ui-plugins/*"
],
"scripts": {
"build": "node scripts/begin.js && yarn build:prod && yarn build:plugins",
Expand All @@ -41,7 +40,11 @@
"build:server": "yarn workspace @bfc/server build",
"build:client": "yarn workspace @bfc/client build",
"build:tools": "yarn workspace @bfc/tools build:all",
"build:plugins": "wsrun -lt -p @bfc/plugin-samples @bfc/plugin-azure-publish @bfc/plugin-azure-functions-publish @bfc/plugin-localpublish -c build",
"build:plugins": "yarn build:plugins:localpublish && yarn build:plugins:samples && yarn build:plugins:azurePublish && yarn build:plugins:azureFunctionsPublish",
"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 && rimraf yarn.lock && yarn install && yarn build",
"build:plugins:azureFunctionsPublish": "cd plugins/azureFunctionsPublish && rimraf yarn.lock && yarn install && yarn build",
"start": "cross-env NODE_ENV=production PORT=3000 yarn start:server",
"startall": "yarn start",
"start:dev": "concurrently \"npm:start:client\" \"npm:start:server:dev\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('getActivityTypes', () => {
{ key: 'Microsoft.OnHandoffActivity', text: 'Handover to human (Handoff activity)' },
{ key: 'Microsoft.OnInvokeActivity', text: 'Conversation invoked (Invoke activity)' },
{ key: 'Microsoft.OnTypingActivity', text: 'User is typing (Typing activity)' },
{ key: 'Microsoft.OnMessageActivity', text: 'Message received (Message recieved activity)' },
{ key: 'Microsoft.OnMessageActivity', text: 'Message received (Message received activity)' },
{ key: 'Microsoft.OnMessageDeleteActivity', text: 'Message deleted (Message deleted activity)' },
{ key: 'Microsoft.OnMessageReactionActivity', text: 'Message reaction (Message reaction activity)' },
{ key: 'Microsoft.OnMessageUpdateActivity', text: 'Message updated (Message updated activity)' },
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/client/config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function getClientEnvironment(publicUrl) {
SDK_PACKAGE_VERSION: '4.9.3', // TODO: change this when Composer supports custom schema/custom runtime
COMPOSER_VERSION: '1.0.1',
LOCAL_PUBLISH_PATH:
process.env.LOCAL_PUBLISH_PATH || path.resolve(process.cwd(), '../plugins/localPublish/hostedBots'),
process.env.LOCAL_PUBLISH_PATH || path.resolve(process.cwd(), '../../plugins/localPublish/hostedBots'),
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@types/reach__router": "^1.2.4",
"@types/react": "16.9.23",
"@types/react-dom": "16.9.5",
"@types/webpack-env": "^1.15.2",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-loader": "8.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type SortState = {
descending: boolean;
};

const _renderIcon = (file: File) => {
const renderIcon = (file: File) => {
const iconName = getFileIconName(file);
if (iconName === FileTypes.FOLDER) {
return <Icon iconName="OpenFolderHorizontal" style={{ fontSize: '16px' }} />;
Expand All @@ -60,7 +60,7 @@ const _renderIcon = (file: File) => {
return <img alt={`${iconName} file icon`} className={detailListClass.fileIconImg} src={url} />;
};

const _renderNameColumn = (onFileChosen: (file: File) => void) => (file: File) => {
const renderNameColumn = (onFileChosen: (file: File) => void) => (file: File) => {
const iconName = getFileIconName(file);
return (
<div data-is-focusable css={tableCell}>
Expand Down Expand Up @@ -105,7 +105,7 @@ export const FileSelector: React.FC<FileSelectorProps> = (props) => {
fieldName: 'name',
minWidth: 16,
maxWidth: 16,
onRender: _renderIcon,
onRender: renderIcon,
},
{
key: 'name',
Expand All @@ -118,7 +118,7 @@ export const FileSelector: React.FC<FileSelectorProps> = (props) => {
sortAscendingAriaLabel: formatMessage('Sorted A to Z'),
sortDescendingAriaLabel: formatMessage('Sorted Z to A'),
data: 'string',
onRender: _renderNameColumn(onFileChosen),
onRender: renderNameColumn(onFileChosen),
isPadded: true,
},
{
Expand Down
6 changes: 3 additions & 3 deletions Composer/packages/client/src/components/ErrorPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ErrorPopupProps = {
export const ErrorPopup = (props: ErrorPopupProps) => {
const [hidden, setHidden] = useState(props.error ? false : true);

const _closeDialog = () => {
const closeDialog = () => {
setHidden(true);
props.onDismiss();
};
Expand All @@ -35,11 +35,11 @@ export const ErrorPopup = (props: ErrorPopupProps) => {
isBlocking: false,
styles: { main: { maxWidth: 450 } },
}}
onDismiss={_closeDialog}
onDismiss={closeDialog}
>
<div css={consoleStyle}>{props.error}</div>
<DialogFooter>
<PrimaryButton text="Ok" onClick={_closeDialog} />
<PrimaryButton text="Ok" onClick={closeDialog} />
</DialogFooter>
</Dialog>
);
Expand Down
2 changes: 2 additions & 0 deletions Composer/packages/client/src/components/NavTree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface INavTreeItem {
name: string;
ariaLabel?: string;
url: string;
disabled?: boolean;
}

interface INavTreeProps {
Expand Down Expand Up @@ -54,6 +55,7 @@ const NavTree: React.FC<INavTreeProps> = (props) => {
return (
<DefaultButton
key={item.id}
disabled={item.disabled}
href={item.url}
styles={isSelected ? itemSelected : itemNotSelected}
text={item.name}
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/client/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export enum AppUpdaterStatus {

export const DefaultPublishConfig = {
name: 'default',
type: '@bfc/plugin-localpublish',
type: 'localpublish',
};

export const EmptyBotTemplateId = 'EmptyBot';
Expand Down
36 changes: 28 additions & 8 deletions Composer/packages/client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import './index.css';
import { App } from './App';
import { StoreProvider } from './store';

const appHostElm = document.getElementById('root');

formatMessage.setup({
missingTranslation: 'ignore',
});
Expand All @@ -20,11 +22,29 @@ const emotionCache = createCache({
nonce: window.__nonce__,
});

ReactDOM.render(
<CacheProvider value={emotionCache}>
<StoreProvider>
<App />
</StoreProvider>
</CacheProvider>,
document.getElementById('root')
);
/**
* Renders the React App module.
*/
const renderApp = (AppComponent: typeof App) => {
ReactDOM.render(
<CacheProvider value={emotionCache}>
<StoreProvider>
<AppComponent />
</StoreProvider>
</CacheProvider>,
appHostElm
);
};

// Rendering the App for the first time.
renderApp(App);

/**
* Re-render updated App Module when hot module notifies a change.
*/
if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require<{ App: typeof App }>('./App').App;
renderApp(NextApp);
});
}
2 changes: 2 additions & 0 deletions Composer/packages/client/src/pages/design/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ const DesignPage: React.FC<RouteComponentProps<{ dialogId: string; projectId: st
onBreadcrumbItemClick: handleBreadcrumbItemClick,
promptTab: getTabFromFragment(),
});
/* eslint-disable no-underscore-dangle */
// @ts-ignore
globalHistory._onTransitionComplete();
/* eslint-enable */
} else {
//leave design page should clear the history
clearUndoHistory();
Expand Down
5 changes: 3 additions & 2 deletions Composer/packages/client/src/pages/home/ExampleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const resolveIcon = (exampleId: string): string => {
export const ExampleList: React.FC<ExampleListProps> = (props) => {
const { onClick, examples } = props;

function _onRenderCell(item?: ProjectTemplate): React.ReactNode {
function onRenderCell(item?: ProjectTemplate): React.ReactNode {
if (!item) {
return;
}
Expand All @@ -46,6 +46,7 @@ export const ExampleList: React.FC<ExampleListProps> = (props) => {
data-is-focusable
aria-label={item.name + '; ' + item.description}
css={exampleListCell}
role="button"
tabIndex={0}
onClick={() => onClick(item.id)}
onKeyDown={(ev) => {
Expand All @@ -66,7 +67,7 @@ export const ExampleList: React.FC<ExampleListProps> = (props) => {
return (
<div css={exampleListContainer} data-is-scrollable="true">
<ScrollablePane scrollbarVisibility={ScrollbarVisibility.auto}>
<List items={examples} onRenderCell={_onRenderCell} />
<List items={examples} onRenderCell={onRenderCell} />
</ScrollablePane>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/client/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const Home: React.FC<RouteComponentProps> = () => {
<h1 css={home.title}>{formatMessage(`Bot Framework Composer`)}</h1>
<div aria-label={formatMessage('Composer introduction')} css={home.introduction} role="region">
{formatMessage(
'Bot Framework Composer is an integrated development environment (IDE) for building bots and other types of conversational software with the Microsoft Bot Framework technology stack'
'Bot Framework Composer is an integrated development environment (IDE) for building bots and other types of conversational software with the Microsoft Bot Framework technology stack.'
)}
</div>
<div css={home.newBotContainer}>
Expand Down Expand Up @@ -216,7 +216,7 @@ const Home: React.FC<RouteComponentProps> = () => {
<div css={home.linkContainer}>
<div>
{formatMessage(
'Bot Framework provides the most comprehensive experience for building conversation applications.'
'Bot Framework provides the most comprehensive experience for building conversational applications.'
)}
</div>
{linksButtom.map((link) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {
[file, projectId]
);

const _onChange = useCallback(
const onChange = useCallback(
(value) => {
if (!file) return;
if (inlineMode) {
Expand Down Expand Up @@ -142,7 +142,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {
}}
lgOption={lgOption}
value={content}
onChange={_onChange}
onChange={onChange}
onChangeSettings={handleSettingsChange}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {
[file, projectId]
);

const _onChange = useCallback(
const onChange = useCallback(
(value) => {
setContent(value);
if (!file) return;
Expand Down Expand Up @@ -134,7 +134,7 @@ const CodeEditor: React.FC<CodeEditorProps> = (props) => {
}}
luOption={luOption}
value={content}
onChange={_onChange}
onChange={onChange}
onChangeSettings={handleSettingsChange}
/>
);
Expand Down
Loading

0 comments on commit 5e76024

Please sign in to comment.