Skip to content

Commit

Permalink
fix: eject schema with runtime (microsoft#2787)
Browse files Browse the repository at this point in the history
* don't look into runtime folder

* eject schema

* update to lowercase

Co-authored-by: Chris Whitten <[email protected]>
  • Loading branch information
boydc2014 and cwhitten authored Apr 28, 2020
1 parent ef457d0 commit 6954722
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Composer/packages/server/src/models/bot/botProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export class BotProject {
const userSDKSchemaFile = this.files.find(f => f.name === 'sdk.schema');

if (userSDKSchemaFile !== undefined) {
debug('Customized SDK schema found');
try {
sdkSchema = JSON.parse(userSDKSchemaFile.content);
} catch (error) {
Expand Down Expand Up @@ -452,7 +453,7 @@ export class BotProject {
// load only from the data dir, otherwise may get "build" versions from
// deployment process
const root = this.dataDir;
const paths = await this.fileStorage.glob([pattern, '!(generated/**)'], root);
const paths = await this.fileStorage.glob([pattern, '!(generated/**)', '!(runtime/**)'], root);

for (const filePath of paths.sort()) {
const realFilePath: string = Path.join(root, filePath);
Expand Down Expand Up @@ -722,13 +723,14 @@ export class BotProject {
throw new Error(`${this.dir} is not a valid path`);
}

const schemasDir = Path.join(this.dir, 'Schemas');
const schemasDir = Path.join(this.dir, 'schemas');

if (!(await this.fileStorage.exists(schemasDir))) {
debug('No schemas directory found.');
return [];
}

debug('Schemas directory found.');
const schemas: FileInfo[] = [];
const paths = await this.fileStorage.glob('*.schema', schemasDir);

Expand Down
3 changes: 3 additions & 0 deletions Composer/plugins/localPublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ export default async (composer: any): Promise<void> => {
eject: async (project: any, localDisk: IFileStorage) => {
const sourcePath = path.resolve(__dirname, '../../../../BotProject/Templates/CSharp');
const destPath = path.join(project.dir, 'runtime');
const schemaSrcPath = path.join(sourcePath, 'Schemas');
const schemaDstPath = path.join(project.dir, 'schemas');
if (!(await project.fileStorage.exists(destPath))) {
// used to read bot project template from source (bundled in plugin)
await copyDir(sourcePath, localDisk, destPath, project.fileStorage);
await copyDir(schemaSrcPath, localDisk, schemaDstPath, project.fileStorage);
return destPath;
} else {
throw new Error(`Runtime already exists at ${destPath}`);
Expand Down

0 comments on commit 6954722

Please sign in to comment.