Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace async-file with fs-extra to match other packages #805

Merged
merged 2 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions libraries/botbuilder/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libraries/botbuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"dependencies": {
"@types/filenamify": "^2.0.1",
"@types/node": "^10.12.18",
"async-file": "^2.0.2",
"botbuilder-core": "~4.1.6",
"botframework-connector": "~4.1.6",
"filenamify": "^2.0.0"
"filenamify": "^2.0.0",
"fs-extra": "^7.0.1"
},
"devDependencies": {
"@types/mocha": "^2.2.47",
Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder/src/fileTranscriptStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as fs from 'async-file';
import * as fs from 'fs-extra';
import { Activity, PagedResult, TranscriptInfo, TranscriptStore } from 'botbuilder-core';
import * as filenamify from 'filenamify';
import * as path from 'path';
Expand Down Expand Up @@ -78,7 +78,7 @@ export class FileTranscriptStore implements TranscriptStore {
const pagedResult: PagedResult<Activity> = { items: [], continuationToken: undefined };
const transcriptFolder: string = this.getTranscriptFolder(channelId, conversationId);

const exists = await fs.exists(transcriptFolder);
const exists = await fs.pathExists(transcriptFolder);
if (!exists) {
return pagedResult;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ export class FileTranscriptStore implements TranscriptStore {
const pagedResult: PagedResult<TranscriptInfo> = { items: [], continuationToken: undefined };
const channelFolder: string = this.getChannelFolder(channelId);

const exists = await fs.exists(channelFolder);
const exists = await fs.pathExists(channelFolder);
if (!exists) {
return pagedResult;
}
Expand Down Expand Up @@ -145,13 +145,13 @@ export class FileTranscriptStore implements TranscriptStore {

const transcriptFolder: string = this.getTranscriptFolder(channelId, conversationId);

return fs.delete(transcriptFolder);
return fs.remove(transcriptFolder);
}

private async saveActivity(activity: Activity, transcriptPath: string, activityFilename: string): Promise<void> {
const json: string = JSON.stringify(activity, null, '\t');

const exists = await fs.exists(transcriptPath);
const exists = await fs.pathExists(transcriptPath);
if (!exists) {
await fs.mkdirp(transcriptPath);
}
Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder/tests/fileTranscriptStore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { FileTranscriptStore } = require('../');
const assert = require('assert');
const path = require('path');
const os = require('os');
const fs = require('async-file');
const fs = require('fs-extra');
const uuid = require('uuid');
const { ActivityTypes } = require('botbuilder-core');

Expand All @@ -13,10 +13,10 @@ describe('The FileTranscriptStore', () => {
let storage;
const startDate = new Date();
before(async () => {
await fs.delete(workingFolder);
await fs.remove(workingFolder);
storage = new FileTranscriptStore(workingFolder);
});
after(() => fs.delete(workingFolder));
after(() => fs.remove(workingFolder));

it('should delete transcripts', async () => {
const [activity] = createActivities('deleteActivitySpec', startDate, 1);
Expand Down Expand Up @@ -155,7 +155,7 @@ describe('The FileTranscriptStore', () => {
storage = new FileTranscriptStore(workingFolder);
return Promise.all(activities.map(activity => storage.logActivity(activity)));
});
after(() => fs.delete(workingFolder));
after(() => fs.remove(workingFolder));

it('with a continuationToken when the page size is smaller than the number of activities stored', async () => {
let pagedResult = await storage.getTranscriptActivities('test', conversationId);
Expand Down Expand Up @@ -224,7 +224,7 @@ describe('The FileTranscriptStore', () => {
storage = new FileTranscriptStore(workingFolder);
return Promise.all(activities.map(activity => storage.logActivity(activity)));
});
after(() => fs.delete(workingFolder));
after(() => fs.remove(workingFolder));

it('for a given conversation and page through them as expected', async () => {
let pagedResult = {};
Expand Down
38 changes: 38 additions & 0 deletions libraries/botframework-config/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading