Skip to content

Commit 8bdbe6b

Browse files
committed
Fix after upgrade to tmp=0.2.4
1. Also upgrade the type definition 2. Adapt the tests to make it compile
1 parent 63d3b08 commit 8bdbe6b

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

app/server/lib/Requests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class DocRequests {
1616
// and only as long as needed to finish calculating all formulas.
1717
// When _numPending reaches 0 again, _cacheDir is deleted.
1818
private _numPending: number = 0;
19-
private _cacheDir: tmp.SynchrounousResult | null = null;
19+
private _cacheDir: tmp.DirResult | null = null;
2020

2121
constructor(private readonly _activeDoc: ActiveDoc) {}
2222

app/server/lib/uploads.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ interface TmpDirResult {
401401
* Helper to create a temporary directory. It's a simple wrapper around tmp.dir, but replaces the
402402
* cleanup callback with an asynchronous version.
403403
*/
404-
export async function createTmpDir(options: tmp.Options): Promise<TmpDirResult> {
404+
export async function createTmpDir(options: tmp.DirOptions): Promise<TmpDirResult> {
405405
const fullOptions = {prefix: 'grist-upload-', unsafeCleanup: true, ...options};
406406

407407
const [tmpDir, tmpCleanup]: [string, CleanupCB] = await fromCallback(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@types/sinon": "17.0.3",
8787
"@types/sqlite3": "3.1.6",
8888
"@types/swagger-ui": "3.52.4",
89-
"@types/tmp": "0.0.33",
89+
"@types/tmp": "0.2.6",
9090
"@types/uuid": "10.0.0",
9191
"@types/webpack-dev-server": "4.7.2",
9292
"@types/which": "2.0.1",

test/server/lib/DocStorageManager.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ describe('DocStorageManager', function() {
1616
// Set Grist home to a temporary directory, and wipe it out on exit.
1717
let docsRoot: string;
1818
let docStorageManager: DocStorageManager;
19-
before(function() {
20-
return tmp.dirAsync({ prefix: 'grist_test_', unsafeCleanup: true })
21-
.then(tmpDir => {
22-
docsRoot = fse.realpathSync(tmpDir);
23-
docStorageManager = new DocStorageManager(docsRoot);
24-
});
19+
before(async function() {
20+
const tmpDir = await tmp.dirAsync({ prefix: 'grist_test_', unsafeCleanup: true });
21+
docsRoot = fse.realpathSync(tmpDir);
22+
docStorageManager = new DocStorageManager(docsRoot);
2523
});
2624

2725
describe('getPath', function() {
@@ -81,7 +79,7 @@ describe('DocStorageManager', function() {
8179
// First create a doc, one under docsRoot, one outside; and include an attachment.
8280
fse.writeFileSync(doc1, "this is a test");
8381
const doc2 = tmp.fileSync({
84-
prefix: 'DeleteTest2', postfix: '.grist', unsafeCleanup: true,
82+
prefix: 'DeleteTest2', postfix: '.grist',
8583
discardDescriptor: true
8684
}).name;
8785
// Check that items got created as we expect.

test/server/testUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as path from 'path';
1717
import * as fse from 'fs-extra';
1818
import clone = require('lodash/clone');
1919
import * as tmp from 'tmp-promise';
20-
import {Options as TmpOptions} from 'tmp';
20+
import {FileOptions as TmpOptions} from 'tmp';
2121
import * as winston from 'winston';
2222
import { serialize } from 'winston/lib/winston/common';
2323

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,10 +1484,10 @@
14841484
dependencies:
14851485
"@types/node" "*"
14861486

1487-
"@types/tmp@0.0.33":
1488-
version "0.0.33"
1489-
resolved "https://registry.npmjs.org/@types/tmp/-/tmp-0.0.33.tgz"
1490-
integrity sha1-EHPEvIJHVK49EM+riKsCN7qWTk0=
1487+
"@types/tmp@0.2.6":
1488+
version "0.2.6"
1489+
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.6.tgz#d785ee90c52d7cc020e249c948c36f7b32d1e217"
1490+
integrity sha512-chhaNf2oKHlRkDGt+tiKE2Z5aJ6qalm7Z9rlLdBwmOiAAf09YQvvoLXjWK4HWPF1xU/fqvMgfNfpVoBscA/tKA==
14911491

14921492
"@types/tough-cookie@*":
14931493
version "4.0.2"

0 commit comments

Comments
 (0)