Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/cmd/files/migration_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func MigrationCheckScript(_ context.Context, input cmdtools.CommandInput) error
payloadApps := appDef.GetAppsByType(appdef.AppTypePayload)

for _, app := range payloadApps {
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.js")
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.cjs")

// Scaffold the check script from template.
err := input.Generator().CopyFromEmbed(
templates.Embed,
"scripts/check-deps.js",
"scripts/check-deps.cjs",
scriptPath,
scaffold.WithTracking(manifest.SourceApp(app.Name)),
scaffold.WithScaffoldMode(),
Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/files/migration_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestMigrationCheckScript(t *testing.T) {

// Verify no scripts were created.
for _, app := range appDef.Apps {
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.js")
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.cjs")
exists, err := afero.Exists(input.FS, scriptPath)
require.NoError(t, err)
assert.False(t, exists, "expected %s not to exist", scriptPath)
Expand All @@ -65,7 +65,7 @@ func TestMigrationCheckScript(t *testing.T) {
require.NoError(t, err)

// Verify script was created for Payload app.
cmsScriptPath := filepath.Join("./apps/cms/scripts", "check-deps.js")
cmsScriptPath := filepath.Join("./apps/cms/scripts", "check-deps.cjs")
exists, err := afero.Exists(input.FS, cmsScriptPath)
require.NoError(t, err)
assert.True(t, exists, "expected %s to exist", cmsScriptPath)
Expand All @@ -78,7 +78,7 @@ func TestMigrationCheckScript(t *testing.T) {
assert.Contains(t, string(content), "Dependencies out of sync")

// Verify script was not created for SvelteKit app.
webScriptPath := filepath.Join("./apps/web/scripts", "check-deps.js")
webScriptPath := filepath.Join("./apps/web/scripts", "check-deps.cjs")
exists, err = afero.Exists(input.FS, webScriptPath)
require.NoError(t, err)
assert.False(t, exists, "expected %s not to exist", webScriptPath)
Expand All @@ -101,7 +101,7 @@ func TestMigrationCheckScript(t *testing.T) {

// Verify script was created for both Payload apps.
for _, app := range appDef.Apps {
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.js")
scriptPath := filepath.Join(app.Path, "scripts", "check-deps.cjs")
exists, err := afero.Exists(input.FS, scriptPath)
require.NoError(t, err)
assert.True(t, exists, "expected %s to exist", scriptPath)
Expand All @@ -123,7 +123,7 @@ func TestMigrationCheckScript(t *testing.T) {
err := MigrationCheckScript(t.Context(), input)
require.NoError(t, err)

scriptPath := filepath.Join("./apps/cms/scripts", "check-deps.js")
scriptPath := filepath.Join("./apps/cms/scripts", "check-deps.cjs")
content1, err := afero.ReadFile(input.FS, scriptPath)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/files/package_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func PackageJSONApp(_ context.Context, input cmdtools.CommandInput) error {
// These scripts are injected into app package.json files based on the app type.
var appTypeScripts = map[appdef.AppType]map[string]string{
appdef.AppTypePayload: {
"migrate:check": "node scripts/check-deps.js",
"migrate:check": "node scripts/check-deps.cjs",
"migrate:create": "pnpm migrate:check && NODE_ENV=production payload migrate:create",
"migrate:status": "NODE_ENV=production payload migrate:status",
},
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/files/package_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func TestPackageJSONApp(t *testing.T) {
scripts, ok := pkg["scripts"].(map[string]any)
require.True(t, ok)

assert.Equal(t, "node scripts/check-deps.js", scripts["migrate:check"])
assert.Equal(t, "node scripts/check-deps.cjs", scripts["migrate:check"])
assert.Equal(t, "pnpm migrate:check && NODE_ENV=production payload migrate:create", scripts["migrate:create"])
assert.Equal(t, "NODE_ENV=production payload migrate:status", scripts["migrate:status"])
}
Expand Down Expand Up @@ -594,7 +594,7 @@ func TestGetAppTypeScripts(t *testing.T) {
"Payload includes migration scripts": {
input: appdef.AppTypePayload,
want: map[string]string{
"migrate:check": "node scripts/check-deps.js",
"migrate:check": "node scripts/check-deps.cjs",
"migrate:create": "pnpm migrate:check && NODE_ENV=production payload migrate:create",
"migrate:status": "NODE_ENV=production payload migrate:status",
},
Expand Down
Loading