Skip to content

Commit 226057b

Browse files
shilmanstorybook-bot
authored andcommitted
Merge pull request #27366 from mnigh/next
Dependency: Upgrade tempy (cherry picked from commit cf0af1a)
1 parent 87fd96c commit 226057b

File tree

12 files changed

+73
-117
lines changed

12 files changed

+73
-117
lines changed

code/lib/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"read-pkg-up": "^7.0.1",
9090
"semver": "^7.3.7",
9191
"strip-json-comments": "^3.0.1",
92-
"tempy": "^1.0.1",
92+
"tempy": "^3.1.0",
9393
"tiny-invariant": "^1.3.1",
9494
"ts-dedent": "^2.0.0"
9595
},

code/lib/cli/src/automigrate/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import prompts from 'prompts';
22
import chalk from 'chalk';
33
import boxen from 'boxen';
44
import { createWriteStream, move, remove } from 'fs-extra';
5-
import tempy from 'tempy';
65
import { join } from 'path';
76
import invariant from 'tiny-invariant';
87
import semver from 'semver';
@@ -40,8 +39,9 @@ let TEMP_LOG_FILE_PATH = '';
4039
const originalStdOutWrite = process.stdout.write.bind(process.stdout);
4140
const originalStdErrWrite = process.stderr.write.bind(process.stdout);
4241

43-
const augmentLogsToFile = () => {
44-
TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME });
42+
const augmentLogsToFile = async () => {
43+
const { temporaryFile } = await import('tempy');
44+
TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME });
4545
const logStream = createWriteStream(TEMP_LOG_FILE_PATH);
4646

4747
process.stdout.write = (d: string) => {
@@ -158,7 +158,7 @@ export const automigrate = async ({
158158
return null;
159159
}
160160

161-
augmentLogsToFile();
161+
await augmentLogsToFile();
162162

163163
logger.info('🔎 checking possible migrations..');
164164

code/lib/cli/src/dirs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { dirname, join } from 'path';
22

33
import downloadTarball from '@ndelangen/get-tarball';
44
import getNpmTarballUrl from 'get-npm-tarball-url';
5-
import * as tempy from 'tempy';
65

76
import invariant from 'tiny-invariant';
87
import { externalFrameworks } from './project_types';
@@ -16,7 +15,8 @@ export function getCliDir() {
1615
}
1716

1817
const resolveUsingBranchInstall = async (packageManager: JsPackageManager, request: string) => {
19-
const tempDirectory = tempy.directory();
18+
const { temporaryDirectory } = await import('tempy');
19+
const tempDirectory = temporaryDirectory();
2020
const name = request as keyof typeof versions;
2121

2222
// FIXME: this might not be the right version for community packages

code/lib/cli/src/doctor/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import chalk from 'chalk';
22
import boxen from 'boxen';
33
import { createWriteStream, move, remove } from 'fs-extra';
4-
import tempy from 'tempy';
54
import dedent from 'ts-dedent';
65
import { join } from 'path';
76

@@ -24,8 +23,9 @@ let TEMP_LOG_FILE_PATH = '';
2423
const originalStdOutWrite = process.stdout.write.bind(process.stdout);
2524
const originalStdErrWrite = process.stderr.write.bind(process.stdout);
2625

27-
const augmentLogsToFile = () => {
28-
TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME });
26+
const augmentLogsToFile = async () => {
27+
const { temporaryFile } = await import('tempy');
28+
TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME });
2929
const logStream = createWriteStream(TEMP_LOG_FILE_PATH);
3030

3131
process.stdout.write = (d: string) => {
@@ -51,7 +51,7 @@ export const doctor = async ({
5151
configDir: userSpecifiedConfigDir,
5252
packageManager: pkgMgr,
5353
}: DoctorOptions = {}) => {
54-
augmentLogsToFile();
54+
await augmentLogsToFile();
5555

5656
let foundIssues = false;
5757
const logDiagnostic = (title: string, message: string) => {

code/lib/core-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"pretty-hrtime": "^1.0.3",
7070
"resolve-from": "^5.0.0",
7171
"semver": "^7.3.7",
72-
"tempy": "^1.0.1",
72+
"tempy": "^3.1.0",
7373
"tiny-invariant": "^1.3.1",
7474
"ts-dedent": "^2.0.0",
7575
"util": "^0.12.4"

code/lib/core-common/src/utils/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { WriteStream } from 'fs-extra';
22
import { move, remove, writeFile, readFile, createWriteStream } from 'fs-extra';
33
import { join } from 'path';
4-
import tempy from 'tempy';
54
import { rendererPackages } from './get-storybook-info';
65
import type { JsPackageManager } from '../js-package-manager';
76
import versions from '../versions';
@@ -86,7 +85,8 @@ export const createLogStream = async (
8685
logStream: WriteStream;
8786
}> => {
8887
const finalLogPath = join(process.cwd(), logFileName);
89-
const temporaryLogPath = tempy.file({ name: logFileName });
88+
const { temporaryFile } = await import('tempy');
89+
const temporaryLogPath = temporaryFile({ name: logFileName });
9090

9191
const logStream = createWriteStream(temporaryLogPath, { encoding: 'utf8' });
9292

code/yarn.lock

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5796,7 +5796,7 @@ __metadata:
57965796
slash: "npm:^5.0.0"
57975797
strip-ansi: "npm:^7.1.0"
57985798
strip-json-comments: "npm:^3.1.1"
5799-
tempy: "npm:^1.0.1"
5799+
tempy: "npm:^3.1.0"
58005800
tiny-invariant: "npm:^1.3.1"
58015801
ts-dedent: "npm:^2.0.0"
58025802
typescript: "npm:^5.3.2"
@@ -5925,7 +5925,7 @@ __metadata:
59255925
resolve-from: "npm:^5.0.0"
59265926
semver: "npm:^7.3.7"
59275927
slash: "npm:^5.0.0"
5928-
tempy: "npm:^1.0.1"
5928+
tempy: "npm:^3.1.0"
59295929
tiny-invariant: "npm:^1.3.1"
59305930
ts-dedent: "npm:^2.0.0"
59315931
type-fest: "npm:~2.19"
@@ -12655,10 +12655,12 @@ __metadata:
1265512655
languageName: node
1265612656
linkType: hard
1265712657

12658-
"crypto-random-string@npm:^2.0.0":
12659-
version: 2.0.0
12660-
resolution: "crypto-random-string@npm:2.0.0"
12661-
checksum: 10c0/288589b2484fe787f9e146f56c4be90b940018f17af1b152e4dde12309042ff5a2bf69e949aab8b8ac253948381529cc6f3e5a2427b73643a71ff177fa122b37
12658+
"crypto-random-string@npm:^4.0.0":
12659+
version: 4.0.0
12660+
resolution: "crypto-random-string@npm:4.0.0"
12661+
dependencies:
12662+
type-fest: "npm:^1.0.1"
12663+
checksum: 10c0/16e11a3c8140398f5408b7fded35a961b9423c5dac39a60cbbd08bd3f0e07d7de130e87262adea7db03ec1a7a4b7551054e0db07ee5408b012bac5400cfc07a5
1266212664
languageName: node
1266312665
linkType: hard
1266412666

@@ -13143,22 +13145,6 @@ __metadata:
1314313145
languageName: node
1314413146
linkType: hard
1314513147

13146-
"del@npm:^6.0.0":
13147-
version: 6.1.1
13148-
resolution: "del@npm:6.1.1"
13149-
dependencies:
13150-
globby: "npm:^11.0.1"
13151-
graceful-fs: "npm:^4.2.4"
13152-
is-glob: "npm:^4.0.1"
13153-
is-path-cwd: "npm:^2.2.0"
13154-
is-path-inside: "npm:^3.0.2"
13155-
p-map: "npm:^4.0.0"
13156-
rimraf: "npm:^3.0.2"
13157-
slash: "npm:^3.0.0"
13158-
checksum: 10c0/8a095c5ccade42c867a60252914ae485ec90da243d735d1f63ec1e64c1cfbc2b8810ad69a29ab6326d159d4fddaa2f5bad067808c42072351ec458efff86708f
13159-
languageName: node
13160-
linkType: hard
13161-
1316213148
"delay@npm:^5.0.0":
1316313149
version: 5.0.0
1316413150
resolution: "delay@npm:5.0.0"
@@ -16388,7 +16374,7 @@ __metadata:
1638816374
languageName: node
1638916375
linkType: hard
1639016376

16391-
"globby@npm:^11.0.1, globby@npm:^11.1.0":
16377+
"globby@npm:^11.1.0":
1639216378
version: 11.1.0
1639316379
resolution: "globby@npm:11.1.0"
1639416380
dependencies:
@@ -17987,13 +17973,6 @@ __metadata:
1798717973
languageName: node
1798817974
linkType: hard
1798917975

17990-
"is-path-cwd@npm:^2.2.0":
17991-
version: 2.2.0
17992-
resolution: "is-path-cwd@npm:2.2.0"
17993-
checksum: 10c0/afce71533a427a759cd0329301c18950333d7589533c2c90205bd3fdcf7b91eb92d1940493190567a433134d2128ec9325de2fd281e05be1920fbee9edd22e0a
17994-
languageName: node
17995-
linkType: hard
17996-
1799717976
"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3":
1799817977
version: 3.0.3
1799917978
resolution: "is-path-inside@npm:3.0.3"
@@ -27245,10 +27224,10 @@ __metadata:
2724527224
languageName: node
2724627225
linkType: hard
2724727226

27248-
"temp-dir@npm:^2.0.0":
27249-
version: 2.0.0
27250-
resolution: "temp-dir@npm:2.0.0"
27251-
checksum: 10c0/b1df969e3f3f7903f3426861887ed76ba3b495f63f6d0c8e1ce22588679d9384d336df6064210fda14e640ed422e2a17d5c40d901f60e161c99482d723f4d309
27227+
"temp-dir@npm:^3.0.0":
27228+
version: 3.0.0
27229+
resolution: "temp-dir@npm:3.0.0"
27230+
checksum: 10c0/a86978a400984cd5f315b77ebf3fe53bb58c61f192278cafcb1f3fb32d584a21dc8e08b93171d7874b7cc972234d3455c467306cc1bfc4524b622e5ad3bfd671
2725227231
languageName: node
2725327232
linkType: hard
2725427233

@@ -27261,16 +27240,15 @@ __metadata:
2726127240
languageName: node
2726227241
linkType: hard
2726327242

27264-
"tempy@npm:^1.0.1":
27265-
version: 1.0.1
27266-
resolution: "tempy@npm:1.0.1"
27243+
"tempy@npm:^3.1.0":
27244+
version: 3.1.0
27245+
resolution: "tempy@npm:3.1.0"
2726727246
dependencies:
27268-
del: "npm:^6.0.0"
27269-
is-stream: "npm:^2.0.0"
27270-
temp-dir: "npm:^2.0.0"
27271-
type-fest: "npm:^0.16.0"
27272-
unique-string: "npm:^2.0.0"
27273-
checksum: 10c0/864a1cf1b5536dc21e84ae45dbbc3ba4dd2c7ec1674d895f99c349cf209df959a53d797ca38d0b2cf69c7684d565fde5cfc67faaa63b7208ffb21d454b957472
27247+
is-stream: "npm:^3.0.0"
27248+
temp-dir: "npm:^3.0.0"
27249+
type-fest: "npm:^2.12.2"
27250+
unique-string: "npm:^3.0.0"
27251+
checksum: 10c0/b88e70baa8d935ba8f0e0372b59ad1a961121f098da5fb4a6e05bec98ec32a49026b553532fb75c1c102ec782fd4c6a6bde0d46cbe87013fa324451ce476fb76
2727427252
languageName: node
2727527253
linkType: hard
2727627254

@@ -28236,12 +28214,12 @@ __metadata:
2823628214
languageName: node
2823728215
linkType: hard
2823828216

28239-
"unique-string@npm:^2.0.0":
28240-
version: 2.0.0
28241-
resolution: "unique-string@npm:2.0.0"
28217+
"unique-string@npm:^3.0.0":
28218+
version: 3.0.0
28219+
resolution: "unique-string@npm:3.0.0"
2824228220
dependencies:
28243-
crypto-random-string: "npm:^2.0.0"
28244-
checksum: 10c0/11820db0a4ba069d174bedfa96c588fc2c96b083066fafa186851e563951d0de78181ac79c744c1ed28b51f9d82ac5b8196ff3e4560d0178046ef455d8c2244b
28221+
crypto-random-string: "npm:^4.0.0"
28222+
checksum: 10c0/b35ea034b161b2a573666ec16c93076b4b6106b8b16c2415808d747ab3a0566b5db0c4be231d4b11cfbc16d7fd915c9d8a45884bff0e2db11b799775b2e1e017
2824528223
languageName: node
2824628224
linkType: hard
2824728225

scripts/combine-compodoc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import { join, resolve } from 'path';
66
import { realpath, readFile, writeFile, lstat } from 'fs-extra';
77
import { globSync } from 'glob';
8-
import { directory } from 'tempy';
98
import { execaCommand } from 'execa';
109
import { esMain } from './utils/esmain';
1110

@@ -36,7 +35,8 @@ async function run(cwd: string) {
3635

3736
const docsArray: Record<string, any>[] = await Promise.all(
3837
dirs.map(async (dir) => {
39-
const outputDir = directory();
38+
const { temporaryDirectory } = await import('tempy');
39+
const outputDir = temporaryDirectory();
4040
const resolvedDir = await realpath(dir);
4141
await execaCommand(
4242
`yarn compodoc ${resolvedDir} -p ./tsconfig.json -e json -d ${outputDir}`,

scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"simple-git": "^3.18.0",
171171
"slash": "^3.0.0",
172172
"sort-package-json": "^2.0.0",
173-
"tempy": "^1.0.0",
173+
"tempy": "^3.1.0",
174174
"tiny-invariant": "^1.3.1",
175175
"trash": "^7.0.0",
176176
"ts-dedent": "^2.0.0",

scripts/sandbox/generate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import pLimit from 'p-limit';
44
import prettyTime from 'pretty-hrtime';
55
import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra';
66
import { program } from 'commander';
7-
import { directory } from 'tempy';
7+
import { temporaryDirectory } from 'tempy';
88
import { execaCommand } from 'execa';
99
import { esMain } from '../utils/esmain';
1010

@@ -81,7 +81,7 @@ const addStorybook = async ({
8181
const beforeDir = join(baseDir, BEFORE_DIR_NAME);
8282
const afterDir = join(baseDir, AFTER_DIR_NAME);
8383

84-
const tmpDir = directory();
84+
const tmpDir = temporaryDirectory();
8585

8686
try {
8787
await copy(beforeDir, tmpDir);
@@ -167,7 +167,7 @@ const runGenerators = async (
167167
await emptyDir(baseDir);
168168

169169
// We do the creation inside a temp dir to avoid yarn container problems
170-
const createBaseDir = directory();
170+
const createBaseDir = temporaryDirectory();
171171
if (!script.includes('pnp')) {
172172
await setupYarn({ cwd: createBaseDir });
173173
}

0 commit comments

Comments
 (0)