inline readme

This commit is contained in:
Jeremy Danyow 2018-03-25 18:53:19 -07:00
parent b53500630d
commit 19eb37da6c
9 changed files with 105 additions and 61 deletions

16
.posthtmlrc.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
plugins: {
'posthtml-expressions': {
root: __dirname,
locals: {
NODE_ENV: process.env.NODE_ENV
}
},
'posthtml-include': {
root: __dirname
},
'posthtml-md': {
root: __dirname
}
}
};

5
.sassrc.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
includePaths: [
'node_modules'
]
};

View File

@ -1,20 +1,16 @@
# utterances :crystal_ball:
# utterances 🔮
A lightweight comments widget built on GitHub issues.
* [Open source](https://github.com/utterance) :octocat:
* No tracking, no ads, always free. :satellite::no_entry_sign:
* No lock-in. All data stored in GitHub issues. :unlock:
* Styled with [Primer](http://primercss.io/), the css toolkit that powers GitHub. :art:
* 9 KB gzipped. Vanilla TypeScript. No font downloads, no JavaScript libraries for evergreen browsers (bluebird, fetch and classList for IE 11 users) :shipit:
* [Open source](https://github.com/utterance). 🙌
* No tracking, no ads, always free. 📡🚫
* No lock-in. All data stored in GitHub issues. 🔓
* Styled with [Primer](http://primercss.io/), the css toolkit that powers GitHub. 💅
* Lightweight. Vanilla TypeScript. No font downloads, JavaScript frameworks or polyfills for evergreen browsers. 🐦🌲
## how it works
When Utterances loads, the GitHub [issue search API](https://developer.github.com/v3/search/#search-issues) is used to find the issue associated with the page based on `url`, `pathname` or `title`. The issue's comments are displayed in the familiar GitHub style.
*What if we can find an issue that matches the page?*
No problem- [utterances-bot](https://github.com/utterances-bot) will automatically create one the first time someone comments.
When Utterances loads, the GitHub [issue search API](https://developer.github.com/v3/search/#search-issues) is used to find the issue associated with the page based on `url`, `pathname` or `title`. If we cannot find an issue that matches the page, no problem, [@utterances-bot](https://github.com/utterances-bot) will automatically create an issue the first time someone comments.
To comment, users must authorize the utterances app to post on their behalf using the GitHub [OAuth flow](https://developer.github.com/v3/oauth/#web-application-flow). Alternatively, users can comment on the GitHub issue directly.
@ -22,8 +18,6 @@ To comment, users must authorize the utterances app to post on their behalf usin
## sites using utterances
Using utterances? [Add your site](https://github.com/utterance/utterances/edit/master/README.md) to the list:
* [danyow.net](https://danyow.net)
* [Den by Default](https://dennisdel.com)
* [winterland.me](http://winterland.me/)
@ -35,4 +29,6 @@ Using utterances? [Add your site](https://github.com/utterance/utterances/edit/m
* [blog.leop0ld.org](http://blog.leop0ld.org/)
* [Anton Medvedev](https://medv.io)
# try it out :point_down::point_down::point_down:
Are you using utterances? [Add your site](https://github.com/utterance/utterances/edit/master/README.md) to the list!
# try it out 👇👇👇

View File

@ -1,16 +1,21 @@
{
"name": "utterances",
"version": "0.1.4",
"description": "A lightweight comments widget built on GitHub issues.",
"private": true,
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/utterance/utterances.git"
},
"scripts": {
"clean": "rm -rf dist",
"clean": "rm -rf .cache & rm -rf dist",
"prestart": "yarn run clean",
"start": "parcel src/utterances.html --no-hmr --public-url / --port 4000 & parcel watch src/client.ts & parcel watch src/index.html & parcel watch src/authorized.html",
"prebuild": "yarn run clean",
"build": "parcel build src/utterances.html && parcel build src/client.ts && parcel build src/index.html && parcel build src/authorized.html",
"predeploy": "yarn run build && cp .nojekyll dist/ && cp CNAME dist/",
"deploy": "echo \"gh-pages --dist dist\"",
"(postinstall is temporary: using unreased version of parcel)": "",
"postinstall": "cd node_modules/parcel-bundler && yarn install && yarn build && cd ../.."
},
@ -18,6 +23,9 @@
"gh-pages": "^1.1.0",
"node-sass": "^4.8.3",
"parcel-bundler": "parcel-bundler/parcel#master",
"posthtml-expressions": "^1.1.0",
"posthtml-include": "^1.1.0",
"posthtml-md": "^1.1.0",
"primer-alerts": "^1.5.5",
"primer-base": "^1.7.0",
"primer-buttons": "^2.5.3",
@ -25,10 +33,5 @@
"primer-markdown": "^3.7.5",
"tslint": "^5.9.1",
"typescript": "^2.7.2"
},
"sass": {
"includePaths": [
"node_modules"
]
}
}

View File

@ -40,25 +40,31 @@
<strong>utterances</strong>
</a>
</header>
<article class="markdown-body" md>
<include src="README.md"></include>
</article>
</div>
</article>
</section>
<script src="index.ts"></script>
<!-- <script src="https://utteranc.es/client.js"
repo="utterance/utterances"
branch="gh-pages"
issue-term="homepage"
async>
</script> -->
<script src="http://localhost:4000/client.js"
repo="jdanyow/utterances-demo"
branch="master"
issue-term="pathname"
async>
</script>
<if condition="NODE_ENV === 'production'">
<script src="https://utteranc.es/client.js"
repo="utterance/utterances"
branch="gh-pages"
issue-term="homepage"
async>
</script>
</if>
<else>
<script src="http://localhost:4000/client.js"
repo="jdanyow/utterances-demo"
branch="master"
issue-term="pathname"
async>
</script>
</else>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -13,12 +13,6 @@
max-height: unset;
font-size: 16px;
h1,h2,h3,h4,h5,h6 {
.anchor {
display: none;
}
}
form {
font-size: $body-font-size;

View File

@ -1,20 +1,4 @@
import {
setRepoContext,
loadJsonFile
} from './github';
import { ConfigurationComponent } from './configuration-component';
const context = {
owner: 'utterance',
repo: 'utterances',
branch: 'master'
};
setRepoContext(context);
loadJsonFile<string>('README.md', true).then(html => {
const commentDiv = document.querySelector('.comment') as HTMLDivElement;
commentDiv.insertAdjacentHTML('beforeend', html);
commentDiv.querySelector('#user-content-configuration')!.parentElement!
.insertAdjacentElement('afterend', new ConfigurationComponent().element);
});
document.querySelector('h2#configuration')!
.insertAdjacentElement('afterend', new ConfigurationComponent().element);

View File

@ -82,7 +82,7 @@ addEventListener('not-installed', function handleNotInstalled() {
document.querySelector('.timeline')!.insertAdjacentHTML('afterbegin', `
<div class="flash flash-error flash-not-installed">
Error: utterances is not installed on <code>${page.owner}/${page.repo}</code>.
If you are the owner of this repo,
If you own this repo,
<a href="https://github.com/apps/utterances" target="_blank"><strong>install the app</strong></a>.
Read more about this change in
<a href="https://github.com/utterance/utterances/issues#3" target="_blank">the PR</a>.

View File

@ -1680,6 +1680,10 @@ fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
fclone@^1.x:
version "1.0.11"
resolved "https://registry.yarnpkg.com/fclone/-/fclone-1.0.11.tgz#10e85da38bfea7fc599341c296ee1d77266ee640"
filesize@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
@ -2068,7 +2072,7 @@ htmlnano@^0.1.7:
svgo "^1.0.5"
uglify-js "^3.3.14"
htmlparser2@^3.9.2:
htmlparser2@^3.8.3, htmlparser2@^3.9.2:
version "3.9.2"
resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338"
dependencies:
@ -2591,6 +2595,10 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
marked@^0.3.5:
version "0.3.18"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.18.tgz#3ef058cd926101849b92a7a7c15db18c7fc76b2f"
math-expression-evaluator@^1.2.14:
version "1.2.17"
resolved "https://registry.yarnpkg.com/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz#de819fdbcd84dccd8fae59c6aeb79615b9d266ac"
@ -3371,6 +3379,31 @@ postcss@^6.0.19:
source-map "^0.6.1"
supports-color "^5.3.0"
posthtml-expressions@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/posthtml-expressions/-/posthtml-expressions-1.1.0.tgz#1f2a64304fda8e90b5e646adcd46ddef2adae45b"
dependencies:
fclone "^1.x"
posthtml-include@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/posthtml-include/-/posthtml-include-1.1.0.tgz#6a11efff05dfba4e9f29788dea1d17248f04f1e1"
dependencies:
posthtml-parser "^0.1.1"
posthtml-md@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/posthtml-md/-/posthtml-md-1.1.0.tgz#4bcb2afb909bad97eec5f2a43da6431acf495821"
dependencies:
marked "^0.3.5"
posthtml "^0.8.0"
posthtml-parser@^0.1.1, posthtml-parser@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/posthtml-parser/-/posthtml-parser-0.1.3.tgz#43251f575ba34e361032f79a11e0fc93ab232b24"
dependencies:
htmlparser2 "^3.8.3"
posthtml-parser@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/posthtml-parser/-/posthtml-parser-0.3.3.tgz#3fe986fca9f00c0f109d731ba590b192f26e776d"
@ -3386,7 +3419,7 @@ posthtml-parser@^0.4.0:
htmlparser2 "^3.9.2"
object-assign "^4.1.1"
posthtml-render@^1.1.0, posthtml-render@^1.1.1:
posthtml-render@^1.0.5, posthtml-render@^1.1.0, posthtml-render@^1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/posthtml-render/-/posthtml-render-1.1.2.tgz#1755717c3ad12f4e6d8846767fa2f0bafdd7f33f"
@ -3398,6 +3431,13 @@ posthtml@^0.11.2, posthtml@^0.11.3:
posthtml-parser "^0.3.3"
posthtml-render "^1.1.0"
posthtml@^0.8.0:
version "0.8.7"
resolved "https://registry.yarnpkg.com/posthtml/-/posthtml-0.8.7.tgz#aba6124c6cf87b4ceea6bab5f7e50268f2c2006d"
dependencies:
posthtml-parser "^0.1.3"
posthtml-render "^1.0.5"
prelude-ls@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"