Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeh committed Jan 6, 2020
1 parent be1a813 commit 71df4ed
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
ROOT: 'docsrc',
PUBLIC: 'docs',
WEB_ROOT: '/test/',
URL: 'magic.github.io/test',
THEME: 'docs',
HOIST: ['Gdpr', 'LightSwitch'],
}
1 change: 1 addition & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="stylesheet" href="/test/magic.css?Zq69ZfLn2z" integrity="sha384-Zq69ZfLn2zMms7j2K6iZ4EutxfQtqvQdMArbrmWD1ZCTC4BnxZbOaCKwKYosMrdy" crossorigin="anonymous"/><link rel="icon" href="/test/favicon.ico"/><title>@magic/format</title><meta name="description" content="run prettier and format your code."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic/format"}</script></head><body><a class="SkipLink" href="/test/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><a class="Logo" href="/test/"><span>@magic/format</span></a><nav class="Menu"><ul><li><a href="/test/-install">install</a></li><li><a href="/test/#usage">usage</a></li><li><a href="/test/#changelog">changelog</a></li></ul></nav></header><div class="Page" id="page"><div>404 - not found</div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></div></footer></div></main><script src="/test/magic.js?/kzB8BNJd3" integrity="sha384-/kzB8BNJd3Zbrf1SObey3/2RYBsfl54rssWK71AQ1BysWreyMrSnbunqZbGM0ssp" crossorigin="anonymous"></script></body></html>
Binary file added docs/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><link rel="stylesheet" href="/test/magic.css?Zq69ZfLn2z" integrity="sha384-Zq69ZfLn2zMms7j2K6iZ4EutxfQtqvQdMArbrmWD1ZCTC4BnxZbOaCKwKYosMrdy" crossorigin="anonymous"/><link rel="icon" href="/test/favicon.ico"/><title>@magic/format</title><meta name="description" content="run prettier and format your code."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic/format"}</script></head><body><a class="SkipLink" href="/test/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><a class="Logo" href="/test/"><span>@magic/format</span></a><nav class="Menu"><ul><li><a href="/test/-install">install</a></li><li><a href="/test/#usage">usage</a></li><li><a href="/test/#changelog">changelog</a></li></ul></nav></header><div class="Page" id="page"><h1>@magic/format</h1><p>run prettier and format your code.</p><ul class="GitBadges"><li><a href="https://www.npmjs.com/package/@magic/format" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/v/@magic/format.svg" role="presentation" alt=""/></a></li><li><a href="https://travis-ci.com/magic/format" target="_blank" rel="noopener"><img src="https://img.shields.io/travis/com/magic/format/master" role="presentation" alt=""/></a></li><li><a href="https://ci.appveyor.com/project/magic/format/branch/master" target="_blank" rel="noopener"><img src="https://img.shields.io/appveyor/ci/magic/format/master.svg" role="presentation" alt=""/></a></li><li><a href="https://coveralls.io/github/magic/format" target="_blank" rel="noopener"><img src="https://img.shields.io/coveralls/github/magic/format/master.svg" role="presentation" alt=""/></a></li><li><a href="https://greenkeeper.io" target="_blank" rel="noopener"><img src="https://badges.greenkeeper.io/magic/format.svg" role="presentation" alt=""/></a></li><li><a href="https://snyk.io/test/github/magic/format" target="_blank" rel="noopener"><img src="https://img.shields.io/snyk/vulnerabilities/github/magic/format.svg" role="presentation" alt=""/></a></li></ul><h2 id="install">install</h2><p>be in a nodejs project.</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">npm i --save-dev --save-exact @magic/format</code></pre></div><h2 id="usage">Usage</h2><h2 id="usage-npm">npm run scripts</h2><p>Add the @magic/test bin scripts to package.json</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">{</code><code class="line"> <span class="string">&#39;scripts&#39;</span>: {</code><code class="line"> <span class="string">&#39;format&#39;</span>: <span class="string">&#39;f -w&#39;</span>,</code><code class="line"> <span class="string">&#39;<span class="colon">format</span>:check&#39;</span>: <span class="string">&#39;f&#39;</span></code><code class="line"> },</code><code class="line"> <span class="string">&#39;devDependencies&#39;</span>: {</code><code class="line"> <span class="string">&#39;@magic/format&#39;</span>: <span class="string">&#39;<span class="object">0</span>.<span class="property">0</span>.<span class="property">1</span>&#39;</span></code><code class="line"> }</code><code class="line">}</code></pre></div><p>then use the npm run scripts</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">npm run format</code><code class="line">npm run <span class="colon">format</span>:check</code></pre></div><h3 id="usage-cli">cli</h3><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line"><span class="comment">// first install globally</span></code><code class="line">npm i -g @magic/format</code><code class="line"></code><code class="line"><span class="comment">// check formatting using prettier but <span class="keyword">do</span> not write</span></code><code class="line"><span class="comment">// prettier --list-different</span></code><code class="line">f</code><code class="line"></code><code class="line"><span class="comment">// format files using prettier</span></code><code class="line"><span class="comment">// prettier --write</span></code><code class="line">f -w</code></pre></div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://github.com/magic/core">magic</a></div></div></footer></div></main><script src="/test/magic.js?/kzB8BNJd3" integrity="sha384-/kzB8BNJd3Zbrf1SObey3/2RYBsfl54rssWK71AQ1BysWreyMrSnbunqZbGM0ssp" crossorigin="anonymous"></script></body></html>
1 change: 1 addition & 0 deletions docs/magic.css

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

1 change: 1 addition & 0 deletions docs/magic.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
user-agent: *
allow: /
sitemap: https://magic.github.io/test/sitemap.xml
22 changes: 22 additions & 0 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
>

<url>
<loc>https://magic.github.io/test/</loc>
<lastmod>2020-01-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>

<url>
<loc>https://magic.github.io/test/404/</loc>
<lastmod>2020-01-06</lastmod>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>

</urlset>
13 changes: 13 additions & 0 deletions docs/sri-hashes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"css": "sha384-Zq69ZfLn2zMms7j2K6iZ4EutxfQtqvQdMArbrmWD1ZCTC4BnxZbOaCKwKYosMrdy",
"js": "sha384-/kzB8BNJd3Zbrf1SObey3/2RYBsfl54rssWK71AQ1BysWreyMrSnbunqZbGM0ssp",
"pages": {
"/test/": "sha384-7HTIxw4ZvgogYbxuYzu+kDiT+2Sma3knxo0Dpk1V7ewyhVdHX1FMjFLAFt/VH1Om",
"/test/404/": "sha384-N6GggPN/sWc+wVyU07S10xr8kMzwPSnuTD40hXbmb0pN/A4vq1s5tSRAAWN0OBDR"
},
"static": {
"/favicon.ico": "sha384-pf51ay6pZCj3+XlVCPmCKLDFpLj7QP+2heR+/n08WgS7Bve7JMkgubHOkwLzaTr+",
"/robots.txt": "sha384-827u8BLWukOLWm6vZHJ6LtNjWr+kzdGopcV3xnyX68b5fJTR224/4cQeXEt9lmkJ",
"/sitemap.xml": "sha384-jSnSZPmbgvNczs+eXWdyIDrmo7T0jroBY0kpoxwgQPHX8TgKVQcx8fz4u3b+06EI"
}
}
19 changes: 19 additions & 0 deletions docsrc/app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const state = {
title: '@magic/format',
description: ['run prettier and format your code.'],

logotext: '@magic/format',
menu: [
{ to: '-install', text: 'install' },
{
to: '/#usage',
text: 'usage',
items: [
{ to: '-js', text: 'js api' },
{ to: '-cli', text: 'cli' },
{ to: '-global', text: 'npm i -g' },
],
},
{ to: '/#changelog', text: 'changelog' },
],
}
Binary file added docsrc/assets/static/favicon.ico
Binary file not shown.
49 changes: 49 additions & 0 deletions docsrc/pages/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export const View = state => [
h1(state.title),

state.description.map(d => p(d)),

GitBadges('magic/format'),

h2({ id: 'install' }, 'install'),
p('be in a nodejs project.'),

Pre('npm i --save-dev --save-exact @magic/format'),

h2({ id: 'usage' }, 'Usage'),

h2({ id: 'usage-npm' }, 'npm run scripts'),
p('Add the @magic/test bin scripts to package.json'),

Pre(`
{
"scripts": {
"format": "f -w",
"format:check": "f"
},
"devDependencies": {
"@magic/format": "0.0.1"
}
}`),

p('then use the npm run scripts'),
Pre(`
npm run format
npm run format:check
`),

h3({ id: 'usage-cli' }, 'cli'),

Pre(`
// first install globally
npm i -g @magic/format
// check formatting using prettier but do not write
// prettier --list-different
f
// format files using prettier
// prettier --write
f -w
`),
]

0 comments on commit 71df4ed

Please sign in to comment.