fix(setup): prefer node project detection over php
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
0179ddf4f2
commit
04d8a17dc7
2 changed files with 11 additions and 3 deletions
|
|
@ -99,12 +99,12 @@ func detectProjectType(path string) string {
|
||||||
if coreio.Local.IsFile(filepath.Join(path, "go.mod")) {
|
if coreio.Local.IsFile(filepath.Join(path, "go.mod")) {
|
||||||
return "go"
|
return "go"
|
||||||
}
|
}
|
||||||
if coreio.Local.IsFile(filepath.Join(path, "composer.json")) {
|
|
||||||
return "php"
|
|
||||||
}
|
|
||||||
if coreio.Local.IsFile(filepath.Join(path, "package.json")) {
|
if coreio.Local.IsFile(filepath.Join(path, "package.json")) {
|
||||||
return "node"
|
return "node"
|
||||||
}
|
}
|
||||||
|
if coreio.Local.IsFile(filepath.Join(path, "composer.json")) {
|
||||||
|
return "php"
|
||||||
|
}
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,3 +20,11 @@ func TestRunRepoSetup_CreatesCoreConfigs(t *testing.T) {
|
||||||
require.NoErrorf(t, err, "expected %s to exist", path)
|
require.NoErrorf(t, err, "expected %s to exist", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDetectProjectType_PrefersPackageOverComposer(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
require.NoError(t, os.WriteFile(filepath.Join(dir, "package.json"), []byte("{}\n"), 0o644))
|
||||||
|
require.NoError(t, os.WriteFile(filepath.Join(dir, "composer.json"), []byte("{}\n"), 0o644))
|
||||||
|
|
||||||
|
require.Equal(t, "node", detectProjectType(dir))
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue