From bbf561e55eb334b684291570cb513d924927e7f8 Mon Sep 17 00:00:00 2001 From: Manu Date: Sun, 10 Sep 2023 19:56:05 +0200 Subject: [PATCH] fix: build process and changesets version (#76) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * set a proper dependency version so it builds gracefully * define types before hand * update lockfile * remove magefront types warmer * replace fs-extra with fs * update the workspace dependency range * fix: patch changeset to avoid major bumps when a peer dep is updated * add changesets * chore: release 1.2.0 🎉 --- .changeset/config.json | 4 +- .gitignore | 1 - package.json | 7 +- packages/magefront/CHANGELOG.md | 13 ++ packages/magefront/build.config.ts | 3 - packages/magefront/package.json | 13 +- packages/magefront/src/actions/build.ts | 2 +- packages/magefront/src/actions/clean.ts | 2 +- packages/magefront/src/actions/context.ts | 2 +- packages/magefront/src/actions/deploy.ts | 6 +- packages/magefront/src/actions/inheritance.ts | 12 +- packages/magefront/src/actions/list.ts | 2 +- packages/magefront/src/actions/watch.ts | 2 +- packages/magefront/src/cli.ts | 2 +- packages/magefront/src/config.ts | 2 +- packages/magefront/src/magefront.ts | 4 +- packages/magefront/src/magento/composer.ts | 2 +- packages/magefront/src/magento/context.ts | 2 +- packages/magefront/src/magento/language.ts | 2 +- packages/magefront/src/magento/module.ts | 2 +- packages/magefront/src/magento/theme.ts | 2 +- packages/magefront/src/main.ts | 4 +- packages/magefront/src/types.ts | 106 ---------------- packages/magefront/tests/helpers.ts | 4 +- packages/magefront/tests/magefront.test.ts | 2 +- .../tests/theme-adminhtml-backend.test.ts | 4 +- .../tests/theme-frontend-blank.test.ts | 4 +- .../tests/theme-frontend-luma.test.ts | 4 +- packages/magefront/types/magefront.d.ts | 114 ++++++++++++++++++ packages/plugin-babel/CHANGELOG.md | 12 ++ packages/plugin-babel/package.json | 4 +- packages/plugin-concat/CHANGELOG.md | 12 ++ packages/plugin-concat/package.json | 4 +- packages/plugin-cssnano/CHANGELOG.md | 13 ++ packages/plugin-cssnano/package.json | 6 +- packages/plugin-js-bundle/CHANGELOG.md | 12 ++ packages/plugin-js-bundle/package.json | 4 +- packages/plugin-js-translation/CHANGELOG.md | 12 ++ packages/plugin-js-translation/package.json | 4 +- packages/plugin-less/CHANGELOG.md | 12 ++ packages/plugin-less/package.json | 4 +- packages/plugin-pngquant/CHANGELOG.md | 12 ++ packages/plugin-pngquant/package.json | 4 +- packages/plugin-postcss/CHANGELOG.md | 12 ++ packages/plugin-postcss/package.json | 4 +- packages/plugin-react/CHANGELOG.md | 13 ++ packages/plugin-react/package.json | 6 +- packages/plugin-requirejs-config/CHANGELOG.md | 12 ++ packages/plugin-requirejs-config/package.json | 4 +- packages/plugin-sass/CHANGELOG.md | 12 ++ packages/plugin-sass/package.json | 4 +- packages/plugin-stylus/CHANGELOG.md | 12 ++ packages/plugin-stylus/package.json | 4 +- packages/plugin-svelte/CHANGELOG.md | 12 ++ packages/plugin-svelte/package.json | 4 +- packages/plugin-svgo/CHANGELOG.md | 12 ++ packages/plugin-svgo/package.json | 4 +- packages/plugin-tailwindcss/CHANGELOG.md | 13 ++ packages/plugin-tailwindcss/package.json | 6 +- packages/plugin-terser/CHANGELOG.md | 12 ++ packages/plugin-terser/package.json | 4 +- packages/plugin-typescript/CHANGELOG.md | 12 ++ packages/plugin-typescript/package.json | 4 +- packages/preset-default/CHANGELOG.md | 17 +++ packages/preset-default/package.json | 14 +-- ...ngesets__assemble-release-plan@5.2.4.patch | 26 ++++ pnpm-lock.yaml | 88 ++++++-------- 67 files changed, 508 insertions(+), 247 deletions(-) delete mode 100644 packages/magefront/src/types.ts create mode 100644 packages/magefront/types/magefront.d.ts create mode 100644 patches/@changesets__assemble-release-plan@5.2.4.patch diff --git a/.changeset/config.json b/.changeset/config.json index abc100de..0d67206d 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -8,5 +8,7 @@ "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [], - "bumpVersionsWithWorkspaceProtocolOnly": true + "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { + "onlyUpdatePeerDependentsWhenOutOfRange": true + } } diff --git a/.gitignore b/.gitignore index 8b31723b..72e31090 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ node_modules .pnpm-* .magefront-* dist -types _*.md .turbo .secrets diff --git a/package.json b/package.json index 50abf21f..78d5c97b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "changeset": "changeset", "changeset:publish": "pnpm run build && changeset publish", "ts-check": "tsc --noEmit", - "build": "npm run build --prefix=packages/magefront && pnpm -r build", + "build": "pnpm -r build", "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand" }, "devDependencies": { @@ -30,5 +30,10 @@ }, "engines": { "node": ">=18" + }, + "pnpm": { + "patchedDependencies": { + "@changesets/assemble-release-plan@5.2.4": "patches/@changesets__assemble-release-plan@5.2.4.patch" + } } } diff --git a/packages/magefront/CHANGELOG.md b/packages/magefront/CHANGELOG.md index 599e9bb9..7ea84e1a 100644 --- a/packages/magefront/CHANGELOG.md +++ b/packages/magefront/CHANGELOG.md @@ -1,5 +1,18 @@ # magefront +## 1.2.0 + +### Minor Changes + +- f8da0cb: - Replace fs-extra with the node:fs functions + - Write types statically to reduce build time and overhead +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] + - magefront-preset-default@1.2.0 + ## 1.1.1 ### Patch Changes diff --git a/packages/magefront/build.config.ts b/packages/magefront/build.config.ts index f6d16208..c5cf348d 100644 --- a/packages/magefront/build.config.ts +++ b/packages/magefront/build.config.ts @@ -5,16 +5,13 @@ export default defineBuildConfig({ { input: './src/main', name: 'magefront', - declaration: true, }, { input: './src/cli', - declaration: false, }, ], rollup: { emitCJS: true, }, clean: true, - declaration: true, }) diff --git a/packages/magefront/package.json b/packages/magefront/package.json index accdf45f..de409f4c 100644 --- a/packages/magefront/package.json +++ b/packages/magefront/package.json @@ -1,6 +1,6 @@ { "name": "magefront", - "version": "1.1.1", + "version": "1.2.0", "type": "module", "description": "A modern Magento 2 theme builder", "keywords": [ @@ -16,7 +16,8 @@ "author": "Emmanuel Vodor ", "license": "MIT", "files": [ - "dist" + "dist", + "types" ], "repository": { "type": "git", @@ -25,7 +26,7 @@ }, "main": "dist/magefront.cjs", "module": "dist/magefront.mjs", - "types": "dist/magefront.d.ts", + "types": "types/magefront.d.ts", "scripts": { "build": "unbuild" }, @@ -34,9 +35,8 @@ "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:~", + "magefront-preset-default": "workspace:^", "memoizee": "^0.4.15", "pretty-ms": "^8.0.0", "sade": "^1.8.1", @@ -45,7 +45,6 @@ "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" }, @@ -59,7 +58,7 @@ ".": { "import": "./dist/magefront.mjs", "require": "./dist/magefront.cjs", - "types": "./dist/magefront.d.ts" + "types": "./types/magefront.d.ts" } } } diff --git a/packages/magefront/src/actions/build.ts b/packages/magefront/src/actions/build.ts index e4a677f0..ff6607cd 100644 --- a/packages/magefront/src/actions/build.ts +++ b/packages/magefront/src/actions/build.ts @@ -1,6 +1,6 @@ import path from 'node:path' +import type { Action, PluginContext } from '../../types/magefront' import { getThemeDependencyTree } from '../magento/theme' -import type { Action, PluginContext } from '../types' /** Build the theme. If a configuration file is found, it will be used. */ export const build: Action = async (context) => { diff --git a/packages/magefront/src/actions/clean.ts b/packages/magefront/src/actions/clean.ts index 3a75b997..2fa799c2 100644 --- a/packages/magefront/src/actions/clean.ts +++ b/packages/magefront/src/actions/clean.ts @@ -1,5 +1,5 @@ import fs from 'node:fs' -import { Action } from '../types' +import type { Action } from '../../types/magefront' export const clean: Action = async (context) => { const { buildConfig } = context diff --git a/packages/magefront/src/actions/context.ts b/packages/magefront/src/actions/context.ts index 7052d329..2221835d 100644 --- a/packages/magefront/src/actions/context.ts +++ b/packages/magefront/src/actions/context.ts @@ -1,11 +1,11 @@ import type { Logger } from 'winston' +import type { ActionContext, MagefrontOptions } from '../../types/magefront' import { getBuildConfig } from '../config' import { createLogger } from '../logger' import { createMagentoContext } from '../magento/context' import { getLanguages } from '../magento/language' import { getModules } from '../magento/module' import { getThemes } from '../magento/theme' -import { ActionContext, MagefrontOptions } from '../types' // Creates an ActionContext object to be passed to the build process. export const createActionContext = async (opts: MagefrontOptions, logger?: Logger): Promise => { diff --git a/packages/magefront/src/actions/deploy.ts b/packages/magefront/src/actions/deploy.ts index 0ec4bad7..0f89ec8f 100644 --- a/packages/magefront/src/actions/deploy.ts +++ b/packages/magefront/src/actions/deploy.ts @@ -1,7 +1,7 @@ import glob from 'fast-glob' -import fs from 'fs-extra' +import fs from 'node:fs' import path from 'node:path' -import { Action } from '../types' +import type { Action } from '../../types/magefront' /** Deploy the built theme files from the temp directory to the `pub/static` dir. This is the third step in the build process. */ export const deploy: Action = async (context) => { @@ -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.copy(filePath, destPath) + return fs.promises.cp(filePath, destPath, { recursive: true }) }) ) } diff --git a/packages/magefront/src/actions/inheritance.ts b/packages/magefront/src/actions/inheritance.ts index ec4b6580..41269f26 100644 --- a/packages/magefront/src/actions/inheritance.ts +++ b/packages/magefront/src/actions/inheritance.ts @@ -1,8 +1,8 @@ -import glob, { Pattern } from 'fast-glob' -import fs from 'fs-extra' +import glob, { type Pattern } from 'fast-glob' +import fs from 'node:fs' import path from 'node:path' +import type { Action } from '../../types/magefront' import { getThemeDependencyTree } from '../magento/theme' -import type { Action } from '../types' /** Gather all the theme files and copy them to the temporary directory. When this is done, the `build` task should be run afterwards. */ export const inheritance: Action = async (context) => { @@ -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.rm(destPath, { recursive: true, force: true }) - return fs.copy(path.join(rootPath, srcPath), destPath) + await fs.promises.rm(destPath, { recursive: true }) + return fs.promises.cp(path.join(rootPath, srcPath), destPath, { recursive: true }) }) ) } // Clean destination dir - fs.removeSync(tmp) + await fs.promises.rm(tmp, { recursive: true }) // Add the Magento core lib resources as a dependency for everyone // Ignore the css docs and txt files diff --git a/packages/magefront/src/actions/list.ts b/packages/magefront/src/actions/list.ts index 04da895d..f95bb50a 100644 --- a/packages/magefront/src/actions/list.ts +++ b/packages/magefront/src/actions/list.ts @@ -1,7 +1,7 @@ import Table from 'cli-table' import console from 'node:console' +import type { MagentoContext } from '../../types/magefront' import { getThemes } from '../magento/theme' -import type { MagentoContext } from '../types' /** List all the themes. */ export const list = (magento: MagentoContext) => { diff --git a/packages/magefront/src/actions/watch.ts b/packages/magefront/src/actions/watch.ts index 0470e770..80d273f6 100644 --- a/packages/magefront/src/actions/watch.ts +++ b/packages/magefront/src/actions/watch.ts @@ -2,7 +2,7 @@ import chokidar from 'chokidar' import path from 'node:path' import { performance } from 'node:perf_hooks' import prettyMilliseconds from 'pretty-ms' -import { Action } from '../types' +import type { Action } from '../../types/magefront' import { instance } from './browser-sync' import { build } from './build' import { deploy } from './deploy' diff --git a/packages/magefront/src/cli.ts b/packages/magefront/src/cli.ts index 069cddb2..2acc0c81 100644 --- a/packages/magefront/src/cli.ts +++ b/packages/magefront/src/cli.ts @@ -5,6 +5,7 @@ import process from 'node:process' import sade from 'sade' import winston from 'winston' import { version } from '../package.json' assert { type: 'json' } +import type { MagefrontOptions } from '../types/magefront' import { browserSync } from './actions/browser-sync' import { createActionContext } from './actions/context' import { list } from './actions/list' @@ -12,7 +13,6 @@ import { watch } from './actions/watch' import { createLogger } from './logger' import { magefront } from './magefront' import { createMagentoContext } from './magento/context' -import type { MagefrontOptions } from './types' import * as u from './utils' const program = sade('magefront', true) diff --git a/packages/magefront/src/config.ts b/packages/magefront/src/config.ts index 989e1daa..55aa9be2 100644 --- a/packages/magefront/src/config.ts +++ b/packages/magefront/src/config.ts @@ -1,7 +1,7 @@ import memo from 'memoizee' import path from 'node:path' +import type { BuildConfig, MagefrontOptions, MagentoContext, MagentoTheme, Plugin, Preset } from '../types/magefront' import { getThemes } from './magento/theme' -import type { BuildConfig, MagefrontOptions, MagentoContext, MagentoTheme, Plugin, Preset } from './types' /** Get the build configuration for the given options. */ export const getBuildConfig = memo(async (opts: MagefrontOptions, context: MagentoContext): Promise => { diff --git a/packages/magefront/src/magefront.ts b/packages/magefront/src/magefront.ts index eedd5928..20b84310 100644 --- a/packages/magefront/src/magefront.ts +++ b/packages/magefront/src/magefront.ts @@ -1,13 +1,13 @@ import k from 'kleur' import { performance } from 'node:perf_hooks' import prettyMilliseconds from 'pretty-ms' -import { Logger } from 'winston' +import type { Logger } from 'winston' +import type { MagefrontOptions } from '../types/magefront' import { build } from './actions/build' import { clean } from './actions/clean' import { createActionContext } from './actions/context' import { deploy } from './actions/deploy' import { inheritance } from './actions/inheritance' -import type { MagefrontOptions } from './types' /** Builds a Magento 2 theme. */ // TODO: Remove the logger argument and implement it in the options diff --git a/packages/magefront/src/magento/composer.ts b/packages/magefront/src/magento/composer.ts index d737bbd2..12b1d363 100644 --- a/packages/magefront/src/magento/composer.ts +++ b/packages/magefront/src/magento/composer.ts @@ -1,7 +1,7 @@ import memo from 'memoizee' import fs from 'node:fs' import path from 'node:path' -import type { ComposerPackage } from '../types' +import type { ComposerPackage } from '../../types/magefront' /** * Get the list of packages installed. diff --git a/packages/magefront/src/magento/context.ts b/packages/magefront/src/magento/context.ts index ba214060..ef38a4f8 100644 --- a/packages/magefront/src/magento/context.ts +++ b/packages/magefront/src/magento/context.ts @@ -1,4 +1,4 @@ -import { MagefrontOptions, MagentoContext } from '../types' +import type { MagefrontOptions, MagentoContext } from '../../types/magefront' import { getPackages } from './composer' export const createMagentoContext = (opts: MagefrontOptions): MagentoContext => { diff --git a/packages/magefront/src/magento/language.ts b/packages/magefront/src/magento/language.ts index ff6984b0..1df87d67 100644 --- a/packages/magefront/src/magento/language.ts +++ b/packages/magefront/src/magento/language.ts @@ -1,7 +1,7 @@ import memo from 'memoizee' import fs from 'node:fs' import path from 'node:path' -import type { MagentoContext, MagentoLanguage } from '../types' +import type { MagentoContext, MagentoLanguage } from '../../types/magefront' import { getRegistrations } from './composer' /** diff --git a/packages/magefront/src/magento/module.ts b/packages/magefront/src/magento/module.ts index ce6355b5..1d73f6a5 100644 --- a/packages/magefront/src/magento/module.ts +++ b/packages/magefront/src/magento/module.ts @@ -2,7 +2,7 @@ import glob from 'fast-glob' import memo from 'memoizee' import fs from 'node:fs' import path from 'node:path' -import type { MagentoContext, MagentoModule } from '../types' +import type { MagentoContext, MagentoModule } from '../../types/magefront' import { getRegistrations } from './composer' /** diff --git a/packages/magefront/src/magento/theme.ts b/packages/magefront/src/magento/theme.ts index 210e5895..2b2b30e3 100644 --- a/packages/magefront/src/magento/theme.ts +++ b/packages/magefront/src/magento/theme.ts @@ -2,7 +2,7 @@ import glob from 'fast-glob' import memo from 'memoizee' import fs from 'node:fs' import path from 'node:path' -import type { ComposerPackage, MagentoContext, MagentoTheme } from '../types' +import type { ComposerPackage, MagentoContext, MagentoTheme } from '../../types/magefront' import { getRegistrations } from './composer' /** diff --git a/packages/magefront/src/main.ts b/packages/magefront/src/main.ts index 52425003..54b8da93 100644 --- a/packages/magefront/src/main.ts +++ b/packages/magefront/src/main.ts @@ -1,9 +1,7 @@ // Main module entry point if the package is installed as dependency. // Gives quick access to the magento related functions from the package. -import type { Config } from './types' - -export type { Config, MagefrontOptions, MagentoLanguage, MagentoModule, MagentoTheme, Plugin, PluginContext, Preset } from './types' +import type { Config } from '../types/magefront' export { magefront } from './magefront' diff --git a/packages/magefront/src/types.ts b/packages/magefront/src/types.ts deleted file mode 100644 index 28fb4124..00000000 --- a/packages/magefront/src/types.ts +++ /dev/null @@ -1,106 +0,0 @@ -import type { Logger } from 'winston' - -// A package from a `composer.lock` file. -export interface ComposerPackage { - name: string - type: string - autoload?: { - files?: string[] - } -} - -export interface MagentoModule { - name: string - src: string - enabled: boolean -} - -export interface MagentoLanguage extends MagentoModule { - code: string | false -} - -export interface MagentoTheme extends MagentoModule { - area: string - dest: string - parent: MagentoTheme | null -} - -// Extends the themeConfig with additional values to be passed to the plugin when it's running. -// TODO: Update this API (outdated) -export type PluginContext = { - theme: string - src: string - dest: string - locale: string - modules: string[] - moduleList: MagentoModule[] - languageList: MagentoLanguage[] - themeList: MagentoTheme[] - themeDependencyTree: string[] - cwd: string - logger: Logger -} - -export type Plugin = (context: PluginContext) => Promise - -// The preset configuration object. Contains already defined plugins (because we cannot resolve them at the module level). -export type Preset = { - plugins?: Plugin[] -} - -// The configuration object that is passed as build context. -// The preset plugins are resolved and merged into the plugins array. -export type BuildConfig = { - tmp: string - dest: string - plugins: Plugin[] -} - -// The options that can be passed to the `magefront` function. -export type MagefrontOptions = { - /** The name of the theme to build. e.g. `Magento/blank`. */ - theme: string - - /** The locale to build the theme for. e.g. `en_US`. */ - locale?: string - - /** The list of presets to use. */ - presets?: Array - - /** The list of plugins to use. */ - plugins?: Array - - magento?: { - /** The path to the magento root directory. */ - rootPath?: string - } -} - -// The configuration object or array that is read from the `magefront.config.js` file. -export type Config = Partial | MagefrontOptions[] - -type MaybePromise = T | Promise - -export type Action = (context: ActionContext) => MaybePromise - -// The context object that is passed to the action functions. -export type ActionContext = { - theme: MagentoTheme - locale: string - logger: Logger - buildConfig: BuildConfig - magento: { - rootPath: string - tempPath: string - modules: MagentoModule[] - languages: MagentoLanguage[] - themes: MagentoTheme[] - } -} - -// The context object that is passed to the magento functions. -export type MagentoContext = { - packages: ComposerPackage[] - rootPath: string - tempPath: string -} diff --git a/packages/magefront/tests/helpers.ts b/packages/magefront/tests/helpers.ts index 9751b2f8..527018f0 100644 --- a/packages/magefront/tests/helpers.ts +++ b/packages/magefront/tests/helpers.ts @@ -1,11 +1,11 @@ import process from 'node:process' import { createActionContext } from '../src/actions/context' -import type { MagefrontOptions } from '../src/types' +import type { ActionContext, MagefrontOptions } from '../types/magefront' export const rootPath = process.env.MAGEFRONT_TEST_MAGENTO_ROOT! /** Create a context for testing purposes. */ -export const testActionContext = async (opts?: MagefrontOptions) => { +export const testActionContext = async (opts?: MagefrontOptions): Promise => { const theme = opts?.theme ?? 'Magento/blank' return await createActionContext({ theme, ...opts, magento: { rootPath } }) } diff --git a/packages/magefront/tests/magefront.test.ts b/packages/magefront/tests/magefront.test.ts index e0731d9c..91cc1ffe 100644 --- a/packages/magefront/tests/magefront.test.ts +++ b/packages/magefront/tests/magefront.test.ts @@ -1,4 +1,4 @@ -import fs from 'fs-extra' +import fs from 'node:fs' import path from 'node:path' import { magefront } from '../src/magefront' import { rootPath } from './helpers' diff --git a/packages/magefront/tests/theme-adminhtml-backend.test.ts b/packages/magefront/tests/theme-adminhtml-backend.test.ts index 06f9bb9d..466214ba 100644 --- a/packages/magefront/tests/theme-adminhtml-backend.test.ts +++ b/packages/magefront/tests/theme-adminhtml-backend.test.ts @@ -1,10 +1,10 @@ -import fs from 'fs-extra' +import fs from 'node:fs' import path from 'node:path' import { build } from '../src/actions/build' import { clean } from '../src/actions/clean' import { deploy } from '../src/actions/deploy' import { inheritance } from '../src/actions/inheritance' -import { ActionContext } from '../src/types' +import type { ActionContext } from '../types/magefront' import { testActionContext } from './helpers' describe('Build and deploy the Magento/backend theme', () => { diff --git a/packages/magefront/tests/theme-frontend-blank.test.ts b/packages/magefront/tests/theme-frontend-blank.test.ts index 2df8cf91..ac53bd2e 100644 --- a/packages/magefront/tests/theme-frontend-blank.test.ts +++ b/packages/magefront/tests/theme-frontend-blank.test.ts @@ -1,10 +1,10 @@ -import fs from 'fs-extra' +import fs from 'node:fs' import path from 'node:path' import { build } from '../src/actions/build' import { clean } from '../src/actions/clean' import { deploy } from '../src/actions/deploy' import { inheritance } from '../src/actions/inheritance' -import { ActionContext } from '../src/types' +import type { ActionContext } from '../types/magefront' import { testActionContext } from './helpers' describe('Build and deploy the Magento/blank theme', () => { diff --git a/packages/magefront/tests/theme-frontend-luma.test.ts b/packages/magefront/tests/theme-frontend-luma.test.ts index 2ce5cd14..8243983c 100644 --- a/packages/magefront/tests/theme-frontend-luma.test.ts +++ b/packages/magefront/tests/theme-frontend-luma.test.ts @@ -1,10 +1,10 @@ -import fs from 'fs-extra' +import fs from 'node:fs' import path from 'node:path' import { build } from '../src/actions/build' import { clean } from '../src/actions/clean' import { deploy } from '../src/actions/deploy' import { inheritance } from '../src/actions/inheritance' -import { ActionContext } from '../src/types' +import type { ActionContext } from '../types/magefront' import { testActionContext } from './helpers' describe('Build and deploy the Magento/luma theme', () => { diff --git a/packages/magefront/types/magefront.d.ts b/packages/magefront/types/magefront.d.ts new file mode 100644 index 00000000..f51262d2 --- /dev/null +++ b/packages/magefront/types/magefront.d.ts @@ -0,0 +1,114 @@ +declare namespace magefront { + import type { Logger } from 'winston' + + // A package from a `composer.lock` file. + export interface ComposerPackage { + name: string + type: string + autoload?: { + files?: string[] + } + } + + export interface MagentoModule { + name: string + src: string + enabled: boolean + } + + export interface MagentoLanguage extends MagentoModule { + code: string | false + } + + export interface MagentoTheme extends MagentoModule { + area: string + dest: string + parent: MagentoTheme | null + } + + // Extends the themeConfig with additional values to be passed to the plugin when it's running. + // TODO: Update this API (outdated) + export type PluginContext = { + theme: string + src: string + dest: string + locale: string + modules: string[] + moduleList: MagentoModule[] + languageList: MagentoLanguage[] + themeList: MagentoTheme[] + themeDependencyTree: string[] + cwd: string + logger: Logger + } + + export type Plugin = (context: PluginContext) => Promise + + // The preset configuration object. Contains already defined plugins (because we cannot resolve them at the module level). + export type Preset = { + plugins?: Plugin[] + } + + // The configuration object that is passed as build context. + // The preset plugins are resolved and merged into the plugins array. + export type BuildConfig = { + tmp: string + dest: string + plugins: Plugin[] + } + + // The options that can be passed to the `magefront` function. + export type MagefrontOptions = { + /** The name of the theme to build. e.g. `Magento/blank`. */ + theme: string + + /** The locale to build the theme for. e.g. `en_US`. */ + locale?: string + + /** The list of presets to use. */ + presets?: Array + + /** The list of plugins to use. */ + plugins?: Array + + magento?: { + /** The path to the magento root directory. */ + rootPath?: string + } + } + + // The configuration object or array that is read from the `magefront.config.js` file. + export type Config = Partial | MagefrontOptions[] + + type MaybePromise = T | Promise + + export type Action = (context: ActionContext) => MaybePromise + + // The context object that is passed to the action functions. + export type ActionContext = { + theme: MagentoTheme + locale: string + logger: Logger + buildConfig: BuildConfig + magento: { + rootPath: string + tempPath: string + modules: MagentoModule[] + languages: MagentoLanguage[] + themes: MagentoTheme[] + } + } + + // The context object that is passed to the magento functions. + export type MagentoContext = { + packages: ComposerPackage[] + rootPath: string + tempPath: string + } + + export function magefront(options: MagefrontOptions): Promise + + export function defineConfig(config: T): T +} + +export = magefront diff --git a/packages/plugin-babel/CHANGELOG.md b/packages/plugin-babel/CHANGELOG.md index 6572580e..5ba55564 100644 --- a/packages/plugin-babel/CHANGELOG.md +++ b/packages/plugin-babel/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-babel +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-babel/package.json b/packages/plugin-babel/package.json index 8299234f..66640e0d 100644 --- a/packages/plugin-babel/package.json +++ b/packages/plugin-babel/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-babel", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -30,7 +30,7 @@ "fast-glob": "^3.3.1" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-concat/CHANGELOG.md b/packages/plugin-concat/CHANGELOG.md index bd3ba676..94063ed7 100644 --- a/packages/plugin-concat/CHANGELOG.md +++ b/packages/plugin-concat/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-concat +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-concat/package.json b/packages/plugin-concat/package.json index 2464f191..d3ec2ed6 100644 --- a/packages/plugin-concat/package.json +++ b/packages/plugin-concat/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-concat", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -28,7 +28,7 @@ "fast-glob": "^3.3.1" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-cssnano/CHANGELOG.md b/packages/plugin-cssnano/CHANGELOG.md index 7ede2602..5ad44a54 100644 --- a/packages/plugin-cssnano/CHANGELOG.md +++ b/packages/plugin-cssnano/CHANGELOG.md @@ -1,5 +1,18 @@ # magefront-plugin-cssnano +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + - magefront-plugin-postcss@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-cssnano/package.json b/packages/plugin-cssnano/package.json index 55aeabf7..6bbff0e8 100644 --- a/packages/plugin-cssnano/package.json +++ b/packages/plugin-cssnano/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-cssnano", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -27,13 +27,13 @@ "dependencies": { "cssnano": "^6.0.1", "cssnano-preset-default": "^6.0.1", - "magefront-plugin-postcss": "workspace:~" + "magefront-plugin-postcss": "workspace:^" }, "devDependencies": { "postcss": "^8.4.29" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-js-bundle/CHANGELOG.md b/packages/plugin-js-bundle/CHANGELOG.md index 040f287a..eca0f567 100644 --- a/packages/plugin-js-bundle/CHANGELOG.md +++ b/packages/plugin-js-bundle/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-js-bundle +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-js-bundle/package.json b/packages/plugin-js-bundle/package.json index 5fe76228..e3af021e 100644 --- a/packages/plugin-js-bundle/package.json +++ b/packages/plugin-js-bundle/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-js-bundle", - "version": "1.1.0", + "version": "1.2.0", "private": true, "type": "module", "keywords": [ @@ -26,7 +26,7 @@ "build": "unbuild" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-js-translation/CHANGELOG.md b/packages/plugin-js-translation/CHANGELOG.md index 766d8cc2..74e336c0 100644 --- a/packages/plugin-js-translation/CHANGELOG.md +++ b/packages/plugin-js-translation/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-js-translation +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-js-translation/package.json b/packages/plugin-js-translation/package.json index 589742ab..d486b45e 100644 --- a/packages/plugin-js-translation/package.json +++ b/packages/plugin-js-translation/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-js-translation", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -28,7 +28,7 @@ "csv-parse": "^5.5.0" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-less/CHANGELOG.md b/packages/plugin-less/CHANGELOG.md index f57f326d..17039c98 100644 --- a/packages/plugin-less/CHANGELOG.md +++ b/packages/plugin-less/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-less +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-less/package.json b/packages/plugin-less/package.json index 450d8f4b..378da52e 100644 --- a/packages/plugin-less/package.json +++ b/packages/plugin-less/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-less", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -30,7 +30,7 @@ "less": "2.7" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-pngquant/CHANGELOG.md b/packages/plugin-pngquant/CHANGELOG.md index e6989058..0b614d40 100644 --- a/packages/plugin-pngquant/CHANGELOG.md +++ b/packages/plugin-pngquant/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-pngquant +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-pngquant/package.json b/packages/plugin-pngquant/package.json index 479475c7..a4179cb9 100644 --- a/packages/plugin-pngquant/package.json +++ b/packages/plugin-pngquant/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-pngquant", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "pngquant": "^4.2.0" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-postcss/CHANGELOG.md b/packages/plugin-postcss/CHANGELOG.md index c144deeb..f742453f 100644 --- a/packages/plugin-postcss/CHANGELOG.md +++ b/packages/plugin-postcss/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-postcss +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-postcss/package.json b/packages/plugin-postcss/package.json index 7f3393c9..c43810c7 100644 --- a/packages/plugin-postcss/package.json +++ b/packages/plugin-postcss/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-postcss", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "postcss": "^8.4.29" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-react/CHANGELOG.md b/packages/plugin-react/CHANGELOG.md index 9281f720..291872a9 100644 --- a/packages/plugin-react/CHANGELOG.md +++ b/packages/plugin-react/CHANGELOG.md @@ -1,5 +1,18 @@ # magefront-plugin-react +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + - magefront-plugin-babel@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 589e1cde..d76b6b66 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-react", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -26,10 +26,10 @@ }, "dependencies": { "@babel/preset-react": "^7.22.15", - "magefront-plugin-babel": "workspace:~" + "magefront-plugin-babel": "workspace:^" }, "peerDependencies": { - "magefront": "*", + "magefront": "workspace:^", "react": ">=18" }, "exports": { diff --git a/packages/plugin-requirejs-config/CHANGELOG.md b/packages/plugin-requirejs-config/CHANGELOG.md index 91d61de8..c5d3b7ec 100644 --- a/packages/plugin-requirejs-config/CHANGELOG.md +++ b/packages/plugin-requirejs-config/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-requirejs-config +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-requirejs-config/package.json b/packages/plugin-requirejs-config/package.json index a5762f53..fd33a9e3 100644 --- a/packages/plugin-requirejs-config/package.json +++ b/packages/plugin-requirejs-config/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-requirejs-config", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "fast-glob": "^3.3.1" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-sass/CHANGELOG.md b/packages/plugin-sass/CHANGELOG.md index fecb5b7f..de1b113c 100644 --- a/packages/plugin-sass/CHANGELOG.md +++ b/packages/plugin-sass/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-sass +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-sass/package.json b/packages/plugin-sass/package.json index 5de343f8..a808e7b1 100644 --- a/packages/plugin-sass/package.json +++ b/packages/plugin-sass/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-sass", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -30,7 +30,7 @@ "sass": "^1.66.1" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-stylus/CHANGELOG.md b/packages/plugin-stylus/CHANGELOG.md index 2a1bc145..48d1c3d5 100644 --- a/packages/plugin-stylus/CHANGELOG.md +++ b/packages/plugin-stylus/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-stylus +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-stylus/package.json b/packages/plugin-stylus/package.json index 960d0f1b..8bd28931 100644 --- a/packages/plugin-stylus/package.json +++ b/packages/plugin-stylus/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-stylus", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -30,7 +30,7 @@ "stylus": "^0.60.0" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-svelte/CHANGELOG.md b/packages/plugin-svelte/CHANGELOG.md index 217ddc82..0ea56711 100644 --- a/packages/plugin-svelte/CHANGELOG.md +++ b/packages/plugin-svelte/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-svelte +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-svelte/package.json b/packages/plugin-svelte/package.json index 25efeb9d..5ac1b5d8 100644 --- a/packages/plugin-svelte/package.json +++ b/packages/plugin-svelte/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-svelte", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "svelte": "~4.2.0" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-svgo/CHANGELOG.md b/packages/plugin-svgo/CHANGELOG.md index fcc862c0..721d98a8 100644 --- a/packages/plugin-svgo/CHANGELOG.md +++ b/packages/plugin-svgo/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-svgo +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-svgo/package.json b/packages/plugin-svgo/package.json index 16802e9a..e61bc248 100644 --- a/packages/plugin-svgo/package.json +++ b/packages/plugin-svgo/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-svgo", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "svgo": "^3.0.2" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-tailwindcss/CHANGELOG.md b/packages/plugin-tailwindcss/CHANGELOG.md index eb375da3..cde3b2a7 100644 --- a/packages/plugin-tailwindcss/CHANGELOG.md +++ b/packages/plugin-tailwindcss/CHANGELOG.md @@ -1,5 +1,18 @@ # magefront-plugin-tailwindcss +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + - magefront-plugin-postcss@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-tailwindcss/package.json b/packages/plugin-tailwindcss/package.json index b106842d..816280b7 100644 --- a/packages/plugin-tailwindcss/package.json +++ b/packages/plugin-tailwindcss/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-tailwindcss", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -27,11 +27,11 @@ "build": "unbuild" }, "dependencies": { - "magefront-plugin-postcss": "workspace:~", + "magefront-plugin-postcss": "workspace:^", "tailwindcss": "^3.3.3" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-terser/CHANGELOG.md b/packages/plugin-terser/CHANGELOG.md index eef65fde..ed8c37d0 100644 --- a/packages/plugin-terser/CHANGELOG.md +++ b/packages/plugin-terser/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-terser +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-terser/package.json b/packages/plugin-terser/package.json index 1554fa39..29c4e602 100644 --- a/packages/plugin-terser/package.json +++ b/packages/plugin-terser/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-terser", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "terser": "^5.19.4" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/plugin-typescript/CHANGELOG.md b/packages/plugin-typescript/CHANGELOG.md index 78b47fc2..1e3f3cd3 100644 --- a/packages/plugin-typescript/CHANGELOG.md +++ b/packages/plugin-typescript/CHANGELOG.md @@ -1,5 +1,17 @@ # magefront-plugin-typescript +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-typescript/package.json b/packages/plugin-typescript/package.json index 5c9c5dda..8829d238 100644 --- a/packages/plugin-typescript/package.json +++ b/packages/plugin-typescript/package.json @@ -1,6 +1,6 @@ { "name": "magefront-plugin-typescript", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -29,7 +29,7 @@ "typescript": "^5.2.2" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/packages/preset-default/CHANGELOG.md b/packages/preset-default/CHANGELOG.md index bb28d167..5de0e8bc 100644 --- a/packages/preset-default/CHANGELOG.md +++ b/packages/preset-default/CHANGELOG.md @@ -1,5 +1,22 @@ # magefront-preset-default +## 1.2.0 + +### Minor Changes + +- f8da0cb: Set a proper (peer) dependency version in packages + +### Patch Changes + +- Updated dependencies [f8da0cb] +- Updated dependencies [f8da0cb] + - magefront@1.2.0 + - magefront-plugin-requirejs-config@1.2.0 + - magefront-plugin-js-translation@1.2.0 + - magefront-plugin-cssnano@1.2.0 + - magefront-plugin-terser@1.2.0 + - magefront-plugin-less@1.2.0 + ## 1.1.0 ### Minor Changes diff --git a/packages/preset-default/package.json b/packages/preset-default/package.json index 447775dc..3635dcd3 100644 --- a/packages/preset-default/package.json +++ b/packages/preset-default/package.json @@ -1,6 +1,6 @@ { "name": "magefront-preset-default", - "version": "1.1.0", + "version": "1.2.0", "type": "module", "keywords": [ "magefront", @@ -25,14 +25,14 @@ "build": "unbuild" }, "dependencies": { - "magefront-plugin-cssnano": "workspace:~", - "magefront-plugin-js-translation": "workspace:~", - "magefront-plugin-less": "workspace:~", - "magefront-plugin-requirejs-config": "workspace:~", - "magefront-plugin-terser": "workspace:~" + "magefront-plugin-cssnano": "workspace:^", + "magefront-plugin-js-translation": "workspace:^", + "magefront-plugin-less": "workspace:^", + "magefront-plugin-requirejs-config": "workspace:^", + "magefront-plugin-terser": "workspace:^" }, "peerDependencies": { - "magefront": "*" + "magefront": "workspace:^" }, "exports": { ".": { diff --git a/patches/@changesets__assemble-release-plan@5.2.4.patch b/patches/@changesets__assemble-release-plan@5.2.4.patch new file mode 100644 index 00000000..8c3f02dd --- /dev/null +++ b/patches/@changesets__assemble-release-plan@5.2.4.patch @@ -0,0 +1,26 @@ +diff --git a/dist/assemble-release-plan.cjs.dev.js b/dist/assemble-release-plan.cjs.dev.js +index e1376ca756d69816f8c79637ee7b45161f092167..8cb0a24dced96f422afffe4ec21cf3628b4951dd 100644 +--- a/dist/assemble-release-plan.cjs.dev.js ++++ b/dist/assemble-release-plan.cjs.dev.js +@@ -257,7 +257,7 @@ function shouldBumpMajor({ + // we check if it is a peerDependency because if it is, our dependent bump type might need to be major. + return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && ( // 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range. + // 2. If onlyUpdatePeerDependentsWhenOutOfRange set to false, bump major regardless whether or not the version is leaving the range. +- !onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default['default'](incrementVersion(nextRelease, preInfo), versionRange)) && ( // bump major only if the dependent doesn't already has a major release. ++ !onlyUpdatePeerDependentsWhenOutOfRange) && ( // bump major only if the dependent doesn't already has a major release. + !releases.has(dependent) || releases.has(dependent) && releases.get(dependent).type !== "major"); + } + +diff --git a/dist/assemble-release-plan.cjs.prod.js b/dist/assemble-release-plan.cjs.prod.js +index 3a83720644a94cdf6e62fa188a72c51c0384d00e..411ef794988c7f770545bca6a7a38f9419806cd6 100644 +--- a/dist/assemble-release-plan.cjs.prod.js ++++ b/dist/assemble-release-plan.cjs.prod.js +@@ -130,7 +130,7 @@ function getDependencyVersionRanges(dependentPkgJSON, dependencyRelease) { + } + + function shouldBumpMajor({dependent: dependent, depType: depType, versionRange: versionRange, releases: releases, nextRelease: nextRelease, preInfo: preInfo, onlyUpdatePeerDependentsWhenOutOfRange: onlyUpdatePeerDependentsWhenOutOfRange}) { +- return "peerDependencies" === depType && "none" !== nextRelease.type && "patch" !== nextRelease.type && (!onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default.default(incrementVersion(nextRelease, preInfo), versionRange)) && (!releases.has(dependent) || releases.has(dependent) && "major" !== releases.get(dependent).type); ++ return "peerDependencies" === depType && "none" !== nextRelease.type && "patch" !== nextRelease.type && !onlyUpdatePeerDependentsWhenOutOfRange && (!releases.has(dependent) || releases.has(dependent) && "major" !== releases.get(dependent).type); + } + + function flattenReleases(changesets, packagesByName, ignoredPackages) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d023310b..ab09247f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + '@changesets/assemble-release-plan@5.2.4': + hash: pv76xcdmjh2izkqzxrh33kl6me + path: patches/@changesets__assemble-release-plan@5.2.4.patch + importers: .: @@ -56,14 +61,11 @@ 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 magefront-preset-default: - specifier: workspace:~ + specifier: workspace:^ version: link:../preset-default memoizee: specifier: ^0.4.15 @@ -84,9 +86,6 @@ 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 @@ -106,7 +105,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-concat: @@ -115,7 +114,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-cssnano: @@ -127,10 +126,10 @@ importers: specifier: ^6.0.1 version: 6.0.1(postcss@8.4.29) magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront magefront-plugin-postcss: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-postcss devDependencies: postcss: @@ -140,7 +139,7 @@ importers: packages/plugin-js-bundle: dependencies: magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-js-translation: @@ -149,7 +148,7 @@ importers: specifier: ^5.5.0 version: 5.5.0 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-less: @@ -164,7 +163,7 @@ importers: specifier: '2.7' version: 2.7.3 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-pngquant: @@ -173,7 +172,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront pngquant: specifier: ^4.2.0 @@ -185,7 +184,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront postcss: specifier: ^8.4.29 @@ -197,10 +196,10 @@ importers: specifier: ^7.22.15 version: 7.22.15(@babel/core@7.22.15) magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront magefront-plugin-babel: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-babel react: specifier: '>=18' @@ -212,7 +211,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront packages/plugin-sass: @@ -221,7 +220,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront sass: specifier: ^1.66.1 @@ -236,7 +235,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront stylus: specifier: ^0.60.0 @@ -248,7 +247,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront svelte: specifier: ~4.2.0 @@ -260,7 +259,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront svgo: specifier: ^3.0.2 @@ -269,10 +268,10 @@ importers: packages/plugin-tailwindcss: dependencies: magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront magefront-plugin-postcss: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-postcss tailwindcss: specifier: ^3.3.3 @@ -284,7 +283,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront terser: specifier: ^5.19.4 @@ -296,7 +295,7 @@ importers: specifier: ^3.3.1 version: 3.3.1 magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront typescript: specifier: ^5.2.2 @@ -305,22 +304,22 @@ importers: packages/preset-default: dependencies: magefront: - specifier: '*' + specifier: workspace:^ version: link:../magefront magefront-plugin-cssnano: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-cssnano magefront-plugin-js-translation: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-js-translation magefront-plugin-less: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-less magefront-plugin-requirejs-config: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-requirejs-config magefront-plugin-terser: - specifier: workspace:~ + specifier: workspace:^ version: link:../plugin-terser packages: @@ -745,7 +744,7 @@ packages: semver: 7.5.4 dev: true - /@changesets/assemble-release-plan@5.2.4: + /@changesets/assemble-release-plan@5.2.4(patch_hash=pv76xcdmjh2izkqzxrh33kl6me): resolution: {integrity: sha512-xJkWX+1/CUaOUWTguXEbCDTyWJFECEhmdtbkjhn5GVBGxdP/JwaHBIU9sW3FR6gD07UwZ7ovpiPclQZs+j+mvg==} dependencies: '@babel/runtime': 7.22.15 @@ -755,6 +754,7 @@ packages: '@manypkg/get-packages': 1.1.3 semver: 7.5.4 dev: true + patched: true /@changesets/changelog-git@0.1.14: resolution: {integrity: sha512-+vRfnKtXVWsDDxGctOfzJsPhaCdXRYoe+KyWYoq5X/GqoISREiat0l3L8B0a453B2B4dfHGcZaGyowHbp9BSaA==} @@ -768,7 +768,7 @@ packages: dependencies: '@babel/runtime': 7.22.15 '@changesets/apply-release-plan': 6.1.4 - '@changesets/assemble-release-plan': 5.2.4 + '@changesets/assemble-release-plan': 5.2.4(patch_hash=pv76xcdmjh2izkqzxrh33kl6me) '@changesets/changelog-git': 0.1.14 '@changesets/config': 2.3.1 '@changesets/errors': 0.1.4 @@ -833,7 +833,7 @@ packages: resolution: {integrity: sha512-6IwKTubNEgoOZwDontYc2x2cWXfr6IKxP3IhKeK+WjyD6y3M4Gl/jdQvBw+m/5zWILSOCAaGLu2ZF6Q+WiPniw==} dependencies: '@babel/runtime': 7.22.15 - '@changesets/assemble-release-plan': 5.2.4 + '@changesets/assemble-release-plan': 5.2.4(patch_hash=pv76xcdmjh2izkqzxrh33kl6me) '@changesets/config': 2.3.1 '@changesets/pre': 1.0.14 '@changesets/read': 0.5.9 @@ -1812,13 +1812,6 @@ 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: @@ -1858,12 +1851,6 @@ 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 @@ -4188,6 +4175,7 @@ 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==} @@ -5607,6 +5595,7 @@ packages: universalify: 2.0.0 optionalDependencies: graceful-fs: 4.2.11 + dev: true /jsonify@0.0.1: resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} @@ -8668,6 +8657,7 @@ 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==}