blazed-past-us 0.7.4 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/blazed-past-us-0.7.6.tgz +0 -0
- package/dist/cli/build.js +6 -5
- package/dist/runtime/render.js +2 -1
- package/dist/server/file-builder.d.ts +1 -1
- package/dist/server/file-builder.js +2 -3
- package/dist/server/server-utils.d.ts +3 -2
- package/dist/server/server-utils.js +4 -1
- package/dist/template/src/main.js +2 -4
- package/dist/template/src/styles/main.css +11 -2
- package/package.json +1 -1
- package/blazed-past-us-0.7.4.tgz +0 -0
- package/dist/template/src/styles/media.css +0 -5
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/gass-git/blazed-past-us/raw/main/bolt.png" width="
|
|
2
|
+
<img src="https://github.com/gass-git/blazed-past-us/raw/main/bolt.png" width="100">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
> 🚧 **Work in progress** This framework is still under active development. Expect changes.
|
|
6
6
|
|
|
7
7
|
# Blazed Past Us..
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Developer centric static blog framework. Write in Markdown from your IDE, share code and SVGs effortlessly, and ship server-rendered HTML for blazing⚡fast load times.
|
|
10
10
|
|
|
11
11
|
## Commit 0
|
|
12
12
|
|
|
Binary file
|
package/dist/cli/build.js
CHANGED
|
@@ -3,7 +3,7 @@ import { parseMarkdown } from '../server/parse-markdown.js';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import fsPromises from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
-
import { getPostsRegistry, handlePostsRegistryUpdate, log, postNotInRegistry, } from '../server/server-utils.js';
|
|
6
|
+
import { getPostsRegistry, handlePostsRegistryUpdate, log, postNotInRegistry, sortPostsByNewest, } from '../server/server-utils.js';
|
|
7
7
|
import { generatePostMetadata, writeTransformedPostFile, } from '../server/file-builder.js';
|
|
8
8
|
import { getSlug } from '../runtime/getters.js';
|
|
9
9
|
/**
|
|
@@ -37,27 +37,28 @@ async function buildBundle(paths) {
|
|
|
37
37
|
const postsFiles = fs.readdirSync(paths.input).filter((f) => f.endsWith('.md'));
|
|
38
38
|
const data = new Array();
|
|
39
39
|
const postsRegistry = { data: await getPostsRegistry(paths.input), update: false };
|
|
40
|
+
const date = new Date().toISOString();
|
|
40
41
|
for (const filename of postsFiles) {
|
|
41
42
|
const filePath = path.join(paths.input, filename);
|
|
42
43
|
const parsedPostData = await parseMarkdown(filePath);
|
|
43
44
|
const htmlFilename = filename.replace('.md', '.html');
|
|
44
45
|
const slug = getSlug(htmlFilename);
|
|
45
|
-
await generatePostMetadata(data, filePath, htmlFilename, parsedPostData.tags, postsRegistry.data);
|
|
46
|
+
await generatePostMetadata(data, filePath, htmlFilename, parsedPostData.tags, postsRegistry.data, date);
|
|
46
47
|
await fsPromises.mkdir(paths.output, { recursive: true });
|
|
47
48
|
await writeTransformedPostFile(path.join(paths.output, htmlFilename), parsedPostData.html, filename);
|
|
48
49
|
if (postNotInRegistry(postsRegistry.data, slug)) {
|
|
49
50
|
postsRegistry.update = true;
|
|
50
|
-
const stats = await fsPromises.stat(filePath);
|
|
51
51
|
postsRegistry.data?.push({
|
|
52
52
|
slug: getSlug(htmlFilename),
|
|
53
|
-
created:
|
|
53
|
+
created: date,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
if (postsRegistry.update) {
|
|
58
58
|
handlePostsRegistryUpdate(postsRegistry.data, paths);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const sortedData = sortPostsByNewest(data);
|
|
61
|
+
const jsonPosts = JSON.stringify(sortedData);
|
|
61
62
|
fs.writeFileSync(path.join(paths.output, '/data.json'), jsonPosts);
|
|
62
63
|
log('all posts have been parsed into HTML ✅', 'yellow');
|
|
63
64
|
}
|
package/dist/runtime/render.js
CHANGED
|
@@ -4,7 +4,8 @@ function render(view, root, views, postsMetadata, postsHTML, postTagsFilter, pos
|
|
|
4
4
|
const { home, post, notFound } = views;
|
|
5
5
|
switch (view) {
|
|
6
6
|
case 'home':
|
|
7
|
-
|
|
7
|
+
const tags = postTagsFilter?.split(',');
|
|
8
|
+
inject(r, home(tags, postsMetadata));
|
|
8
9
|
break;
|
|
9
10
|
case 'post':
|
|
10
11
|
if (postSlug && postExists(postsMetadata, postSlug)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PostMetadata, PostsRegistry } from '../types';
|
|
2
2
|
declare function writeTransformedPostFile(outputPath: string, postHtmlContent: string, filename: string): Promise<void>;
|
|
3
|
-
declare function generatePostMetadata(data: Array<PostMetadata>, filePath: string, htmlFilename: string, postTags: string[], persistentPostsMetadata: PostsRegistry | void): Promise<void>;
|
|
3
|
+
declare function generatePostMetadata(data: Array<PostMetadata>, filePath: string, htmlFilename: string, postTags: string[], persistentPostsMetadata: PostsRegistry | void, date: string): Promise<void>;
|
|
4
4
|
export { generatePostMetadata, writeTransformedPostFile };
|
|
@@ -7,11 +7,10 @@ async function writeTransformedPostFile(outputPath, postHtmlContent, filename) {
|
|
|
7
7
|
.then(() => console.log(chalk.green(`✔ ${filename}`)))
|
|
8
8
|
.catch((error) => console.error(error));
|
|
9
9
|
}
|
|
10
|
-
async function generatePostMetadata(data, filePath, htmlFilename, postTags, persistentPostsMetadata) {
|
|
11
|
-
const stats = await fsPromises.stat(filePath);
|
|
10
|
+
async function generatePostMetadata(data, filePath, htmlFilename, postTags, persistentPostsMetadata, date) {
|
|
12
11
|
const fileContent = await fsPromises.readFile(filePath, 'utf-8');
|
|
13
12
|
const slug = getSlug(htmlFilename);
|
|
14
|
-
const createdDate = persistentPostsMetadata?.find((p) => p.slug === slug)?.created ||
|
|
13
|
+
const createdDate = persistentPostsMetadata?.find((p) => p.slug === slug)?.created || date;
|
|
15
14
|
data.push({
|
|
16
15
|
slug: getSlug(htmlFilename),
|
|
17
16
|
filename: htmlFilename,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MsgColor, PostsPaths, PostsRegistry } from '../types';
|
|
1
|
+
import { MsgColor, PostMetadata, PostsPaths, PostsRegistry } from '../types';
|
|
2
2
|
import type { Plugin } from 'unified';
|
|
3
3
|
import type { Root } from 'mdast';
|
|
4
4
|
declare function postNotInRegistry(registry: PostsRegistry | [] | void, slug: string): boolean;
|
|
@@ -7,4 +7,5 @@ declare function getPostsRegistry(postsDirectoryPath: string): Promise<void | Po
|
|
|
7
7
|
declare function copyRecursive(src: string, destination: string): void;
|
|
8
8
|
declare function log(msg: string, color: MsgColor): void;
|
|
9
9
|
declare const remarkInlineSvg: Plugin<[], Root, Root>;
|
|
10
|
-
|
|
10
|
+
declare function sortPostsByNewest(postsMetadata: PostMetadata[]): PostMetadata[];
|
|
11
|
+
export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
|
|
@@ -93,4 +93,7 @@ const remarkInlineSvg = function () {
|
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
function sortPostsByNewest(postsMetadata) {
|
|
97
|
+
return postsMetadata.sort((a, b) => b.created.localeCompare(a.created));
|
|
98
|
+
}
|
|
99
|
+
export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
|
|
@@ -6,10 +6,8 @@ import layout from './layout';
|
|
|
6
6
|
|
|
7
7
|
const { postsMetadata, postsHTML } = await blazed.fetchResources(config);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
initRouter(document.getElementById('root'), postsMetadata, postsHTML);
|
|
12
|
-
}, 5000);
|
|
9
|
+
blazed.inject(document.body, layout());
|
|
10
|
+
initRouter(document.getElementById('root'), postsMetadata, postsHTML);
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* ----------------------------
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
@import 'fonts.css';
|
|
2
|
-
@import 'media.css';
|
|
3
2
|
@import 'animations.css';
|
|
4
3
|
@import 'loader.css';
|
|
5
4
|
@import 'post.css';
|
|
@@ -8,7 +7,7 @@
|
|
|
8
7
|
@import 'home.css';
|
|
9
8
|
|
|
10
9
|
:root {
|
|
11
|
-
--background: #
|
|
10
|
+
--background: #172330;
|
|
12
11
|
--max-width: 55rem;
|
|
13
12
|
--neon: #82f9ff;
|
|
14
13
|
--post-title-color: rgb(241, 241, 241);
|
|
@@ -85,3 +84,13 @@ canvas {
|
|
|
85
84
|
font-size: 0.85rem;
|
|
86
85
|
text-transform: uppercase;
|
|
87
86
|
}
|
|
87
|
+
|
|
88
|
+
@media (max-width: 60rem) {
|
|
89
|
+
header {
|
|
90
|
+
width: clamp(95%, 95%, 95%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
section {
|
|
94
|
+
width: clamp(95%, 95%, 95%);
|
|
95
|
+
}
|
|
96
|
+
}
|
package/package.json
CHANGED
package/blazed-past-us-0.7.4.tgz
DELETED
|
Binary file
|