diff --git a/internal/functions/deploy/deploy.go b/internal/functions/deploy/deploy.go index 5b6bb8e47..196d2e8a7 100644 --- a/internal/functions/deploy/deploy.go +++ b/internal/functions/deploy/deploy.go @@ -113,11 +113,22 @@ func GetFunctionConfig(slugs []string, importMapPath string, noVerifyJWT *bool, functionConfig[name] = function } if len(functionsUsingDeprecatedImportMap) > 0 { - fmt.Fprintln(os.Stderr, utils.Yellow("WARNING:"), "Functions using deprecated import_map.json (please migrate to deno.jsonc):", utils.Aqua(strings.Join(functionsUsingDeprecatedImportMap, ", "))) + fmt.Fprintln(os.Stderr, + utils.Yellow("WARNING:"), + "Functions using deprecated import_map.json (please migrate to deno.json):", + utils.Aqua(strings.Join(functionsUsingDeprecatedImportMap, ", ")), + ) } if len(functionsUsingDeprecatedGlobalFallback) > 0 { - fmt.Fprintln(os.Stderr, utils.Yellow("WARNING:"), "Functions using fallback import map:", utils.Aqua(strings.Join(functionsUsingDeprecatedGlobalFallback, ", "))) - fmt.Fprintln(os.Stderr, "Please use recommended per function dependency declaration ", utils.Aqua("https://supabase.com/docs/guides/functions/import-maps")) + fmt.Fprintln(os.Stderr, + utils.Yellow("WARNING:"), + "Functions using fallback import map:", + utils.Aqua(strings.Join(functionsUsingDeprecatedGlobalFallback, ", ")), + ) + fmt.Fprintln(os.Stderr, + "Please use recommended per function dependency declaration ", + utils.Aqua("https://supabase.com/docs/guides/functions/import-maps"), + ) } return functionConfig, nil } diff --git a/internal/functions/new/new.go b/internal/functions/new/new.go index 5eca5b67a..67a9893e2 100644 --- a/internal/functions/new/new.go +++ b/internal/functions/new/new.go @@ -17,7 +17,7 @@ import ( var ( //go:embed templates/index.ts indexEmbed string - //go:embed templates/deno.jsonc + //go:embed templates/deno.json denoEmbed string //go:embed templates/.npmrc npmrcEmbed string @@ -57,8 +57,8 @@ func Run(ctx context.Context, slug string, fsys afero.Fs) error { return errors.Errorf("failed to create function entrypoint: %w", err) } - if err := afero.WriteFile(fsys, filepath.Join(funcDir, "deno.jsonc"), []byte(denoEmbed), 0644); err != nil { - return errors.Errorf("failed to create deno.jsonc config: %w", err) + if err := afero.WriteFile(fsys, filepath.Join(funcDir, "deno.json"), []byte(denoEmbed), 0644); err != nil { + return errors.Errorf("failed to create deno.json config: %w", err) } if err := afero.WriteFile(fsys, filepath.Join(funcDir, ".npmrc"), []byte(npmrcEmbed), 0644); err != nil { diff --git a/internal/functions/new/new_test.go b/internal/functions/new/new_test.go index 56a24f705..8e00fa656 100644 --- a/internal/functions/new/new_test.go +++ b/internal/functions/new/new_test.go @@ -25,10 +25,10 @@ func TestNewCommand(t *testing.T) { "curl -i --location --request POST 'http://127.0.0.1:54321/functions/v1/test-func'", ) - // Verify deno.jsonc exists - denoPath := filepath.Join(utils.FunctionsDir, "test-func", "deno.jsonc") + // Verify deno.json exists + denoPath := filepath.Join(utils.FunctionsDir, "test-func", "deno.json") _, err = afero.ReadFile(fsys, denoPath) - assert.NoError(t, err, "deno.jsonc should be created") + assert.NoError(t, err, "deno.json should be created") // Verify .npmrc exists npmrcPath := filepath.Join(utils.FunctionsDir, "test-func", ".npmrc") diff --git a/internal/functions/new/templates/deno.json b/internal/functions/new/templates/deno.json new file mode 100644 index 000000000..f6ca8454c --- /dev/null +++ b/internal/functions/new/templates/deno.json @@ -0,0 +1,3 @@ +{ + "imports": {} +} diff --git a/internal/functions/new/templates/deno.jsonc b/internal/functions/new/templates/deno.jsonc deleted file mode 100644 index 97275ba5e..000000000 --- a/internal/functions/new/templates/deno.jsonc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "imports": { - // Add your dependencies here - // See: https://supabase.com/docs/guides/functions/import-maps#using-denojson-recommended - } -} diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 2280ae40b..e13e67e59 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -410,7 +410,7 @@ func TestLoadFunctionImportMap(t *testing.T) { } // Run test assert.NoError(t, config.Load("", fsys)) - // Check that deno.json was set as import map + // Check that deno.jsonc was set as import map assert.Equal(t, "supabase/functions/hello/deno.jsonc", config.Functions["hello"].ImportMap) })