Skip to content

Commit a53f1be

Browse files
build(fetch-tool): use node16 module resolution (#20240)
Semi-automatic PR to switch to node16 module resolution --------- Co-authored-by: Sonali Deshpande <[email protected]>
1 parent d8dc721 commit a53f1be

File tree

9 files changed

+29
-26
lines changed

9 files changed

+29
-26
lines changed

packages/tools/fetch-tool/package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,25 @@
1010
},
1111
"license": "MIT",
1212
"author": "Microsoft and contributors",
13-
"main": "dist/fluidFetch.js",
14-
"types": "dist/fluidFetch.d.ts",
13+
"type": "module",
1514
"bin": {
1615
"fluid-fetch": "bin/fluid-fetch"
1716
},
1817
"scripts": {
1918
"build": "fluid-build . --task build",
2019
"build:compile": "fluid-build . --task compile",
21-
"check:are-the-types-wrong": "attw --pack",
20+
"build:esnext": "tsc --project ./tsconfig.json",
2221
"check:biome": "biome check .",
2322
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
24-
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\"",
23+
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" lib",
2524
"eslint": "eslint --format stylish src",
2625
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
2726
"format": "fluid-build --task format .",
2827
"format:biome": "biome check --apply .",
2928
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
3029
"lint": "fluid-build . --task lint",
3130
"lint:fix": "fluid-build . --task eslint:fix --task format",
32-
"tsc": "tsc"
31+
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist"
3332
},
3433
"dependencies": {
3534
"@fluid-internal/client-utils": "workspace:~",
@@ -49,14 +48,14 @@
4948
"@fluidframework/tool-utils": "workspace:~"
5049
},
5150
"devDependencies": {
52-
"@arethetypeswrong/cli": "^0.13.3",
5351
"@biomejs/biome": "^1.6.1",
5452
"@fluid-tools/build-cli": "^0.34.0",
5553
"@fluid-tools/fetch-tool-previous": "npm:@fluid-tools/[email protected]",
5654
"@fluidframework/build-common": "^2.0.3",
5755
"@fluidframework/build-tools": "^0.34.0",
5856
"@fluidframework/eslint-config-fluid": "^5.1.0",
5957
"@types/node": "^18.19.0",
58+
"copyfiles": "^2.4.1",
6059
"eslint": "~8.55.0",
6160
"prettier": "~3.0.3",
6261
"rimraf": "^4.4.0",

packages/tools/fetch-tool/src/fluidFetch.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import fs from "fs";
77
import util from "util";
88
import { IOdspDriveItem, isOdspHostname } from "@fluidframework/odsp-doclib-utils/internal";
9-
import { paramSaveDir, paramURL, parseArguments } from "./fluidFetchArgs";
10-
import { connectionInfo, fluidFetchInit } from "./fluidFetchInit";
11-
import { fluidFetchMessages } from "./fluidFetchMessages";
12-
import { getSharepointFiles, getSingleSharePointFile } from "./fluidFetchSharePoint";
13-
import { fluidFetchSnapshot } from "./fluidFetchSnapshot";
9+
import { paramSaveDir, paramURL, parseArguments } from "./fluidFetchArgs.js";
10+
import { connectionInfo, fluidFetchInit } from "./fluidFetchInit.js";
11+
import { fluidFetchMessages } from "./fluidFetchMessages.js";
12+
import { getSharepointFiles, getSingleSharePointFile } from "./fluidFetchSharePoint.js";
13+
import { fluidFetchSnapshot } from "./fluidFetchSnapshot.js";
1414

1515
async function fluidFetchOneFile(urlStr: string, name?: string) {
1616
const documentService = await fluidFetchInit(urlStr);

packages/tools/fetch-tool/src/fluidFetchInit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { FluidAppOdspUrlResolver, OdspUrlResolver } from "@fluidframework/odsp-u
1515
import * as r11s from "@fluidframework/routerlicious-driver";
1616
import { RouterliciousUrlResolver } from "@fluidframework/routerlicious-urlresolver";
1717
import { getMicrosoftConfiguration } from "@fluidframework/tool-utils";
18-
import { localDataOnly, paramJWT } from "./fluidFetchArgs";
19-
import { resolveWrapper } from "./fluidFetchSharePoint";
18+
import { localDataOnly, paramJWT } from "./fluidFetchArgs.js";
19+
import { resolveWrapper } from "./fluidFetchSharePoint.js";
2020

2121
export let latestVersionsId: string = "";
2222
export let connectionInfo: any;

packages/tools/fetch-tool/src/fluidFetchMessages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import {
1212
MessageType,
1313
ScopeType,
1414
} from "@fluidframework/protocol-definitions";
15-
import { printMessageStats } from "./fluidAnalyzeMessages";
15+
import { printMessageStats } from "./fluidAnalyzeMessages.js";
1616
import {
1717
connectToWebSocket,
1818
dumpMessageStats,
1919
dumpMessages,
2020
messageTypeFilter,
2121
overWrite,
2222
paramActualFormatting,
23-
} from "./fluidFetchArgs";
23+
} from "./fluidFetchArgs.js";
2424

2525
function filenameFromIndex(index: number): string {
2626
return index === 0 ? "" : index.toString(); // support old tools...

packages/tools/fetch-tool/src/fluidFetchSharePoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
getMicrosoftConfiguration,
2222
odspTokensCache,
2323
} from "@fluidframework/tool-utils";
24-
import { getForceTokenReauth } from "./fluidFetchArgs";
24+
import { getForceTokenReauth } from "./fluidFetchArgs.js";
2525

2626
export async function resolveWrapper<T>(
2727
callback: (authRequestInfo: IOdspAuthRequestInfo) => Promise<T>,

packages/tools/fetch-tool/src/fluidFetchSnapshot.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
1010
import { IDocumentService, IDocumentStorageService } from "@fluidframework/driver-definitions";
1111
import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
1212

13-
import { formatNumber } from "./fluidAnalyzeMessages";
13+
import { formatNumber } from "./fluidAnalyzeMessages.js";
1414
import {
1515
dumpSnapshotStats,
1616
dumpSnapshotTrees,
1717
dumpSnapshotVersions,
1818
paramActualFormatting,
1919
paramNumSnapshotVersions,
2020
paramSnapshotVersionIndex,
21-
} from "./fluidFetchArgs";
22-
import { latestVersionsId } from "./fluidFetchInit";
21+
} from "./fluidFetchArgs.js";
22+
import { latestVersionsId } from "./fluidFetchInit.js";
2323

2424
interface ISnapshotInfo {
2525
blobCountNew: number;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// This config must be used in a "type": "commonjs" environment. (Use `fluid-tsc commonjs`.)
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"outDir": "./dist",
6+
},
7+
}
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
2-
"extends": [
3-
"../../../common/build/build-common/tsconfig.base.json",
4-
"../../../common/build/build-common/tsconfig.cjs.json",
5-
],
2+
"extends": "../../../common/build/build-common/tsconfig.node16.json",
63
"include": ["src/**/*.ts"],
74
"exclude": ["dist", "node_modules"],
85
"compilerOptions": {
96
"rootDir": "./src",
10-
"outDir": "./dist",
7+
"outDir": "./lib",
118
"types": ["node"],
129
},
1310
}

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)