Skip to content

Commit

Permalink
vitepress, node test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyraspopov committed Aug 21, 2023
1 parent 93e410a commit 345a8d3
Show file tree
Hide file tree
Showing 11 changed files with 313 additions and 322 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docs

on:
push:
branches: [ master ]
branches: [master]
workflow_dispatch:

jobs:
Expand All @@ -13,14 +13,14 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
node-version: 18
- name: Install docs-related dependencies
run: cd docs && npm install && npm run build && cd ..
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs/.vuepress/dist
build_dir: docs/.vitepress/dist
fqdn: dataclass.js.org
verbose: true
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Testing

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
integration:
Expand All @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20
- run: npm install
- run: npm run build
- run: TARGET=modern npm run test
Expand Down
2 changes: 2 additions & 0 deletions docs/.vitepress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cache
dist
50 changes: 50 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export default {
title: "dataclass",
description: "Data Classes for TypeScript & JavaScript",

lastUpdated: true,

themeConfig: {
nav: [
{ text: "Guide", link: "/guide/" },
{ text: "Reference", link: "/reference/" },
],
sidebar: [
{
text: "Guide",
items: [
{ text: "Introduction", link: "/guide/" },
{ text: "Installation", link: "/guide/installation" },
{ text: "Getting Started", link: "/guide/getting-started" },
{ text: "Objects Equality", link: "/guide/objects-equality" },
{ text: "Serialization & Deserialization", link: "/guide/serialization-deserialization" },
{ text: "Caveats", link: "/guide/caveats" },
{ text: "Migrating", link: "/guide/migrating" },
{ text: "Contributing", link: "/guide/contributing" },
],
},
{
text: "Reference",
items: [{ text: "API Reference", link: "/reference/index" }],
},
],

outline: "deep",

search: {
provider: "local",
},

editLink: {
pattern: "https://github.com/alexeyraspopov/dataclass/edit/master/docs/:path",
},

socialLinks: [{ icon: "github", link: "https://github.com/alexeyraspopov/dataclass" }],
externalLinkIcon: true,

footer: {
message: `Made by <a href="alexeyraspopov.com" rel="noopener noreferrer" target="_blank">Oleksii Raspopov</a> with ❤️`,
copyright: "ISC License &copy; Oleksii Raspopov",
},
},
};
3 changes: 0 additions & 3 deletions docs/.vuepress/.gitignore

This file was deleted.

52 changes: 0 additions & 52 deletions docs/.vuepress/config.js

This file was deleted.

5 changes: 0 additions & 5 deletions docs/.vuepress/styles/index.scss

This file was deleted.

53 changes: 24 additions & 29 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
---
layout: home
hero:
name: dataclass
# text: lorem ipsum
tagline: Data Classes for TypeScript & JavaScript
actions:
- theme: brand
text: Get Started
link: /guide/
- theme: alt
text: GitHub
link: https://github.com/alexeyraspopov/dataclass

home: true
tagline: Data Classes for TypeScript & JavaScript
actions:
Expand All @@ -9,42 +22,24 @@ actions:
link: https://github.com/alexeyraspopov/dataclass
type: secondary
features:
- title: Lightweight
- icon: 🪶
title: Lightweight
details:
The library takes less than 500B in your bundle (min+gzip) while still providing a lot of
flexibility and typings
- title: Immutable
- icon: 🧱
title: Immutable
details: The power of value objects is based on a simple convention that objects never mutate
- title: Delightful
- icon:
title: Delightful
details:
The project is built with developer experience in mind. Coding should be easy and dataclass is
here to help
footer:
Made by <a href="https://twitter.com/alexeyraspopov" rel="noopener noreferrer"
target="_blank">Alexey Raspopov</a> with ❤️
footerHtml: true
---

```ts:no-line-numbers{3,9,13,19}
import { Data } from "dataclass";
// 1. easily describe your data classes using just language features
class User extends Data {
name: string = "Anon";
age: number = 0;
<style>
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: linear-gradient(-30deg, hsl(200deg 100% 65%), var(--vp-c-brand-dark));
}
// 2. instantiate classes while type systems ensure correctness
let user = User.create({ name: "Liza", age: 23 });
// > User { name: "Liza", age: 23 }
// 3. make changes while benefiting from immutable values
let updated = user.copy({ name: "Ann" });
// > User { name: "Ann", age: 23 }
updated = updated.copy({ name: "Liza" });
// > User { name: "Liza", age: 23 }
// 4. compare objects by their value, not reference
console.log(user === updated, user.equals(updated));
// > false, true
```
</style>
7 changes: 3 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"scripts": {
"start": "vuepress dev .",
"build": "vuepress build ."
"start": "vitepress dev .",
"build": "vitepress build ."
},
"dependencies": {
"@vuepress/plugin-search": "^2.0.0-beta.51",
"vuepress": "^2.0.0-beta.51"
"vitepress": "^1.0.0-rc.4"
}
}
Loading

0 comments on commit 345a8d3

Please sign in to comment.