Skip to content

Commit

Permalink
Add GitHub Page Publish Action
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Oct 10, 2024
1 parent 7cc06a2 commit bb0831d
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 19 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/github-page-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: GitHub Page Publish

on:
push:
branches: ['main']
paths-ignore: ['test/**']

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- run: npm install
- run: npm run build
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
enable_jekyll: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ dist-ssr
*.sln
*.sw?

# # Antlr
# Antlr
*.antlr
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CodeMirror Linter Example</title>
<title>Yorkie Schema Test</title>
<style>
.cm-editor {
border: 1px solid #ddd;
Expand All @@ -15,7 +15,7 @@
</style>
</head>
<body>
<h2>CodeMirror Linter</h2>
<h2>Yorkie Schema Test</h2>
<div id="editor"></div>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
Expand Down
44 changes: 30 additions & 14 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,39 @@ const yorkieLinter = linter((view): Array<Diagnostic> => {
});
});

new EditorView({
state: EditorState.create({
doc: `// 🐾 Yorkie Schema Example
const exampleDoc = `// 🐾 Yorkie Schema Test
// This is the root of your document
// Every schema must define a Document type
// Every document should start with 'Document' type.
type Document = {
theme: "light" | "dark";
history: Event[];
text: yorkie.Text;
};
// Primitives
created: boolean; // Boolean
key: string; // String
seq: number; // Number
theme: "light" | "dark"; // String literal with Union
key: string; // Error: duplicated key(TODO)
// Object, Array and User-defined Type
udt1: Change; // User-Defined Type
udt2: UndefinedType; // User-Defined Type: undefined type
arr0: Array; // Array
arr1: Change[]; // Array with []
arr2: Array<Change>; // Array: Type Parameter
obj1: Object<{ key: string; }>; // Object: Type Parameter
obj2: { key: string; }; // Object
type Event = {
statusCode: 200 | 400;
info: string;
};
`,
yobj1: yorkie.Object<{k:number;}>; // yorkie.Object
yobj2: yorkie.Object; // yorkie.Object: Error: requires a generic type
yarr1: yorkie.Array<number>; // yorkie.Array
yarr2: yorkie.Array; // yorkie.Array: Error: requires a generic type
ycnt: yorkie.Counter; // Yorkie Counter
ytree: yorkie.Tree; // Yorkie Tree
ytext: yorkie.Text; // Yorkie Text
ytext: yorkie.Text<{b:boolean;}>; // Yorkie Text: Type Parameter
};`;

new EditorView({
state: EditorState.create({
doc: exampleDoc,
extensions: [basicSetup, yorkieLinter, lintGutter()],
}),
parent: document.getElementById('editor')!,
Expand Down
2 changes: 1 addition & 1 deletion test/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('Schema:User-Defined', () => {
});
});

describe('Schema:Exception', () => {
describe('Schema:Semantic', () => {
it.skip('should not parse a schema with undefined types', () => {
const schema = `
type Document = {
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

export default defineConfig({
base: '',
plugins: [nodePolyfills()],
});
});

0 comments on commit bb0831d

Please sign in to comment.