From 88648fd3c213fb8a6d59bcf90b0e7be27558925c Mon Sep 17 00:00:00 2001 From: vinodkumarsharma276 Date: Wed, 18 May 2022 19:12:30 +0530 Subject: [PATCH 1/5] Bump file-system to 2.0.0 We are using @storybook/core-common in our project and it pulls file-system@1.0.5 --> ramda@0.21.0. We need to use ramda@0.28.0 which file-system@2.0.0 uses. --- lib/core-common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core-common/package.json b/lib/core-common/package.json index 9bcc6fa7a3d1..c2846f02efbe 100644 --- a/lib/core-common/package.json +++ b/lib/core-common/package.json @@ -72,7 +72,7 @@ "chalk": "^4.1.0", "core-js": "^3.8.2", "express": "^4.17.1", - "file-system-cache": "^1.0.5", + "file-system-cache": "^2.0.0", "find-up": "^5.0.0", "fork-ts-checker-webpack-plugin": "^6.0.4", "fs-extra": "^9.0.1", From c27b0038b8ab7bffca67ad3b0e4a78b020354852 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 1 Jul 2022 02:26:03 +0200 Subject: [PATCH 2/5] fix lockfile --- yarn.lock | 63 +++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9ed8e80852c2..953a01afab7c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7606,7 +7606,7 @@ __metadata: chalk: ^4.1.0 core-js: ^3.8.2 express: ^4.17.1 - file-system-cache: ^1.0.5 + file-system-cache: ^2.0.0 find-up: ^5.0.0 fork-ts-checker-webpack-plugin: ^6.0.4 fs-extra: ^9.0.1 @@ -14857,7 +14857,7 @@ __metadata: languageName: node linkType: hard -"bluebird@npm:^3.1.1, bluebird@npm:^3.3.5, bluebird@npm:^3.4.6, bluebird@npm:^3.5.1, bluebird@npm:^3.5.3, bluebird@npm:^3.5.5, bluebird@npm:^3.7.2": +"bluebird@npm:^3.1.1, bluebird@npm:^3.4.6, bluebird@npm:^3.5.1, bluebird@npm:^3.5.3, bluebird@npm:^3.5.5, bluebird@npm:^3.7.2": version: 3.7.2 resolution: "bluebird@npm:3.7.2" checksum: 680de03adc54ff925eaa6c7bb9a47a0690e8b5de60f4792604aae8ed618c65e6b63a7893b57ca924beaf53eee69c5af4f8314148c08124c550fe1df1add897d2 @@ -22873,14 +22873,13 @@ __metadata: languageName: node linkType: hard -"file-system-cache@npm:^1.0.5": - version: 1.0.5 - resolution: "file-system-cache@npm:1.0.5" +"file-system-cache@npm:^2.0.0": + version: 2.0.0 + resolution: "file-system-cache@npm:2.0.0" dependencies: - bluebird: ^3.3.5 - fs-extra: ^0.30.0 - ramda: ^0.21.0 - checksum: 4898deb88303c8d54548b857920bea7227535d951ad4ec873c3b26d2b31a03b6ce112df856e9b5fc5993be6dbfb30cb40a3a8feef4054c286c1017f241f9f533 + fs-extra: ^10.1.0 + ramda: ^0.28.0 + checksum: 8ff29a9afa9edd6d0608bd345ea0e22376ff14b6bf11406ebff47877a8081263b7c20eadeb54c7f9b03404ace5743cc61eef9d262734c3b2fdb72ff9b7a468c1 languageName: node linkType: hard @@ -23563,19 +23562,6 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^0.30.0": - version: 0.30.0 - resolution: "fs-extra@npm:0.30.0" - dependencies: - graceful-fs: ^4.1.2 - jsonfile: ^2.1.0 - klaw: ^1.0.0 - path-is-absolute: ^1.0.0 - rimraf: ^2.2.8 - checksum: 24f3c966018c7bf436bf38ca3a126f1d95bf0f82598302195c4f0c8887767f045dae308f92c53a39cead74631dabbc30fcf1c71dbe96f1f0148f6de8edd114bc - languageName: node - linkType: hard - "fs-extra@npm:^10.0.0, fs-extra@npm:^10.0.1": version: 10.0.1 resolution: "fs-extra@npm:10.0.1" @@ -23587,6 +23573,17 @@ __metadata: languageName: node linkType: hard +"fs-extra@npm:^10.1.0": + version: 10.1.0 + resolution: "fs-extra@npm:10.1.0" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^6.0.1 + universalify: ^2.0.0 + checksum: 5f579466e7109719d162a9249abbeffe7f426eb133ea486e020b89bc6d67a741134076bf439983f2eb79276ceaf6bd7b7c1e43c3fd67fe889863e69072fb0a5e + languageName: node + linkType: hard + "fs-extra@npm:^4.0.2": version: 4.0.3 resolution: "fs-extra@npm:4.0.3" @@ -24558,7 +24555,7 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": +"graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.3, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.2, graceful-fs@npm:^4.2.3, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.9 resolution: "graceful-fs@npm:4.2.9" checksum: 2a66760ce6677ca18a24a1ef15d440cfd970086446af1e78c9e9de083c48122d8bd9c3fdc37f8f80f34aae833fa0d9dd52725e75a1c3f433ddd34eece39e7376 @@ -29623,18 +29620,6 @@ __metadata: languageName: node linkType: hard -"klaw@npm:^1.0.0": - version: 1.3.1 - resolution: "klaw@npm:1.3.1" - dependencies: - graceful-fs: ^4.1.9 - dependenciesMeta: - graceful-fs: - optional: true - checksum: da994768b02b3843cc994c99bad3cf1c8c67716beb4dd2834133c919e9e9ee788669fbe27d88ab0ad9a3991349c28280afccbde01c2318229b662dd7a05e4728 - languageName: node - linkType: hard - "kleur@npm:4.1.4, kleur@npm:^4.0.3": version: 4.1.4 resolution: "kleur@npm:4.1.4" @@ -37692,10 +37677,10 @@ __metadata: languageName: node linkType: hard -"ramda@npm:^0.21.0": - version: 0.21.0 - resolution: "ramda@npm:0.21.0" - checksum: a5d28ef8f09f7fd024b2a92477f5356e6323c26be29992c87139757e39b20f9006b6a4c69002b952b2ddb88d983823b26ed68020257660617e3a395b7ea2d6da +"ramda@npm:^0.28.0": + version: 0.28.0 + resolution: "ramda@npm:0.28.0" + checksum: 0f9dc0cc3b0432ff047f1e2a5e58860c531a84574674c0f52fef535efc6e1e07fa3851102fff3da7dd551a592c743f6f6fa521379a6aa5fe50266f8af8f0b570 languageName: node linkType: hard From 320a7a9af99233d20c330960cc8947eda574971b Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 1 Jul 2022 02:28:13 +0200 Subject: [PATCH 3/5] guess what?! the packages has typings now!! what a time to be alive! --- lib/core-common/src/utils/file-cache.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/core-common/src/utils/file-cache.ts b/lib/core-common/src/utils/file-cache.ts index 2f810b927a34..b9e1eb6f64c4 100644 --- a/lib/core-common/src/utils/file-cache.ts +++ b/lib/core-common/src/utils/file-cache.ts @@ -1,4 +1,3 @@ -// @ts-ignore - this package has no typings, so we wrap it and add typings that way, because we expose it import Cache from 'file-system-cache'; export interface Options { From a32e15f0c2fa8fbec1a327852c9721a406423b4f Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 1 Jul 2022 02:31:54 +0200 Subject: [PATCH 4/5] cleanup --- lib/core-common/src/utils/file-cache.ts | 63 ++----------------------- 1 file changed, 3 insertions(+), 60 deletions(-) diff --git a/lib/core-common/src/utils/file-cache.ts b/lib/core-common/src/utils/file-cache.ts index b9e1eb6f64c4..42415bd56c34 100644 --- a/lib/core-common/src/utils/file-cache.ts +++ b/lib/core-common/src/utils/file-cache.ts @@ -1,64 +1,7 @@ import Cache from 'file-system-cache'; -export interface Options { - basePath?: string; - ns?: string | string[]; - extension?: string; -} - -export class FileSystemCache { - constructor(options: Options) { - this.internal = Cache(options) as any as FileSystemCache; - } - - private internal: FileSystemCache; - - path(key: string): string { - return this.internal.path(key); - } - - fileExists(key: string): Promise { - return this.internal.fileExists(key); - } - - ensureBasePath(): Promise { - return this.internal.ensureBasePath(); - } - - get(key: string, defaultValue?: any): Promise { - return this.internal.get(key, defaultValue); - } - - getSync(key: string, defaultValue?: any): any | typeof defaultValue { - return this.internal.getSync(key, defaultValue); - } - - set(key: string, value: any): Promise<{ path: string }> { - return this.internal.set(key, value); - } - - setSync(key: string, value: any): this { - this.internal.setSync(key, value); - return this; - } - - remove(key: string): Promise { - return this.internal.remove(key); - } - - clear(): Promise { - return this.internal.clear(); - } - - save(): Promise<{ paths: string[] }> { - return this.internal.save(); - } - - load(): Promise<{ files: Array<{ path: string; value: any }> }> { - return this.internal.load(); - } -} +export type Options = Parameters['0']; -export function createFileSystemCache(options: Options): FileSystemCache { - return new FileSystemCache(options); +export function createFileSystemCache(options: Options): ReturnType { + return Cache(options); } From 26ae4a145a376993f9cce462c07d4104363b451d Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Fri, 1 Jul 2022 02:47:28 +0200 Subject: [PATCH 5/5] small fix --- lib/core-common/src/types.ts | 2 +- lib/core-common/src/utils/file-cache.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/core-common/src/types.ts b/lib/core-common/src/types.ts index b3ca1000ff06..2b8cd029f1b0 100644 --- a/lib/core-common/src/types.ts +++ b/lib/core-common/src/types.ts @@ -5,7 +5,7 @@ import type { Configuration, Stats } from 'webpack'; import type { TransformOptions } from '@babel/core'; import { Router } from 'express'; import { Server } from 'http'; -import { FileSystemCache } from './utils/file-cache'; +import type { FileSystemCache } from './utils/file-cache'; /** * ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now! diff --git a/lib/core-common/src/utils/file-cache.ts b/lib/core-common/src/utils/file-cache.ts index 42415bd56c34..cc62de6dac47 100644 --- a/lib/core-common/src/utils/file-cache.ts +++ b/lib/core-common/src/utils/file-cache.ts @@ -1,7 +1,8 @@ import Cache from 'file-system-cache'; export type Options = Parameters['0']; +export type FileSystemCache = ReturnType; -export function createFileSystemCache(options: Options): ReturnType { +export function createFileSystemCache(options: Options): FileSystemCache { return Cache(options); }