feat(project): add support for mojo

This commit is contained in:
Oleksandr Babieiev 2024-10-19 16:21:04 +02:00 committed by Jan De Dobbeleer
parent a8962f5498
commit 541a26d414
3 changed files with 53 additions and 8 deletions

View file

@ -76,6 +76,11 @@ func (n *Project) Enabled() bool {
Files: []string{"pyproject.toml"},
Fetcher: n.getPythonPackage,
},
{
Name: "mojo",
Files: []string{"mojoproject.toml"},
Fetcher: n.getPythonPackage,
},
{
Name: "php",
Files: []string{"composer.json"},

View file

@ -138,6 +138,22 @@ func TestPackage(t *testing.T) {
File: "pyproject.toml",
PackageContents: "[project]\nname=\"test\"\nversion=\"3.2.1\"\n",
},
{
Case: "1.0.0 mojo",
ExpectedEnabled: true,
ExpectedString: "\uf487 1.0.0 test",
Name: "mojo",
File: "mojoproject.toml",
PackageContents: "[project]\nname=\"test\"\nversion=\"1.0.0\"\n",
},
{
Case: "3.2.1 mojo",
ExpectedEnabled: true,
ExpectedString: "\uf487 3.2.1 test",
Name: "mojo",
File: "mojoproject.toml",
PackageContents: "[project]\nname=\"test\"\nversion=\"3.2.1\"\n",
},
{
Case: "No version present node.js",
ExpectedEnabled: true,
@ -178,6 +194,14 @@ func TestPackage(t *testing.T) {
File: "pyproject.toml",
PackageContents: "[project]\nname=\"test\"\n",
},
{
Case: "No version present mojo",
ExpectedEnabled: true,
ExpectedString: "test",
Name: "mojo",
File: "mojoproject.toml",
PackageContents: "[project]\nname=\"test\"\n",
},
{
Case: "No name present node.js",
ExpectedEnabled: true,
@ -218,6 +242,14 @@ func TestPackage(t *testing.T) {
File: "pyproject.toml",
PackageContents: "[project]\nversion=\"1.0.0\"\n",
},
{
Case: "No name present mojo",
ExpectedEnabled: true,
ExpectedString: "\uf487 1.0.0",
Name: "mojo",
File: "mojoproject.toml",
PackageContents: "[project]\nversion=\"1.0.0\"\n",
},
{
Case: "Empty project package node.js",
ExpectedEnabled: true,
@ -246,6 +278,13 @@ func TestPackage(t *testing.T) {
File: "pyproject.toml",
PackageContents: "",
},
{
Case: "Empty project package mojo",
ExpectedEnabled: true,
Name: "mojo",
File: "mojoproject.toml",
PackageContents: "",
},
{
Case: "Invalid json",
ExpectedString: "invalid character '}' looking for beginning of value",

View file

@ -13,6 +13,7 @@ Supports:
- Node.js project (`package.json`)
- Cargo project (`Cargo.toml`)
- Python project (`pyproject.toml`, supports metadata defined according to [PEP 621][pep621-standard] or [Poetry][poetry-standard])
- Mojo project (`mojoproject.toml`)
- PHP project (`composer.json`)
- Dart project (`pubspec.yaml`)
- Any nuspec based project (`*.nuspec`, first file match info is displayed)
@ -55,8 +56,8 @@ import Config from "@site/src/components/Config.js";
### Properties
| Name | Type | Description |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.Type` | `string` | The type of project:<ul><li>`node`</li><li>`cargo`</li><li>`python`</li><li>`php`</li><li>`dart`</li><li>`nuspec`</li><li>`dotnet`</li><li>`julia`</li><li>`powershell`</li></ul> |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.Type` | `string` | The type of project:<ul><li>`node`</li><li>`cargo`</li><li>`python`</li><li>`mojo`</li><li>`php`</li><li>`dart`</li><li>`nuspec`</li><li>`dotnet`</li><li>`julia`</li><li>`powershell`</li></ul> |
| `.Version` | `string` | The version of your project |
| `.Target` | `string` | The target framework/language version of your project |
| `.Name` | `string` | The name of your project |