Compare commits
8 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 545e8c7315 | |||
| e3bcebe078 | |||
| 47dfb1bc67 | |||
| c1b24a1d5f | |||
| 6494a3bbed | |||
| 08bcc85c93 | |||
| 62862b560f | |||
| 4c4730e812 |
5 changed files with 1414 additions and 1720 deletions
3
.husky/post-commit
Normal file
3
.husky/post-commit
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
echo "post-commit..."
|
||||||
|
git push gh
|
||||||
|
git push sh
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
> **>>> TL;DR:** This facilitates the *creation* and *usage* of global, immutable data for [Astro](https://astro.build) apps
|
> [!NOTE]
|
||||||
|
> This project moved to [SourceHut](https://git.sr.ht/~ayoayco/astro-resume).
|
||||||
|
|
||||||
# Astro Resume
|
# Astro Resume
|
||||||
|
|
||||||
|
|
@ -176,7 +177,7 @@ console.log(now instanceof Date); // true
|
||||||
## Errors & Warning in `deserialize()`
|
## Errors & Warning in `deserialize()`
|
||||||
|
|
||||||
The `deserialize()` function may give you the following:
|
The `deserialize()` function may give you the following:
|
||||||
1. **ERR: No match found** - there are no `JSON` scripts with the given ID
|
1. **ERR: No match found** - there are no `JSON` scripts with the given ID
|
||||||
1. **WARNING: Multiple matches for <id>** - there were multiple `JSON` scripts found with the same ID
|
1. **WARNING: Multiple matches for <id>** - there were multiple `JSON` scripts found with the same ID
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
@ -204,4 +205,3 @@ See the [TODO tracker](https://todo.sr.ht/~ayoayco/astro-resume) for planned wor
|
||||||
## Reporting Issues
|
## Reporting Issues
|
||||||
|
|
||||||
To report issues or request features, send a plain text email to [~ayoayco/astro-resume@todo.sr.ht](mailto:~ayoayco/astro-resume@todo.sr.ht) or file a ticket via [SourceHut](https://todo.sr.ht/~ayoayco/astro-resume)
|
To report issues or request features, send a plain text email to [~ayoayco/astro-resume@todo.sr.ht](mailto:~ayoayco/astro-resume@todo.sr.ht) or file a ticket via [SourceHut](https://todo.sr.ht/~ayoayco/astro-resume)
|
||||||
|
|
||||||
|
|
|
||||||
22
package.json
22
package.json
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "@ayco/astro-resume",
|
"name": "@ayco/astro-resume",
|
||||||
"author": "Ayo Ayco",
|
"author": "Ayo Ayco",
|
||||||
"homepage": "https://github.com/ayoayco/astro-resume",
|
"homepage": "https://ayco.io/sh/astro-resume",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/ayoayco/astro-resume"
|
"url": "https://git.sr.ht/~ayoayco/astro-resume"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.4.2",
|
"version": "0.4.3",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"astro-component",
|
"astro-component",
|
||||||
"css",
|
"css",
|
||||||
|
|
@ -23,18 +23,20 @@
|
||||||
"index.ts"
|
"index.ts"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
|
||||||
"start": "astro dev",
|
|
||||||
"build": "astro build",
|
|
||||||
"preview": "astro preview",
|
|
||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
|
"dev": "astro telemetry disable && astro dev",
|
||||||
|
"start": "astro telemetry disable && astro dev",
|
||||||
|
"build": "astro telemetry disable && astro build",
|
||||||
|
"preview": "astro preview",
|
||||||
"publish:patch": "npm version patch && npm publish --access public",
|
"publish:patch": "npm version patch && npm publish --access public",
|
||||||
"publish:minor": "npm version minor && npm publish --access public"
|
"publish:minor": "npm version minor && npm publish --access public",
|
||||||
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"devalue": "^5.1.1"
|
"devalue": "^5.1.1",
|
||||||
|
"husky": "^9.1.7"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"astro": "^4.12.2"
|
"astro": "^5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3043
pnpm-lock.yaml
3043
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
|
@ -2,43 +2,43 @@
|
||||||
import Serialize from "../Serialize.astro";
|
import Serialize from "../Serialize.astro";
|
||||||
import { stringify } from "devalue";
|
import { stringify } from "devalue";
|
||||||
const data = {
|
const data = {
|
||||||
name: 'John Doe',
|
nameStr: "John Doe",
|
||||||
isOkay: true,
|
isOkayBool: true,
|
||||||
mood: null,
|
moodNull: null,
|
||||||
now: new Date(),
|
nowDate: new Date(),
|
||||||
age: BigInt('3218378192378')
|
ageBigInt: BigInt("3218378192378"),
|
||||||
}
|
};
|
||||||
export type Data = typeof data;
|
export type Data = typeof data;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div id="render-here"></div>
|
<div id="render-here"></div>
|
||||||
<Serialize data={data} id="my-data" use={stringify}/>
|
<Serialize data={data} id="my-data" use={stringify} />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { deserialize } from '../deserialize';
|
import { deserialize } from "../deserialize";
|
||||||
import { parse } from 'devalue';
|
import { parse } from "devalue";
|
||||||
import type { Data } from './index.astro';
|
import type { Data } from "./index.astro";
|
||||||
|
|
||||||
const data = deserialize<Data>('my-data', parse);
|
const data = deserialize<Data>("my-data", parse);
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|
||||||
Object.keys(data).forEach(key => console.log(key, data[key], typeof data[key]))
|
|
||||||
|
|
||||||
// render table to render-here
|
|
||||||
const table = document.createElement('table');
|
|
||||||
const tbody = document.createElement('tbody');
|
|
||||||
table.appendChild(tbody);
|
|
||||||
Object.keys(data).forEach(key => {
|
|
||||||
const tr = document.createElement('tr');
|
|
||||||
const tdKey = document.createElement('td');
|
|
||||||
const tdValue = document.createElement('td');
|
|
||||||
tdKey.textContent = key;
|
|
||||||
tdValue.textContent = data[key];
|
|
||||||
tr.appendChild(tdKey);
|
|
||||||
tr.appendChild(tdValue);
|
|
||||||
tbody.appendChild(tr);
|
|
||||||
});
|
|
||||||
document.getElementById('render-here').appendChild(table);
|
|
||||||
|
|
||||||
|
Object.keys(data).forEach((key) =>
|
||||||
|
console.log(key, data[key], typeof data[key])
|
||||||
|
);
|
||||||
|
|
||||||
|
// render table to render-here
|
||||||
|
const table = document.createElement("table");
|
||||||
|
const tbody = document.createElement("tbody");
|
||||||
|
table.appendChild(tbody);
|
||||||
|
Object.keys(data).forEach((key) => {
|
||||||
|
const tr = document.createElement("tr");
|
||||||
|
const tdKey = document.createElement("td");
|
||||||
|
const tdValue = document.createElement("td");
|
||||||
|
tdKey.textContent = key;
|
||||||
|
tdValue.textContent = data[key];
|
||||||
|
tr.appendChild(tdKey);
|
||||||
|
tr.appendChild(tdValue);
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
});
|
||||||
|
document.getElementById("render-here").appendChild(table);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue