From c84eb2462cf06d99876d53c8713d357a355b6e69 Mon Sep 17 00:00:00 2001 From: KristofersMagebit Date: Wed, 12 Mar 2025 19:21:41 +0200 Subject: [PATCH 01/22] 1.1.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 000090d..d677bfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "magebit-magento-toolbox", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "magebit-magento-toolbox", - "version": "1.1.2", + "version": "1.1.3", "dependencies": { "@vscode-elements/elements": "^1.11.0", "@xml-tools/ast": "^5.0.5", diff --git a/package.json b/package.json index 534437d..8f06fb2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Magento 2 code generation, inspection and utility tools", "publisher": "magebit", "icon": "resources/logo.jpg", - "version": "1.1.2", + "version": "1.1.3", "engines": { "vscode": "^1.93.1" }, From 37e44d35e29bfdb125c70b1d8244def0d25d854f Mon Sep 17 00:00:00 2001 From: KristofersMagebit Date: Wed, 12 Mar 2025 19:23:32 +0200 Subject: [PATCH 02/22] fix: package command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f06fb2..29c1f3a 100644 --- a/package.json +++ b/package.json @@ -193,7 +193,7 @@ "watch": "npm-run-all -p watch:*", "watch:esbuild": "node esbuild.js --watch", "watch:test": "node esbuild.test.js --watch", - "package": "npm run build", + "package": "npm run compile", "compile-tests": "node esbuild.test.js", "pretest": "npm run compile && npm run compile-tests && npm run lint", "check-types": "tsc --noEmit", From 9bb3ee7d0bb82af2dabfe77ee8064c535ca79fd9 Mon Sep 17 00:00:00 2001 From: KristofersMagebit Date: Wed, 12 Mar 2025 19:26:15 +0200 Subject: [PATCH 03/22] chore: updated changelog --- CHANGELOG.md | 9 +++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b40c122..a15ffb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to the "magento-toolbox" extension will be documented in thi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [1.1.3] - 3/12/2025 + +- Fixed: Block, observer, plugin and preference class generation fails if class name includes backslashes +- Fixed: Composer.json license is not capitalized +- Fixed: Module generation module.xml sequence elements are not added +- Fixed: Observer XML generation fails if file header comment is not configured +- Fixed: Preference type attribute does not include full class namespace +- Chore: added unit tests for generator commands + ## [1.1.2] - 2/27/2025 - Fixed: Module generator creates an invalid registration.php file diff --git a/package-lock.json b/package-lock.json index d677bfc..a30adee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "magebit-magento-toolbox", - "version": "1.1.3", + "version": "1.1.2", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 29c1f3a..185f019 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Magento 2 code generation, inspection and utility tools", "publisher": "magebit", "icon": "resources/logo.jpg", - "version": "1.1.3", + "version": "1.1.2", "engines": { "vscode": "^1.93.1" }, From e7c4d915b61ef39228dd42ac4034e2fb26a8da9e Mon Sep 17 00:00:00 2001 From: KristofersMagebit Date: Wed, 12 Mar 2025 19:26:19 +0200 Subject: [PATCH 04/22] 1.1.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a30adee..d677bfc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "magebit-magento-toolbox", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 185f019..29c1f3a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Magento 2 code generation, inspection and utility tools", "publisher": "magebit", "icon": "resources/logo.jpg", - "version": "1.1.2", + "version": "1.1.3", "engines": { "vscode": "^1.93.1" }, From 949aa49006d1cab8d82c019151b06a61c3554da1 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:06:06 +0200 Subject: [PATCH 05/22] feat: added sample layout.xml generator --- CHANGELOG.md | 6 ++- package.json | 8 ++++ src/command/GenerateLayoutXmlCommand.ts | 51 +++++++++++++++++++++++++ src/command/index.ts | 15 ++++++++ src/extension.ts | 37 ++---------------- templates/xml/blank-di.ejs | 2 +- templates/xml/blank-events.ejs | 2 +- templates/xml/blank-layout.ejs | 7 ++++ templates/xml/blank-webapi.ejs | 2 +- 9 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 src/command/GenerateLayoutXmlCommand.ts create mode 100644 src/command/index.ts create mode 100644 templates/xml/blank-layout.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index a15ffb9..2813f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to the "magento-toolbox" extension will be documented in thi Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## [Unreleased] + +- Added: Generator command for sample layout.xml file + ## [1.1.3] - 3/12/2025 - Fixed: Block, observer, plugin and preference class generation fails if class name includes backslashes @@ -11,7 +15,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Fixed: Module generation module.xml sequence elements are not added - Fixed: Observer XML generation fails if file header comment is not configured - Fixed: Preference type attribute does not include full class namespace -- Chore: added unit tests for generator commands +- Chore: Added unit tests for generator commands ## [1.1.2] - 2/27/2025 diff --git a/package.json b/package.json index 29c1f3a..9b7f239 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,10 @@ { "command": "magento-toolbox.generatePreference", "title": "Magento Toolbox: Generate Preference" + }, + { + "command": "magento-toolbox.generateLayoutXmlFile", + "title": "Magento Toolbox: Generate Layout XML" } ], "menus": { @@ -183,6 +187,10 @@ { "command": "magento-toolbox.generateWebapiXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateLayoutXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateLayoutXmlCommand.ts b/src/command/GenerateLayoutXmlCommand.ts new file mode 100644 index 0000000..7fbf90e --- /dev/null +++ b/src/command/GenerateLayoutXmlCommand.ts @@ -0,0 +1,51 @@ +import { MagentoScope } from 'types'; +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import { WizardField, WizardValidationRule } from 'webview/types'; +import { WizardFieldBuilder } from 'webview/WizardFieldBuilder'; + +export default class GenerateLayoutXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateLayoutXmlFile'); + } + + getAreas(): MagentoScope[] { + return [ + MagentoScope.Global, + MagentoScope.Adminhtml, + MagentoScope.Frontend, + MagentoScope.Cron, + MagentoScope.WebapiRest, + MagentoScope.WebapiSoap, + MagentoScope.Graphql, + ]; + } + + getWizardTitle(): string { + return 'Layout XML File'; + } + + getTemplatePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + if (data.area && data.area !== MagentoScope.Global) { + return `app/code/${vendor}/${module}/view/${data.area}/layout/${data.name}.xml`; + } + + return `app/code/${vendor}/${module}/view/base/layout/${data.name}.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-layout'; + } + + getWizardFields(): WizardField[] { + return [WizardFieldBuilder.text('name', 'Layout Name').build()]; + } + + getWizardValidation(): Record { + return { + name: 'required', + }; + } +} diff --git a/src/command/index.ts b/src/command/index.ts new file mode 100644 index 0000000..c7005e1 --- /dev/null +++ b/src/command/index.ts @@ -0,0 +1,15 @@ +export { default as IndexWorkspaceCommand } from './IndexWorkspaceCommand'; +export { default as GenerateModuleCommand } from './GenerateModuleCommand'; +export { default as GenerateContextPluginCommand } from './GenerateContextPluginCommand'; +export { default as CopyMagentoPathCommand } from './CopyMagentoPathCommand'; +export { default as GenerateXmlCatalogCommand } from './GenerateXmlCatalogCommand'; +export { default as GenerateObserverCommand } from './GenerateObserverCommand'; +export { default as GenerateBlockCommand } from './GenerateBlockCommand'; +export { default as GenerateEventsXmlCommand } from './GenerateEventsXmlCommand'; +export { default as GenerateGraphqlSchemaFileCommand } from './GenerateGraphqlSchemaFile'; +export { default as GenerateRoutesXmlFileCommand } from './GenerateRoutesXmlFileCommand'; +export { default as GenerateAclXmlFileCommand } from './GenerateAclXmlFileCommand'; +export { default as GenerateDiXmlFileCommand } from './GenerateDiXmlFileCommand'; +export { default as GeneratePreferenceCommand } from './GeneratePreferenceCommand'; +export { default as GenerateLayoutXmlCommand } from './GenerateLayoutXmlCommand'; +export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFileCommand'; diff --git a/src/extension.ts b/src/extension.ts index d656c2c..376445b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,7 +1,3 @@ -// The module 'vscode' contains the VS Code extensibility API -// Import the module and reference it with the alias vscode in your code below -import GenerateModuleCommand from 'command/GenerateModuleCommand'; -import IndexWorkspaceCommand from 'command/IndexWorkspaceCommand'; import ExtensionState from 'common/ExtensionState'; import IndexRunner from 'indexer/IndexRunner'; import ActiveTextEditorChangeObserver from 'observer/ActiveTextEditorChangeObserver'; @@ -9,45 +5,20 @@ import * as vscode from 'vscode'; import DiagnosticCollectionProvider from 'diagnostics/DiagnosticCollectionProvider'; import ChangeTextEditorSelectionObserver from 'observer/ChangeTextEditorSelectionObserver'; import DocumentCache from 'cache/DocumentCache'; -import GenerateContextPluginCommand from 'command/GenerateContextPluginCommand'; import { XmlClasslikeDefinitionProvider } from 'definition/XmlClasslikeDefinitionProvider'; -import CopyMagentoPathCommand from 'command/CopyMagentoPathCommand'; -import GenerateXmlCatalogCommand from 'command/GenerateXmlCatalogCommand'; import XmlClasslikeHoverProvider from 'hover/XmlClasslikeHoverProvider'; import ObserverCodelensProvider from 'codelens/ObserverCodelensProvider'; -import GenerateObserverCommand from 'command/GenerateObserverCommand'; -import GenerateBlockCommand from 'command/GenerateBlockCommand'; -import GenerateEventsXmlCommand from 'command/GenerateEventsXmlCommand'; -import GenerateGraphqlSchemaFileCommand from 'command/GenerateGraphqlSchemaFile'; -import GenerateRoutesXmlFileCommand from 'command/GenerateRoutesXmlFileCommand'; -import GenerateAclXmlFileCommand from 'command/GenerateAclXmlFileCommand'; -import GenerateDiXmlFileCommand from 'command/GenerateDiXmlFileCommand'; -import GeneratePreferenceCommand from 'command/GeneratePreferenceCommand'; +import * as commands from 'command'; import Magento from 'util/Magento'; import { WorkspaceFolder } from 'vscode'; import Logger from 'util/Logger'; +import { Command } from 'command/Command'; // This method is called when your extension is activated // Your extension is activated the very first time the command is executed export async function activate(context: vscode.ExtensionContext) { console.log('[Magento Toolbox] Activating extension'); - const commands = [ - IndexWorkspaceCommand, - GenerateModuleCommand, - GenerateContextPluginCommand, - CopyMagentoPathCommand, - GenerateXmlCatalogCommand, - GenerateObserverCommand, - GenerateBlockCommand, - GenerateEventsXmlCommand, - GenerateGraphqlSchemaFileCommand, - GenerateRoutesXmlFileCommand, - GenerateAclXmlFileCommand, - GenerateDiXmlFileCommand, - GeneratePreferenceCommand, - ]; - const magentoWorkspaces: WorkspaceFolder[] = []; if (vscode.workspace.workspaceFolders) { @@ -60,8 +31,8 @@ export async function activate(context: vscode.ExtensionContext) { ExtensionState.init(context, magentoWorkspaces); - commands.forEach(command => { - const instance = new command(); + Object.values(commands).forEach(command => { + const instance = new command() as Command; Logger.log('Registering command', instance.getCommand()); diff --git a/templates/xml/blank-di.ejs b/templates/xml/blank-di.ejs index 0d78280..aacdd53 100644 --- a/templates/xml/blank-di.ejs +++ b/templates/xml/blank-di.ejs @@ -4,4 +4,4 @@ <% } -%> - \ No newline at end of file + diff --git a/templates/xml/blank-events.ejs b/templates/xml/blank-events.ejs index 7e7cab1..888106d 100644 --- a/templates/xml/blank-events.ejs +++ b/templates/xml/blank-events.ejs @@ -4,4 +4,4 @@ <% } -%> - \ No newline at end of file + diff --git a/templates/xml/blank-layout.ejs b/templates/xml/blank-layout.ejs new file mode 100644 index 0000000..c49adf8 --- /dev/null +++ b/templates/xml/blank-layout.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> +layout="admin-1column"<% } %> + xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> + diff --git a/templates/xml/blank-webapi.ejs b/templates/xml/blank-webapi.ejs index 147511f..ee49872 100644 --- a/templates/xml/blank-webapi.ejs +++ b/templates/xml/blank-webapi.ejs @@ -4,4 +4,4 @@ <% } -%> - \ No newline at end of file + From c9c4ea54008e2425a80d39533f8c28d7865db9e5 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:16:05 +0200 Subject: [PATCH 06/22] feat: added file header --- src/command/GenerateLayoutXmlCommand.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/command/GenerateLayoutXmlCommand.ts b/src/command/GenerateLayoutXmlCommand.ts index 7fbf90e..d78826e 100644 --- a/src/command/GenerateLayoutXmlCommand.ts +++ b/src/command/GenerateLayoutXmlCommand.ts @@ -3,6 +3,7 @@ import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; import { WizardField, WizardValidationRule } from 'webview/types'; import { WizardFieldBuilder } from 'webview/WizardFieldBuilder'; +import FileHeader from 'common/xml/FileHeader'; export default class GenerateLayoutXmlCommand extends SimpleTemplateGeneratorCommand { constructor() { @@ -21,11 +22,15 @@ export default class GenerateLayoutXmlCommand extends SimpleTemplateGeneratorCom ]; } + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + getWizardTitle(): string { return 'Layout XML File'; } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); if (data.area && data.area !== MagentoScope.Global) { From ff880b003e676a2d35b7189d52a59b8f701dd777 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:18:51 +0200 Subject: [PATCH 07/22] feat: generator for page_types.xml --- CHANGELOG.md | 3 +- package.json | 8 +++++ src/command/GenerateAclXmlFileCommand.ts | 2 +- src/command/GenerateDiXmlFileCommand.ts | 2 +- src/command/GenerateEventsXmlCommand.ts | 2 +- src/command/GenerateGraphqlSchemaFile.ts | 2 +- src/command/GeneratePageTypesXmlCommand.ts | 32 +++++++++++++++++++ src/command/GenerateRoutesXmlFileCommand.ts | 2 +- src/command/GenerateWebapiXmlFileCommand.ts | 2 +- src/command/SimpleTemplateGeneratorCommand.ts | 4 +-- src/command/index.ts | 1 + templates/xml/blank-page-types.ejs | 7 ++++ 12 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 src/command/GeneratePageTypesXmlCommand.ts create mode 100644 templates/xml/blank-page-types.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2813f81..949fce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [Unreleased] -- Added: Generator command for sample layout.xml file +- Added: Generator command for sample Layout XML file +- Added: Generator command for sample page_types.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 9b7f239..e860ed5 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,10 @@ { "command": "magento-toolbox.generateLayoutXmlFile", "title": "Magento Toolbox: Generate Layout XML" + }, + { + "command": "magento-toolbox.generatePageTypesXmlFile", + "title": "Magento Toolbox: Generate Page Types XML" } ], "menus": { @@ -191,6 +195,10 @@ { "command": "magento-toolbox.generateLayoutXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generatePageTypesXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateAclXmlFileCommand.ts b/src/command/GenerateAclXmlFileCommand.ts index 687ee7a..c2ba402 100644 --- a/src/command/GenerateAclXmlFileCommand.ts +++ b/src/command/GenerateAclXmlFileCommand.ts @@ -10,7 +10,7 @@ export default class GenerateAclXmlFileCommand extends SimpleTemplateGeneratorCo return 'ACL XML File'; } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); return `app/code/${vendor}/${module}/etc/acl.xml`; diff --git a/src/command/GenerateDiXmlFileCommand.ts b/src/command/GenerateDiXmlFileCommand.ts index e0f6c9a..a806a4b 100644 --- a/src/command/GenerateDiXmlFileCommand.ts +++ b/src/command/GenerateDiXmlFileCommand.ts @@ -23,7 +23,7 @@ export default class GenerateDiXmlFileCommand extends SimpleTemplateGeneratorCom return 'DI XML File'; } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); if (data.area && data.area !== MagentoScope.Global) { diff --git a/src/command/GenerateEventsXmlCommand.ts b/src/command/GenerateEventsXmlCommand.ts index 5a18fa1..4d88a74 100644 --- a/src/command/GenerateEventsXmlCommand.ts +++ b/src/command/GenerateEventsXmlCommand.ts @@ -28,7 +28,7 @@ export default class GenerateEventsXmlCommand extends SimpleTemplateGeneratorCom return FileHeader.getHeader(data.module); } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); if (data.area && data.area !== MagentoScope.Global) { diff --git a/src/command/GenerateGraphqlSchemaFile.ts b/src/command/GenerateGraphqlSchemaFile.ts index 7b430fc..7c82b06 100644 --- a/src/command/GenerateGraphqlSchemaFile.ts +++ b/src/command/GenerateGraphqlSchemaFile.ts @@ -10,7 +10,7 @@ export default class GenerateGraphqlSchemaFileCommand extends SimpleTemplateGene return 'GraphQL Schema File'; } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); return `app/code/${vendor}/${module}/etc/schema.graphqls`; diff --git a/src/command/GeneratePageTypesXmlCommand.ts b/src/command/GeneratePageTypesXmlCommand.ts new file mode 100644 index 0000000..3921b11 --- /dev/null +++ b/src/command/GeneratePageTypesXmlCommand.ts @@ -0,0 +1,32 @@ +import { MagentoScope } from 'types'; +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GeneratePageTypesXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generatePageTypesXmlFile'); + } + + getAreas(): MagentoScope[] { + return [MagentoScope.Frontend]; + } + + getWizardTitle(): string { + return 'Page Types XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/frontend/page_types.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-page-types'; + } +} diff --git a/src/command/GenerateRoutesXmlFileCommand.ts b/src/command/GenerateRoutesXmlFileCommand.ts index e42e4fb..1df986b 100644 --- a/src/command/GenerateRoutesXmlFileCommand.ts +++ b/src/command/GenerateRoutesXmlFileCommand.ts @@ -22,7 +22,7 @@ export default class GenerateRoutesXmlFileCommand extends SimpleTemplateGenerato return FileHeader.getHeader(data.module); } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); return `app/code/${vendor}/${module}/etc/${data.area}/routes.xml`; diff --git a/src/command/GenerateWebapiXmlFileCommand.ts b/src/command/GenerateWebapiXmlFileCommand.ts index 5a96b12..115cd7c 100644 --- a/src/command/GenerateWebapiXmlFileCommand.ts +++ b/src/command/GenerateWebapiXmlFileCommand.ts @@ -15,7 +15,7 @@ export default class GenerateWebapiXmlFileCommand extends SimpleTemplateGenerato return FileHeader.getHeader(data.module); } - getTemplatePath(data: TemplateWizardData): string { + getFilePath(data: TemplateWizardData): string { const [vendor, module] = data.module.split('_'); return `app/code/${vendor}/${module}/etc/webapi.xml`; diff --git a/src/command/SimpleTemplateGeneratorCommand.ts b/src/command/SimpleTemplateGeneratorCommand.ts index 69b5bf2..d0837ee 100644 --- a/src/command/SimpleTemplateGeneratorCommand.ts +++ b/src/command/SimpleTemplateGeneratorCommand.ts @@ -16,7 +16,7 @@ export abstract class SimpleTemplateGeneratorCommand extends Command { return []; } - abstract getTemplatePath(data: TemplateWizardData): string; + abstract getFilePath(data: TemplateWizardData): string; abstract getTemplateName(data: TemplateWizardData): string; @@ -60,7 +60,7 @@ export abstract class SimpleTemplateGeneratorCommand extends Command { ); const manager = new FileGeneratorManager([ - new TemplateGenerator(this.getTemplatePath(data), this.getTemplateName(data), { + new TemplateGenerator(this.getFilePath(data), this.getTemplateName(data), { ...this.getTemplateData(data), fileHeader: this.getFileHeader(data) ?? '', }), diff --git a/src/command/index.ts b/src/command/index.ts index c7005e1..88fde78 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -13,3 +13,4 @@ export { default as GenerateDiXmlFileCommand } from './GenerateDiXmlFileCommand' export { default as GeneratePreferenceCommand } from './GeneratePreferenceCommand'; export { default as GenerateLayoutXmlCommand } from './GenerateLayoutXmlCommand'; export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFileCommand'; +export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCommand'; diff --git a/templates/xml/blank-page-types.ejs b/templates/xml/blank-page-types.ejs new file mode 100644 index 0000000..90481c0 --- /dev/null +++ b/templates/xml/blank-page-types.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + \ No newline at end of file From f58e09c2054f93257f85f867037f9035ed2f9697 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:20:20 +0200 Subject: [PATCH 08/22] fix: added newline --- .../reference/generator/module/module-with-comment.xml | 2 +- .../reference/generator/observer/events-adminhtml.xml | 2 +- .../reference/generator/observer/events-with-comment.xml | 2 +- test-resources/reference/generator/observer/events.xml | 2 +- test-resources/reference/generator/plugin/di-adminhtml.xml | 2 +- test-resources/reference/generator/plugin/di.xml | 2 +- test-resources/reference/generator/preference/di.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test-resources/reference/generator/module/module-with-comment.xml b/test-resources/reference/generator/module/module-with-comment.xml index 9104467..ebf3484 100644 --- a/test-resources/reference/generator/module/module-with-comment.xml +++ b/test-resources/reference/generator/module/module-with-comment.xml @@ -4,4 +4,4 @@ --> - \ No newline at end of file + diff --git a/test-resources/reference/generator/observer/events-adminhtml.xml b/test-resources/reference/generator/observer/events-adminhtml.xml index 96fe3a6..b147fca 100644 --- a/test-resources/reference/generator/observer/events-adminhtml.xml +++ b/test-resources/reference/generator/observer/events-adminhtml.xml @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/test-resources/reference/generator/observer/events-with-comment.xml b/test-resources/reference/generator/observer/events-with-comment.xml index 867ae2d..87943d8 100644 --- a/test-resources/reference/generator/observer/events-with-comment.xml +++ b/test-resources/reference/generator/observer/events-with-comment.xml @@ -8,4 +8,4 @@ Foo_Bar - \ No newline at end of file + diff --git a/test-resources/reference/generator/observer/events.xml b/test-resources/reference/generator/observer/events.xml index 96fe3a6..b147fca 100644 --- a/test-resources/reference/generator/observer/events.xml +++ b/test-resources/reference/generator/observer/events.xml @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/test-resources/reference/generator/plugin/di-adminhtml.xml b/test-resources/reference/generator/plugin/di-adminhtml.xml index 6357502..5a8a5ab 100644 --- a/test-resources/reference/generator/plugin/di-adminhtml.xml +++ b/test-resources/reference/generator/plugin/di-adminhtml.xml @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/test-resources/reference/generator/plugin/di.xml b/test-resources/reference/generator/plugin/di.xml index 6357502..5a8a5ab 100644 --- a/test-resources/reference/generator/plugin/di.xml +++ b/test-resources/reference/generator/plugin/di.xml @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/test-resources/reference/generator/preference/di.xml b/test-resources/reference/generator/preference/di.xml index a9f4d71..d25accd 100644 --- a/test-resources/reference/generator/preference/di.xml +++ b/test-resources/reference/generator/preference/di.xml @@ -3,4 +3,4 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> - \ No newline at end of file + From 76c1fddd0fb06654c8b8761c1d969e04283c636d Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:21:14 +0200 Subject: [PATCH 09/22] chore: run CI on push only --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f7b685..cf9f383 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: Run CI jobs -on: [push, pull_request] +on: [push] jobs: lint: From 3e55b7cd3585f89d072b0aca2a3ea73af8656306 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:22:17 +0200 Subject: [PATCH 10/22] chore: removed scope --- src/command/GeneratePageTypesXmlCommand.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/command/GeneratePageTypesXmlCommand.ts b/src/command/GeneratePageTypesXmlCommand.ts index 3921b11..d504a09 100644 --- a/src/command/GeneratePageTypesXmlCommand.ts +++ b/src/command/GeneratePageTypesXmlCommand.ts @@ -1,4 +1,3 @@ -import { MagentoScope } from 'types'; import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; import FileHeader from 'common/xml/FileHeader'; @@ -8,10 +7,6 @@ export default class GeneratePageTypesXmlCommand extends SimpleTemplateGenerator super('magento-toolbox.generatePageTypesXmlFile'); } - getAreas(): MagentoScope[] { - return [MagentoScope.Frontend]; - } - getWizardTitle(): string { return 'Page Types XML File'; } From c91c6225b8bdb06b11c19f460be6c67fba1b99e8 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:25:41 +0200 Subject: [PATCH 11/22] feat: added generator for sample crontab.xml file --- CHANGELOG.md | 1 + package.json | 8 +++++++ src/command/GenerateCrontabXmlCommand.ts | 27 ++++++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-crontab.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateCrontabXmlCommand.ts create mode 100644 templates/xml/blank-crontab.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 949fce1..1fd4f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample Layout XML file - Added: Generator command for sample page_types.xml file +- Added: Generator command for sample crontab.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index e860ed5..ec99873 100644 --- a/package.json +++ b/package.json @@ -118,6 +118,10 @@ { "command": "magento-toolbox.generatePageTypesXmlFile", "title": "Magento Toolbox: Generate Page Types XML" + }, + { + "command": "magento-toolbox.generateCrontabXmlFile", + "title": "Magento Toolbox: Generate Crontab XML" } ], "menus": { @@ -199,6 +203,10 @@ { "command": "magento-toolbox.generatePageTypesXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateCrontabXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateCrontabXmlCommand.ts b/src/command/GenerateCrontabXmlCommand.ts new file mode 100644 index 0000000..d964e6f --- /dev/null +++ b/src/command/GenerateCrontabXmlCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateCrontabXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateCrontabXmlFile'); + } + + getWizardTitle(): string { + return 'Crontab XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/crontab.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-crontab'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 88fde78..14f9a16 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -14,3 +14,4 @@ export { default as GeneratePreferenceCommand } from './GeneratePreferenceComman export { default as GenerateLayoutXmlCommand } from './GenerateLayoutXmlCommand'; export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFileCommand'; export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCommand'; +export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlCommand'; diff --git a/templates/xml/blank-crontab.ejs b/templates/xml/blank-crontab.ejs new file mode 100644 index 0000000..6ab66d2 --- /dev/null +++ b/templates/xml/blank-crontab.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From 0005895d310adc4c2e271e9d318ec9f083855bf5 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:28:27 +0200 Subject: [PATCH 12/22] feat: generator for sample email_templates.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ .../GenerateEmailTemplatesXmlCommand.ts | 27 +++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-email-templates.ejs | 7 +++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateEmailTemplatesXmlCommand.ts create mode 100644 templates/xml/blank-email-templates.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd4f47..29146aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample Layout XML file - Added: Generator command for sample page_types.xml file - Added: Generator command for sample crontab.xml file +- Added: Generator command for sample email_templates.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index ec99873..a682d15 100644 --- a/package.json +++ b/package.json @@ -122,6 +122,10 @@ { "command": "magento-toolbox.generateCrontabXmlFile", "title": "Magento Toolbox: Generate Crontab XML" + }, + { + "command": "magento-toolbox.generateEmailTemplatesXmlFile", + "title": "Magento Toolbox: Generate Email Templates XML" } ], "menus": { @@ -207,6 +211,10 @@ { "command": "magento-toolbox.generateCrontabXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateEmailTemplatesXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateEmailTemplatesXmlCommand.ts b/src/command/GenerateEmailTemplatesXmlCommand.ts new file mode 100644 index 0000000..79bf69d --- /dev/null +++ b/src/command/GenerateEmailTemplatesXmlCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateEmailTemplatesXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateEmailTemplatesXmlFile'); + } + + getWizardTitle(): string { + return 'Email Templates XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/email_templates.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-email-templates'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 14f9a16..0b66ac7 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -15,3 +15,4 @@ export { default as GenerateLayoutXmlCommand } from './GenerateLayoutXmlCommand' export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFileCommand'; export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCommand'; export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlCommand'; +export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemplatesXmlCommand'; diff --git a/templates/xml/blank-email-templates.ejs b/templates/xml/blank-email-templates.ejs new file mode 100644 index 0000000..48df29e --- /dev/null +++ b/templates/xml/blank-email-templates.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From 1f9f4a3ad3e4bfae42ca1330e6828a9ce20b0ab3 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:30:49 +0200 Subject: [PATCH 13/22] feat: generator command for sample sections.xml --- CHANGELOG.md | 1 + package.json | 8 +++++++ src/command/GenerateSectionsXmlCommand.ts | 27 +++++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-sections.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateSectionsXmlCommand.ts create mode 100644 templates/xml/blank-sections.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 29146aa..265d257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample page_types.xml file - Added: Generator command for sample crontab.xml file - Added: Generator command for sample email_templates.xml file +- Added: Generator command for sample sections.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index a682d15..21fbb0b 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,10 @@ { "command": "magento-toolbox.generateEmailTemplatesXmlFile", "title": "Magento Toolbox: Generate Email Templates XML" + }, + { + "command": "magento-toolbox.generateSectionsXmlFile", + "title": "Magento Toolbox: Generate Sections XML" } ], "menus": { @@ -215,6 +219,10 @@ { "command": "magento-toolbox.generateEmailTemplatesXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateSectionsXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateSectionsXmlCommand.ts b/src/command/GenerateSectionsXmlCommand.ts new file mode 100644 index 0000000..75cfd68 --- /dev/null +++ b/src/command/GenerateSectionsXmlCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateSectionsXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateSectionsXmlFile'); + } + + getWizardTitle(): string { + return 'Sections XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/frontend/sections.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-sections'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 0b66ac7..b831281 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -16,3 +16,4 @@ export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFile export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCommand'; export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlCommand'; export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemplatesXmlCommand'; +export { default as GenerateSectionsXmlCommand } from './GenerateSectionsXmlCommand'; diff --git a/templates/xml/blank-sections.ejs b/templates/xml/blank-sections.ejs new file mode 100644 index 0000000..4b257fe --- /dev/null +++ b/templates/xml/blank-sections.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From ed65729b2286284de3ada987a80fb93ddf3addea Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:33:10 +0200 Subject: [PATCH 14/22] feat: generator command for sample fieldset.xml file --- CHANGELOG.md | 1 + package.json | 8 +++++++ src/command/GenerateFieldsetXmlCommand.ts | 27 +++++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-fieldset.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateFieldsetXmlCommand.ts create mode 100644 templates/xml/blank-fieldset.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 265d257..a62e706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample crontab.xml file - Added: Generator command for sample email_templates.xml file - Added: Generator command for sample sections.xml file +- Added: Generator command for sample fieldset.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 21fbb0b..18dbfb7 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,10 @@ { "command": "magento-toolbox.generateSectionsXmlFile", "title": "Magento Toolbox: Generate Sections XML" + }, + { + "command": "magento-toolbox.generateFieldsetXmlFile", + "title": "Magento Toolbox: Generate Fieldset XML" } ], "menus": { @@ -223,6 +227,10 @@ { "command": "magento-toolbox.generateSectionsXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateFieldsetXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateFieldsetXmlCommand.ts b/src/command/GenerateFieldsetXmlCommand.ts new file mode 100644 index 0000000..0917bc7 --- /dev/null +++ b/src/command/GenerateFieldsetXmlCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateFieldsetXmlCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateFieldsetXmlFile'); + } + + getWizardTitle(): string { + return 'Fieldset XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/fieldset.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-fieldset'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index b831281..af622ca 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -17,3 +17,4 @@ export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCo export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlCommand'; export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemplatesXmlCommand'; export { default as GenerateSectionsXmlCommand } from './GenerateSectionsXmlCommand'; +export { default as GenerateFieldsetXmlCommand } from './GenerateFieldsetXmlCommand'; diff --git a/templates/xml/blank-fieldset.ejs b/templates/xml/blank-fieldset.ejs new file mode 100644 index 0000000..ba00c6a --- /dev/null +++ b/templates/xml/blank-fieldset.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From 98d80b988a5ca1754dbae24ce777a474085d0fb4 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:35:52 +0200 Subject: [PATCH 15/22] feat: generator command for sample view.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++++ src/command/GenerateViewXmlFile.ts | 27 +++++++++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-view.ejs | 7 +++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateViewXmlFile.ts create mode 100644 templates/xml/blank-view.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index a62e706..1bd5c6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample email_templates.xml file - Added: Generator command for sample sections.xml file - Added: Generator command for sample fieldset.xml file +- Added: Generator command for sample view.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 18dbfb7..c3bbda3 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,10 @@ { "command": "magento-toolbox.generateFieldsetXmlFile", "title": "Magento Toolbox: Generate Fieldset XML" + }, + { + "command": "magento-toolbox.generateViewXmlFile", + "title": "Magento Toolbox: Generate View XML" } ], "menus": { @@ -231,6 +235,10 @@ { "command": "magento-toolbox.generateFieldsetXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateViewXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateViewXmlFile.ts b/src/command/GenerateViewXmlFile.ts new file mode 100644 index 0000000..09bfa4e --- /dev/null +++ b/src/command/GenerateViewXmlFile.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateViewXmlFile extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateViewXmlFile'); + } + + getWizardTitle(): string { + return 'View XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/view.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-view'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index af622ca..da0b4cf 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -18,3 +18,4 @@ export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlComman export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemplatesXmlCommand'; export { default as GenerateSectionsXmlCommand } from './GenerateSectionsXmlCommand'; export { default as GenerateFieldsetXmlCommand } from './GenerateFieldsetXmlCommand'; +export { default as GenerateViewXmlFile } from './GenerateViewXmlFile'; diff --git a/templates/xml/blank-view.ejs b/templates/xml/blank-view.ejs new file mode 100644 index 0000000..47db023 --- /dev/null +++ b/templates/xml/blank-view.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From 2f11c8187083e8d9dbca010cd36840b0d673ae71 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:37:56 +0200 Subject: [PATCH 16/22] feat: generator command for sample indexer.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ src/command/GenerateIndexerXmlFileCommand.ts | 27 ++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-indexer.ejs | 7 +++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateIndexerXmlFileCommand.ts create mode 100644 templates/xml/blank-indexer.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bd5c6e..003433a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample sections.xml file - Added: Generator command for sample fieldset.xml file - Added: Generator command for sample view.xml file +- Added: Generator command for sample indexer.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index c3bbda3..a51d08a 100644 --- a/package.json +++ b/package.json @@ -138,6 +138,10 @@ { "command": "magento-toolbox.generateViewXmlFile", "title": "Magento Toolbox: Generate View XML" + }, + { + "command": "magento-toolbox.generateIndexerXmlFile", + "title": "Magento Toolbox: Generate Indexer XML" } ], "menus": { @@ -239,6 +243,10 @@ { "command": "magento-toolbox.generateViewXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateIndexerXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateIndexerXmlFileCommand.ts b/src/command/GenerateIndexerXmlFileCommand.ts new file mode 100644 index 0000000..5db3be7 --- /dev/null +++ b/src/command/GenerateIndexerXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateIndexerXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateIndexerXmlFile'); + } + + getWizardTitle(): string { + return 'Indexer XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/indexer.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-indexer'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index da0b4cf..1aaa7e3 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -19,3 +19,4 @@ export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemp export { default as GenerateSectionsXmlCommand } from './GenerateSectionsXmlCommand'; export { default as GenerateFieldsetXmlCommand } from './GenerateFieldsetXmlCommand'; export { default as GenerateViewXmlFile } from './GenerateViewXmlFile'; +export { default as GenerateIndexerXmlFileCommand } from './GenerateIndexerXmlFileCommand'; diff --git a/templates/xml/blank-indexer.ejs b/templates/xml/blank-indexer.ejs new file mode 100644 index 0000000..e2b1710 --- /dev/null +++ b/templates/xml/blank-indexer.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From d0ed5696911045c3ea01a32dacd9da78585f7630 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:40:45 +0200 Subject: [PATCH 17/22] feat: generator for sample mview.xml file --- CHANGELOG.md | 1 + package.json | 8 +++++++ src/command/GenerateMviewXmlFileCommand.ts | 27 ++++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-mview.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateMviewXmlFileCommand.ts create mode 100644 templates/xml/blank-mview.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 003433a..19adf1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample fieldset.xml file - Added: Generator command for sample view.xml file - Added: Generator command for sample indexer.xml file +- Added: Generator command for sample mview.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index a51d08a..40220ea 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,10 @@ { "command": "magento-toolbox.generateIndexerXmlFile", "title": "Magento Toolbox: Generate Indexer XML" + }, + { + "command": "magento-toolbox.generateMviewXmlFile", + "title": "Magento Toolbox: Generate MVIEW XML" } ], "menus": { @@ -247,6 +251,10 @@ { "command": "magento-toolbox.generateIndexerXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateMviewXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateMviewXmlFileCommand.ts b/src/command/GenerateMviewXmlFileCommand.ts new file mode 100644 index 0000000..7439a64 --- /dev/null +++ b/src/command/GenerateMviewXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateMviewXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateMviewXmlFile'); + } + + getWizardTitle(): string { + return 'MVIEW XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/mview.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-mview'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 1aaa7e3..b9ef66e 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -20,3 +20,4 @@ export { default as GenerateSectionsXmlCommand } from './GenerateSectionsXmlComm export { default as GenerateFieldsetXmlCommand } from './GenerateFieldsetXmlCommand'; export { default as GenerateViewXmlFile } from './GenerateViewXmlFile'; export { default as GenerateIndexerXmlFileCommand } from './GenerateIndexerXmlFileCommand'; +export { default as GenerateMviewXmlFileCommand } from './GenerateMviewXmlFileCommand'; diff --git a/templates/xml/blank-mview.ejs b/templates/xml/blank-mview.ejs new file mode 100644 index 0000000..6e2e3f8 --- /dev/null +++ b/templates/xml/blank-mview.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From a9624271c7a1d96b1e05fc9a35c1dbe9acaf0fdd Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:43:40 +0200 Subject: [PATCH 18/22] feat: generator for sample widget.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ src/command/GenerateWidgetXmlFileCommand.ts | 27 +++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-widget.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateWidgetXmlFileCommand.ts create mode 100644 templates/xml/blank-widget.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 19adf1f..c972d43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample view.xml file - Added: Generator command for sample indexer.xml file - Added: Generator command for sample mview.xml file +- Added: Generator command for sample widget.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 40220ea..9b66ac8 100644 --- a/package.json +++ b/package.json @@ -146,6 +146,10 @@ { "command": "magento-toolbox.generateMviewXmlFile", "title": "Magento Toolbox: Generate MVIEW XML" + }, + { + "command": "magento-toolbox.generateWidgetXmlFile", + "title": "Magento Toolbox: Generate Widget XML" } ], "menus": { @@ -255,6 +259,10 @@ { "command": "magento-toolbox.generateMviewXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateWidgetXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateWidgetXmlFileCommand.ts b/src/command/GenerateWidgetXmlFileCommand.ts new file mode 100644 index 0000000..2bdd237 --- /dev/null +++ b/src/command/GenerateWidgetXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateWidgetXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateWidgetXmlFile'); + } + + getWizardTitle(): string { + return 'Widget XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/widget.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-widget'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index b9ef66e..dff7c1f 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -21,3 +21,4 @@ export { default as GenerateFieldsetXmlCommand } from './GenerateFieldsetXmlComm export { default as GenerateViewXmlFile } from './GenerateViewXmlFile'; export { default as GenerateIndexerXmlFileCommand } from './GenerateIndexerXmlFileCommand'; export { default as GenerateMviewXmlFileCommand } from './GenerateMviewXmlFileCommand'; +export { default as GenerateWidgetXmlFileCommand } from './GenerateWidgetXmlFileCommand'; diff --git a/templates/xml/blank-widget.ejs b/templates/xml/blank-widget.ejs new file mode 100644 index 0000000..87d0840 --- /dev/null +++ b/templates/xml/blank-widget.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From cd346d541de709ee3afcf84f8f30dd81d37c13cf Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:46:55 +0200 Subject: [PATCH 19/22] feat: generator for sample extension_attributes.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ ...nerateExtensionAttributesXmlFileCommand.ts | 27 +++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-extension-attributes.ejs | 7 +++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateExtensionAttributesXmlFileCommand.ts create mode 100644 templates/xml/blank-extension-attributes.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index c972d43..44348a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample indexer.xml file - Added: Generator command for sample mview.xml file - Added: Generator command for sample widget.xml file +- Added: Generator command for sample extension_attributes.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 9b66ac8..3c8b3ba 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,10 @@ { "command": "magento-toolbox.generateWidgetXmlFile", "title": "Magento Toolbox: Generate Widget XML" + }, + { + "command": "magento-toolbox.generateExtensionAttributesXmlFile", + "title": "Magento Toolbox: Generate Extension Attributes XML" } ], "menus": { @@ -263,6 +267,10 @@ { "command": "magento-toolbox.generateWidgetXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateExtensionAttributesXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateExtensionAttributesXmlFileCommand.ts b/src/command/GenerateExtensionAttributesXmlFileCommand.ts new file mode 100644 index 0000000..967ca07 --- /dev/null +++ b/src/command/GenerateExtensionAttributesXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateExtensionAttributesXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateExtensionAttributesXmlFile'); + } + + getWizardTitle(): string { + return 'Extension Attributes XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/extension_attributes.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-extension-attributes'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index dff7c1f..0308471 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -22,3 +22,4 @@ export { default as GenerateViewXmlFile } from './GenerateViewXmlFile'; export { default as GenerateIndexerXmlFileCommand } from './GenerateIndexerXmlFileCommand'; export { default as GenerateMviewXmlFileCommand } from './GenerateMviewXmlFileCommand'; export { default as GenerateWidgetXmlFileCommand } from './GenerateWidgetXmlFileCommand'; +export { default as GenerateExtensionAttributesXmlFileCommand } from './GenerateExtensionAttributesXmlFileCommand'; diff --git a/templates/xml/blank-extension-attributes.ejs b/templates/xml/blank-extension-attributes.ejs new file mode 100644 index 0000000..c2a1913 --- /dev/null +++ b/templates/xml/blank-extension-attributes.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From fa8e89f7baa828ce677f1d81bd9f552683fbc464 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:49:48 +0200 Subject: [PATCH 20/22] feat: generator for sample system.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ src/command/GenerateSystemXmlFileCommand.ts | 27 +++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-system.ejs | 9 +++++++ 5 files changed, 46 insertions(+) create mode 100644 src/command/GenerateSystemXmlFileCommand.ts create mode 100644 templates/xml/blank-system.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 44348a1..9f4b455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample mview.xml file - Added: Generator command for sample widget.xml file - Added: Generator command for sample extension_attributes.xml file +- Added: Generator command for sample system.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index 3c8b3ba..f545c28 100644 --- a/package.json +++ b/package.json @@ -154,6 +154,10 @@ { "command": "magento-toolbox.generateExtensionAttributesXmlFile", "title": "Magento Toolbox: Generate Extension Attributes XML" + }, + { + "command": "magento-toolbox.generateSystemXmlFile", + "title": "Magento Toolbox: Generate System XML" } ], "menus": { @@ -271,6 +275,10 @@ { "command": "magento-toolbox.generateExtensionAttributesXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateSystemXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateSystemXmlFileCommand.ts b/src/command/GenerateSystemXmlFileCommand.ts new file mode 100644 index 0000000..bb2ea5c --- /dev/null +++ b/src/command/GenerateSystemXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateSystemXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateSystemXmlFile'); + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getWizardTitle(): string { + return 'System XML File'; + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/adminhtml/system.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-system'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 0308471..6ebc363 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -23,3 +23,4 @@ export { default as GenerateIndexerXmlFileCommand } from './GenerateIndexerXmlFi export { default as GenerateMviewXmlFileCommand } from './GenerateMviewXmlFileCommand'; export { default as GenerateWidgetXmlFileCommand } from './GenerateWidgetXmlFileCommand'; export { default as GenerateExtensionAttributesXmlFileCommand } from './GenerateExtensionAttributesXmlFileCommand'; +export { default as GenerateSystemXmlFileCommand } from './GenerateSystemXmlFileCommand'; diff --git a/templates/xml/blank-system.ejs b/templates/xml/blank-system.ejs new file mode 100644 index 0000000..734b6d7 --- /dev/null +++ b/templates/xml/blank-system.ejs @@ -0,0 +1,9 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + + + From 2f3c134c4ea9f6b11b0ff1427142260bbdab6186 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 18:55:46 +0200 Subject: [PATCH 21/22] feat: generator for sample config.xml file --- CHANGELOG.md | 1 + package.json | 8 ++++++ src/command/GenerateConfigXmlFileCommand.ts | 27 +++++++++++++++++++++ src/command/index.ts | 1 + templates/xml/blank-config.ejs | 7 ++++++ 5 files changed, 44 insertions(+) create mode 100644 src/command/GenerateConfigXmlFileCommand.ts create mode 100644 templates/xml/blank-config.ejs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4b455..cb7bd30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Added: Generator command for sample widget.xml file - Added: Generator command for sample extension_attributes.xml file - Added: Generator command for sample system.xml file +- Added: Generator command for sample config.xml file ## [1.1.3] - 3/12/2025 diff --git a/package.json b/package.json index f545c28..db062cd 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,10 @@ { "command": "magento-toolbox.generateSystemXmlFile", "title": "Magento Toolbox: Generate System XML" + }, + { + "command": "magento-toolbox.generateConfigXmlFile", + "title": "Magento Toolbox: Generate Config XML" } ], "menus": { @@ -279,6 +283,10 @@ { "command": "magento-toolbox.generateSystemXmlFile", "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" + }, + { + "command": "magento-toolbox.generateConfigXmlFile", + "when": "resourcePath =~ /app\\/code\\/.+\\/.+/i" } ] } diff --git a/src/command/GenerateConfigXmlFileCommand.ts b/src/command/GenerateConfigXmlFileCommand.ts new file mode 100644 index 0000000..c2d4a2a --- /dev/null +++ b/src/command/GenerateConfigXmlFileCommand.ts @@ -0,0 +1,27 @@ +import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand'; +import { TemplateWizardData } from 'wizard/SimpleTemplateWizard'; +import FileHeader from 'common/xml/FileHeader'; + +export default class GenerateConfigXmlFileCommand extends SimpleTemplateGeneratorCommand { + constructor() { + super('magento-toolbox.generateConfigXmlFile'); + } + + getWizardTitle(): string { + return 'Config XML File'; + } + + getFileHeader(data: TemplateWizardData): string | undefined { + return FileHeader.getHeader(data.module); + } + + getFilePath(data: TemplateWizardData): string { + const [vendor, module] = data.module.split('_'); + + return `app/code/${vendor}/${module}/etc/config.xml`; + } + + getTemplateName(data: TemplateWizardData): string { + return 'xml/blank-config'; + } +} diff --git a/src/command/index.ts b/src/command/index.ts index 6ebc363..aa4c2f2 100644 --- a/src/command/index.ts +++ b/src/command/index.ts @@ -24,3 +24,4 @@ export { default as GenerateMviewXmlFileCommand } from './GenerateMviewXmlFileCo export { default as GenerateWidgetXmlFileCommand } from './GenerateWidgetXmlFileCommand'; export { default as GenerateExtensionAttributesXmlFileCommand } from './GenerateExtensionAttributesXmlFileCommand'; export { default as GenerateSystemXmlFileCommand } from './GenerateSystemXmlFileCommand'; +export { default as GenerateConfigXmlFileCommand } from './GenerateConfigXmlFileCommand'; diff --git a/templates/xml/blank-config.ejs b/templates/xml/blank-config.ejs new file mode 100644 index 0000000..e09d979 --- /dev/null +++ b/templates/xml/blank-config.ejs @@ -0,0 +1,7 @@ + +<% if (fileHeader) { -%> +<%- fileHeader %> +<% } -%> + + From 9f2bf91b6a51d2b11bc050146b5198a5633e96b4 Mon Sep 17 00:00:00 2001 From: raideer Date: Thu, 13 Mar 2025 19:02:20 +0200 Subject: [PATCH 22/22] chore: added auto deploy action --- .github/workflows/release.yml | 12 +++++++++++- package.json | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3ac13f..e768e9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,4 +19,14 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - files: '*.vsix' \ No newline at end of file + files: '*.vsix' + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Publish + run: npm run deploy + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} diff --git a/package.json b/package.json index db062cd..badc522 100644 --- a/package.json +++ b/package.json @@ -305,7 +305,8 @@ "test": "vscode-test", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md}\"", "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,json,css,scss,md}\"", - "package-vsix": "vsce package" + "package-vsix": "vsce package", + "deploy": "vsce publish" }, "devDependencies": { "@types/ejs": "^3.1.5",