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
9 changes: 4 additions & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Code generated from the blueprint by the codegen.

output/csharp/src/Seam/Api/** linguist-generated
output/csharp/src/Seam/Model/** linguist-generated
output/csharp/src/Seam/Seam.csproj linguist-generated
src/Seam/Api/** linguist-generated
src/Seam/Model/** linguist-generated

# Static, schema-independent sources kept alongside the generated code.

output/csharp/src/Seam/Model/AsbtractModelSchema.cs -linguist-generated
output/csharp/src/Seam/Model/SafeStringEnumConverter.cs -linguist-generated
src/Seam/Model/AsbtractModelSchema.cs -linguist-generated
src/Seam/Model/SafeStringEnumConverter.cs -linguist-generated
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ runs:
- name: Restore dependencies
if: inputs.install_dependencies == 'true'
shell: bash
run: dotnet restore ./output/csharp
run: dotnet restore ./Seam.sln
4 changes: 2 additions & 2 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: tj-actions/changed-files@v44
with:
files: |
output/csharp/src/Seam/Api/**
output/csharp/src/Seam/Model/**
src/Seam/Api/**
src/Seam/Model/**
merge:
name: Merge
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
install_dependencies: 'false'
- name: Normalize package-lock.json
run: npm install
- name: Restore tools
run: dotnet tool restore
- name: Generate code
run: npm run generate
- name: Commit
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,19 @@ and dispatches the [Version](.github/workflows/version.yml) workflow.
Run the [Version](.github/workflows/version.yml) workflow with the
version to cut.
It runs `npm version`, which bumps the `version` field in `package.json`,
regenerates `Seam.csproj` with that version, creates a signed `v*` git tag
injects that version into `Seam.csproj`, creates a signed `v*` git tag
and pushes it.
Pushing the tag triggers the [Publish](.github/workflows/publish.yml)
workflow, which packs the library with `dotnet pack` and pushes the
package to [NuGet](https://www.nuget.org/packages/Seam) and GitHub
Packages.

> The version lives in `package.json`, the development manifest that
> drives the codegen, and is injected into `Seam.csproj` by
> `src/generate-csproj.ts`.
> The injection runs from `src/version.ts`, wired to the `version`
> lifecycle script, which npm runs after the bump but before the commit,
> so the updated project file is part of the tagged commit and MSBuild
> surfaces the version at runtime through
> drives the codegen.
> `version.ts`, wired to the `version` lifecycle script, injects it
> into the `<Version>` element of `Seam.csproj`, which npm runs after the
> bump but before the commit, so the updated project file is part of the
> tagged commit and MSBuild surfaces the version at runtime through
> `AssemblyInformationalVersionAttribute`.
> Never edit the version in `Seam.csproj` by hand.

Expand Down
6 changes: 4 additions & 2 deletions output/csharp/csharp-testing.sln → Seam.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E1444EB3-69DB-4DC7-B1DA-798B74419077}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7C2E8F1A-4B3D-4C5E-9A6F-1D2E3F4A5B6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam", "src\Seam\Seam.csproj", "{9A33E809-F95A-4E65-A9F8-145A49A16EBC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam.Test", "src\Seam.Test\Seam.Test.csproj", "{B6EDC1FF-9838-4997-B98E-62B768430DF3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seam.Test", "test\Seam.Test\Seam.Test.csproj", "{B6EDC1FF-9838-4997-B98E-62B768430DF3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -29,6 +31,6 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9A33E809-F95A-4E65-A9F8-145A49A16EBC} = {E1444EB3-69DB-4DC7-B1DA-798B74419077}
{B6EDC1FF-9838-4997-B98E-62B768430DF3} = {E1444EB3-69DB-4DC7-B1DA-798B74419077}
{B6EDC1FF-9838-4997-B98E-62B768430DF3} = {7C2E8F1A-4B3D-4C5E-9A6F-1D2E3F4A5B6C}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions codegen/lib/class-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface CsUnion {

export type CsDecl = CsClass | CsUnion

// A generated model file (output/csharp/src/Seam/Model/<Name>.cs): one or more
// A generated model file (src/Seam/Model/<Name>.cs): one or more
// top-level declarations (the main type first, then sibling classes spawned by
// inline-object properties).
export interface CsModelFile {
Expand Down Expand Up @@ -119,7 +119,7 @@ export interface CsRoute {
obsoleteMessage?: string
}

// A generated Api file (output/csharp/src/Seam/Api/<Name>.cs).
// A generated Api file (src/Seam/Api/<Name>.cs).
export interface CsApiFile {
className: string
routes: CsRoute[]
Expand Down
6 changes: 3 additions & 3 deletions codegen/lib/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
buildModelFile,
} from './build-model.js'

const outputRoot = 'output/csharp/src/Seam'
const outputRoot = 'src/Seam'

// Resource types that are emitted as discriminated unions rather than plain
// model classes.
Expand All @@ -21,8 +21,8 @@ const apiClassName = (path: string): string =>
pascalCase(path.split('/').filter(Boolean).reverse().join('_'))

// Metalsmith plugin that generates the blueprint-derived C# SDK files: the Api
// route classes (output/csharp/src/Seam/Api/*.cs) and the resource models
// (output/csharp/src/Seam/Model/*.cs). Static, schema-independent files (the
// route classes (src/Seam/Api/*.cs) and the resource models
// (src/Seam/Model/*.cs). Static, schema-independent files (the
// Client/* runtime, the static Model helpers, the .sln, the test project) are
// normal committed package source and are intentionally NOT generated here.
//
Expand Down
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Build the package
build:
dotnet pack --configuration Release --output pkg ./output/csharp/src/Seam
dotnet pack --configuration Release --output pkg ./src/Seam

# Run the tests
test framework="":
dotnet test ./output/csharp {{ if framework == "" { "" } else { "--framework " + framework } }}
dotnet test ./Seam.sln {{ if framework == "" { "" } else { "--framework " + framework } }}

# Lint
lint:
dotnet csharpier --check ./output/csharp
dotnet csharpier --check ./src ./test

# Format
format:
dotnet csharpier ./output/csharp
dotnet csharpier ./src ./test
2 changes: 0 additions & 2 deletions output/csharp/.gitignore

This file was deleted.

124 changes: 0 additions & 124 deletions output/csharp/src/Seam/README.md

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"private": true,
"license": "MIT",
"scripts": {
"version": "tsx src/version.ts",
"version": "tsx ./version.ts",
"postversion": "git push --follow-tags",
"generate": "tsx codegen/smith.ts",
"postgenerate": "tsx src/postgenerate.ts",
"generate:csproj": "tsx src/generate-csproj.ts",
"postgenerate": "just format",
"typecheck": "tsc",
"lint": "eslint .",
"postlint": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore .",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion output/csharp/src/Seam/Seam.csproj → src/Seam/Seam.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<PackageId>Seam</PackageId>

<!-- Injected from package.json when a version is cut, by the version
lifecycle script in package.json. Do not edit by hand. -->
<Version>1.3.0</Version>

<Authors>Seam Labs, Inc.</Authors>
Expand Down Expand Up @@ -38,7 +40,7 @@

<ItemGroup>
<None Include="icon.png" Pack="true" PackagePath="icon.png" />
<None Include="README.md" Pack="true" PackagePath="README.md" />
<None Include="../../README.md" Pack="true" PackagePath="README.md" />

<PackageReference Include="JsonSubTypes" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
File renamed without changes
70 changes: 0 additions & 70 deletions src/generate-csproj.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/postgenerate.ts

This file was deleted.

Loading
Loading