Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 616-diff-style
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed May 21, 2024
2 parents 4692623 + 7cd65b2 commit dd119a6
Show file tree
Hide file tree
Showing 66 changed files with 2,743 additions and 3,540 deletions.
6 changes: 0 additions & 6 deletions .changeset/slimy-dolphins-add.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tame-deers-whisper.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Main

on:
pull_request:
types: [ opened, synchronize, reopened ]
types: [ opened, synchronize, reopened, edited, assigned ]
pull_request_target:
types: [ opened, synchronize, reopened, edited ]
types: [ opened, synchronize, reopened, edited, assigned ]
branches:
- changeset-release/main

Expand Down
14 changes: 14 additions & 0 deletions apps/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @codeimage/api

## 0.4.1

### Patch Changes

- [#631](https://github.com/riccardoperra/codeimage/pull/631) [`d8b472a2`](https://github.com/riccardoperra/codeimage/commit/d8b472a2a3ddc1fd113d89688d045755046ee8b0) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat: add support for go lang

## 0.4.0

### Minor Changes

- [#611](https://github.com/riccardoperra/codeimage/pull/611) [`e94e8a2d`](https://github.com/riccardoperra/codeimage/commit/e94e8a2d5ec01cddd7593c837bf59f55b8a4e231) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat(app,api) add new border type glass option

- [#624](https://github.com/riccardoperra/codeimage/pull/624) [`9e537bcd`](https://github.com/riccardoperra/codeimage/commit/9e537bcdf92ffaf43eb5e38f5f7fb578eaef9709) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat(app,api): add line number start option

## 0.3.2

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeimage/api",
"version": "0.3.2",
"version": "0.4.1",
"description": "CodeImage api rest server",
"main": "app.ts",
"type": "module",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@prisma/client": "^4.15.0",
"@sinclair/typebox": "^0.28.15",
"close-with-grace": "^1.2.0",
"dotenv": "^16.1.4",
"dotenv": "^16.3.1",
"dotenv-cli": "^6.0.0",
"fastify": "^4.18.0",
"fastify-auth0-verify": "^1.2.0",
Expand All @@ -71,7 +71,7 @@
"tsup": "6.7.0",
"tsx": "3.12.7",
"typescript": "~5.3.2",
"vite": "^4.3.9",
"vite": "^4.5.1",
"vitest": "^0.31.4"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "SnippetTerminal" ADD COLUMN "borderType" TEXT;
1 change: 1 addition & 0 deletions apps/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ model SnippetTerminal {
showGlassReflection Boolean @default(false)
opacity Float @default(100)
alternativeTheme Boolean @default(false)
borderType String?
}

model SnippetEditorOptions {
Expand Down
10 changes: 10 additions & 0 deletions apps/api/src/common/typebox/enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {TString, Type} from '@sinclair/typebox';

export const enumLiteral = <T extends string>(values: T[]): TString => {
const literals = values.map(value => Type.Literal(value));
// TODO: validation should work but type must work as a string...
return Type.Intersect([
Type.Union(literals),
Type.String(),
]) as unknown as TString;
};
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function makePrismaProjectRepository(
showWatermark: data.terminal.showWatermark,
textColor: data.terminal.textColor,
type: data.terminal.type,
borderType: data.terminal.borderType,
},
},
},
Expand Down Expand Up @@ -188,6 +189,7 @@ export function makePrismaProjectRepository(
showWatermark: data.terminal.showWatermark,
textColor: data.terminal.textColor,
type: data.terminal.type,
borderType: data.terminal.borderType,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function createProjectRequestMapper(
data.terminal.alternativeTheme ??
SnippetTerminalCreateRequestSchema.properties.alternativeTheme.default,
shadow: data.terminal.shadow ?? null,
borderType: data.terminal.borderType ?? null,
},
editorOptions: {
fontWeight: data.editorOptions.fontWeight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function createCompleteProjectGetByIdResponseMapper(
accentVisible: data.terminal.accentVisible,
alternativeTheme: data.terminal.alternativeTheme,
shadow: data.terminal.shadow,
borderType: data.terminal.borderType as 'glass' | null,
},
editorOptions: {
id: data.editorOptions.id,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/modules/project/schema/project-create.schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Static, Type} from '@sinclair/typebox';
import {Nullable} from '../../../common/typebox/nullable.js';
import {SnippetTerminalBorderType} from './project.schema.js';

export const SnippetFrameCreateRequestSchema = Type.Object(
{
Expand Down Expand Up @@ -45,6 +46,7 @@ export const SnippetTerminalCreateRequestSchema = Type.Object(
opacity: Nullable(Type.Number({minimum: 0, maximum: 100, default: 100})),
showHeader: Type.Boolean(),
showWatermark: Nullable(Type.Boolean({default: true})),
borderType: Nullable(SnippetTerminalBorderType),
},
{title: 'SnippetTerminalCreateRequest'},
);
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/modules/project/schema/project-update.schema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Static, Type} from '@sinclair/typebox';
import {Nullable} from '../../../common/typebox/nullable.js';
import {SnippetTerminalBorderType} from './project.schema.js';

export const SnippetFrameUpdateRequestSchema = Type.Object(
{
Expand Down Expand Up @@ -40,6 +41,7 @@ const SnippetTerminalUpdateRequestSchema = Type.Object(
showWatermark: Type.Boolean(),
textColor: Nullable(Type.String()),
type: Type.String(),
borderType: Nullable(SnippetTerminalBorderType),
},
{title: 'SnippetTerminalUpdateRequest'},
);
Expand Down
4 changes: 4 additions & 0 deletions apps/api/src/modules/project/schema/project.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Type} from '@sinclair/typebox';
import {enumLiteral} from '../../../common/typebox/enum.js';
import {Nullable} from '../../../common/typebox/nullable.js';

export const BaseProjectResponseSchema = Type.Object(
Expand Down Expand Up @@ -34,6 +35,8 @@ export const BaseSnippetFrameSchema = Type.Object({
opacity: Type.Number(),
});

export const SnippetTerminalBorderType = enumLiteral(['glass'] as const);

export const BaseSnippetTerminalSchema = Type.Object({
id: Type.String({format: 'uuid'}),
showHeader: Type.Boolean(),
Expand All @@ -46,6 +49,7 @@ export const BaseSnippetTerminalSchema = Type.Object({
showGlassReflection: Type.Boolean(),
opacity: Type.Number(),
alternativeTheme: Type.Boolean(),
borderType: Nullable(SnippetTerminalBorderType),
});

export const BaseSnippetEditorOptionsSchema = Type.Object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ test('should map ProjectCreateRequest to Prisma ProjectCreateRequest with defaul
shadow: null,
textColor: null,
accentVisible: null,
borderType: null,
},
name: 'Untitled',
editors: [],
Expand Down Expand Up @@ -53,6 +54,7 @@ test('should map ProjectCreateRequest to Prisma ProjectCreateRequest with defaul
showWatermark: true,
opacity: 100,
showHeader: true,
borderType: null,
},
editors: [],
name: 'Untitled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ test('should map Prisma ProjectGetByIdResponse to schema ProjectGetByIdResponse'
shadow: null,
textColor: null,
accentVisible: true,
borderType: 'glass',
},
editorOptionsId: 'editorOptionsId',
terminalId: 'terminalId',
Expand Down Expand Up @@ -75,6 +76,7 @@ test('should map Prisma ProjectGetByIdResponse to schema ProjectGetByIdResponse'
showWatermark: false,
opacity: 100,
showHeader: true,
borderType: 'glass',
},
editorOptions: {
id: 'editorOptionsId',
Expand Down
4 changes: 3 additions & 1 deletion apps/api/test/routes/v1/project/update.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ test<TestContext>('POST /v1/project/:id [Update Project] -> 200', async context
alternativeTheme: true,
accentVisible: false,
type: 'windows',
borderType: 'glass',
},
};

Expand Down Expand Up @@ -125,7 +126,8 @@ test<TestContext>('POST /v1/project/:id [Update Project] -> 200', async context
alternativeTheme: true,
accentVisible: false,
type: 'windows',
} as ProjectUpdateResponse['terminal'],
borderType: 'glass',
} satisfies ProjectUpdateResponse['terminal'],
'return updated terminal',
);
assert.deepStrictEqual(
Expand Down
37 changes: 37 additions & 0 deletions apps/codeimage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# @codeimage/app

## 1.6.2

### Patch Changes

- Updated dependencies [[`7f715bd2`](https://github.com/riccardoperra/codeimage/commit/7f715bd2db3424503702a1156d69dbf1fbfeb10c)]:
- @codeimage/dom-export@1.11.5

## 1.6.1

### Patch Changes

- [#631](https://github.com/riccardoperra/codeimage/pull/631) [`d8b472a2`](https://github.com/riccardoperra/codeimage/commit/d8b472a2a3ddc1fd113d89688d045755046ee8b0) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat: add support for go lang

- Updated dependencies [[`d8b472a2`](https://github.com/riccardoperra/codeimage/commit/d8b472a2a3ddc1fd113d89688d045755046ee8b0)]:
- @codeimage/api@0.4.1
- @codeimage/atomic-state@1.0.1
- @codeimage/config@8.2.6
- @codeimage/dom-export@1.11.4
- @codeimage/highlight@0.10.9
- @codeimage/ui@0.10.4
- @codeimage/vanilla-extract@0.2.1

## 1.6.0

### Minor Changes

- [#611](https://github.com/riccardoperra/codeimage/pull/611) [`e94e8a2d`](https://github.com/riccardoperra/codeimage/commit/e94e8a2d5ec01cddd7593c837bf59f55b8a4e231) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat(app,api) add new border type glass option

- [#624](https://github.com/riccardoperra/codeimage/pull/624) [`9e537bcd`](https://github.com/riccardoperra/codeimage/commit/9e537bcdf92ffaf43eb5e38f5f7fb578eaef9709) Thanks [@riccardoperra](https://github.com/riccardoperra)! - feat(app,api): add line number start option

- [#625](https://github.com/riccardoperra/codeimage/pull/625) [`4d27d146`](https://github.com/riccardoperra/codeimage/commit/4d27d1468451ee36a64613a03a167ed607aee0ba) Thanks [@SarjuHansaliya](https://github.com/SarjuHansaliya)! - feat: allow zero padding

### Patch Changes

- Updated dependencies [[`e94e8a2d`](https://github.com/riccardoperra/codeimage/commit/e94e8a2d5ec01cddd7593c837bf59f55b8a4e231), [`9e537bcd`](https://github.com/riccardoperra/codeimage/commit/9e537bcdf92ffaf43eb5e38f5f7fb578eaef9709)]:
- @codeimage/api@0.4.0

## 1.5.1

### Patch Changes
Expand Down
35 changes: 35 additions & 0 deletions apps/codeimage/changelog/1-6-0_04-27-2024.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import newBorderOptionUrl from './data/1-6-0/new-border-option.mp4';
import startingLineNumberUrl from './data/1-6-0/starting-line-number.mp4';
import {MdxVideo} from '../src/mdx/Video';
import {mdxComponents} from '../src/mdx/components';

# v1.6.0

<mdxComponents.h3>🎨 New Window border options</mdxComponents.h3>

Editor has been updated allowing to update the window border options. With this update,
a new macOS-like border is now available for everyone.

You'll be able to update the border type through the new `border` option.

<MdxVideo src={newBorderOptionUrl} ratio={'4/3'}/>

## 🖥️ Starting line number

Thanks to [@alexandercerutti](https://github.com/alexandercerutti), the editor
will now let you decide the starting line number of your code.

<MdxVideo src={startingLineNumberUrl} ratio={'4/3'} />


## Changes
* feat(app): allow zero padding by [@SarjuHansaliya](https://github.com/SarjuHansaliya) in [!625](https://github.com/riccardoperra/codeimage/pull/625)
* feat(app,api): add line number start option by [@riccardoperra](https://github.com/riccardoperra) in [!624](https://github.com/riccardoperra/codeimage/pull/624)
* feat(app,api) add new border type glass option by [@riccardoperra](https://github.com/riccardoperra) in [!611](https://github.com/riccardoperra/codeimage/pull/611)

## New Contributors
* [@SarjuHansaliya](https://github.com/SarjuHansaliya) made their first contribution in [!625](https://github.com/riccardoperra/codeimage/pull/625)
* [@alexandercerutti](https://github.com/alexandercerutti) made their first contribution in [!615](https://github.com/riccardoperra/codeimage/issues/615)



Binary file not shown.
Binary file not shown.
Loading

0 comments on commit dd119a6

Please sign in to comment.