Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd99ca6c

Browse files
MSbuild library and CSProjFile (#307)
1 parentdf74714 commitd99ca6c

30 files changed

+10179
-182
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind:internal
3+
packages:
4+
-"@alloy-js/msbuild"
5+
---
6+
7+
Initial
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind:feature
3+
packages:
4+
-"@alloy-js/csharp"
5+
---
6+
7+
Add`CsprojFile` component, to be used with`@alloy-js/msbuild`

‎.prettierignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ packages/csharp/src/builtins
1515

1616

1717
.chronus/changes/
18-
CHANGELOG.md
18+
CHANGELOG.md
19+
20+
*.generated.*

‎cspell.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ dictionaries:
77
words:
88
-arrayify
99
-cref
10+
-msbuild
1011
useGitignore:true
1112
enableGlobDot:true

‎packages/csharp/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"license":"MIT",
4646
"dependencies": {
4747
"@alloy-js/core":"workspace:~",
48+
"@alloy-js/msbuild":"workspace:~",
4849
"change-case":"catalog:",
4950
"marked":"catalog:",
5051
"pathe":"catalog:"

‎packages/csharp/src/components/ProjectDirectory.tsx‎

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import{expect,it}from"vitest";
2+
import{CsprojFile}from"./csproj-file.jsx";
3+
4+
it("create empty .csproj file",()=>{
5+
expect(<CsprojFilepath={"foo.csproj"}>{"<!-- content -->"}</CsprojFile>)
6+
.toRenderTo(`
7+
<Project Sdk="Microsoft.NET.Sdk"><!-- content --></Project>
8+
`);
9+
});
10+
11+
it("set different sdk",()=>{
12+
expect(
13+
<CsprojFilepath={"foo.csproj"}sdk="Microsoft.NET.Sdk.Web">
14+
{"<!-- content -->"}
15+
</CsprojFile>,
16+
).toRenderTo(`
17+
<Project Sdk="Microsoft.NET.Sdk.Web"><!-- content --></Project>
18+
`);
19+
});
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import{Children,SourceFile}from"@alloy-js/core";
2+
import{Project}from"@alloy-js/msbuild/components";
3+
4+
exporttypeCSharpProjectSdk=
5+
|"Microsoft.NET.Sdk"
6+
|"Microsoft.NET.Sdk.Web"
7+
|"Microsoft.NET.Sdk.Worker"
8+
|"Microsoft.NET.Sdk.Razor"
9+
|"Microsoft.NET.Sdk.BlazorWebAssembly"
10+
|"Aspire.AppHost.Sdk"
11+
|"MSTest.Sdk";
12+
13+
exportinterfaceCsprojProps{
14+
path: `${string}.csproj`;
15+
/**
16+
* Project SDK https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview
17+
*@default "Microsoft.NET.Sdk"
18+
*/
19+
sdk?:CSharpProjectSdk;
20+
21+
/** Content inside <project> */
22+
children?:Children;
23+
}
24+
25+
/** Create a .csproj file */
26+
exportfunctionCsprojFile(props:CsprojProps){
27+
return(
28+
<SourceFilepath={props.path}filetype="xml"tabWidth={4}>
29+
<ProjectSdk={props.sdk??"Microsoft.NET.Sdk"}>{props.children}</Project>
30+
</SourceFile>
31+
);
32+
}

‎packages/csharp/src/components/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from "./access-expression/access-expression.jsx";
22
export*from"./attributes/attributes.jsx";
33
export*from"./class/declaration.jsx";
44
export*from"./constructor/constructor.jsx";
5+
export*from"./csproj-file/csproj-file.jsx";
56
export*from"./Declaration.js";
67
export*from"./doc/comment.jsx";
78
export*from"./doc/from-markdown.jsx";
@@ -19,7 +20,6 @@ export * from "./method/method.jsx";
1920
export*from"./Name.js";
2021
export{Namespace,typeNamespaceProps}from"./namespace/namespace.jsx";
2122
export*from"./parameters/parameters.jsx";
22-
export*from"./ProjectDirectory.js";
2323
export*from"./property/property.jsx";
2424
export*from"./record/declaration.js";
2525
export*from"./Reference.js";

‎packages/csharp/src/components/stc/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ export const EnumDeclaration = core.stc(base.EnumDeclaration);
99
exportconstEnumMember=core.stc(base.EnumMember);
1010
exportconstParameter=core.stc(base.Parameter);
1111
exportconstParameters=core.stc(base.Parameters);
12-
exportconstProjectDirectory=core.stc(base.ProjectDirectory);
1312
exportconstUsingDirective=core.stc(base.Usings);
1413
exportconstStructDeclaration=core.stc(base.StructDeclaration);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp