create-markupress 0.0.0-stage → 0.7.0
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/index.js +25 -0
- package/package.json +25 -4
- package/template/_gitignore +2 -0
- package/template/app/components/counter.html +5 -0
- package/template/app/components/counter.ts +10 -0
- package/template/docs/01.guide/01.getting-started.md +17 -0
- package/template/docs/01.guide/02.writing.md +32 -0
- package/template/docs/01.guide/index.md +4 -0
- package/template/docs/_footer.md +9 -0
- package/template/docs/index.md +21 -0
- package/template/markupress.config.ts +5 -0
- package/template/package.json +15 -0
- package/README.md +0 -3
package/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// @ts-check
|
|
3
|
+
import { cpSync, existsSync, readdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { basename, join, relative, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Copies the starter site into a new folder: `npm create markupress@latest <folder>`. The starter's package.json depends
|
|
9
|
+
* on the Markupress release this package shares its version with, and on the HTML Next and Looma it pins.
|
|
10
|
+
*/
|
|
11
|
+
const template = fileURLToPath(new URL('./template', import.meta.url));
|
|
12
|
+
const folder = process.argv[2] ?? 'docs';
|
|
13
|
+
const target = resolve(folder);
|
|
14
|
+
if (existsSync(target) && readdirSync(target).length > 0) {
|
|
15
|
+
process.stderr.write(`${target} already has files. Choose a new or empty folder: npm create markupress@latest my-docs\n`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
cpSync(template, target, { recursive: true });
|
|
19
|
+
// npm leaves .gitignore files out of a package, so the starter's is stored as _gitignore.
|
|
20
|
+
renameSync(join(target, '_gitignore'), join(target, '.gitignore'));
|
|
21
|
+
const manifest = join(target, 'package.json');
|
|
22
|
+
const name = basename(target).toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[._-]+/, '') || 'docs';
|
|
23
|
+
writeFileSync(manifest, readFileSync(manifest, 'utf8').replace('"name": "markupress-site"', `"name": ${JSON.stringify(name)}`));
|
|
24
|
+
const where = relative(process.cwd(), target) || '.';
|
|
25
|
+
process.stdout.write(`Created a Markupress site in ${where}.\n\n cd ${where}\n npm install\n npm run dev\n\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-markupress",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Start a Markupress documentation site: npm create markupress@latest docs.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-markupress": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"template"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22.22.2 <23 || >=24.15 <25"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": { "access": "public" },
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/threadlabs-studio/markupress.git",
|
|
21
|
+
"directory": "packages/create-markupress"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://threadlabs-studio.github.io/markupress/guide/getting-started/",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/threadlabs-studio/markupress/issues"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template component="demo-counter" controller="./counter.js">
|
|
2
|
+
<defs><state name="count" type="number" value="0"></state></defs>
|
|
3
|
+
<div><button>Count</button><output>{$count}</output></div>
|
|
4
|
+
<style>:host { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-md); }</style>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentHost } from '@nextwebwg/html-next/runtime';
|
|
2
|
+
|
|
3
|
+
export default function counter(host: ComponentHost): void {
|
|
4
|
+
host.on('connect', () => {
|
|
5
|
+
const button = host.root.querySelector('button')!;
|
|
6
|
+
const click = () => { host.state.count = Number(host.state.count) + 1; };
|
|
7
|
+
button.addEventListener('click', click);
|
|
8
|
+
return () => button.removeEventListener('click', click);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Install and run the project.
|
|
3
|
+
---
|
|
4
|
+
# Getting started
|
|
5
|
+
|
|
6
|
+
Install the project's dependencies, then start the development server:
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install
|
|
10
|
+
npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The development server reloads the page after every edit. `npm run build` writes the static site to `site/`, and `npm run preview` serves it.
|
|
14
|
+
|
|
15
|
+
::: tip Edit this page
|
|
16
|
+
This page is `docs/01.guide/01.getting-started.md`. Change it, save, and the browser shows the change.
|
|
17
|
+
:::
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Markdown, callouts, code groups and components.
|
|
3
|
+
---
|
|
4
|
+
# Writing pages
|
|
5
|
+
|
|
6
|
+
Each Markdown file in `docs/` is a page. Folders are sections, and a number prefix such as `02.` orders a page among its siblings.
|
|
7
|
+
|
|
8
|
+
## Callouts
|
|
9
|
+
|
|
10
|
+
::: warning Before you upgrade
|
|
11
|
+
Back up your data first.
|
|
12
|
+
:::
|
|
13
|
+
|
|
14
|
+
## Code groups
|
|
15
|
+
|
|
16
|
+
::: code-group
|
|
17
|
+
```sh title="npm"
|
|
18
|
+
npm install my-project
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```sh title="pnpm"
|
|
22
|
+
pnpm add my-project
|
|
23
|
+
```
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
## Components
|
|
27
|
+
|
|
28
|
+
<link rel="component" href="@/app/components/counter.html">
|
|
29
|
+
|
|
30
|
+
<demo-counter></demo-counter>
|
|
31
|
+
|
|
32
|
+
The counter is `app/components/counter.html`, linked from the project root with `@/`, and its controller is `app/components/counter.ts`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
description: The documentation for my project.
|
|
4
|
+
---
|
|
5
|
+
# My project
|
|
6
|
+
|
|
7
|
+
The documentation for my project, written in Markdown.
|
|
8
|
+
|
|
9
|
+
[Get started](01.guide/01.getting-started.md) [Writing pages](01.guide/02.writing.md)
|
|
10
|
+
|
|
11
|
+
## Markdown
|
|
12
|
+
|
|
13
|
+
Callouts, tabs, code groups and highlighted code, from plain Markdown.
|
|
14
|
+
|
|
15
|
+
## Components
|
|
16
|
+
|
|
17
|
+
Native HTML Next components in any page, with TypeScript controllers.
|
|
18
|
+
|
|
19
|
+
## Versions
|
|
20
|
+
|
|
21
|
+
`npx markupress snapshot v1` records the docs as they stand.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "markupress-site",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "markupress dev",
|
|
7
|
+
"build": "markupress build",
|
|
8
|
+
"preview": "markupress preview"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@nextwebwg/html-next": "1.0.0-alpha.69",
|
|
12
|
+
"@threadlabs/looma": "0.31.4",
|
|
13
|
+
"markupress": "^0.7.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
package/README.md
DELETED