Skip to content

Commit

Permalink
fix: deploy issue while zipping the folder (#3557)
Browse files Browse the repository at this point in the history
* move bot-deploy to plugins

* fix profile edit and save not saving to settings

* add dependency to electron-server

* update settings file clicking customized runtime toggle

Co-authored-by: Wenyi Luo <wenyluo@microsoft.com>
Co-authored-by: Dong Lei <donglei@microsoft.com>
  • Loading branch information
3 people authored Jul 7, 2020
1 parent f9128fb commit 532c757
Show file tree
Hide file tree
Showing 29 changed files with 577 additions and 3,695 deletions.
6 changes: 1 addition & 5 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
"build:server": "yarn workspace @bfc/server build",
"build:client": "yarn workspace @bfc/client build",
"build:tools": "yarn workspace @bfc/tools build:all",
"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 && yarn install && yarn build",
"build:plugins:azureFunctionsPublish": "cd plugins/azureFunctionsPublish && yarn install && yarn build",
"build:plugins": "cd plugins && yarn install && yarn build:all",
"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
1 change: 0 additions & 1 deletion Composer/packages/client/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export enum ActionTypes {
DISPLAY_SKILL_MANIFEST_MODAL = 'DISPLAY_SKILL_MANIFEST_MODAL',
DISMISS_SKILL_MANIFEST_MODAL = 'DISMISS_SKILL_MANIFEST_MODAL',
SET_PUBLISH_TARGETS = 'SET_PUBLISH_TARGETS',
SET_RUNTIME_SETTINGS = 'SET_RUNTIME_SETTINGS',
SET_CUSTOM_RUNTIME_TOGGLE = 'SET_CUSTOM_RUNTIME_TOGGLE',
SET_RUNTIME_FIELD = 'SET_RUNTIME_FIELD',
}
Expand Down
4 changes: 0 additions & 4 deletions Composer/packages/client/src/store/action/eject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ActionCreator } from '../types';
import { ActionTypes } from '../../constants';

import httpClient from './../../utils/httpUtil';
import { setRuntimeSettings } from './setting';

export const getRuntimeTemplates: ActionCreator = async ({ dispatch }) => {
try {
Expand All @@ -30,9 +29,6 @@ export const ejectRuntime: ActionCreator = async (store, projectId, name) => {
type: ActionTypes.EJECT_SUCCESS,
payload: response.data,
});
if (response.data.settings?.path) {
setRuntimeSettings(store, projectId, response.data.settings.path, response.data.settings.startCommand);
}
} catch (err) {
dispatch({
type: ActionTypes.SET_ERROR,
Expand Down
11 changes: 0 additions & 11 deletions Composer/packages/client/src/store/action/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ export const setPublishTargets: ActionCreator = async ({ dispatch }, publishTarg
});
};

export const setRuntimeSettings: ActionCreator = async ({ dispatch }, projectId: string, path, command) => {
dispatch({
type: ActionTypes.SET_RUNTIME_SETTINGS,
payload: {
projectId,
path,
command,
},
});
};

export const setCustomRuntime: ActionCreator = async ({ dispatch }, _, isOn) => {
dispatch({
type: ActionTypes.SET_CUSTOM_RUNTIME_TOGGLE,
Expand Down
7 changes: 0 additions & 7 deletions Composer/packages/client/src/store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ export const initialBotState: BotState = {
isEnvSettingUpdated: false,
settings: {},
publishVersions: {},
publishStatus: 'inactive',
lastPublishChange: null,
publishTypes: [],
publishTargets: [],
publishHistory: {},
botOpening: false,
};
Expand Down Expand Up @@ -117,10 +114,6 @@ const initialAppState: AppState = {
clipboardActions: [],
runtimeTemplates: [],
userSettings: getUserSettings(),
runtimeSettings: {
path: '',
startCommand: '',
},
announcement: undefined,
appUpdate: {
progressPercent: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const actionType2ChangeType = {
[ActionTypes.UPDATE_SKILL_MANIFEST]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Manifest },
[ActionTypes.SYNC_ENV_SETTING]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
[ActionTypes.SET_PUBLISH_TARGETS]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
[ActionTypes.SET_RUNTIME_SETTINGS]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
[ActionTypes.EJECT_SUCCESS]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
[ActionTypes.SET_RUNTIME_FIELD]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
[ActionTypes.SET_CUSTOM_RUNTIME_TOGGLE]: { changeType: ChangeType.UPDATE, fileExtension: FileExtensions.Setting },
};

class FilePersistence {
Expand Down
20 changes: 8 additions & 12 deletions Composer/packages/client/src/store/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,7 @@ const syncEnvSetting: ReducerFunc = (state, { settings, projectId }) => {
};

const setPublishTargets: ReducerFunc = (state, { publishTarget }) => {
state.publishTargets = publishTarget;
return state;
};

const setRuntimeSettings: ReducerFunc = (state, { path, command }) => {
state.settings.runtime = {
customRuntime: true,
path,
command,
};
state.settings.publishTargets = publishTarget;
return state;
};

Expand Down Expand Up @@ -611,7 +602,13 @@ const setUserSettings: ReducerFunc<Partial<UserSettings>> = (state, settings) =>
};

const ejectSuccess: ReducerFunc = (state, payload) => {
state.runtimeSettings = payload.settings;
if (payload.settings?.path) {
state.settings.runtime = {
customRuntime: true,
path: payload.settings.path,
command: payload.settings.startCommand,
};
}
return state;
};

Expand Down Expand Up @@ -727,7 +724,6 @@ export const reducer = createReducer({
[ActionTypes.DISPLAY_SKILL_MANIFEST_MODAL]: displaySkillManifestModal,
[ActionTypes.DISMISS_SKILL_MANIFEST_MODAL]: dismissSkillManifestModal,
[ActionTypes.SET_PUBLISH_TARGETS]: setPublishTargets,
[ActionTypes.SET_RUNTIME_SETTINGS]: setRuntimeSettings,
[ActionTypes.SET_CUSTOM_RUNTIME_TOGGLE]: setCustomRuntimeToggle,
[ActionTypes.SET_RUNTIME_FIELD]: setRuntimeField,
});
8 changes: 0 additions & 8 deletions Composer/packages/client/src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ export interface BotState {
actionsSeed: any;

publishVersions: any;
publishStatus: any;
lastPublishChange: any;
publishTargets: any[];
publishTypes: PublishType[];
publishHistory: {
[key: string]: any[];
Expand Down Expand Up @@ -176,11 +173,6 @@ export type AppState = {

userSettings: UserSettings; // preferences for the editors

runtimeSettings: {
// custom runtime settings, used in ejection
path: string;
startCommand: string;
};
displaySkillManifest?: string;

// currently displayed error
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/electron-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"debug": "4.1.1",
"electron-updater": "4.2.5",
"fix-path": "^3.0.0",
"fs-extra": "^9.0.0",
"lodash": "^4.17.15",
"semver": "7.3.2"
}
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/electron-server/scripts/copy-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const filterOutTS = (src) => {
// copy plugins from /Composer/plugins/ to pre-packaged electron app
fs.copy(source, destination, { filter: filterOutTS }, (err) => {
if (err) {
console.err('[copy-plugins.js] Error while copying plugins: ', err);
console.error('[copy-plugins.js] Error while copying plugins: ', err);
return;
}
console.log('[copy-plugins.js] Copied plugins successfully.');
Expand Down
3 changes: 1 addition & 2 deletions Composer/packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"build:shared": "cd shared && yarn build",
"build:indexers": "cd indexers && yarn build",
"build:uishared": "cd ui-shared && yarn build",
"build:bot-deploy": "cd bot-deploy && yarn build",
"build:all": "yarn build:shared && yarn build:indexers && yarn build:code-editor && yarn build:uishared && yarn build:bot-deploy"
"build:all": "yarn build:shared && yarn build:indexers && yarn build:code-editor && yarn build:uishared"
},
"author": "",
"license": "ISC"
Expand Down
4 changes: 2 additions & 2 deletions Composer/plugins/azureFunctionsPublish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"dependencies": {
"@azure/arm-resources": "2.1.0",
"@azure/ms-rest-nodeauth": "3.0.3",
"@bfc/libs/bot-deploy": "../../packages/lib/bot-deploy",
"@bfc/plugin-loader": "../../packages/extensions/plugin-loader",
"@bfc/botframeworkdeploy": "*",
"@bfc/plugin-loader": "../packages/extensions/plugin-loader",
"@types/archiver": "3.1.0",
"@types/fs-extra": "8.1.0",
"@types/request": "2.48.4",
Expand Down
6 changes: 3 additions & 3 deletions Composer/plugins/azureFunctionsPublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import path from 'path';

import { BotProjectDeploy } from '@bfc/libs/bot-deploy';
import { BotProjectDeploy } from '@bfc/botframeworkdeploy';
import { v4 as uuid } from 'uuid';
import md5 from 'md5';
import { copy, rmdir, emptyDir, readJson, pathExists, writeJson, mkdirSync, writeFileSync } from 'fs-extra';
Expand Down Expand Up @@ -141,7 +141,7 @@ class AzurePublisher {
};
private removeLoadingStatus = (botId: string, profileName: string, jobId: string) => {
if (this.publishingBots[botId] && this.publishingBots[botId][profileName]) {
const index = this.publishingBots[botId][profileName].findIndex(item => item.result.id === jobId);
const index = this.publishingBots[botId][profileName].findIndex((item) => item.result.id === jobId);
const status = this.publishingBots[botId][profileName][index];
this.publishingBots[botId][profileName] = this.publishingBots[botId][profileName]
.slice(0, index)
Expand All @@ -154,7 +154,7 @@ class AzurePublisher {
if (this.publishingBots[botId] && this.publishingBots[botId][profileName].length > 0) {
// get current status
if (jobId) {
return this.publishingBots[botId][profileName].find(item => item.result.id === jobId);
return this.publishingBots[botId][profileName].find((item) => item.result.id === jobId);
}
return this.publishingBots[botId][profileName][this.publishingBots[botId][profileName].length - 1];
}
Expand Down
Loading

0 comments on commit 532c757

Please sign in to comment.