From cc01f17616e0a26d469dc9f3cb50d25e3082b714 Mon Sep 17 00:00:00 2001 From: Steffen Waldmann Date: Tue, 25 Jun 2024 12:43:52 +0200 Subject: [PATCH] Replace `--production` by `--omit=dev` --- cmd/module_test.go | 2 +- configs/builder_type_cfg.yaml | 6 ++--- docs/docs/configuration.md | 2 +- docs/docs/migration.md | 4 ++-- internal/artifacts/meta_test.go | 2 +- internal/artifacts/module_arch_test.go | 2 +- internal/artifacts/project_test.go | 2 +- internal/buildtools/testdata/cfg.yaml | 4 ++-- internal/commands/commands_test.go | 22 +++++++++---------- internal/commands/process_test.go | 4 ++-- internal/tpl/makefile_test.go | 2 +- .../dep_with_artifacts_and_targetpath.yaml | 2 +- .../testdata/modulegen/multiple_commands.yaml | 2 +- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cmd/module_test.go b/cmd/module_test.go index a42300f73..8c601caa8 100644 --- a/cmd/module_test.go +++ b/cmd/module_test.go @@ -73,7 +73,7 @@ var _ = Describe("Commands", func() { BeforeEach(func() { config = make([]byte, len(commands.ModuleTypeConfig)) copy(config, commands.ModuleTypeConfig) - // Simplified commands configuration (performance purposes). removed "npm prune --production" + // Simplified commands configuration (performance purposes). removed "npm prune --omit=dev" commands.ModuleTypeConfig = []byte(` builders: - name: html5 diff --git a/configs/builder_type_cfg.yaml b/configs/builder_type_cfg.yaml index 6d5eb13d6..cc2593ba6 100644 --- a/configs/builder_type_cfg.yaml +++ b/configs/builder_type_cfg.yaml @@ -16,13 +16,13 @@ builders: info: "installing module dependencies & remove dev dependencies" path: "path to config file which override the following default commands" commands: - - command: npm install --production + - command: npm install --omit=dev - name: npm-ci info: "clean install production dependencies" path: "path to config file which override the following default commands" commands: - - command: npm clean-install --production + - command: npm clean-install --omit=dev - name: grunt info: "execute grunt" @@ -44,7 +44,7 @@ builders: - command: npm install - command: npm run init - command: npm run build - - command: npm prune --production + - command: npm prune --omit=dev - name: maven info: "build java application" diff --git a/docs/docs/configuration.md b/docs/docs/configuration.md index 0f45d7761..fc0fd77d0 100644 --- a/docs/docs/configuration.md +++ b/docs/docs/configuration.md @@ -165,7 +165,7 @@ You can define your own build commands by configuring a `custom` builder as foll commands: - npm install - grunt - - npm prune --production + - npm prune --omit=dev ``` diff --git a/docs/docs/migration.md b/docs/docs/migration.md index 590aad06e..ce12eee49 100644 --- a/docs/docs/migration.md +++ b/docs/docs/migration.md @@ -80,9 +80,9 @@ After renaming, make sure that the places where the name is used refer to the co
  • -The `hdb` builder is not supported by the Cloud MTA Build tool. You no longer require builder settings for the `hdb` module because the required `npm install --production` command is run by default for this module type. +The `hdb` builder is not supported by the Cloud MTA Build tool. You no longer require builder settings for the `hdb` module because the required `npm install --omit=dev` command is run by default for this module type. -If you used this builder for other module types, you can repace it with the `npm` builder or use the `custom` builder that runs the `"npm install --production"`command. +If you used this builder for other module types, you can replace it with the `npm` builder or use the `custom` builder that runs the `"npm install --omit=dev"`command.  
  •   diff --git a/internal/artifacts/meta_test.go b/internal/artifacts/meta_test.go index 06ce3f902..a50965e1c 100644 --- a/internal/artifacts/meta_test.go +++ b/internal/artifacts/meta_test.go @@ -104,7 +104,7 @@ modules: BeforeEach(func() { config = make([]byte, len(version.VersionConfig)) copy(config, version.VersionConfig) - // Simplified commands configuration (performance purposes). removed "npm prune --production" + // Simplified commands configuration (performance purposes). removed "npm prune --omit=dev" version.VersionConfig = []byte(` cli_version:["x"] `) diff --git a/internal/artifacts/module_arch_test.go b/internal/artifacts/module_arch_test.go index 61686b45d..5c5838a4b 100644 --- a/internal/artifacts/module_arch_test.go +++ b/internal/artifacts/module_arch_test.go @@ -30,7 +30,7 @@ var _ = Describe("ModuleArch", func() { BeforeEach(func() { config = make([]byte, len(commands.ModuleTypeConfig)) copy(config, commands.ModuleTypeConfig) - // Simplified commands configuration (performance purposes). removed "npm prune --production" + // Simplified commands configuration (performance purposes). removed "npm prune --omit=dev" commands.ModuleTypeConfig = []byte(` builders: - name: html5 diff --git a/internal/artifacts/project_test.go b/internal/artifacts/project_test.go index f8447eae5..649c8b630 100644 --- a/internal/artifacts/project_test.go +++ b/internal/artifacts/project_test.go @@ -95,7 +95,7 @@ var _ = Describe("Project", func() { cmds, err := getProjectBuilderCommands(projectBuild) Ω(err).Should(Succeed()) Ω(len(cmds.Command)).Should(Equal(1)) - Ω(cmds.Command[0]).Should(Equal("npm install --production")) + Ω(cmds.Command[0]).Should(Equal("npm install --omit=dev")) }) It("Custom builder with no commands", func() { projectBuild := mta.ProjectBuilder{ diff --git a/internal/buildtools/testdata/cfg.yaml b/internal/buildtools/testdata/cfg.yaml index a76238948..63fb8c781 100644 --- a/internal/buildtools/testdata/cfg.yaml +++ b/internal/buildtools/testdata/cfg.yaml @@ -5,7 +5,7 @@ builders: type: - command: npm install - command: grunt - - command: npm prune --production + - command: npm prune --omit=dev - name: java info: "build java application" path: "path to config file which override the following default commands" @@ -15,7 +15,7 @@ builders: info: "build nodejs application" path: "path to config file which override the following default commands" type: - - command: npm install --production + - command: npm install --omit=dev - name: golang info: "build golang application" path: "path to config file which override the following default commands" diff --git a/internal/commands/commands_test.go b/internal/commands/commands_test.go index 6da314095..424b090b7 100644 --- a/internal/commands/commands_test.go +++ b/internal/commands/commands_test.go @@ -25,7 +25,7 @@ module-types: commands: - command: npm install - command: grunt - - command: npm prune --production + - command: npm prune --omit=dev - name: java info: "build java application" commands: @@ -46,7 +46,7 @@ module-types: } var expected = CommandList{ Info: "build UI application", - Command: []string{"npm install", "grunt", "npm prune --production"}, + Command: []string{"npm install", "grunt", "npm prune --omit=dev"}, } commands := ModuleTypes{} customCommands := Builders{} @@ -97,7 +97,7 @@ module-types: commands: - command: npm install - command: grunt - - command: npm prune --production + - command: npm prune --omit=dev `) var modules = mta.Module{ Name: "uiapp", @@ -132,7 +132,7 @@ module-types: It("CommandProvider", func() { expected := CommandList{ Info: "installing module dependencies & remove dev dependencies", - Command: []string{"npm install --production"}, + Command: []string{"npm install --omit=dev"}, } Ω(CommandProvider(mta.Module{Type: "html5"})).Should(Equal(expected)) }) @@ -143,7 +143,7 @@ module-types: BeforeEach(func() { config = make([]byte, len(ModuleTypeConfig)) copy(config, ModuleTypeConfig) - // Simplified commands configuration (performance purposes). removed "npm prune --production" + // Simplified commands configuration (performance purposes). removed "npm prune --omit=dev" ModuleTypeConfig = []byte(` module-types: - name: html5 @@ -175,7 +175,7 @@ module-types: BeforeEach(func() { moduleTypesConfig = make([]byte, len(ModuleTypeConfig)) copy(moduleTypesConfig, ModuleTypeConfig) - // Simplified commands configuration (performance purposes). removed "npm prune --production" + // Simplified commands configuration (performance purposes). removed "npm prune --omit=dev" ModuleTypeConfig = []byte(` module-types: - name: html5 @@ -211,11 +211,11 @@ builders: var _ = Describe("Command converter", func() { It("Sanity", func() { - cmdInput := []string{"npm install {{config}}", "grunt", "npm prune --production"} + cmdInput := []string{"npm install {{config}}", "grunt", "npm prune --omit=dev"} cmdExpected := [][]string{ {"path", "npm", "install", "{{config}}"}, {"path", "grunt"}, - {"path", "npm", "prune", "--production"}} + {"path", "npm", "prune", "--omit=dev"}} result, e := CmdConverter("path", cmdInput) Ω(e).Should(Succeed()) Ω(result).Should(Equal(cmdExpected)) @@ -269,7 +269,7 @@ modules: module, commands, _, err := moduleCmd(m, "htmlapp") Ω(err).Should(Succeed()) Ω(module.Path).Should(Equal("app")) - Ω(commands).Should(Equal([]string{"npm install --production"})) + Ω(commands).Should(Equal([]string{"npm install --omit=dev"})) }) It("Builder specified in build params", func() { @@ -292,7 +292,7 @@ modules: module, commands, _, err := moduleCmd(m, "htmlapp") Ω(err).Should(BeNil()) Ω(module.Path).Should(Equal("app")) - Ω(commands).Should(Equal([]string{"npm install --production"})) + Ω(commands).Should(Equal([]string{"npm install --omit=dev"})) }) It("Fetcher builder specified in build params", func() { @@ -337,7 +337,7 @@ modules: Ω(err).Should(Succeed()) Ω(module.Name).Should(Equal("node-js")) Ω(len(cmd)).Should(Equal(1)) - Ω(cmd[0]).Should(Equal("npm install --production")) + Ω(cmd[0]).Should(Equal("npm install --omit=dev")) }) It("Invalid case - wrong module name", func() { diff --git a/internal/commands/process_test.go b/internal/commands/process_test.go index f574f403a..d3586e5dd 100644 --- a/internal/commands/process_test.go +++ b/internal/commands/process_test.go @@ -16,7 +16,7 @@ builders: commands: - command: npm install - command: grunt - - command: npm prune --production + - command: npm prune --omit=dev - name: java info: "build java application" commands: @@ -39,7 +39,7 @@ builders: Commands: []Command{ {Command: "npm install"}, {Command: "grunt"}, - {Command: "npm prune --production"}, + {Command: "npm prune --omit=dev"}, }, }, { diff --git a/internal/tpl/makefile_test.go b/internal/tpl/makefile_test.go index 3c63452af..20d3ba3d3 100644 --- a/internal/tpl/makefile_test.go +++ b/internal/tpl/makefile_test.go @@ -143,7 +143,7 @@ makefile_version: 0.0.0 Entry("module with no commands and with timeout", "no_commands_with_timeout.yaml", "no_commands_with_timeout", `$(MBT) execute -d="$(PROJ_DIR)/no_commands_with_timeout" -t=3m`), Entry("module with multiple commands", - "multiple_commands.yaml", "multiple_commands", `$(MBT) execute -d="$(PROJ_DIR)/multiple_commands" -c='npm install' -c=grunt -c='npm prune --production'`), + "multiple_commands.yaml", "multiple_commands", `$(MBT) execute -d="$(PROJ_DIR)/multiple_commands" -c='npm install' -c=grunt -c='npm prune --omit=dev'`), Entry("module with command and timeout", "command_with_timeout.yaml", "command_with_timeout", `$(MBT) execute -d="$(PROJ_DIR)/command_with_timeout" -t=2s -c='sleep 1'`), Entry("module with commands with special characters", diff --git a/internal/tpl/testdata/modulegen/dep_with_artifacts_and_targetpath.yaml b/internal/tpl/testdata/modulegen/dep_with_artifacts_and_targetpath.yaml index 5233583ac..b5c8fd558 100644 --- a/internal/tpl/testdata/modulegen/dep_with_artifacts_and_targetpath.yaml +++ b/internal/tpl/testdata/modulegen/dep_with_artifacts_and_targetpath.yaml @@ -24,6 +24,6 @@ modules: builder: custom commands: - npm install - - npm prune --production + - npm prune --omit=dev timeout: 15m supported-platforms: [] \ No newline at end of file diff --git a/internal/tpl/testdata/modulegen/multiple_commands.yaml b/internal/tpl/testdata/modulegen/multiple_commands.yaml index 5462953f7..71b697ad4 100644 --- a/internal/tpl/testdata/modulegen/multiple_commands.yaml +++ b/internal/tpl/testdata/modulegen/multiple_commands.yaml @@ -10,4 +10,4 @@ modules: commands: - npm install - grunt - - npm prune --production \ No newline at end of file + - npm prune --omit=dev