mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
package.yash => README.md
This commit is contained in:
35
README.md
35
README.md
@@ -64,7 +64,7 @@ An install consists of 5 parts in 4 files:
|
||||
|
||||
```
|
||||
my-new-package/
|
||||
- package.yash
|
||||
- README.md (package info in frontmatter)
|
||||
- releases.js
|
||||
- install.sh
|
||||
- install.bat
|
||||
@@ -105,27 +105,22 @@ node _webi/test.js ./new-package/
|
||||
|
||||
Just copy the format from any of the existing packages. It's like this:
|
||||
|
||||
`package.yash`:
|
||||
`README.md`:
|
||||
|
||||
````md
|
||||
---
|
||||
title: Node.js
|
||||
homepage: https://nodejs.org
|
||||
tagline: JavaScript V8 runtime
|
||||
description: |
|
||||
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
|
||||
---
|
||||
|
||||
```bash
|
||||
node -e 'console.log("Hello, World!")'
|
||||
> Hello, World!
|
||||
```
|
||||
````
|
||||
# title: Node.js
|
||||
# homepage: https://nodejs.org
|
||||
# tagline: JavaScript V8 runtime
|
||||
# description: |
|
||||
# Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
|
||||
# examples: |
|
||||
# ```bash
|
||||
# node -e 'console.log("Hello, World!")'
|
||||
# > Hello, World!
|
||||
# ```
|
||||
|
||||
END
|
||||
````
|
||||
|
||||
This is a dumb format. We know. Historical accident (originally these were in
|
||||
bash comments).
|
||||
|
||||
It's in the TODOs to replace this with either YAML or Markdown.
|
||||
|
||||
### 1. Fetch Releases
|
||||
|
||||
|
||||
87
_webi/frontmarker.js
Normal file
87
_webi/frontmarker.js
Normal file
@@ -0,0 +1,87 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var marked = require('marked');
|
||||
|
||||
var frontmatter = '---';
|
||||
var keyValRe = /(\w+): (.*)/;
|
||||
|
||||
function parseYamlish(txt) {
|
||||
var end = false;
|
||||
var cfg = { title: '', tagline: '', description: '', examples: '' };
|
||||
var block = false;
|
||||
|
||||
var lines = txt.trim().split('\n');
|
||||
var moreRe = /\s+/;
|
||||
var last;
|
||||
|
||||
if (frontmatter !== lines.shift()) {
|
||||
throw new Error('no frontmatter marker at beginning of file');
|
||||
}
|
||||
|
||||
function unblock() {
|
||||
cfg[block] = marked(cfg[block]);
|
||||
block = false;
|
||||
}
|
||||
|
||||
lines.some(function (line, i) {
|
||||
if (frontmatter === line) {
|
||||
// end of frontmatter
|
||||
end = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (end) {
|
||||
if (line.trim()) {
|
||||
throw new Error('missing newline after frontmatter');
|
||||
}
|
||||
last = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!line[0]) {
|
||||
if (block) {
|
||||
cfg[block] += '\n';
|
||||
} else {
|
||||
throw new Error('invalid blank line in frontmatter');
|
||||
}
|
||||
}
|
||||
|
||||
if (block) {
|
||||
if (!line || ' ' === line.slice(0, 2)) {
|
||||
cfg[block] += line.slice(2) + '\n';
|
||||
return;
|
||||
}
|
||||
unblock();
|
||||
}
|
||||
|
||||
var m = line.match(keyValRe);
|
||||
if (!m) {
|
||||
throw new Error(
|
||||
'invalid key format for: ' + JSON.stringify(line) + ' ' + i
|
||||
);
|
||||
}
|
||||
if ('|' === m[2]) {
|
||||
block = m[1];
|
||||
return;
|
||||
}
|
||||
cfg[m[1]] = m[2];
|
||||
});
|
||||
|
||||
if (block) {
|
||||
cfg[block] = marked(cfg[block]);
|
||||
}
|
||||
cfg.examples = marked(lines.slice(last).join('\n'));
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
||||
module.exports.parse = parseYamlish;
|
||||
|
||||
if (require.main === module) {
|
||||
console.info(
|
||||
parseYamlish(
|
||||
fs.readFileSync(__dirname + '/../node/README.md', 'utf8')
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var frontmarker = require('./frontmarker.js');
|
||||
var shmatter = require('shmatter');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
@@ -43,7 +44,7 @@ pkgs.create = function (Pkgs, basepath) {
|
||||
.readFile(readme, 'utf-8')
|
||||
.then(function (txt) {
|
||||
// TODO
|
||||
//return frontmarker.parse(txt);
|
||||
return frontmarker.parse(txt);
|
||||
})
|
||||
.catch(function (e) {
|
||||
if ('ENOENT' !== e.code && 'ENOTDIR' !== e.code) {
|
||||
@@ -84,7 +85,7 @@ pkgs.create = function (Pkgs, basepath) {
|
||||
}
|
||||
})
|
||||
]).then(function (items) {
|
||||
var meta = items[1];
|
||||
var meta = items[0] || items[1];
|
||||
if (!meta) {
|
||||
// doesn't exist
|
||||
return;
|
||||
|
||||
@@ -46,7 +46,7 @@ nodes.forEach(function (node) {
|
||||
var maxLen = 0;
|
||||
console.info('');
|
||||
console.info('Has the necessary files?');
|
||||
['package.yash', 'releases.js', 'install.sh', 'install.bat']
|
||||
['README.md', 'releases.js', 'install.sh', 'install.bat']
|
||||
.map(function (node) {
|
||||
maxLen = Math.max(maxLen, node.length);
|
||||
return node;
|
||||
|
||||
12
caddy/README.md
Normal file
12
caddy/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Caddy
|
||||
homepage: https://github.com/caddyserver/caddy
|
||||
tagline: |
|
||||
Caddy is a fast, multi-platform web server with automatic HTTPS.
|
||||
description: |
|
||||
Caddy makes it easy to use Let's Encrypt to handle HTTPS (TLS/SSL) and to reverse proxy APIs and WebSockets to other apps - such as those written node, Go, python, ruby, and PHP.
|
||||
---
|
||||
|
||||
```bash
|
||||
caddy start
|
||||
```
|
||||
@@ -1,14 +0,0 @@
|
||||
# title: Caddy
|
||||
# homepage: https://github.com/caddyserver/caddy
|
||||
# tagline: |
|
||||
# Caddy is a fast, multi-platform web server with automatic HTTPS.
|
||||
# description: |
|
||||
# Caddy makes it easy to use Let's Encrypt to handle HTTPS (TLS/SSL) and to reverse proxy APIs and WebSockets to other apps - such as those written node, Go, python, ruby, and PHP.
|
||||
# examples: |
|
||||
# ```bash
|
||||
# caddy start
|
||||
# ```
|
||||
|
||||
This is a comment... because... poor choices I made.
|
||||
|
||||
Don't worry, this will be yaml or markdown in the... sometime... future
|
||||
33
deno/README.md
Normal file
33
deno/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: Deno
|
||||
homepage: https://github.com/denoland/deno
|
||||
tagline: |
|
||||
Deno: A secure runtime for JavaScript and TypeScript.
|
||||
description: |
|
||||
Deno proves that lightning does strike twice. It's the ease of use of node, the intentional tooling of Go, and built in Rust.
|
||||
---
|
||||
|
||||
The obligatory Hello World
|
||||
|
||||
```bash
|
||||
deno run https://deno.land/std/examples/welcome.ts
|
||||
```
|
||||
|
||||
Run a local file
|
||||
|
||||
```bash
|
||||
deno run ./hello.ts
|
||||
```
|
||||
|
||||
Enable [permissions](https://deno.land/manual/getting_started/permissions)
|
||||
|
||||
```bash
|
||||
deno run --allow-read=./data,./public --allow-write=./data \
|
||||
--allow-net=example.com,example.net ./hello.ts
|
||||
```
|
||||
|
||||
Format source code, recursively
|
||||
|
||||
```bash
|
||||
deno fmt ./my-project
|
||||
```
|
||||
@@ -1,37 +0,0 @@
|
||||
# title: Deno
|
||||
# homepage: https://github.com/denoland/deno
|
||||
# tagline: |
|
||||
# Deno: A secure runtime for JavaScript and TypeScript.
|
||||
# description: |
|
||||
# Deno proves that lightning does strike twice. It's the ease of use of node, the intentional tooling of Go, and built in Rust.
|
||||
# examples: |
|
||||
# The obligatory Hello World
|
||||
#
|
||||
# ```bash
|
||||
# deno run https://deno.land/std/examples/welcome.ts
|
||||
# ```
|
||||
#
|
||||
# Run a local file
|
||||
#
|
||||
# ```bash
|
||||
# deno run ./hello.ts
|
||||
# ```
|
||||
#
|
||||
# Enable [permissions](https://deno.land/manual/getting_started/permissions)
|
||||
#
|
||||
# ```bash
|
||||
# deno run --allow-read=./data,./public --allow-write=./data \
|
||||
# --allow-net=example.com,example.net ./hello.ts
|
||||
# ```
|
||||
#
|
||||
# Format source code, recursively
|
||||
#
|
||||
# ```bash
|
||||
# deno fmt ./my-project
|
||||
# ```
|
||||
#
|
||||
|
||||
|
||||
This is a comment... because... poor choices I made.
|
||||
|
||||
Don't worry, this will be yaml or markdown in the... sometime... future
|
||||
74
node/README.md
Normal file
74
node/README.md
Normal file
@@ -0,0 +1,74 @@
|
||||
---
|
||||
title: Node.js
|
||||
homepage: https://nodejs.org
|
||||
tagline: |
|
||||
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
|
||||
description: |
|
||||
Node is great for simple, snappy HTTP(S) servers, and for stitching APIs together with minimal fuss or muss.
|
||||
---
|
||||
|
||||
Hello World
|
||||
|
||||
```bash
|
||||
node -e 'console.log("Hello, World!")'
|
||||
> Hello, World!
|
||||
```
|
||||
|
||||
A Simple Web Server
|
||||
|
||||
`server.js`:
|
||||
|
||||
```bash
|
||||
var http = require('http');
|
||||
var app = function (req, res) {
|
||||
res.end('Hello, World!');
|
||||
};
|
||||
http.createServer(app).listen(8080, function () {
|
||||
console.info('Listening on', this.address());
|
||||
});
|
||||
```
|
||||
|
||||
```bash
|
||||
node server.js
|
||||
```
|
||||
|
||||
An Express App
|
||||
|
||||
```bash
|
||||
mkdir my-server
|
||||
pushd my-server
|
||||
npm init
|
||||
npm install --save express
|
||||
```
|
||||
|
||||
`app.js`:
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
|
||||
app.use('/', function (req, res, next) {
|
||||
res.end("Hello, World!");
|
||||
});
|
||||
|
||||
module.exports = app;</code></pre>
|
||||
```
|
||||
|
||||
`server.js`:
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
var http = require('http');
|
||||
var app = require('./app.js');
|
||||
|
||||
http.createServer(app).listen(8080, function () {
|
||||
console.info('Listening on', this.address());
|
||||
});
|
||||
```
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
@@ -1,79 +0,0 @@
|
||||
#
|
||||
# title: Node.js
|
||||
# homepage: https://nodejs.org
|
||||
# tagline: |
|
||||
# Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
|
||||
# description: |
|
||||
# Node is great for simple, snappy HTTP(S) servers, and for stitching APIs together with minimal fuss or muss.
|
||||
# examples: |
|
||||
#
|
||||
# ### Hello World
|
||||
#
|
||||
# ```bash
|
||||
# node -e 'console.log("Hello, World!")'
|
||||
# > Hello, World!
|
||||
# ```
|
||||
#
|
||||
# ### A Simple Web Server
|
||||
#
|
||||
# `server.js`:
|
||||
#
|
||||
# ```bash
|
||||
# var http = require('http');
|
||||
# var app = function (req, res) {
|
||||
# res.end('Hello, World!');
|
||||
# };
|
||||
# http.createServer(app).listen(8080, function () {
|
||||
# console.info('Listening on', this.address());
|
||||
# });
|
||||
# ```
|
||||
#
|
||||
# ```bash
|
||||
# node server.js
|
||||
# ```
|
||||
#
|
||||
# ### An Express App
|
||||
#
|
||||
# ```bash
|
||||
# mkdir my-server
|
||||
# pushd my-server
|
||||
# npm init
|
||||
# npm install --save express
|
||||
# ```
|
||||
#
|
||||
# `app.js`:
|
||||
#
|
||||
# ```js
|
||||
# 'use strict';
|
||||
#
|
||||
# var express = require('express');
|
||||
# var app = express();
|
||||
#
|
||||
# app.use('/', function (req, res, next) {
|
||||
# res.end("Hello, World!");
|
||||
# });
|
||||
#
|
||||
# module.exports = app;</code></pre>
|
||||
# ```
|
||||
#
|
||||
# `server.js`:
|
||||
#
|
||||
# ```js
|
||||
# 'use strict';
|
||||
#
|
||||
# var http = require('http');
|
||||
# var app = require('./app.js');
|
||||
#
|
||||
# http.createServer(app).listen(8080, function () {
|
||||
# console.info('Listening on', this.address());
|
||||
# });
|
||||
# ```
|
||||
#
|
||||
# ```bash
|
||||
# npm start
|
||||
# ```
|
||||
#
|
||||
|
||||
This is a comment... because... poor choices I made.
|
||||
|
||||
Don't worry, this will be yaml or markdown in the... sometime... future
|
||||
13
package-lock.json
generated
13
package-lock.json
generated
@@ -8,6 +8,19 @@
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@root/request/-/request-1.6.1.tgz",
|
||||
"integrity": "sha512-8wrWyeBLRp7T8J36GkT3RODJ6zYmL0/maWlAUD5LOXT28D3TDquUepyYDKYANNA3Gc8R5ZCgf+AXvSTYpJEWwQ=="
|
||||
},
|
||||
"marked": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-1.1.0.tgz",
|
||||
"integrity": "sha512-EkE7RW6KcXfMHy2PA7Jg0YJE1l8UPEZE8k45tylzmZM30/r1M1MUXWQfJlrSbsTeh7m/XTwHbWUENvAJZpp1YA=="
|
||||
},
|
||||
"shmatter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/shmatter/-/shmatter-1.0.1.tgz",
|
||||
"integrity": "sha512-bBAvHI8640XcMDsShK2HOR8WOkF65hMprXr7Rsqb3z+26/5qna3jZfP7VZScItGoULUYyNeen9isD60KxtD2hQ==",
|
||||
"requires": {
|
||||
"marked": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/webinstall/packages#readme",
|
||||
"dependencies": {
|
||||
"@root/request": "^1.6.1"
|
||||
"@root/request": "^1.6.1",
|
||||
"shmatter": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user