Skip to content

Commit 2d2ee15

Browse files
committed
stuff
1 parent 8e85890 commit 2d2ee15

13 files changed

Lines changed: 1606 additions & 3430 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Setup .NET
2+
description: Setup .NET SDK
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: actions/setup-dotnet@v5
8+
with:
9+
dotnet-version: |
10+
8.0.x
11+
9.0.x
12+
10.0.x

.github/actions/setup-js/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,24 @@ inputs:
66
description: Directory to run pnpm install in
77
required: false
88
default: ${{ github.workspace }}
9-
9+
skip-install:
10+
description: Skip running pnpm install
11+
required: false
12+
default: "false"
1013
runs:
1114
using: composite
1215
steps:
1316
- uses: actions/setup-node@v6
1417
with:
1518
node-version: 24.x
19+
registry-url: "https://registry.npmjs.org"
1620

1721
- name: Install pnpm
1822
shell: bash
1923
run: npm install -g pnpm@11
2024

2125
- name: Install dependencies
26+
if: inputs.skip-install != 'true'
2227
shell: bash
2328
working-directory: ${{ inputs.working-directory }}
2429
run: pnpm install --frozen-lockfile

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,7 @@ jobs:
2727
- name: Checkout code
2828
uses: actions/checkout@v6
2929

30-
- name: Setup dotnet
31-
uses: actions/setup-dotnet@v5
32-
with:
33-
dotnet-version: |
34-
8.0.x
35-
9.0.x
36-
10.0.x
37-
30+
- uses: ./.github/actions/setup-dotnet
3831
- uses: ./.github/actions/setup-js
3932

4033
- name: Restore .NET packages

.github/workflows/part-build.yml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v6
19-
- name: Setup dotnet
20-
uses: actions/setup-dotnet@v5
21-
with:
22-
dotnet-version: |
23-
8.0.x
24-
9.0.x
25-
19+
- uses: ./.github/actions/setup-dotnet
2620
- uses: ./.github/actions/setup-js
2721
- run: dotnet restore
2822
- run: dotnet build --no-restore --configuration Release /WarnAsError
@@ -44,12 +38,7 @@ jobs:
4438
steps:
4539
- uses: actions/checkout@v6
4640

47-
- uses: actions/setup-dotnet@v5
48-
with:
49-
dotnet-version: |
50-
8.0.x
51-
9.0.x
52-
41+
- uses: ./.github/actions/setup-dotnet
5342
- uses: ./.github/actions/setup-js
5443

5544
- run: pnpm coalesce
@@ -68,16 +57,6 @@ jobs:
6857
steps:
6958
- uses: actions/checkout@v6
7059

71-
# setup-node and update npm are only here to preemptively test
72-
# the required install of npm@11 that's needed for OIDC npm publish
73-
- uses: actions/setup-node@v6
74-
with:
75-
node-version: 24.x
76-
registry-url: "https://registry.npmjs.org"
77-
78-
- name: Update npm
79-
run: npm install -g npm@latest
80-
8160
- uses: ./.github/actions/setup-js
8261

8362
- run: pnpm lint
@@ -250,18 +229,11 @@ jobs:
250229
steps:
251230
- uses: actions/checkout@v6
252231

253-
- name: Setup dotnet
254-
uses: actions/setup-dotnet@v5
255-
with:
256-
dotnet-version: |
257-
8.0.x
258-
9.0.x
232+
- uses: ./.github/actions/setup-dotnet
259233

260-
- uses: actions/setup-node@v6
234+
- uses: ./.github/actions/setup-js
261235
with:
262-
node-version: 24.x
263-
264-
- run: npm install -g pnpm@11
236+
skip-install: "true"
265237

266238
- name: Download Artifacts
267239
uses: actions/download-artifact@v8

.github/workflows/part-publish.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,25 @@ jobs:
2525
- name: Download all workflow run artifacts
2626
uses: actions/download-artifact@v8
2727

28-
- uses: actions/setup-node@v6
28+
- uses: ./.github/actions/setup-js
2929
with:
30-
node-version: 24.x
31-
registry-url: "https://registry.npmjs.org"
30+
skip-install: "true"
3231

33-
- name: Update npm
34-
run: npm install -g npm@latest
35-
36-
- name: npm publish coalesce-vue
32+
- name: pnpm publish coalesce-vue
3733
if: ${{ !inputs.skipNpm }}
38-
run: npm publish ./coalesce-vue/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public
34+
run: pnpm publish ./coalesce-vue/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public --no-git-checks
3935

40-
- name: npm publish coalesce-mcp
36+
- name: pnpm publish coalesce-mcp
4137
if: ${{ !inputs.skipNpm }}
42-
run: npm publish ./coalesce-mcp/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public
38+
run: pnpm publish ./coalesce-mcp/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public --no-git-checks
4339

44-
- name: npm publish coalesce-vue-vuetify
40+
- name: pnpm publish coalesce-vue-vuetify
4541
if: ${{ !inputs.skipNpm }}
46-
run: for f in ./coalesce-vue-vuetify*/*.tgz; do npm publish $f --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public; done
42+
run: for f in ./coalesce-vue-vuetify*/*.tgz; do pnpm publish $f --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public --no-git-checks; done
4743

48-
- name: npm publish eslint-plugin-coalesce
44+
- name: pnpm publish eslint-plugin-coalesce
4945
if: ${{ !inputs.skipNpm }}
50-
run: npm publish ./eslint-plugin-coalesce/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public
46+
run: pnpm publish ./eslint-plugin-coalesce/*.tgz --tag ${{ inputs.prereleaseSlug || 'latest' }} --access public --no-git-checks
5147

5248
nuget:
5349
runs-on: ubuntu-latest

.github/workflows/part-template-build.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v6
2727

28-
- name: Setup dotnet
29-
uses: actions/setup-dotnet@v5
30-
with:
31-
dotnet-version: |
32-
8.0.x
33-
9.0.x
28+
- uses: ./.github/actions/setup-dotnet
3429

3530
- name: "Set dependency versions"
3631
if: success() && env.COALESCE_VERSION

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packages:
22
- src/*
3+
- src/IntelliTect.Coalesce.CodeGeneration.Tests/out
34
- playground/*
45
- docs
56

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
out
1+
out
2+
!out/package.json

src/IntelliTect.Coalesce.CodeGeneration.Tests/TargetClassesFullGenerationTest.cs

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,54 @@
11
using IntelliTect.Coalesce.Api.Behaviors;
22
using IntelliTect.Coalesce.Api.DataSources;
3+
using IntelliTect.Coalesce.CodeGeneration.Configuration;
34
using IntelliTect.Coalesce.CodeGeneration.Generation;
45
using IntelliTect.Coalesce.CodeGeneration.Vue.Generators;
56
using IntelliTect.Coalesce.Testing;
67
using IntelliTect.Coalesce.Testing.TargetClasses.TestDbContext;
78
using IntelliTect.Coalesce.Testing.Util;
9+
using IntelliTect.Coalesce.Validation;
810
using Microsoft.AspNetCore.Hosting;
911
using Microsoft.Extensions.DependencyInjection;
1012
using Moq;
1113
using Newtonsoft.Json;
1214
using Newtonsoft.Json.Linq;
15+
using System.Reflection;
16+
using System.Runtime.Versioning;
17+
using TUnit.Core.Interfaces;
1318

1419
namespace IntelliTect.Coalesce.CodeGeneration.Tests;
1520

16-
public class TargetClassesFullGenerationTest : CodeGenTestBase
21+
public class VueSuiteFixture : IAsyncInitializer
22+
{
23+
public IRootGenerator Suite { get; private set; } = null!;
24+
25+
public async Task InitializeAsync()
26+
{
27+
var executor = new GenerationExecutor(
28+
new CoalesceConfiguration
29+
{
30+
WebProject = new ProjectConfiguration { RootNamespace = "MyProject" }
31+
},
32+
Microsoft.Extensions.Logging.LogLevel.Information
33+
);
34+
35+
var suite = executor.CreateRootGenerator<VueSuite>()
36+
.WithModel(ReflectionRepositoryFactory.Symbol);
37+
38+
var validationResult = ValidateContext.Validate(suite.Model);
39+
await Assert.That(validationResult.Where(r => r.IsError)).IsEmpty();
40+
41+
var tfmAttr = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttribute<TargetFrameworkAttribute>()!;
42+
var outDir = Path.Combine(FilesystemExtensions.GetRepoRoot().FullName, "src", "IntelliTect.Coalesce.CodeGeneration.Tests", "out", tfmAttr.FrameworkName!, "VueSuite");
43+
suite = suite.WithOutputPath(outDir);
44+
45+
await suite.GenerateAsync();
46+
Suite = suite;
47+
}
48+
}
49+
50+
[ClassDataSource<VueSuiteFixture>(Shared = SharedType.PerTestSession)]
51+
public class TargetClassesFullGenerationTest(VueSuiteFixture fixture) : CodeGenTestBase
1752
{
1853
// #IF directive so this doesn't needlessly run for multiple TFMs. It only needs to run for one.
1954
#if NET10_0
@@ -55,44 +90,24 @@ public async Task CreateVitestTargets()
5590
#endif
5691

5792
[Test]
58-
public async Task VueOutputCompiles()
93+
[Arguments("5")]
94+
[Arguments("5.9")]
95+
[Arguments("6")]
96+
public async Task VueOutputTypescriptCompiles(string tsVersion)
5997
{
60-
var executor = BuildExecutor();
61-
62-
var suite = executor.CreateRootGenerator<VueSuite>()
63-
.WithModel(ReflectionRepositoryFactory.Symbol);
64-
suite = await ConfigureAndValidateSuite(suite);
65-
await suite.GenerateAsync();
66-
67-
await Task.WhenAll(
68-
Task.Run(() => AssertVueSuiteTypescriptOutputCompiles(suite, "5")),
69-
Task.Run(() => AssertVueSuiteTypescriptOutputCompiles(suite, "5.5")),
70-
Task.Run(() => AssertVueSuiteTypescriptOutputCompiles(suite, "5.9")),
71-
Task.Run(() => AssertSuiteCSharpOutputCompiles(suite))
72-
);
73-
}
98+
var outputPath = fixture.Suite.EffectiveOutputPath.Replace("\\", "/");
7499

75-
protected async Task AssertVueSuiteTypescriptOutputCompiles(IRootGenerator suite, string tsVersion)
76-
{
77-
var coalesceVue = GetRepoRoot().GetDirectory("src/coalesce-vue");
78-
79-
await Assert.That(coalesceVue.GetDirectory("node_modules").Exists).IsTrue().Because("Test relies on NPM packages for coalesce-vue being restored.");
80-
81-
// We use coalesce-vue as our working directory here
82-
// because it contains both tsc and all the dependencies of the generated code.
83-
var workingDirectory = coalesceVue.FullName.Replace("\\", "/");
84100
var tsConfig =
85101
$$"""
86102
{
87103
"compilerOptions": {
88104
"target": "ES2022",
105+
"module": "preserve",
106+
"moduleResolution": "bundler",
89107
"strict": true,
90-
"moduleResolution": "node",
91108
"verbatimModuleSyntax": true,
92-
"baseUrl": ".",
93109
"paths": {
94-
"coalesce-vue/lib/*": [ "{{workingDirectory}}/src/*" ],
95-
"*": [ "{{workingDirectory}}/node_modules/*" ],
110+
"coalesce-vue/lib/*": [ "../../node_modules/coalesce-vue/src/*" ],
96111
},
97112
"types": ["vue-router"]
98113
},
@@ -101,16 +116,22 @@ protected async Task AssertVueSuiteTypescriptOutputCompiles(IRootGenerator suite
101116
],
102117
}
103118
""";
104-
var tsConfigPath = $"{suite.EffectiveOutputPath}/tsconfig.{tsVersion}.json";
119+
var tsConfigPath = $"{outputPath}/tsconfig.{tsVersion}.json";
105120
File.WriteAllText(tsConfigPath, tsConfig);
106121

107122
await AssertTypescriptProjectCompiles(
108123
tsConfigPath: tsConfigPath,
109-
workingDirectory: workingDirectory,
124+
workingDirectory: outputPath,
110125
tsVersion: tsVersion
111126
);
112127
}
113128

129+
[Test]
130+
public async Task VueOutputCSharpCompiles()
131+
{
132+
await AssertSuiteCSharpOutputCompiles(fixture.Suite);
133+
}
134+
114135
[Test]
115136
public async Task SecurityOverviewDataGenerates()
116137
{

0 commit comments

Comments
 (0)