Skip to content

Commit

Permalink
rebrand to aubade (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatiusmb committed Feb 23, 2024
1 parent 685f0c1 commit efa5f71
Show file tree
Hide file tree
Showing 46 changed files with 165 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
registry-url: https://registry.npmjs.org

- run: pnpm install
- run: pnpm publish ./workspace/marqua --no-git-checks
- run: pnpm publish ./workspace/aubade --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contributing goes a long way, there are lots of ways you can still help, even if

## Testing

The easiest way to contribute! By just using the software, you're already helping the project grows. Simply use and let us know if you run into problems, or there's some use case you would like to use it for but are not yet covered, this is the most common way we uncover bugs or implement new features. Open a [new issue](https://github.com/ignatiusmb/marqua/issues/new/choose) or start a [new discussion](https://github.com/ignatiusmb/marqua/discussions/new).
The easiest way to contribute! By just using the software, you're already helping the project grows. Simply use and let us know if you run into problems, or there's some use case you would like to use it for but are not yet covered, this is the most common way we uncover bugs or implement new features. Open a [new issue](https://github.com/ignatiusmb/aubade/issues/new/choose) or start a [new discussion](https://github.com/ignatiusmb/aubade/discussions/new).

## Documentation

Expand All @@ -29,19 +29,19 @@ The next step is to checkout the code by forking and cloning the repository.

### Scripts

The first script to run is `"watch"` in `workspace/marqua`, this will compile and watch for changes in the source code. The next step is to run the dev server with `"dev"` in `workspace/documentation`, this will host the documentation site locally and it's the easiest way to see the code changes that you do in `workspace/marqua` source.
The first script to run is `"watch"` in `workspace/aubade`, this will compile and watch for changes in the source code. The next step is to run the dev server with `"dev"` in `workspace/website`, this will host the documentation site locally and it's the easiest way to see the code changes that you do in `workspace/aubade` source.

### Structure

How the project and code is structured, and some entry points to be aware of

- `workspace/content` - unprocessed markdown files containing all of the documentation
- `workspace/marqua/src/core` - marqua core module, compiler components
- `workspace/marqua/src/artisan` - marqua artisan module, syntax highlighter and marker
- `workspace/marqua/src/browser` - marqua browser module, DOM hydrating function
- `workspace/marqua/src/fs` - marqua file system module, read markdown files from disk
- `workspace/marqua/src/transform` - marqua transform module, transformers for `traverse`
- `workspace/marqua/styles` - stylesheets used and exported
- `workspace/aubade/src/core` - aubade core module, compiler components
- `workspace/aubade/src/artisan` - aubade artisan module, syntax highlighter and marker
- `workspace/aubade/src/browser` - aubade browser module, DOM hydrating function
- `workspace/aubade/src/compass` - aubade compass module, read files from disk
- `workspace/aubade/src/transform` - aubade transform module, transformers for `traverse`
- `workspace/aubade/styles` - stylesheets used and exported
- `workspace/website` - source code for the website

## Maintaining
Expand All @@ -50,6 +50,6 @@ For maintainers of the project.

### Publishing

0. prepare a [new release draft](https://github.com/ignatiusmb/marqua/releases/new) with a new tag
1. bump version in [`package.json`](workspace/marqua/package.json) and commit with `~ vX.Y.Z`
0. prepare a [new release draft](https://github.com/ignatiusmb/aubade/releases/new) with a new tag
1. bump version in [`package.json`](workspace/aubade/package.json) and commit with `~ vX.Y.Z`
2. publish release draft and title release with `X.Y.Z`
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Marqua ![Total npm downloads](https://img.shields.io/npm/dt/marqua) · ![Published npm version](https://img.shields.io/npm/v/marqua) ![Monthly npm downloads](https://img.shields.io/npm/dm/marqua) ![License](https://img.shields.io/github/license/ignatiusmb/marqua)
# Aubade ![Total npm downloads](https://img.shields.io/npm/dt/aubade) · ![Published npm version](https://img.shields.io/npm/v/aubade) ![Monthly npm downloads](https://img.shields.io/npm/dm/aubade) ![License](https://img.shields.io/github/license/ignatiusmb/aubade)

- Visit the documentation at <https://marqua.mauss.dev> to learn more.
- See <https://github.com/ignatiusmb/marqua/releases> to stay updated.
- Visit the documentation at <https://aubade.mauss.dev> to learn more.
- See <https://github.com/ignatiusmb/aubade/releases> to stay updated.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) to develop locally.

<h3 align="center"><pre>Marqua | <a href="LICENSE">MIT License</a></pre></h3>
<h3 align="center"><pre>Aubade | <a href="LICENSE">MIT License</a></pre></h3>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"lint": "pnpm --filter \"./workspace/*\" lint",
"test": "pnpm --filter \"./workspace/*\" test",
"format": "pnpm --filter \"./workspace/*\" format",
"postinstall": "cd ./workspace/marqua && pnpm prepublish"
"postinstall": "cd ./workspace/aubade && pnpm prepublish"
},
"packageManager": "pnpm@8.14.0",
"prettier": "mauss/prettier.json",
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "marqua",
"name": "aubade",
"version": "0.6.1",
"description": "Data Authoring Framework",
"repository": "github:ignatiusmb/marqua",
"repository": "github:ignatiusmb/aubade",
"author": "Ignatius Bagus",
"license": "MIT",
"type": "module",
Expand All @@ -28,9 +28,9 @@
"types": "./index.d.ts",
"default": "./src/browser/index.js"
},
"./fs": {
"./compass": {
"types": "./index.d.ts",
"default": "./src/fs/index.js"
"default": "./src/compass/index.js"
},
"./transform": {
"types": "./index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ await createBundle({
output: 'index.d.ts',
modules: Object.keys(exports).reduce((acc, key) => {
if (key.slice(2).includes('.')) return acc; // skip non-modules
return { ...acc, ['marqua' + key.slice(1)]: exports[key].default };
return { ...acc, ['aubade' + key.slice(1)]: exports[key].default };
}, {}),
});

Expand All @@ -16,6 +16,6 @@ for (const subpath of Object.keys(exports).filter((k) => k.includes('*'))) {
const files = fs.readdirSync(parent).filter((f) => f.endsWith(ext));
fs.writeFileSync(
`${parent}/index.d.ts`,
files.map((f) => `declare module 'marqua/${parent.slice(2)}/${f}' {}`).join('\n'),
files.map((f) => `declare module 'aubade/${parent.slice(2)}/${f}' {}`).join('\n'),
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,20 @@ import { parse } from '../core/index.js';
* @param {string} entry
* @returns {Output & import('../types.js').Metadata & { content: string }}
*/
export function compile(entry) {
export function visit(entry) {
const { body, metadata } = parse(fs.readFileSync(entry, 'utf-8'));
const result = { ...metadata, content: marker.render(body) };
return /** @type {any} */ (result);
}

/**
* @template {{
* entry: string;
* @param {string} entry
* @param {{
* depth?: number;
* files?(path: string): boolean;
* }} Options
* @template {object} Output
* @template [Transformed = Array<Output & import('../types.js').Metadata>]
*
* @param {Options} options
* @param {(chunk: import('../types.js').HydrateChunk) => undefined | Output} hydrate
* @param {(items: Array<Output & import('../types.js').Metadata>) => Transformed} [transform]
* @returns {Transformed}
* }} [options]
*/
export function traverse(
{ entry, depth: level = 0, files = (v) => v.endsWith('.md') },
hydrate,
transform = (v) => /** @type {Transformed} */ (v),
) {
export function traverse(entry, { depth: level = 0, files = (v) => v.endsWith('.md') } = {}) {
/** @type {import('../types.js').HydrateChunk['siblings']} */
const tree = fs.readdirSync(entry).map((name) => {
const path = join(entry, name);
Expand All @@ -45,20 +34,32 @@ export function traverse(
};
});

const backpack = tree.flatMap(({ type, breadcrumb, buffer }) => {
const path = [...breadcrumb].reverse().join('/');
if (type === 'file') {
if (!files(path)) return [];
const siblings = tree.filter(({ breadcrumb: [name] }) => name !== breadcrumb[0]);
return hydrate({ breadcrumb, buffer, marker, parse, siblings }) ?? [];
} else if (level !== 0) {
const depth = level < 0 ? level : level - 1;
return traverse({ entry: path, depth, files }, hydrate);
}
return [];
});
return {
/**
* @template {object} Output
* @template Transformed
*
* @param {(chunk: import('../types.js').HydrateChunk) => undefined | Output} load
* @param {(items: Output[]) => Transformed} [transform]
* @returns {Transformed}
*/
hydrate(load, transform = (v) => /** @type {Transformed} */ (v)) {
const backpack = tree.flatMap(({ type, breadcrumb, buffer }) => {
const path = [...breadcrumb].reverse().join('/');
if (type === 'file') {
if (!files(path)) return [];
const siblings = tree.filter(({ breadcrumb: [name] }) => name !== breadcrumb[0]);
return load({ breadcrumb, buffer, marker, parse, siblings }) ?? [];
} else if (level !== 0) {
const depth = level < 0 ? level : level - 1;
return traverse(path, { depth, files }).hydrate(load);
}
return [];
});

return transform(/** @type {any} */ (backpack));
return transform(/** @type {any} */ (backpack));
},
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function parse(source) {

/** table of contents */
get table() {
/** @type {import('../types.js').MarquaTable[]} */
/** @type {import('../types.js').AubadeTable[]} */
const table = [];
for (const line of stuffed.split('\n')) {
const match = line.trim().match(/^(#{2,4}) (.+)/);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ tags: [x, y, z]
tags: ['x', 'y', 'z'],
});
});
suites['construct/']('construct marqua rules', () => {
suites['construct/']('construct aubade rules', () => {
const index = core.construct(
`
title: Marqua Rules
title: Aubade Rules
date:published: 2023-02-01
a:b:x: 0
a:b:y: 1
Expand All @@ -33,7 +33,7 @@ a:b:z: 2
);

assert.equal(index, {
title: 'Marqua Rules',
title: 'Aubade Rules',
date: { published: '2023-02-01' },
a: { b: { x: '0', y: '1', z: '2' } },
});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ export interface HydrateChunk {

export interface Metadata {
estimate: number;
table: MarquaTable[];
table: AubadeTable[];
}

export interface MarquaData {
export interface AubadeData {
type: string;
title: string;
body: string | MarquaData[];
body: string | AubadeData[];
}

export interface MarquaTable {
export interface AubadeTable {
id: string;
level: number;
title: string;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { suite } from 'uvu';
import * as assert from 'uvu/assert';
import { traverse } from '../../../src/fs/index.js';
import { traverse } from '../../../src/compass/index.js';
import { readJSON } from '../utils.js';

const basics = {
Expand All @@ -11,7 +11,7 @@ const basics = {
const target = `${process.cwd()}/test/apps/multiple`;

basics.standard('standard traversal', () => {
const output = traverse({ entry: `${target}/standard/input` }, ({ buffer, marker, parse }) => {
const output = traverse(`${target}/standard/input`).hydrate(({ buffer, marker, parse }) => {
const { body, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(body) };
});
Expand All @@ -24,8 +24,7 @@ basics.standard('standard traversal', () => {
});

basics.depth('depth traversal', () => {
const output = traverse(
{ entry: `${target}/depth/input`, depth: 1 },
const output = traverse(`${target}/depth/input`, { depth: 1 }).hydrate(
({ buffer, marker, parse }) => {
const { body, metadata } = parse(buffer.toString('utf-8'));
return { ...metadata, content: marker.render(body) };
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions workspace/content/00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Introduction
---

## What is Marqua?
## What is Aubade?

Marqua is a data authoring framework for writing and organizing your content away from your code, designed to be flexible and adaptable with any frameworks. It helps you focus on writing your content by collocating your articles with their assets, and providing you with the necessary tools to turn them into a data source for your website.
Aubade is a data authoring framework for writing and organizing your content away from your code, designed to be flexible and adaptable with any frameworks. It helps you focus on writing your content by collocating your articles with their assets, and providing you with the necessary tools to turn them into a data source for your website.

## Why separate content from code

Expand All @@ -16,8 +16,8 @@ It will not only help the future you, but also your team and anyone who is going

## How it works

Marqua includes a markdown compiler with code syntax highlighting and built-in front matter parser that splits your markdown into two parts, `body` and `metadata`. The markdown compiler is powered by [markdown-it](https://github.com/markdown-it/markdown-it) and code syntax highlighter is powered by [Shikiji](https://github.com/antfu/shikiji). The [front matter parser](/docs/modules#core-parse) for the `metadata` is powered by a lightweight in-house implementation, which supports a minimal subset of [YAML](https://yaml.org/) syntax and can be used as a standalone module.
Aubade includes a markdown compiler with code syntax highlighting and built-in front matter parser that splits your markdown into two parts, `body` and `metadata`. The markdown compiler is powered by [markdown-it](https://github.com/markdown-it/markdown-it) and code syntax highlighter is powered by [Shikiji](https://github.com/antfu/shikiji). The [front matter parser](/docs/modules#core-parse) for the `metadata` is powered by a lightweight in-house implementation, which supports a minimal subset of [YAML](https://yaml.org/) syntax and can be used as a standalone module.

Marqua only provides the necessary tools to help you with the initial layout and for you to create your own architecture and workflow, so you can have full control over your project. Simply start writing in a markdown file or use your existing markdown files and Marqua will help you easily turn them into a data source for your website.
Aubade only provides the necessary tools to help you with the initial layout and for you to create your own architecture and workflow, so you can have full control over your project. Simply start writing in a markdown file or use your existing markdown files and Aubade will help you easily turn them into a data source for your website.

![marqua architecture](./diagram.png)
![aubade architecture](./diagram.png)
18 changes: 9 additions & 9 deletions workspace/content/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
title: Getting Started
---

Start by installing Marqua from the npm registry
Start by installing Aubade from the npm registry

```
pnpm install marqua
pnpm install aubade
```

If you're using any code blocks in your markdown, make sure to include the stylesheets from `/styles` to your app, which you can do in either a JS file or a CSS file.

```javascript
// process with JS bundler
import 'marqua/styles/code.css';
import 'aubade/styles/code.css';
```

```css
/* process with CSS bundler */
@import 'marqua/styles/code.css';
@import 'aubade/styles/code.css';
```

Use the functions from the [`/fs` module](/docs/modules#fs) to `compile` a file or `traverse` directories.
Use the function from the [`/compass` module](/docs/modules#compass) to `visit` a file or `traverse` directories.

```javascript
import { compile, traverse } from 'marqua/fs';
import { visit, traverse } from 'aubade/compass';

const article = compile(/* path to your file */);
const article = visit(/* path to your file */);

const data = traverse(/* options */, /* hydrate callback */);
const data = traverse(/* entrypoint */).hydrate(/* callback */);
```

Add interactivity to the code blocks with `hydrate` from `/browser` module.

```svelte
<script>
import { hydrate } from 'marqua/browser';
import { hydrate } from 'aubade/browser';
</script>
<main use:hydrate>
Expand Down
2 changes: 1 addition & 1 deletion workspace/content/05-semantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Semantics

## Front Matter

Marqua supports a minimal subset of [YAML](https://yaml.org/) syntax for the front matter, which is semantically placed at the start of the file between two `---` lines, and it will be parsed as a JSON object.
Aubade supports a minimal subset of [YAML](https://yaml.org/) syntax for the front matter, which is semantically placed at the start of the file between two `---` lines, and it will be parsed as a JSON object.

All values will be attempted to be parsed into the supported types, which are `null`, `true`, and `false`. Any other values will go through the following checks and the first one to pass will be used.

Expand Down
Loading

0 comments on commit efa5f71

Please sign in to comment.