diff --git a/packages/magefront/CHANGELOG.md b/packages/magefront/CHANGELOG.md index 7ea84e1a..c4f8e3a9 100644 --- a/packages/magefront/CHANGELOG.md +++ b/packages/magefront/CHANGELOG.md @@ -4,8 +4,7 @@ ### Minor Changes -- f8da0cb: - Replace fs-extra with the node:fs functions - - Write types statically to reduce build time and overhead +- f8da0cb: Write types statically to reduce build time and overhead - f8da0cb: Set a proper (peer) dependency version in packages ### Patch Changes diff --git a/packages/magefront/package.json b/packages/magefront/package.json index de409f4c..c8b3aa70 100644 --- a/packages/magefront/package.json +++ b/packages/magefront/package.json @@ -35,6 +35,7 @@ "chokidar": "^3.5.3", "cli-table": "^0.3.11", "fast-glob": "^3.3.1", + "fs-extra": "^11.1.1", "kleur": "^4.1.5", "magefront-preset-default": "workspace:^", "memoizee": "^0.4.15", @@ -45,6 +46,7 @@ "devDependencies": { "@types/browser-sync": "^2.27.0", "@types/cli-table": "^0.3.2", + "@types/fs-extra": "^11.0.1", "@types/memoizee": "^0.4.8", "@types/node": "^20.5.9" }, diff --git a/packages/magefront/src/actions/deploy.ts b/packages/magefront/src/actions/deploy.ts index 0f89ec8f..59cf5e0b 100644 --- a/packages/magefront/src/actions/deploy.ts +++ b/packages/magefront/src/actions/deploy.ts @@ -1,5 +1,5 @@ import glob from 'fast-glob' -import fs from 'node:fs' +import fs from 'fs-extra' import path from 'node:path' import type { Action } from '../../types/magefront' @@ -32,7 +32,7 @@ export const deploy: Action = async (context) => { files.map(async (file) => { const filePath = await fs.promises.realpath(path.join(buildConfig.tmp, file)) const destPath = path.join(dest, file) - return fs.promises.cp(filePath, destPath, { recursive: true }) + return fs.copy(filePath, destPath) }) ) } diff --git a/packages/magefront/src/actions/inheritance.ts b/packages/magefront/src/actions/inheritance.ts index 41269f26..76c4a367 100644 --- a/packages/magefront/src/actions/inheritance.ts +++ b/packages/magefront/src/actions/inheritance.ts @@ -1,5 +1,5 @@ import glob, { type Pattern } from 'fast-glob' -import fs from 'node:fs' +import fs from 'fs-extra' import path from 'node:path' import type { Action } from '../../types/magefront' import { getThemeDependencyTree } from '../magento/theme' @@ -19,14 +19,14 @@ export const inheritance: Action = async (context) => { await Promise.all( files.map(async (srcPath) => { const destPath = path.join(dest, srcPath.replace(src + '/', '/')) - await fs.promises.rm(destPath, { recursive: true }) - return fs.promises.cp(path.join(rootPath, srcPath), destPath, { recursive: true }) + await fs.remove(destPath) + return fs.copy(path.join(rootPath, srcPath), destPath) }) ) } // Clean destination dir - await fs.promises.rm(tmp, { recursive: true }) + await fs.remove(tmp) // Add the Magento core lib resources as a dependency for everyone // Ignore the css docs and txt files diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab09247f..451e1b01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,6 +61,9 @@ importers: fast-glob: specifier: ^3.3.1 version: 3.3.1 + fs-extra: + specifier: ^11.1.1 + version: 11.1.1 kleur: specifier: ^4.1.5 version: 4.1.5 @@ -86,6 +89,9 @@ importers: '@types/cli-table': specifier: ^0.3.2 version: 0.3.2 + '@types/fs-extra': + specifier: ^11.0.1 + version: 11.0.1 '@types/memoizee': specifier: ^0.4.8 version: 0.4.8 @@ -1812,6 +1818,13 @@ packages: /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} + /@types/fs-extra@11.0.1: + resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==} + dependencies: + '@types/jsonfile': 6.1.1 + '@types/node': 20.5.9 + dev: true + /@types/graceful-fs@4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: @@ -1851,6 +1864,12 @@ packages: pretty-format: 29.6.3 dev: true + /@types/jsonfile@6.1.1: + resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==} + dependencies: + '@types/node': 20.5.9 + dev: true + /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} requiresBuild: true @@ -4175,7 +4194,6 @@ packages: graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.0 - dev: true /fs-extra@3.0.1: resolution: {integrity: sha512-V3Z3WZWVUYd8hoCL5xfXJCaHWYzmtwW5XWYSlLgERi8PWd8bx1kUHUk8L1BT57e49oKnDDD180mjfrHc1yA9rg==} @@ -5595,7 +5613,6 @@ packages: universalify: 2.0.0 optionalDependencies: graceful-fs: 4.2.11 - dev: true /jsonify@0.0.1: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} @@ -8657,7 +8674,6 @@ packages: /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} - dev: true /unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}