-
Notifications
You must be signed in to change notification settings - Fork 26
feat: deno runtime for typescript #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dmmordvi
wants to merge
38
commits into
main
Choose a base branch
from
feat/typescript-deno
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
e6b3552
feat: deno runtime for typescript
dmmordvi d8f4d76
wip: chart ts init / chart ts build, changes for ts init
dmmordvi deb9960
wip: fixes for init ts test
dmmordvi ced72e2
wip: `deno task build` in deno.json
dmmordvi 38f495b
wip: missing import
dmmordvi 0cde3ee
wip: deno bundle implementation
dmmordvi 46ba3e4
Merge branch 'main' into feat/typescript-deno
dmmordvi 2f26171
wip: format fix
dmmordvi 238a355
wip: helm ignore node_modules
dmmordvi 0422508
wip: move `deno bundle` logic to 3p-helm, draft for `nelm chart ts bu…
dmmordvi d795632
feat: fixes for ts build
dmmordvi 13102ea
wip: ChartName for ts init (from werf)
dmmordvi cb061b4
Merge branch 'main' into feat/typescript-deno
dmmordvi b21d3a7
wip: apply wormatter
dmmordvi 7c13ab2
wip: write context as `input.yaml` into temp dir and pass to deno run
dmmordvi 92a0580
wip: test fixes for ts/init
dmmordvi 83406cf
wip: tree folder structure for typescript render
dmmordvi 28db0c4
wip: DenoRuntime class + binary downloader with double-checked lockin…
dmmordvi e928058
Merge branch 'main' into feat/typescript-deno
dmmordvi 5c339a9
wip: updated 3p-helm version
dmmordvi 1b95a3c
wip: fixes for logging
dmmordvi 8b3dec7
wip: changed naming for ts package from 3p-helm
dmmordvi 30423bf
wip: --rebuild-ts and --deno-bin-path flags
dmmordvi e17d511
Merge branch 'main' into feat/typescript-deno
dmmordvi ef3ce5f
fix: review recommendations fixes
dmmordvi caca802
Merge branch 'main' into feat/typescript-deno
dmmordvi bf3aeab
fix: changed ts rebuild flag
dmmordvi 2a5a401
fix: changes for chart ts init, small refactor for BundleChartRecursi…
dmmordvi 9bbdee1
fix: format fixes
dmmordvi dd2dcb2
Merge branch 'main' into feat/typescript-deno
dmmordvi 920e4b9
fix: changed comment for InitChartStructure
dmmordvi 53c6b7a
Merge branch 'main' into feat/typescript-deno
dmmordvi de00522
fix: moved changes from 3p-helm
dmmordvi 1cf3d0e
refactor: use separate functions instead of DenoRuntime class
dmmordvi fa7d4bd
wip: updated version of npm package for init ts, changed description …
dmmordvi c8b7f0a
wip: changed the way to pass DenoBinaryPath
dmmordvi 7064989
wip: changed the way to pass DenoBinaryPath
dmmordvi 4230257
Merge branch 'main' into feat/typescript-deno
dmmordvi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/spf13/cobra" | ||
|
|
||
| "github.com/werf/common-go/pkg/cli" | ||
| ) | ||
|
|
||
| func newChartTSCommand(ctx context.Context, afterAllCommandsBuiltFuncs map[*cobra.Command]func(cmd *cobra.Command) error) *cobra.Command { | ||
| cmd := cli.NewGroupCommand( | ||
| ctx, | ||
| "ts", | ||
| "Manage TypeScript charts.", | ||
| "Manage TypeScript charts.", | ||
| tsCmdGroup, | ||
| cli.GroupCommandOptions{}, | ||
| ) | ||
|
|
||
| cmd.AddCommand(newChartTSInitCommand(ctx, afterAllCommandsBuiltFuncs)) | ||
| cmd.AddCommand(newChartTSBuildCommand(ctx, afterAllCommandsBuiltFuncs)) | ||
|
|
||
| return cmd | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,23 +13,23 @@ import ( | |
| "github.com/werf/nelm/pkg/log" | ||
| ) | ||
|
|
||
| type chartInitConfig struct { | ||
| action.ChartInitOptions | ||
| type chartTSBuildConfig struct { | ||
| action.ChartTSBuildOptions | ||
|
|
||
| LogColorMode string | ||
| LogLevel string | ||
| } | ||
|
|
||
| func newChartInitCommand(ctx context.Context, afterAllCommandsBuiltFuncs map[*cobra.Command]func(cmd *cobra.Command) error) *cobra.Command { | ||
| cfg := &chartInitConfig{} | ||
| func newChartTSBuildCommand(ctx context.Context, afterAllCommandsBuiltFuncs map[*cobra.Command]func(cmd *cobra.Command) error) *cobra.Command { | ||
| cfg := &chartTSBuildConfig{} | ||
|
|
||
| cmd := cli.NewSubCommand( | ||
| ctx, | ||
| "init [PATH]", | ||
| "Initialize a new chart.", | ||
| "Initialize a new chart in the specified directory. If PATH is not specified, uses the current directory.", | ||
| "build [PATH]", | ||
| "Build TypeScript chart.", | ||
| "Build TypeScript chart in the specified directory. If PATH is not specified, uses the current directory.", | ||
| 10, // priority for ordering in help | ||
| chartCmdGroup, | ||
| tsCmdGroup, | ||
| cli.SubCommandOptions{ | ||
| Args: cobra.MaximumNArgs(1), | ||
| ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
|
|
@@ -45,39 +45,40 @@ func newChartInitCommand(ctx context.Context, afterAllCommandsBuiltFuncs map[*co | |
| cfg.ChartDirPath = args[0] | ||
| } | ||
|
|
||
| if err := action.ChartInit(ctx, cfg.ChartInitOptions); err != nil { | ||
| return fmt.Errorf("chart init: %w", err) | ||
| if err := action.ChartTSBuild(ctx, cfg.ChartTSBuildOptions); err != nil { | ||
| return fmt.Errorf("chart build: %w", err) | ||
| } | ||
|
|
||
| return nil | ||
| }, | ||
| ) | ||
|
|
||
| afterAllCommandsBuiltFuncs[cmd] = func(cmd *cobra.Command) error { | ||
| if err := cli.AddFlag(cmd, &cfg.TS, "ts", false, "Initialize TypeScript chart", cli.AddFlagOptions{ | ||
| Group: mainFlagGroup, | ||
| if err := cli.AddFlag(cmd, &cfg.LogColorMode, "color-mode", common.DefaultLogColorMode, "Color mode for logs. "+allowedLogColorModesHelp(), cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| if err := cli.AddFlag(cmd, &cfg.TempDirPath, "temp-dir", "", "The directory for temporary files. By default, create a new directory in the default system directory for temporary files", cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalEnvVarRegexes, | ||
| if err := cli.AddFlag(cmd, &cfg.LogLevel, "log-level", string(log.InfoLevel), "Set log level. "+allowedLogLevelsHelp(), cli.AddFlagOptions{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check which flags are present in any command. Even if not always used. At least tempdir flag is missing. |
||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| Type: cli.FlagTypeDir, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| if err := cli.AddFlag(cmd, &cfg.LogColorMode, "color-mode", common.DefaultLogColorMode, "Color mode for logs. "+allowedLogColorModesHelp(), cli.AddFlagOptions{ | ||
| if err := cli.AddFlag(cmd, &cfg.DenoBinaryPath, "deno-binary-path", "", "Path to the Deno binary to use instead of auto-downloading.", cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| Group: tsFlagGroup, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| if err := cli.AddFlag(cmd, &cfg.LogLevel, "log-level", string(log.InfoLevel), "Set log level. "+allowedLogLevelsHelp(), cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| if err := cli.AddFlag(cmd, &cfg.TempDirPath, "temp-dir", "", "The directory for temporary files. By default, create a new directory in the default system directory for temporary files", cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| Type: cli.FlagTypeDir, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "cmp" | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/spf13/cobra" | ||
|
|
||
| "github.com/werf/common-go/pkg/cli" | ||
| "github.com/werf/nelm/pkg/action" | ||
| "github.com/werf/nelm/pkg/common" | ||
| "github.com/werf/nelm/pkg/log" | ||
| ) | ||
|
|
||
| type chartTSInitConfig struct { | ||
| action.ChartTSInitOptions | ||
|
|
||
| LogColorMode string | ||
| LogLevel string | ||
| } | ||
|
|
||
| func newChartTSInitCommand(ctx context.Context, afterAllCommandsBuiltFuncs map[*cobra.Command]func(cmd *cobra.Command) error) *cobra.Command { | ||
| cfg := &chartTSInitConfig{} | ||
|
|
||
| cmd := cli.NewSubCommand( | ||
| ctx, | ||
| "init [PATH]", | ||
| "Initialize the files needed to render manifests using TypeScript.", | ||
| "Initialize the files needed to render manifests using TypeScript. If PATH is not specified, uses the current directory.", | ||
| 20, // priority for ordering in help | ||
| tsCmdGroup, | ||
| cli.SubCommandOptions{ | ||
| Args: cobra.MaximumNArgs(1), | ||
| ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
| return nil, cobra.ShellCompDirectiveFilterDirs | ||
| }, | ||
| }, | ||
| func(cmd *cobra.Command, args []string) error { | ||
| ctx = log.SetupLogging(ctx, cmp.Or(log.Level(cfg.LogLevel), log.InfoLevel), log.SetupLoggingOptions{ | ||
| ColorMode: cfg.LogColorMode, | ||
| }) | ||
|
|
||
| if len(args) > 0 { | ||
| cfg.ChartDirPath = args[0] | ||
| } | ||
|
|
||
| if err := action.ChartTSInit(ctx, cfg.ChartTSInitOptions); err != nil { | ||
| return fmt.Errorf("chart ts init: %w", err) | ||
| } | ||
|
|
||
| return nil | ||
| }, | ||
| ) | ||
|
|
||
| afterAllCommandsBuiltFuncs[cmd] = func(cmd *cobra.Command) error { | ||
| if err := cli.AddFlag(cmd, &cfg.TempDirPath, "temp-dir", "", "The directory for temporary files. By default, create a new directory in the default system directory for temporary files", cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| Type: cli.FlagTypeDir, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| if err := cli.AddFlag(cmd, &cfg.LogColorMode, "color-mode", common.DefaultLogColorMode, "Color mode for logs. "+allowedLogColorModesHelp(), cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| if err := cli.AddFlag(cmd, &cfg.LogLevel, "log-level", string(log.InfoLevel), "Set log level. "+allowedLogLevelsHelp(), cli.AddFlagOptions{ | ||
| GetEnvVarRegexesFunc: cli.GetFlagGlobalAndLocalEnvVarRegexes, | ||
| Group: miscFlagGroup, | ||
| }); err != nil { | ||
| return fmt.Errorf("add flag: %w", err) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| return cmd | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.