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

Dependency: Upgrade tempy #27366

Merged
merged 6 commits into from
May 29, 2024
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
2 changes: 1 addition & 1 deletion code/lib/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"read-pkg-up": "^7.0.1",
"semver": "^7.3.7",
"strip-json-comments": "^3.0.1",
"tempy": "^1.0.1",
"tempy": "^3.1.0",
"tiny-invariant": "^1.3.1",
"ts-dedent": "^2.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions code/lib/cli/src/automigrate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import prompts from 'prompts';
import chalk from 'chalk';
import boxen from 'boxen';
import { createWriteStream, move, remove } from 'fs-extra';
import tempy from 'tempy';
import { join } from 'path';
import invariant from 'tiny-invariant';
import semver from 'semver';
Expand Down Expand Up @@ -40,8 +39,9 @@ let TEMP_LOG_FILE_PATH = '';
const originalStdOutWrite = process.stdout.write.bind(process.stdout);
const originalStdErrWrite = process.stderr.write.bind(process.stdout);

const augmentLogsToFile = () => {
TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME });
const augmentLogsToFile = async () => {
const { temporaryFile } = await import('tempy');
TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME });
const logStream = createWriteStream(TEMP_LOG_FILE_PATH);

process.stdout.write = (d: string) => {
Expand Down Expand Up @@ -158,7 +158,7 @@ export const automigrate = async ({
return null;
}

augmentLogsToFile();
await augmentLogsToFile();

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

Expand Down
4 changes: 2 additions & 2 deletions code/lib/cli/src/dirs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { dirname, join } from 'path';

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

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

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

// FIXME: this might not be the right version for community packages
Expand Down
8 changes: 4 additions & 4 deletions code/lib/cli/src/doctor/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import chalk from 'chalk';
import boxen from 'boxen';
import { createWriteStream, move, remove } from 'fs-extra';
import tempy from 'tempy';
import dedent from 'ts-dedent';
import { join } from 'path';

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

const augmentLogsToFile = () => {
TEMP_LOG_FILE_PATH = tempy.file({ name: LOG_FILE_NAME });
const augmentLogsToFile = async () => {
const { temporaryFile } = await import('tempy');
TEMP_LOG_FILE_PATH = temporaryFile({ name: LOG_FILE_NAME });
const logStream = createWriteStream(TEMP_LOG_FILE_PATH);

process.stdout.write = (d: string) => {
Expand All @@ -51,7 +51,7 @@ export const doctor = async ({
configDir: userSpecifiedConfigDir,
packageManager: pkgMgr,
}: DoctorOptions = {}) => {
augmentLogsToFile();
await augmentLogsToFile();

let foundIssues = false;
const logDiagnostic = (title: string, message: string) => {
Expand Down
2 changes: 1 addition & 1 deletion code/lib/core-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"pretty-hrtime": "^1.0.3",
"resolve-from": "^5.0.0",
"semver": "^7.3.7",
"tempy": "^1.0.1",
"tempy": "^3.1.0",
"tiny-invariant": "^1.3.1",
"ts-dedent": "^2.0.0",
"util": "^0.12.4"
Expand Down
4 changes: 2 additions & 2 deletions code/lib/core-common/src/utils/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { WriteStream } from 'fs-extra';
import { move, remove, writeFile, readFile, createWriteStream } from 'fs-extra';
import { join } from 'path';
import tempy from 'tempy';
import { rendererPackages } from './get-storybook-info';
import type { JsPackageManager } from '../js-package-manager';
import versions from '../versions';
Expand Down Expand Up @@ -86,7 +85,8 @@ export const createLogStream = async (
logStream: WriteStream;
}> => {
const finalLogPath = join(process.cwd(), logFileName);
const temporaryLogPath = tempy.file({ name: logFileName });
const { temporaryFile } = await import('tempy');
const temporaryLogPath = temporaryFile({ name: logFileName });

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

Expand Down
74 changes: 26 additions & 48 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5795,7 +5795,7 @@ __metadata:
slash: "npm:^5.0.0"
strip-ansi: "npm:^7.1.0"
strip-json-comments: "npm:^3.1.1"
tempy: "npm:^1.0.1"
tempy: "npm:^3.1.0"
tiny-invariant: "npm:^1.3.1"
ts-dedent: "npm:^2.0.0"
typescript: "npm:^5.3.2"
Expand Down Expand Up @@ -5924,7 +5924,7 @@ __metadata:
resolve-from: "npm:^5.0.0"
semver: "npm:^7.3.7"
slash: "npm:^5.0.0"
tempy: "npm:^1.0.1"
tempy: "npm:^3.1.0"
tiny-invariant: "npm:^1.3.1"
ts-dedent: "npm:^2.0.0"
type-fest: "npm:~2.19"
Expand Down Expand Up @@ -12633,10 +12633,12 @@ __metadata:
languageName: node
linkType: hard

"crypto-random-string@npm:^2.0.0":
version: 2.0.0
resolution: "crypto-random-string@npm:2.0.0"
checksum: 10c0/288589b2484fe787f9e146f56c4be90b940018f17af1b152e4dde12309042ff5a2bf69e949aab8b8ac253948381529cc6f3e5a2427b73643a71ff177fa122b37
"crypto-random-string@npm:^4.0.0":
version: 4.0.0
resolution: "crypto-random-string@npm:4.0.0"
dependencies:
type-fest: "npm:^1.0.1"
checksum: 10c0/16e11a3c8140398f5408b7fded35a961b9423c5dac39a60cbbd08bd3f0e07d7de130e87262adea7db03ec1a7a4b7551054e0db07ee5408b012bac5400cfc07a5
languageName: node
linkType: hard

Expand Down Expand Up @@ -13121,22 +13123,6 @@ __metadata:
languageName: node
linkType: hard

"del@npm:^6.0.0":
version: 6.1.1
resolution: "del@npm:6.1.1"
dependencies:
globby: "npm:^11.0.1"
graceful-fs: "npm:^4.2.4"
is-glob: "npm:^4.0.1"
is-path-cwd: "npm:^2.2.0"
is-path-inside: "npm:^3.0.2"
p-map: "npm:^4.0.0"
rimraf: "npm:^3.0.2"
slash: "npm:^3.0.0"
checksum: 10c0/8a095c5ccade42c867a60252914ae485ec90da243d735d1f63ec1e64c1cfbc2b8810ad69a29ab6326d159d4fddaa2f5bad067808c42072351ec458efff86708f
languageName: node
linkType: hard

"delay@npm:^5.0.0":
version: 5.0.0
resolution: "delay@npm:5.0.0"
Expand Down Expand Up @@ -16366,7 +16352,7 @@ __metadata:
languageName: node
linkType: hard

"globby@npm:^11.0.1, globby@npm:^11.1.0":
"globby@npm:^11.1.0":
version: 11.1.0
resolution: "globby@npm:11.1.0"
dependencies:
Expand Down Expand Up @@ -17965,13 +17951,6 @@ __metadata:
languageName: node
linkType: hard

"is-path-cwd@npm:^2.2.0":
version: 2.2.0
resolution: "is-path-cwd@npm:2.2.0"
checksum: 10c0/afce71533a427a759cd0329301c18950333d7589533c2c90205bd3fdcf7b91eb92d1940493190567a433134d2128ec9325de2fd281e05be1920fbee9edd22e0a
languageName: node
linkType: hard

"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3":
version: 3.0.3
resolution: "is-path-inside@npm:3.0.3"
Expand Down Expand Up @@ -27223,10 +27202,10 @@ __metadata:
languageName: node
linkType: hard

"temp-dir@npm:^2.0.0":
version: 2.0.0
resolution: "temp-dir@npm:2.0.0"
checksum: 10c0/b1df969e3f3f7903f3426861887ed76ba3b495f63f6d0c8e1ce22588679d9384d336df6064210fda14e640ed422e2a17d5c40d901f60e161c99482d723f4d309
"temp-dir@npm:^3.0.0":
version: 3.0.0
resolution: "temp-dir@npm:3.0.0"
checksum: 10c0/a86978a400984cd5f315b77ebf3fe53bb58c61f192278cafcb1f3fb32d584a21dc8e08b93171d7874b7cc972234d3455c467306cc1bfc4524b622e5ad3bfd671
languageName: node
linkType: hard

Expand All @@ -27239,16 +27218,15 @@ __metadata:
languageName: node
linkType: hard

"tempy@npm:^1.0.1":
version: 1.0.1
resolution: "tempy@npm:1.0.1"
"tempy@npm:^3.1.0":
version: 3.1.0
resolution: "tempy@npm:3.1.0"
dependencies:
del: "npm:^6.0.0"
is-stream: "npm:^2.0.0"
temp-dir: "npm:^2.0.0"
type-fest: "npm:^0.16.0"
unique-string: "npm:^2.0.0"
checksum: 10c0/864a1cf1b5536dc21e84ae45dbbc3ba4dd2c7ec1674d895f99c349cf209df959a53d797ca38d0b2cf69c7684d565fde5cfc67faaa63b7208ffb21d454b957472
is-stream: "npm:^3.0.0"
temp-dir: "npm:^3.0.0"
type-fest: "npm:^2.12.2"
unique-string: "npm:^3.0.0"
checksum: 10c0/b88e70baa8d935ba8f0e0372b59ad1a961121f098da5fb4a6e05bec98ec32a49026b553532fb75c1c102ec782fd4c6a6bde0d46cbe87013fa324451ce476fb76
languageName: node
linkType: hard

Expand Down Expand Up @@ -28214,12 +28192,12 @@ __metadata:
languageName: node
linkType: hard

"unique-string@npm:^2.0.0":
version: 2.0.0
resolution: "unique-string@npm:2.0.0"
"unique-string@npm:^3.0.0":
version: 3.0.0
resolution: "unique-string@npm:3.0.0"
dependencies:
crypto-random-string: "npm:^2.0.0"
checksum: 10c0/11820db0a4ba069d174bedfa96c588fc2c96b083066fafa186851e563951d0de78181ac79c744c1ed28b51f9d82ac5b8196ff3e4560d0178046ef455d8c2244b
crypto-random-string: "npm:^4.0.0"
checksum: 10c0/b35ea034b161b2a573666ec16c93076b4b6106b8b16c2415808d747ab3a0566b5db0c4be231d4b11cfbc16d7fd915c9d8a45884bff0e2db11b799775b2e1e017
languageName: node
linkType: hard

Expand Down
4 changes: 2 additions & 2 deletions scripts/combine-compodoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import { join, resolve } from 'path';
import { realpath, readFile, writeFile, lstat } from 'fs-extra';
import { globSync } from 'glob';
import { directory } from 'tempy';
import { execaCommand } from 'execa';
import { esMain } from './utils/esmain';

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

const docsArray: Record<string, any>[] = await Promise.all(
dirs.map(async (dir) => {
const outputDir = directory();
const { temporaryDirectory } = await import('tempy');
const outputDir = temporaryDirectory();
const resolvedDir = await realpath(dir);
await execaCommand(
`yarn compodoc ${resolvedDir} -p ./tsconfig.json -e json -d ${outputDir}`,
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
"simple-git": "^3.18.0",
"slash": "^3.0.0",
"sort-package-json": "^2.0.0",
"tempy": "^1.0.0",
"tempy": "^3.1.0",
"tiny-invariant": "^1.3.1",
"trash": "^7.0.0",
"ts-dedent": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import pLimit from 'p-limit';
import prettyTime from 'pretty-hrtime';
import { copy, emptyDir, ensureDir, move, remove, rename, writeFile } from 'fs-extra';
import { program } from 'commander';
import { directory } from 'tempy';
import { temporaryDirectory } from 'tempy';
import { execaCommand } from 'execa';
import { esMain } from '../utils/esmain';

Expand Down Expand Up @@ -81,7 +81,7 @@ const addStorybook = async ({
const beforeDir = join(baseDir, BEFORE_DIR_NAME);
const afterDir = join(baseDir, AFTER_DIR_NAME);

const tmpDir = directory();
const tmpDir = temporaryDirectory();

try {
await copy(beforeDir, tmpDir);
Expand Down Expand Up @@ -167,7 +167,7 @@ const runGenerators = async (
await emptyDir(baseDir);

// We do the creation inside a temp dir to avoid yarn container problems
const createBaseDir = directory();
const createBaseDir = temporaryDirectory();
if (!script.includes('pnp')) {
await setupYarn({ cwd: createBaseDir });
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/sandbox/publish.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import program from 'commander';
import { dirname, join, relative } from 'path';
import { existsSync } from 'fs';
import * as tempy from 'tempy';
import { temporaryDirectory } from 'tempy';
import { copy, emptyDir, remove, writeFile } from 'fs-extra';
import { execaCommand } from 'execa';

Expand Down Expand Up @@ -99,7 +99,7 @@ if (!existsSync(REPROS_DIRECTORY)) {
throw Error("Couldn't find sandbox directory. Did you forget to run generate-sandboxes?");
}

const tmpFolder = tempy.directory();
const tmpFolder = temporaryDirectory();
logger.log(`⏱ Created tmp folder: ${tmpFolder}`);

const options = program.opts() as PublishOptions;
Expand Down
Loading