From 80a7ab273381f70b874051b1482eda4697f121a3 Mon Sep 17 00:00:00 2001 From: PatrickMenoti <82882574+PatrickMenoti@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:02:51 -0300 Subject: [PATCH 1/5] chore: update vulcan version --- messages/build/messages.go | 1 - messages/init/errors.go | 4 +- messages/init/messages.go | 2 +- messages/link/errors.go | 1 - messages/link/messages.go | 1 - .../edge_applications/edge_applications.go | 2 +- pkg/cmd/build/build.go | 1 - pkg/cmd/build/run.go | 5 -- pkg/cmd/build/run_test.go | 4 - pkg/cmd/deploy/requests.go | 2 +- pkg/cmd/deploy_remote/requests.go | 2 +- pkg/cmd/init/.fixtures/project_samples.json | 83 ------------------- pkg/cmd/init/contracts.go | 1 - pkg/cmd/init/init.go | 2 - pkg/cmd/init/init_test.go | 22 +---- pkg/cmd/init/template.go | 1 - pkg/cmd/init/template_test.go | 6 -- pkg/cmd/init/utils.go | 21 ++--- pkg/cmd/init/utils_test.go | 23 +---- pkg/cmd/link/link.go | 10 +-- pkg/cmd/link/template.go | 1 - pkg/cmd/link/utils.go | 11 +-- pkg/contracts/contracts.go | 2 - pkg/vulcan/vulcan.go | 6 +- pkg/vulcan/vulcan_test.go | 14 ++-- scripts/test.sh | 4 +- 26 files changed, 34 insertions(+), 198 deletions(-) diff --git a/messages/build/messages.go b/messages/build/messages.go index 908588a26..869867431 100644 --- a/messages/build/messages.go +++ b/messages/build/messages.go @@ -12,7 +12,6 @@ var ( BuildStatic = "Skipping build step. Build isn't applied to the type 'static'\n" BuildNotNecessary = "Skipping build step. There were no changes detected in your project" FlagTemplate = "The Edge Application's preset; Inform this flag if you wish to change the project's preset during build" - FlagMode = "The Edge Application's mode; Inform this flag if you wish to change the project's mode during build" FlagWorker = "Indicates that the constructed code inserts its own worker expression, such as addEventListener(\"fetch\") or similar, without the need to inject a provider" FlagPolyfill = "Use node polyfills in build" FlagEntry = "Code entrypoint; (default: ./main.js)" diff --git a/messages/init/errors.go b/messages/init/errors.go index 0e4a2708e..cead0ac59 100644 --- a/messages/init/errors.go +++ b/messages/init/errors.go @@ -6,7 +6,6 @@ var ( EdgeApplicationsOutputErr = errors.New("This output-ctrl option is not available. Read the readme files found in the repository https://github.com/aziontech/azion-template and try again") ErrorVulcanExecute = errors.New("Error executing Vulcan: %s") - ErrorModeNotSent = errors.New("You must send the --mode flag when --template is not nextjs/simple/static") ErrorUpdatingVulcan = errors.New("Failed to update Vulcan: %s") ErrorInstallVulcan = errors.New("Failed to install Vulcan: %s") ErrorOpeningConfigFile = errors.New("Failed to open the config.json file. The file doesn't exist, is corrupted, or has an invalid JSON format. Verify if the file format is JSON or fix its content according to the JSON format specification at https://www.json.org/json-en.html") @@ -21,8 +20,7 @@ var ( ErrorFailedCreatingAzionDirectory = errors.New("Failed to create the azion directory. The public's parent directory is read-only and/or isn't accessible. Change the permissions of the parent directory to read and write and/or give access to it") ErrorDeps = errors.New("Failed to install project dependencies") ErrorWorkingDir = errors.New("Failed to change current working directory") - ErrorModeNotFound = errors.New("No mode was found for the selected template. For more information, run the command again using the '--debug' flag. If the problem persists, contact Azion’s support") ErrorReadingGitignore = errors.New("Failed to read your .gitignore file") ErrorWritingGitignore = errors.New("Failed to write to your .gitignore file") - ErrorGetProjectInfo = errors.New("Failed to get project info (preset and mode)") + ErrorGetProjectInfo = errors.New("Failed to get project preset") ) diff --git a/messages/init/messages.go b/messages/init/messages.go index 85ba1c0dd..107469cb6 100644 --- a/messages/init/messages.go +++ b/messages/init/messages.go @@ -18,7 +18,7 @@ var ( EdgeApplicationsInitFlagNo = "Answers all yes/no interactions automatically with no" WebAppInitContentOverridden = "This application was already configured. Do you want to override the previous configuration? (default: no) " WebAppInitCmdSuccess = "Template successfully fetched and configured\n" - InitGettingTemplates = "\nGetting modes available (Some dependencies may need to be installed)\n" + InitGettingTemplates = "\nGetting presets available (Some dependencies may need to be installed)\n" InitGettingVulcan = "\nGetting templates available\n" InitProjectQuestion = "Your application's name: " EdgeApplicationsInitFlagHelp = "Displays more information about the init command" diff --git a/messages/link/errors.go b/messages/link/errors.go index 4d0c4c9a9..86773aa36 100644 --- a/messages/link/errors.go +++ b/messages/link/errors.go @@ -6,7 +6,6 @@ var ( EdgeApplicationsOutputErr = errors.New("This output-ctrl option is not available. Read the readme files found in the repository https://github.com/aziontech/azion-template and try again") ErrorVulcanExecute = errors.New("Error executing Vulcan: %s") - ErrorModeNotSent = errors.New("You must send the --mode flag when --template is not nextjs/simple/static") ErrorUpdatingVulcan = errors.New("Failed to update Vulcan: %s") ErrorInstallVulcan = errors.New("Failed to install Vulcan: %s") ErrorOpeningConfigFile = errors.New("Failed to open the config.json file. The file doesn't exist, is corrupted, or has an invalid JSON format. Verify if the file format is JSON or fix its content according to the JSON format specification at https://www.json.org/json-en.html") diff --git a/messages/link/messages.go b/messages/link/messages.go index 84fee914f..8b97f708f 100644 --- a/messages/link/messages.go +++ b/messages/link/messages.go @@ -12,7 +12,6 @@ var ( EdgeApplicationsLinkRunningCmd = "Running link step command:\n\n" EdgeApplicationsLinkFlagName = "The Edge Application's name" EdgeApplicationsLinkFlagTemplate = "The Edge Application's template" - EdgeApplicationsLinkFlagMode = "The Edge Application's mode" WebAppLinkCmdSuccess = "Project successfully configured\n" LinkGettingTemplates = "Getting templates available\n" LinkProjectQuestion = "(Hit enter to accept the suggested name in parenthesis) Your application's name: " diff --git a/pkg/api/edge_applications/edge_applications.go b/pkg/api/edge_applications/edge_applications.go index 35db4d344..06601cc17 100644 --- a/pkg/api/edge_applications/edge_applications.go +++ b/pkg/api/edge_applications/edge_applications.go @@ -495,7 +495,7 @@ func (c *Client) CreateDeviceGroups(ctx context.Context, req *CreateDeviceGroups return &resp.Results, nil } -func (c *Client) CreateRulesEngineNextApplication(ctx context.Context, applicationId int64, cacheId int64, typeLang string, mode string, authorize bool) error { +func (c *Client) CreateRulesEngineNextApplication(ctx context.Context, applicationId int64, cacheId int64, typeLang string, authorize bool) error { logger.Debug("Create Rules Engine Next Application") req := CreateRulesEngineRequest{} diff --git a/pkg/cmd/build/build.go b/pkg/cmd/build/build.go index 4fc9aca86..61e8171ab 100644 --- a/pkg/cmd/build/build.go +++ b/pkg/cmd/build/build.go @@ -51,7 +51,6 @@ func NewCobraCmd(build *BuildCmd) *cobra.Command { buildCmd.Flags().BoolP("help", "h", false, msg.BuildFlagHelp) buildCmd.Flags().StringVar(&fields.Preset, "preset", "", msg.FlagTemplate) - buildCmd.Flags().StringVar(&fields.Mode, "mode", "", msg.FlagMode) buildCmd.Flags().StringVar(&fields.Entry, "entry", "", msg.FlagEntry) buildCmd.Flags().StringVar(&fields.NodePolyfills, "use-node-polyfills", "", msg.FlagPolyfill) buildCmd.Flags().StringVar(&fields.OwnWorker, "use-own-worker", "", msg.FlagWorker) diff --git a/pkg/cmd/build/run.go b/pkg/cmd/build/run.go index ca701ff26..e8445dfb0 100644 --- a/pkg/cmd/build/run.go +++ b/pkg/cmd/build/run.go @@ -29,11 +29,6 @@ func (b *BuildCmd) run(fields *contracts.BuildInfo, msgs *[]string) error { conf.Preset = fields.Preset } - if fields.Mode != "" { - vulcanParams += " --mode " + fields.Mode - conf.Mode = fields.Mode - } - if fields.Entry != "" { vulcanParams += " --entry " + fields.Entry } diff --git a/pkg/cmd/build/run_test.go b/pkg/cmd/build/run_test.go index 24d7c0e61..24f97f9eb 100644 --- a/pkg/cmd/build/run_test.go +++ b/pkg/cmd/build/run_test.go @@ -117,7 +117,6 @@ func TestBuildCmd_run(t *testing.T) { fields: &contracts.BuildInfo{ ProjectPath: "", Preset: "vanilla", - Mode: "compute", Entry: "no", NodePolyfills: "true", OwnWorker: "true", @@ -163,7 +162,6 @@ func TestBuildCmd_run(t *testing.T) { fields: &contracts.BuildInfo{ ProjectPath: "", Preset: "vanilla", - Mode: "compute", Entry: "no", NodePolyfills: "true", OwnWorker: "true", @@ -210,7 +208,6 @@ func TestBuildCmd_run(t *testing.T) { fields: &contracts.BuildInfo{ ProjectPath: "", Preset: "vanilla", - Mode: "compute", Entry: "no", NodePolyfills: "adf", OwnWorker: "true", @@ -257,7 +254,6 @@ func TestBuildCmd_run(t *testing.T) { fields: &contracts.BuildInfo{ ProjectPath: "", Preset: "vanilla", - Mode: "compute", Entry: "no", NodePolyfills: "true", OwnWorker: "adf", diff --git a/pkg/cmd/deploy/requests.go b/pkg/cmd/deploy/requests.go index 3c3fa1c58..fb6e97733 100644 --- a/pkg/cmd/deploy/requests.go +++ b/pkg/cmd/deploy/requests.go @@ -255,7 +255,7 @@ func (cmd *DeployCmd) doRulesDeploy(ctx context.Context, conf *contracts.AzionAp } // creates gzip and cache rules - err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, conf.Mode, authorize) + err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, authorize) if err != nil { logger.Debug("Error while creating rules engine", zap.Error(err)) return err diff --git a/pkg/cmd/deploy_remote/requests.go b/pkg/cmd/deploy_remote/requests.go index fec659efc..997092220 100644 --- a/pkg/cmd/deploy_remote/requests.go +++ b/pkg/cmd/deploy_remote/requests.go @@ -259,7 +259,7 @@ func (cmd *DeployCmd) doRulesDeploy( } // creates gzip and cache rules - err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, conf.Mode, authorize) + err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, authorize) if err != nil { logger.Debug("Error while creating rules engine", zap.Error(err)) return err diff --git a/pkg/cmd/init/.fixtures/project_samples.json b/pkg/cmd/init/.fixtures/project_samples.json index b4b689a76..2c88a402d 100644 --- a/pkg/cmd/init/.fixtures/project_samples.json +++ b/pkg/cmd/init/.fixtures/project_samples.json @@ -6,7 +6,6 @@ "name": "Angular Boilerplate", "message": "Automate your Angular.js deployment process on the edge", "preset": "angular", - "mode": "deliver", "path": "/angular/angular-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/angular/angular-boilerplate" } @@ -19,7 +18,6 @@ "name": "Astro Basics", "message": "Astro Starter Kit: Basics", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-basics", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-basics" }, @@ -27,7 +25,6 @@ "name": "Astro Blog Starter Kit", "message": "Deploy a blog page based on the Astro framework in a few steps", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-blog", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-blog" }, @@ -35,7 +32,6 @@ "name": "Astro Boilerplate", "message": "Automate your Astro.js deployment process on the edge", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-boilerplate" }, @@ -43,7 +39,6 @@ "name": "Astro with Framework Alpine", "message": "This example showcases Astro working with AlpineJS", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-alpine", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-alpine" }, @@ -51,7 +46,6 @@ "name": "Astro with Framework Lit", "message": "This example showcases Astro working with Lit", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-lit", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-lit" }, @@ -59,7 +53,6 @@ "name": "Astro with Multiple Frameworks", "message": "This example showcases Astro's built-in support for multiple frameworks", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-multiple", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-multiple" }, @@ -67,7 +60,6 @@ "name": "Astro with Framework Preact", "message": "This example showcases Astro working with Preact", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-preact", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-preact" }, @@ -75,7 +67,6 @@ "name": "Astro with Framework React", "message": "This example showcases Astro working with React", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-react", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-react" }, @@ -83,7 +74,6 @@ "name": "Astro with Framework Solid", "message": "This example showcases Astro working with Solid", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-solid", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-solid" }, @@ -91,7 +81,6 @@ "name": "Astro with Framework Svelte", "message": "This example showcases Astro working with Svelte", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-svelte", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-svelte" }, @@ -99,7 +88,6 @@ "name": "Astro with Framework Vue", "message": "This example showcases Astro working with Vue", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-framework-vue", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-framework-vue" }, @@ -107,7 +95,6 @@ "name": "Astro Init", "message": "Astro Starter template", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-init", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-init" }, @@ -115,7 +102,6 @@ "name": "Astro Minimal", "message": "A minimal template to start a new Astro project", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-minimal", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-minimal" }, @@ -123,7 +109,6 @@ "name": "Astro with Non-HTML Pages", "message": "This example showcases Astro working with Non-HTML pages", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-non-html-pages", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-non-html-pages" }, @@ -131,7 +116,6 @@ "name": "Astro Portfolio", "message": "Astro portfolio example", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-portfolio", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-portfolio" }, @@ -139,7 +123,6 @@ "name": "Astro Starlog", "message": "Release notes theme for Astro", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-starlog", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-starlog" }, @@ -147,7 +130,6 @@ "name": "Astro with Markdoc", "message": "This starter showcases the experimental Markdoc integration", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-markdoc", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-markdoc" }, @@ -155,7 +137,6 @@ "name": "Astro Markdown with Plugins", "message": "This example showcases Astro's built-in Markdown support with additional, user-provided plugins", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-markdown-plugins", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-markdown-plugins" }, @@ -163,7 +144,6 @@ "name": "Astro Markdown with Shiki", "message": "This example showcases Astro's built-in Markdown support", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-markdown-shiki", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-markdown-shiki" }, @@ -171,7 +151,6 @@ "name": "Astro with MDX", "message": "This example showcases using @astrojs/mdx to author content using MDX", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-mdx", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-mdx" }, @@ -179,7 +158,6 @@ "name": "Astro with Nano Stores", "message": "This example showcases using nanostores to provide shared state between components of any framework", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-nanostores", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-nanostores" }, @@ -187,7 +165,6 @@ "name": "Astro with Tailwind CSS", "message": "This example showcases how to style your Astro project with Tailwind", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-tailwindcss", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-tailwindcss" }, @@ -195,7 +172,6 @@ "name": "Astro with Vitest", "message": "This example showcases Astro working with Vitest", "preset": "astro", - "mode": "deliver", "path": "/astro/astro-with-vitest", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/astro-with-vitest" }, @@ -203,7 +179,6 @@ "name": "Deploy at the Edge", "message": "Challenge BrazilJS 2024", "preset": "astro", - "mode": "deliver", "path": "/astro/challenge-braziljs-2024", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/challenge-braziljs-2024" }, @@ -211,7 +186,6 @@ "name": "Devscard", "message": "A fully customizable template to create your online (and paper) resume without writing a single line of code", "preset": "astro", - "mode": "deliver", "path": "/astro/devscard", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/devscard" }, @@ -219,7 +193,6 @@ "name": "Webpage to PDF Resume", "message": "A tasteful, printable resume written with Astro and PandaCSS", "preset": "astro", - "mode": "deliver", "path": "/astro/webpage-pdf-resume", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/astro/webpage-pdf-resume" } @@ -232,7 +205,6 @@ "name": "Docusaurus Blog Template", "message": "Deploy a blog page based on the Docusaurus framework in a few steps", "preset": "docusaurus", - "mode": "deliver", "path": "/docusaurus/docusaurus-blog-template", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/docusaurus/docusaurus-blog-template" }, @@ -240,7 +212,6 @@ "name": "Docusaurus Boilerplate (JS)", "message": "Deploy new Docusaurus applications to run directly on the edge", "preset": "docusaurus", - "mode": "deliver", "path": "/docusaurus/docusaurus-boilerplate-js", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/docusaurus/docusaurus-boilerplate-js" }, @@ -248,7 +219,6 @@ "name": "Docusaurus Boilerplate (TS)", "message": "Deploy new Docusaurus applications to run directly on the edge", "preset": "docusaurus", - "mode": "deliver", "path": "/docusaurus/docusaurus-boilerplate-ts", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/docusaurus/docusaurus-boilerplate-ts" }, @@ -256,7 +226,6 @@ "name": "Docusaurus with Material UI", "message": "This example showcases how to style your Docusaurus project with Material UI", "preset": "docusaurus", - "mode": "deliver", "path": "/docusaurus/docusaurus-material-ui-template", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/docusaurus/docusaurus-material-ui-template" } @@ -269,7 +238,6 @@ "name": "11ty Starter Kit", "message": "Start your own 11ty application with this template. Powered by Vite, Tailwind CSS and Alpine.js", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-11st-starter-kit", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-11st-starter-kit" }, @@ -277,7 +245,6 @@ "name": "11ty Landing Page", "message": "A simple landing page template built with 11ty and Tailwind CSS", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-11ty-landing-page", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-11ty-landing-page" }, @@ -285,7 +252,6 @@ "name": "11ty Shop", "message": "Starter online shop template build with 11ty", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-11ty-shop", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-11ty-shop" }, @@ -293,7 +259,6 @@ "name": "11ty Portfolio", "message": "A starter repository showing how to build a portfolio with the 11ty static site generator", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-dark-portfolio-template-11ty", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-dark-portfolio-template-11ty" }, @@ -301,7 +266,6 @@ "name": "11ty Link in Bio", "message": "A list of links, built with 11ty", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-link-in-bio-11ty", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-link-in-bio-11ty" }, @@ -309,7 +273,6 @@ "name": "11ty Micro Site", "message": "Opinionated micro front-end that can be used to create a one-pager", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-micro-site", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-micro-site" }, @@ -317,7 +280,6 @@ "name": "Mobile 11ty", "message": "Build Generator static site and android app all in one with mobile11ty", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-mobile11ty", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-mobile11ty" }, @@ -325,7 +287,6 @@ "name": "11ty Photo Gallery", "message": "A starter site for creating your own photo or art gallery using the Eleventy static site generator", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-photo-gallery", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-photo-gallery" }, @@ -333,7 +294,6 @@ "name": "11ty Base Blog", "message": "A starter template showing how to build a blog with the Eleventy site generator", "preset": "eleventy", - "mode": "deliver", "path": "/eleventy/eleventy-static", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/eleventy/eleventy-static" } @@ -346,7 +306,6 @@ "name": "EMScripten WASM", "message": "The Azion EMScripten WASM is designed to simplify and enhance the deployment process for EMScripten WASM applications directly on the edge of the network.", "preset": "emscripten", - "mode": "compute", "path": "/emscripten/emscripten-wasm", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/emscripten/emscripten-wasm" } @@ -359,7 +318,6 @@ "name": "Gatsby Blog Starter Kit", "message": "Deploy a blog page based on the Gatsby framework in a few steps", "preset": "gatsby", - "mode": "deliver", "path": "/gatsby/gatsby-blog", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/gatsby/gatsby-blog" }, @@ -367,7 +325,6 @@ "name": "Gatsby Boilerplate", "message": "Deploy new Gatsby applications to run directly on the edge", "preset": "gatsby", - "mode": "deliver", "path": "/gatsby/gatsby-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/gatsby/gatsby-boilerplate" } @@ -380,7 +337,6 @@ "name": "Hexo Boilerplate", "message": "Deploy new Hexo applications to run directly on the edge", "preset": "hexo", - "mode": "deliver", "path": "/hexo/hexo-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/hexo/hexo-boilerplate" } @@ -393,7 +349,6 @@ "name": "Hono Boilerplate", "message": "Test how the Hono framework works on the edge", "preset": "javascript", - "mode": "compute", "path": "/hono/hono-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/hono/hono-boilerplate" } @@ -406,7 +361,6 @@ "name": "Hugo Boilerplate", "message": "Deploy new Hugo applications to run directly on the edge", "preset": "hugo", - "mode": "deliver", "path": "/hugo/hugo-static", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/hugo/hugo-static" }, @@ -414,7 +368,6 @@ "name": "Influencer Hugo", "message": "A modern and elegant crafted responsive Hugo theme for book authors and writer", "preset": "hugo", - "mode": "deliver", "path": "/hugo/influencer-hugo", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/hugo/influencer-hugo" }, @@ -422,7 +375,6 @@ "name": "Vex Hugo", "message": "A clean multipurpose e-commerce theme that makes building your first online store easier than ever", "preset": "hugo", - "mode": "deliver", "path": "/hugo/vex-hugo", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/hugo/vex-hugo" } @@ -435,7 +387,6 @@ "name": "Azion Edge SQL", "message": "The Azion Edge SQL accelerates the integration of a Azion edge SQL database into an edge function. It also provides an interface to easily create, update, and delete items in your database", "preset": "javascript", - "mode": "compute", "path": "/javascript/azion-edge-sql", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/azion-edge-sql" }, @@ -443,7 +394,6 @@ "name": "Drizzle + Neon Sample", "message": "Integrate a Neon database, using the Drizzle ORM", "preset": "javascript", - "mode": "compute", "path": "/javascript/drizzle-neondb-sample", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/drizzle-neondb-sample" }, @@ -451,7 +401,6 @@ "name": "Drizzle + TiDB Sample", "message": "Integrate a TiDB database, using the Drizzle ORM", "preset": "javascript", - "mode": "compute", "path": "/javascript/drizzle-tidb-sample", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/drizzle-tidb-sample" }, @@ -459,7 +408,6 @@ "name": "Drizzle + Turso Sample", "message": "Integrate a Turso database, using the Drizzle ORM", "preset": "javascript", - "mode": "compute", "path": "/javascript/drizzle-turso-sample", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/drizzle-turso-sample" }, @@ -467,7 +415,6 @@ "name": "Edge Function GitHub AutoDeploy", "message": "Automate the deployment of edge functions integrated with GitHub Actions", "preset": "javascript", - "mode": "compute", "path": "/javascript/edge-function-github-autodeploy", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/edge-function-github-autodeploy" }, @@ -475,7 +422,6 @@ "name": "Fauna DB Boilerplate", "message": "Easily deploy and manage an application integrated with Fauna on the edge", "preset": "javascript", - "mode": "compute", "path": "/javascript/faunadb-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/faunadb-boilerplate" }, @@ -483,7 +429,6 @@ "name": "Hello World", "message": "Deploy a Hello World application to test edge computing capabilities", "preset": "javascript", - "mode": "compute", "path": "/javascript/hello-world", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/hello-world" }, @@ -491,7 +436,6 @@ "name": "HTMX Boilerplate", "message": "Test how the HTMX library works on the edge", "preset": "javascript", - "mode": "compute", "path": "/javascript/htmx-minimal", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/htmx-minimal" }, @@ -499,7 +443,6 @@ "name": "Simple Javascript Router Node", "message": "The Azion Simple Javascript Router Node is designed to simplify and enhance the deployment process for Javascript applications with Node polyfills directly on the edge of the network", "preset": "javascript", - "mode": "compute", "path": "/javascript/javascript-simple-router-node", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/javascript-simple-router-node" }, @@ -507,7 +450,6 @@ "name": "Simple Javascript Router", "message": "The Azion Simple Javascript Router is designed to simplify and enhance the deployment process for Javascript applications directly on the edge of the network.", "preset": "javascript", - "mode": "compute", "path": "/javascript/javascript-simple-router", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/javascript-simple-router" }, @@ -515,7 +457,6 @@ "name": "Prisma Accelerate", "message": "Integrate a database using the Prisma ORM Accelerate", "preset": "javascript", - "mode": "compute", "path": "/javascript/prisma-accelerate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/prisma-accelerate" }, @@ -523,7 +464,6 @@ "name": "QStash EdgeFunction Scheduler", "message": "Schedule and dispatch tasks using a custom edge function and QStash.", "preset": "javascript", - "mode": "compute", "path": "/javascript/qstash-scheduler", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/qstash-scheduler" }, @@ -531,7 +471,6 @@ "name": "Turso Starter Kit", "message": "Integrate a Turso database, created using Turso's LibSQL SDK, into an edge function", "preset": "javascript", - "mode": "compute", "path": "/javascript/turso-starter-kit", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/turso-starter-kit" }, @@ -539,7 +478,6 @@ "name": "Upstash Geolocation", "message": "Provide a personalized and localized user experience on the edge", "preset": "javascript", - "mode": "compute", "path": "/javascript/upstash-geolocation", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/upstash-geolocation" }, @@ -547,7 +485,6 @@ "name": "Upstash Rate Limit", "message": "Implement rate limiting in a serverless environment", "preset": "javascript", - "mode": "compute", "path": "/javascript/upstash-ratelimit", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/javascript/upstash-ratelimit" } @@ -560,7 +497,6 @@ "name": "Jekyll Boilerplate", "message": "Simplify the deployment of a static Jekyll project on the edge.", "preset": "jekyll", - "mode": "deliver", "path": "/jekyll/jekyll-blog", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/jekyll/jekyll-blog" }, @@ -568,7 +504,6 @@ "name": "Supply", "message": "An e-commerce Jekyll theme with Gumroad integration.", "preset": "jekyll", - "mode": "deliver", "path": "/jekyll/supply", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/jekyll/supply" } @@ -581,7 +516,6 @@ "name": "Next JS App + Configurations", "message": "Deploy a Next.js application with App Router and custom configurations.", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-app-13-5-6-config", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-app-13-5-6-config" }, @@ -589,7 +523,6 @@ "name": "Next JS App + Middleware", "message": "Deploy a Next.js application including a Middleware, App Router, and custom configuration.", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-app-13-5-6-middleware", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-app-13-5-6-middleware" }, @@ -597,7 +530,6 @@ "name": "Next JS App + Turso", "message": "Deploy a Next.js application including a connection to a Turso database", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-app-13-5-6-turso", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-app-13-5-6-turso" }, @@ -605,7 +537,6 @@ "name": "Next JS Faststore Boilerplate", "message": "The Azion Next.js FastStore Boilerplate is designed to simplify and enhance the deployment process for Next.js FastStore.js applications directly on the edge of the network", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-faststore-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-faststore-boilerplate" }, @@ -613,7 +544,6 @@ "name": "Next JS Pages + Configurations", "message": "Build a new Next.js application including Pages Router format and custom configurations", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-pages-13-5-6-config", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-pages-13-5-6-config" }, @@ -621,7 +551,6 @@ "name": "Next JS Pages + Middleware", "message": "Build a Next.js application including a Middleware, Pages Router, and custom configuration", "preset": "next", - "mode": "compute", "path": "/nextjs/nextjs-pages-13-5-6-middleware", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-pages-13-5-6-middleware" }, @@ -629,7 +558,6 @@ "name": "Next JS Static Boilerplate (13.5.3)", "message": "Automate your Next.js deployment process on the edge", "preset": "next", - "mode": "deliver", "path": "/nextjs/nextjs-static-boilerplate-13", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-static-boilerplate-13" }, @@ -637,7 +565,6 @@ "name": "Next JS Static Boilerplate (14.1.4)", "message": "Automate your Next.js deployment process on the edge", "preset": "next", - "mode": "deliver", "path": "/nextjs/nextjs-static-boilerplate-14", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/nextjs-static-boilerplate-14" }, @@ -645,7 +572,6 @@ "name": "Next Node Pages", "message": "Next.js v12.3.1 project example using node runtime and pages format", "preset": "next", - "mode": "compute", "path": "/nextjs/node-pages-12-3-1", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/nextjs/node-pages-12-3-1" } @@ -658,7 +584,6 @@ "name": "React Boilerplate", "message": "Automate your React.js deployment process on the edge", "preset": "react", - "mode": "deliver", "path": "/react/reactjs-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/react/reactjs-boilerplate" } @@ -671,7 +596,6 @@ "name": "Rust WASM Yew SSR", "message": "The Azion Rust WASM Yew SSR is designed to simplify and enhance the deployment process for Rust WASM Yew SSR applications directly on the edge of the network.", "preset": "rustwasm", - "mode": "compute", "path": "/rustwasm/rust-wasm-yew-ssr", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/rustwasm/rust-wasm-yew-ssr" } @@ -684,7 +608,6 @@ "name": "Svelte Boilerplate", "message": "Accelerate the deployment of Svelte static applications to run directly on the edge", "preset": "svelte", - "mode": "deliver", "path": "/svelte/svelte-static", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/svelte/svelte-static" } @@ -697,7 +620,6 @@ "name": "MongoDB Atlas Boilerplate", "message": "Deploy an application integrated with MongoDB Atlas on the edge and manage it via API", "preset": "typescript", - "mode": "compute", "path": "/typescript/azion-atlas", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/typescript/azion-atlas" }, @@ -705,7 +627,6 @@ "name": "Simple Typescript Router", "message": "The Azion Simple Typescript Router is designed to simplify and enhance the deployment process for Typescript applications directly on the edge of the network", "preset": "typescript", - "mode": "compute", "path": "/typescript/simple-ts-router", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/typescript/simple-ts-router" } @@ -718,7 +639,6 @@ "name": "VitePress Boilerplate (JS)", "message": "Deploy new VitePress applications to run directly on the edge", "preset": "vitepress", - "mode": "deliver", "path": "/vitepress/vitepress-boilerplate-js", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/vitepress/vitepress-boilerplate-js" }, @@ -726,7 +646,6 @@ "name": "VitePress Boilerplate (TS)", "message": "Deploy new VitePress applications to run directly on the edge", "preset": "vitepress", - "mode": "deliver", "path": "/vitepress/vitepress-boilerplate-ts", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/vitepress/vitepress-boilerplate-ts" } @@ -739,7 +658,6 @@ "name": "Vue3/Vite Boilerplate", "message": "Accelerate the deployment of Vue3/Vite applications ready to run on the edge", "preset": "vue", - "mode": "deliver", "path": "/vue/vue3-vite-static", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/vue/vue3-vite-static" }, @@ -747,7 +665,6 @@ "name": "Vue Boilerplate", "message": "Automate your Vue.js deployment process on the edge", "preset": "vue", - "mode": "deliver", "path": "/vue/vuejs-boilerplate", "link": "https://github.com/aziontech/azion-samples/tree/dev/templates/vue/vuejs-boilerplate" } diff --git a/pkg/cmd/init/contracts.go b/pkg/cmd/init/contracts.go index dbb1bd012..5b8418baf 100644 --- a/pkg/cmd/init/contracts.go +++ b/pkg/cmd/init/contracts.go @@ -9,7 +9,6 @@ type Item struct { Name string `json:"name"` Message string `json:"message"` Preset string `json:"preset"` - Mode string `json:"mode"` Path string `json:"path"` Link string `json:"link"` } diff --git a/pkg/cmd/init/init.go b/pkg/cmd/init/init.go index f810c4eb8..8a2df6b5c 100644 --- a/pkg/cmd/init/init.go +++ b/pkg/cmd/init/init.go @@ -40,7 +40,6 @@ type initCmd struct { name string preset string auto bool - mode string packageManager string pathWorkingDir string globalFlagAll bool @@ -244,7 +243,6 @@ func (cmd *initCmd) Run(c *cobra.Command, _ []string) error { } cmd.preset = strings.ToLower(templateOptionsMap[answerTemplate].Preset) - cmd.mode = strings.ToLower(templateOptionsMap[answerTemplate].Mode) if err = cmd.createTemplateAzion(); err != nil { return err diff --git a/pkg/cmd/init/init_test.go b/pkg/cmd/init/init_test.go index 91fc7a2e5..22d817bb1 100644 --- a/pkg/cmd/init/init_test.go +++ b/pkg/cmd/init/init_test.go @@ -25,7 +25,7 @@ import ( "go.uber.org/zap/zapcore" ) -var infoJsonData = `{"preset":"astro","mode":"deliver"}` +var infoJsonData = `{"preset":"astro"}` func TestNewCmd(t *testing.T) { mock := &httpmock.Registry{} @@ -40,7 +40,6 @@ func Test_initCmd_Run(t *testing.T) { name string preset string auto bool - mode string packageManager string pathWorkingDir string globalFlagAll bool @@ -104,7 +103,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "project-piece", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -152,7 +150,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -181,7 +178,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "project-piece", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", errors.New("error getWorkDir") }, @@ -229,7 +225,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -259,7 +254,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: true, name: "", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -307,7 +301,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -337,7 +330,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -385,7 +377,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -415,7 +406,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -463,7 +453,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -493,7 +482,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -543,7 +531,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -573,7 +560,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "project-piece", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -623,7 +609,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -653,7 +638,6 @@ func Test_initCmd_Run(t *testing.T) { globalFlagAll: false, name: "", preset: "vite", - mode: "deliver", getWorkDir: func() (string, error) { return "/path/full", nil }, @@ -701,7 +685,6 @@ func Test_initCmd_Run(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, git: github.Github{ @@ -719,7 +702,6 @@ func Test_initCmd_Run(t *testing.T) { name: tt.fields.name, preset: tt.fields.preset, auto: tt.fields.auto, - mode: tt.fields.mode, packageManager: tt.fields.packageManager, pathWorkingDir: tt.fields.pathWorkingDir, globalFlagAll: tt.fields.globalFlagAll, @@ -766,7 +748,6 @@ func Test_initCmd_deps(t *testing.T) { name string preset string auto bool - mode string packageManager string pathWorkingDir string globalFlagAll bool @@ -888,7 +869,6 @@ func Test_initCmd_deps(t *testing.T) { name: tt.fields.name, preset: tt.fields.preset, auto: tt.fields.auto, - mode: tt.fields.mode, packageManager: tt.fields.packageManager, pathWorkingDir: tt.fields.pathWorkingDir, globalFlagAll: tt.fields.globalFlagAll, diff --git a/pkg/cmd/init/template.go b/pkg/cmd/init/template.go index 724ed016b..620daa9c3 100644 --- a/pkg/cmd/init/template.go +++ b/pkg/cmd/init/template.go @@ -18,7 +18,6 @@ func (cmd *initCmd) createTemplateAzion() error { Name: cmd.name, Env: "production", Preset: cmd.preset, - Mode: cmd.mode, Prefix: "", } diff --git a/pkg/cmd/init/template_test.go b/pkg/cmd/init/template_test.go index d865c5217..93cacdd9c 100644 --- a/pkg/cmd/init/template_test.go +++ b/pkg/cmd/init/template_test.go @@ -20,7 +20,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { type fields struct { name string preset string - mode string writeFile func(filename string, data []byte, perm fs.FileMode) error mkdir func(path string, perm os.FileMode) error marshalIndent func(v any, prefix, indent string) ([]byte, error) @@ -39,7 +38,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { }, name: "project_piece", preset: "vite", - mode: "deliver", mkdir: func(path string, perm os.FileMode) error { return nil }, @@ -58,7 +56,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { }, name: "project_piece", preset: "vite", - mode: "deliver", mkdir: func(path string, perm os.FileMode) error { return msg.ErrorFailedCreatingAzionDirectory }, @@ -77,7 +74,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { }, name: "project_piece", preset: "vite", - mode: "deliver", mkdir: func(path string, perm os.FileMode) error { return nil }, @@ -98,7 +94,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { }, name: "project_piece", preset: "vite", - mode: "deliver", mkdir: func(path string, perm os.FileMode) error { return nil }, @@ -115,7 +110,6 @@ func Test_initCmd_createTemplateAzion(t *testing.T) { cmd := &initCmd{ name: tt.fields.name, preset: tt.fields.preset, - mode: tt.fields.mode, writeFile: tt.fields.writeFile, mkdir: tt.fields.mkdir, marshalIndent: tt.fields.marshalIndent, diff --git a/pkg/cmd/init/utils.go b/pkg/cmd/init/utils.go index 705253053..6ba64aeb7 100644 --- a/pkg/cmd/init/utils.go +++ b/pkg/cmd/init/utils.go @@ -42,13 +42,7 @@ func (cmd *initCmd) selectVulcanTemplates(vul *vulcanPkg.VulcanPkg) error { cmdVulcanInit := "init" if len(cmd.preset) > 0 { - cmdVulcanInit = fmt.Sprintf("%s --preset '%s'", cmdVulcanInit, cmd.preset) - } - if len(cmd.mode) > 0 { - cmdVulcanInit = fmt.Sprintf("%s --mode '%s'", cmdVulcanInit, cmd.mode) - } - if len(cmd.pathWorkingDir) > 0 { - cmdVulcanInit = fmt.Sprintf("%s --scope '%s'", cmdVulcanInit, cmd.pathWorkingDir) + cmdVulcanInit = fmt.Sprintf("%s --preset '%s' --scope global", cmdVulcanInit, cmd.preset) } command := vul.Command("", cmdVulcanInit, cmd.f) @@ -58,7 +52,7 @@ func (cmd *initCmd) selectVulcanTemplates(vul *vulcanPkg.VulcanPkg) error { return err } - preset, mode, err := cmd.getVulcanInfo() + preset, err := cmd.getVulcanInfo() if err != nil { return err } @@ -68,7 +62,6 @@ func (cmd *initCmd) selectVulcanTemplates(vul *vulcanPkg.VulcanPkg) error { } cmd.preset = strings.ToLower(preset) - cmd.mode = strings.ToLower(mode) return nil } @@ -82,21 +75,21 @@ func (cmd *initCmd) depsInstall() error { return nil } -func (cmd *initCmd) getVulcanInfo() (string, string, error) { +func (cmd *initCmd) getVulcanInfo() (string, error) { fileContent, err := cmd.fileReader(path.Join(cmd.pathWorkingDir, "info.json")) if err != nil { logger.Debug("Error reading template info", zap.Error(err)) - return "", "", err + return "", err } var infoJson map[string]string err = cmd.unmarshal(fileContent, &infoJson) if err != nil { logger.Debug("Error unmarshalling template info", zap.Error(err)) - return "", "", err + return "", err } - logger.Debug("Information about the template:", zap.Any("preset", infoJson["preset"]), zap.Any("mode", infoJson["mode"])) - return infoJson["preset"], infoJson["mode"], nil + logger.Debug("Information about the template:", zap.Any("preset", infoJson["preset"])) + return infoJson["preset"], nil } diff --git a/pkg/cmd/init/utils_test.go b/pkg/cmd/init/utils_test.go index 47622bd22..acf855489 100644 --- a/pkg/cmd/init/utils_test.go +++ b/pkg/cmd/init/utils_test.go @@ -96,7 +96,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { type fields struct { preset string auto bool - mode string packageManager string pathWorkingDir string commandRunner func(envVars []string, comm string) (string, int, error) @@ -134,7 +133,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vanilla") - os.Setenv("mode", "compute") return nil }, }, @@ -162,7 +160,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { return []byte(infoJsonData), nil }, preset: "vanilla", - mode: "compute", pathWorkingDir: "./azion/pathmock", commandRunnerOutput: func( f *cmdutil.Factory, @@ -176,7 +173,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vite") - os.Setenv("mode", "deliver") return nil }, }, @@ -200,7 +196,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { name: "error command runner output", fields: fields{ preset: "vanilla", - mode: "compute", pathWorkingDir: "./azion/pathmock", commandRunnerOutput: func( f *cmdutil.Factory, @@ -214,7 +209,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vanilla") - os.Setenv("mode", "compute") return nil }, }, @@ -238,7 +232,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { name: "error CheckVulcanMajor", fields: fields{ preset: "vanilla", - mode: "compute", pathWorkingDir: "./azion/pathmock", commandRunnerOutput: func( f *cmdutil.Factory, @@ -252,7 +245,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vanilla") - os.Setenv("mode", "compute") return nil }, }, @@ -276,7 +268,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { name: "error commandRunInteractive", fields: fields{ preset: "vanilla", - mode: "compute", pathWorkingDir: "./azion/pathmock", commandRunnerOutput: func( f *cmdutil.Factory, @@ -290,7 +281,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { }, load: func(filenames ...string) (err error) { os.Setenv("preset", "vanilla") - os.Setenv("mode", "compute") return nil }, }, @@ -314,7 +304,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { name: "error getVulcanEnvInfo", fields: fields{ preset: "vanilla", - mode: "compute", pathWorkingDir: "./azion/pathmock", commandRunnerOutput: func( f *cmdutil.Factory, @@ -355,7 +344,6 @@ func Test_initCmd_selectVulcanTemplates(t *testing.T) { cmd := &initCmd{ preset: tt.fields.preset, auto: tt.fields.auto, - mode: tt.fields.mode, packageManager: tt.fields.packageManager, pathWorkingDir: tt.fields.pathWorkingDir, commandRunner: tt.fields.commandRunner, @@ -430,7 +418,6 @@ func Test_initCmd_getVulcanInfo(t *testing.T) { fields fields mockFile string wantPreset string - wantMode string wantErr bool readFile func(filename string) ([]byte, error) }{ @@ -442,16 +429,14 @@ func Test_initCmd_getVulcanInfo(t *testing.T) { // Mocking unmarshalling process *(v.(*map[string]string)) = map[string]string{ "preset": "astro", - "mode": "deliver", } return nil }, }, wantPreset: "astro", - wantMode: "deliver", wantErr: false, readFile: func(filename string) ([]byte, error) { - return []byte(`{"preset": "astro", "mode": "deliver"}`), nil + return []byte(`{"preset": "astro"}`), nil }, }, { @@ -463,7 +448,6 @@ func Test_initCmd_getVulcanInfo(t *testing.T) { }, }, wantPreset: "", - wantMode: "", wantErr: true, readFile: func(filename string) ([]byte, error) { return nil, errors.New("error reading json") @@ -478,7 +462,7 @@ func Test_initCmd_getVulcanInfo(t *testing.T) { fileReader: tt.readFile, } - gotPreset, gotMode, err := cmd.getVulcanInfo() + gotPreset, err := cmd.getVulcanInfo() if (err != nil) != tt.wantErr { t.Errorf("initCmd.getVulcanInfo() error = %v, wantErr %v", err, tt.wantErr) return @@ -486,9 +470,6 @@ func Test_initCmd_getVulcanInfo(t *testing.T) { if gotPreset != tt.wantPreset { t.Errorf("initCmd.getVulcanInfo() gotPreset = %v, want %v", gotPreset, tt.wantPreset) } - if gotMode != tt.wantMode { - t.Errorf("initCmd.getVulcanInfo() gotMode = %v, want %v", gotMode, tt.wantMode) - } }) } } diff --git a/pkg/cmd/link/link.go b/pkg/cmd/link/link.go index a0eccbf92..f0178bb9f 100644 --- a/pkg/cmd/link/link.go +++ b/pkg/cmd/link/link.go @@ -29,7 +29,6 @@ import ( type LinkInfo struct { Name string Preset string - Mode string packageManager string PathWorkingDir string GlobalFlagAll bool @@ -101,8 +100,8 @@ func NewCobraCmd(link *LinkCmd, f *cmdutil.Factory) *cobra.Command { Example: heredoc.Doc(` $ azion link $ azion link --help - $ azion link --name "thisisatest" --preset hexo --mode deliver - $ azion link --preset astro --mode deliver + $ azion link --name "thisisatest" --preset hexo + $ azion link --preset astro $ azion link --name "thisisatest" --preset nextjs $ azion link --name "thisisatest" --preset static `), @@ -115,7 +114,6 @@ func NewCobraCmd(link *LinkCmd, f *cmdutil.Factory) *cobra.Command { cobraCmd.Flags().StringVar(&info.Name, "name", "", msg.EdgeApplicationsLinkFlagName) cobraCmd.Flags().StringVar(&info.Preset, "preset", "", msg.EdgeApplicationsLinkFlagTemplate) cobraCmd.Flags().StringVar(&info.packageManager, "package-manager", "", msg.FLAG_PACKAGE_MANAGE) - cobraCmd.Flags().StringVar(&info.Mode, "mode", "", msg.EdgeApplicationsLinkFlagMode) cobraCmd.Flags().BoolVar(&info.Auto, "auto", false, msg.LinkFlagAuto) cobraCmd.Flags().StringVar(&info.remote, "remote", "", msg.FLAG_REMOTE) cobraCmd.Flags().StringVar(&info.projectPath, "config-dir", "azion", msg.FLAGPATHCONF) @@ -186,7 +184,7 @@ func (cmd *LinkCmd) run(c *cobra.Command, info *LinkInfo) error { } } - if info.Preset == "" || info.Mode == "" { + if info.Preset == "" { err = cmd.selectVulcanMode(info) if err != nil { return err @@ -216,7 +214,7 @@ func (cmd *LinkCmd) run(c *cobra.Command, info *LinkInfo) error { //run init before calling build cmdVulcanInit := "init" - cmdVulcanInit = fmt.Sprintf("%s --preset '%s' --mode '%s' --scope '%s'", cmdVulcanInit, strings.ToLower(info.Preset), strings.ToLower(info.Mode), info.PathWorkingDir) + cmdVulcanInit = fmt.Sprintf("%s --preset '%s' --scope global", cmdVulcanInit, strings.ToLower(info.Preset)) vul := vulcanPkg.NewVulcan() command := vul.Command("", cmdVulcanInit, cmd.F) diff --git a/pkg/cmd/link/template.go b/pkg/cmd/link/template.go index e126300e1..e43690699 100644 --- a/pkg/cmd/link/template.go +++ b/pkg/cmd/link/template.go @@ -21,7 +21,6 @@ func (cmd *LinkCmd) createTemplateAzion(info *LinkInfo) error { Name: info.Name, Env: "production", Preset: strings.ToLower(info.Preset), - Mode: strings.ToLower(info.Mode), Prefix: "", } azionJson.Function.Name = "__DEFAULT__" diff --git a/pkg/cmd/link/utils.go b/pkg/cmd/link/utils.go index 70e7ffc36..2c88e4c37 100644 --- a/pkg/cmd/link/utils.go +++ b/pkg/cmd/link/utils.go @@ -92,23 +92,18 @@ func (cmd *LinkCmd) selectVulcanMode(info *LinkInfo) error { copy(listPresets, outputInline[:noLastItem]) prompt := &survey.Select{ - Message: "Choose a preset and mode:", + Message: "Choose a preset:", Options: listPresets, PageSize: len(listPresets), } - var answer, template, mode string + var answer string err = survey.AskOne(prompt, &answer) if err != nil { return err } - modeSplit := strings.Split(answer, " ") - template = modeSplit[0] - mode = strings.Replace(strings.Replace(modeSplit[1], "(", "", -1), ")", "", -1) - - info.Preset = template - info.Mode = mode + info.Preset = answer return nil } diff --git a/pkg/contracts/contracts.go b/pkg/contracts/contracts.go index 25832fd7d..68714aae4 100644 --- a/pkg/contracts/contracts.go +++ b/pkg/contracts/contracts.go @@ -15,7 +15,6 @@ type FileOps struct { type BuildInfo struct { Preset string - Mode string Entry string NodePolyfills string OwnWorker string @@ -48,7 +47,6 @@ type AzionApplicationOptions struct { Name string `json:"name"` Bucket string `json:"bucket"` Preset string `json:"preset"` // framework: react, next, vue, angular and etc - Mode string `json:"mode"` // deliver == ssg, compute == ssr Env string `json:"env"` Prefix string `json:"prefix"` NotFirstRun bool `json:"not-first-run"` diff --git a/pkg/vulcan/vulcan.go b/pkg/vulcan/vulcan.go index 6d0e8b3ed..46a9545e9 100644 --- a/pkg/vulcan/vulcan.go +++ b/pkg/vulcan/vulcan.go @@ -14,12 +14,12 @@ import ( ) const ( - currentMajor = 3 + currentMajor = 4 installEdgeFunctions = "npx --yes %s edge-functions%s %s" - firstTimeExecuting = "@v3.2.1" + firstTimeExecuting = "@v4.0.0" ) -var versionVulcan = "@3.2.1" +var versionVulcan = "@4.0.0" type VulcanPkg struct { Command func(flags, params string, f *cmdutil.Factory) string diff --git a/pkg/vulcan/vulcan_test.go b/pkg/vulcan/vulcan_test.go index 57aac49ff..edb107c5d 100644 --- a/pkg/vulcan/vulcan_test.go +++ b/pkg/vulcan/vulcan_test.go @@ -105,7 +105,7 @@ func TestCheckVulcanMajor(t *testing.T) { { name: "new major version without last version", args: args{ - currentVersion: "4.0.0", + currentVersion: "5.0.0", }, lastVulcanVer: "", expectedVersion: firstTimeExecuting, @@ -114,19 +114,19 @@ func TestCheckVulcanMajor(t *testing.T) { { name: "new major version with last version", args: args{ - currentVersion: "4.0.0", + currentVersion: "5.0.0", }, - lastVulcanVer: "3.2.1", - expectedVersion: "@v3.2.1", + lastVulcanVer: "4.0.0", + expectedVersion: "@v4.0.0", wantErr: false, }, { name: "same major version", args: args{ - currentVersion: "3.2.1", + currentVersion: "5.0.0", }, - lastVulcanVer: "3.2.1", - expectedVersion: "@v3.2.1", + lastVulcanVer: "4.0.0", + expectedVersion: "@v4.0.0", wantErr: false, }, { diff --git a/scripts/test.sh b/scripts/test.sh index f1f925bba..5d95ca7bf 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -37,8 +37,8 @@ if [ -f "$full_main_go_path" ]; then npm install # Run the link command with the specified options - echo "Running cmd/azion/main.go link --preset react --mode deliver --auto --debug" - go run "$full_main_go_path" link --preset react --mode deliver --auto --debug + echo "Running cmd/azion/main.go link --preset react --auto --debug" + go run "$full_main_go_path" link --preset react --auto --debug # Check the exit status of the last command if [ $? -eq 0 ]; then From 083b1ec7165a12af33c31f9e715e29b2e3c3ff3f Mon Sep 17 00:00:00 2001 From: PatrickMenoti <82882574+PatrickMenoti@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:16:48 -0300 Subject: [PATCH 2/5] chore: update bundler flags --- pkg/cmd/build/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/build/run.go b/pkg/cmd/build/run.go index e8445dfb0..3257a158c 100644 --- a/pkg/cmd/build/run.go +++ b/pkg/cmd/build/run.go @@ -38,7 +38,7 @@ func (b *BuildCmd) run(fields *contracts.BuildInfo, msgs *[]string) error { if err != nil { return fmt.Errorf("%w: %s", msg.ErrorPolyfills, fields.NodePolyfills) } - vulcanParams += " --useNodePolyfills " + fields.NodePolyfills + vulcanParams += " --polyfills " + fields.NodePolyfills } if fields.OwnWorker != "" { @@ -46,7 +46,7 @@ func (b *BuildCmd) run(fields *contracts.BuildInfo, msgs *[]string) error { if err != nil { return fmt.Errorf("%w: %s", msg.ErrorWorker, fields.OwnWorker) } - vulcanParams += " --useOwnWorker " + fields.OwnWorker + vulcanParams += " --worker " + fields.OwnWorker } if fields.IsFirewall { From f4baeca2afd738380f1ac0df16355ad1b7c4fcef Mon Sep 17 00:00:00 2001 From: PatrickMenoti <82882574+PatrickMenoti@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:00:33 -0300 Subject: [PATCH 3/5] refactor: update vulcan version --- pkg/vulcan/vulcan.go | 12 ++---------- pkg/vulcan/vulcan_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/pkg/vulcan/vulcan.go b/pkg/vulcan/vulcan.go index 46a9545e9..e25daf479 100644 --- a/pkg/vulcan/vulcan.go +++ b/pkg/vulcan/vulcan.go @@ -16,10 +16,10 @@ import ( const ( currentMajor = 4 installEdgeFunctions = "npx --yes %s edge-functions%s %s" - firstTimeExecuting = "@v4.0.0" + firstTimeExecuting = "@v4.0.1" ) -var versionVulcan = "@4.0.0" +var versionVulcan = "@4.0.1" type VulcanPkg struct { Command func(flags, params string, f *cmdutil.Factory) string @@ -65,14 +65,6 @@ func checkVulcanMajor(currentVersion string, f *cmdutil.Factory, vulcan *VulcanP if firstNumber > currentMajor { logger.FInfo(f.IOStreams.Out, msg.NewMajorVersion) - - if config.LastVulcanVersion == "" { - // new version update please - versionVulcan = firstTimeExecuting - return nil - } - - versionVulcan = "@" + strings.TrimRight(config.LastVulcanVersion, "\n") return nil } diff --git a/pkg/vulcan/vulcan_test.go b/pkg/vulcan/vulcan_test.go index edb107c5d..7c3257969 100644 --- a/pkg/vulcan/vulcan_test.go +++ b/pkg/vulcan/vulcan_test.go @@ -116,8 +116,8 @@ func TestCheckVulcanMajor(t *testing.T) { args: args{ currentVersion: "5.0.0", }, - lastVulcanVer: "4.0.0", - expectedVersion: "@v4.0.0", + lastVulcanVer: "4.0.1", + expectedVersion: "@v4.0.1", wantErr: false, }, { @@ -125,8 +125,8 @@ func TestCheckVulcanMajor(t *testing.T) { args: args{ currentVersion: "5.0.0", }, - lastVulcanVer: "4.0.0", - expectedVersion: "@v4.0.0", + lastVulcanVer: "4.0.1", + expectedVersion: "@v4.0.1", wantErr: false, }, { From 49657f4b15f0a206629e0726f954a9f70cae4b95 Mon Sep 17 00:00:00 2001 From: PatrickMenoti <82882574+PatrickMenoti@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:09:34 -0300 Subject: [PATCH 4/5] refactor: remove v from firstTimeExecuting --- pkg/vulcan/vulcan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/vulcan/vulcan.go b/pkg/vulcan/vulcan.go index e25daf479..308176820 100644 --- a/pkg/vulcan/vulcan.go +++ b/pkg/vulcan/vulcan.go @@ -16,7 +16,7 @@ import ( const ( currentMajor = 4 installEdgeFunctions = "npx --yes %s edge-functions%s %s" - firstTimeExecuting = "@v4.0.1" + firstTimeExecuting = "@4.0.1" ) var versionVulcan = "@4.0.1" From 984df6a4d887b2ad897d7e971fbb1597aaabfb3e Mon Sep 17 00:00:00 2001 From: PatrickMenoti <82882574+PatrickMenoti@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:13:11 -0300 Subject: [PATCH 5/5] refactor: remove v from firstTimeExecuting --- pkg/vulcan/vulcan_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/vulcan/vulcan_test.go b/pkg/vulcan/vulcan_test.go index 7c3257969..8db02c7ee 100644 --- a/pkg/vulcan/vulcan_test.go +++ b/pkg/vulcan/vulcan_test.go @@ -117,7 +117,7 @@ func TestCheckVulcanMajor(t *testing.T) { currentVersion: "5.0.0", }, lastVulcanVer: "4.0.1", - expectedVersion: "@v4.0.1", + expectedVersion: "@4.0.1", wantErr: false, }, { @@ -126,7 +126,7 @@ func TestCheckVulcanMajor(t *testing.T) { currentVersion: "5.0.0", }, lastVulcanVer: "4.0.1", - expectedVersion: "@v4.0.1", + expectedVersion: "@4.0.1", wantErr: false, }, {