first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

BIN
build/.DS_Store vendored Normal file

Binary file not shown.

86
build/config.js Normal file
View File

@@ -0,0 +1,86 @@
const path = require('path')
// get timestamp as deployment directory name
const get_timestamp = () => String(Math.floor(new Date() / 1000))
// static config
module.exports = {
/* paths */
root_dir: get_timestamp(),
basepath: path.normalize(__dirname + '/..'),
template_path: 'templates/',
partials_path: 'components/',
font_path: 'font/',
image_path: 'img/',
css_path: 'css/',
javascipt: 'js/',
paths: {
base: path.normalize(__dirname + '/..'),
js: 'js',
css: 'css',
img: 'img',
font: 'font',
templates: 'templates',
},
html: {
pages: [
{name: 'index', template: 'home', css: ['core', 'home'], js: ['scripts']}
]
},
images: [
'bg/*.{jpg,png,svg}',
'content/*.{jpg,png,svg}',
'menu/*.{jpg,png,svg}',
'util/*.{jpg,png,svg}',
],
/* serviceworker */
serviceworker: {
file: 'sw.js',
statics: ['css/**.css', '**.html', 'img/**/**.{jpg,png,webp,svg}', 'js/**.js']
},
/* ftp connection */
ftp_options: {
host: 'w00dfcf1.kasserver.com',
user: 'f00e43cc',
password: 'UH57MsPPAmXGo3Xm',
},
/* ghost */
ghost: {
id: 'ghost-admin',
secret: 'f481cecda9fb',
username: 'public@asciidisco.com',
password: 'Bx75q3Vt!',
host: 'worried-secure.glitch.me',
},
/* github */
github: {
user: 'asciidisco'
},
/* markdown contents */
mdcontents: {
pages: [
{key: 'about-short', url: 'https://raw.githubusercontent.com/asciidisco/about.me/master/README.md'}
]
},
/* RSS/Atom/JSON feed */
rss: {
title: 'asciidisco.com Blog',
description: 'Blog of asciidisco (Sebastian Golasch)',
id: 'https://stage.asciidisco.com',
link: 'https://stage.asciidisco.com',
image: 'https://stage.asciidisco.com/android-chome-512x512.png',
favicon: 'https://stage.asciidisco.com/favicon.ico',
copyright: '2018 Sebastian Golasch',
generator: 'asciidisco.com',
feedLinks: {
json: 'https://stage.asciidisco.com/feed.json',
atom: 'https://stage.asciidisco.com/feed.atom',
},
author: {
name: 'Sebastian Golasch',
email: 'public@asciidisco.com',
link: 'https://stage.asciidisco.com',
},
categories: ['Technology','JavaScript','Web','Python','Rust','React Native'],
}
}

84
build/config.json Normal file
View File

@@ -0,0 +1,84 @@
{
"manifest": {
"title": "asciidisco.com Blog",
"description": "Blog of asciidisco (Sebastian Golasch)",
"url": "https://stage.asciidisco.com",
"copyright": "2018 Sebastian Golasch",
"author": {
"name": "Sebastian Golasch",
"email": "public@asciidisco.com"
},
"keywords": [
"Technology",
"JavaScript",
"IoT",
"Web",
"Python",
"Rust",
"React Native"
]
},
"content": {
"ghost": {
"id": "ghost-admin",
"secret": "f481cecda9fb",
"username": "public@asciidisco.com",
"password": "Bx75q3Vt!",
"host": "worried-secure.glitch.me"
},
"github": {
"user": "asciidisco"
},
"markdown": {
"pages": [
{"key": "about-short", "url": "https://raw.githubusercontent.com/asciidisco/about.me/master/README.md"}
]
}
},
"css": {
"plugins": {
"postcss-import": {},
"autoprefixer": {},
"css-mqpacker": {},
"postcss-unique-selectors": {},
"postcss-merge-selectors": {},
"postcss-minify-selectors": {},
"postcss-merge-longhand": {},
"postcss-merge-idents": {},
"postcss-convert-values": {},
"postcss-colormin": {},
"postcss-discard-unused": {},
"postcss-minify-font-values": {},
"postcss-discard-duplicates": {},
"postcss-discard-empty": {},
"postcss-ordered-values": {},
"cssnano": {"preset": "default"},
"postcss-csso": {}
}
},
"images": {
"plugins": {
"imagemin-jpegtran": {},
"imagemin-jpegoptim": {},
"imagemin-mozjpeg": {},
"imagemin-zopfli": {"more": true},
"imagemin-pngcrush": {},
"imagemin-advpng": {},
"imagemin-optipng": {},
"imagemin-svgo'": {}
}
},
"serviceworker": {
"statics": {
"prefer-cache": [".css", ".jpg", ".png", ".webp", ".svg", ".js"],
"offline-only": [".html"]
}
},
"deploy": {
"ftp": {
"host": "w00dfcf1.kasserver.com",
"user": "f00e43cc",
"password": "UH57MsPPAmXGo3Xm"
}
}
}

50
build/index.js Normal file
View File

@@ -0,0 +1,50 @@
const config = require('./config')
const content = require('./tasks/fetch_content')
const feed = require('./tasks/feed')
const icons = require('./tasks/icons')
const images = require('./tasks/images')
const fonts = require('./tasks/fonts')
const css = require('./tasks/css')
const javascript = require('./tasks/javascript')
const pwa_manifest = require('./tasks/manifest')
const serviceworker = require('./tasks/serviceworker')
const html = require('./tasks/html')
const htaccess = require('./tasks/htaccess')
const deploy = require('./tasks/deploy')
const chalk = require('chalk')
const log = console.log;
(async function __main() {
let result = {}
log(chalk.blue('>>'), 'Starting static page generator')
try {
log(chalk.blue('>>'), 'Fetching remote content')
result.content = await content(config, result)
/*log(chalk.blue('>>'), 'Creating feed')
result.feed = await feed(config, result)
log(chalk.blue('>>'), 'Creating icons')
result.icons = await icons(config, result)
log(chalk.blue('>>'), 'Creating image files')
result.images = await images(config, result)
log(chalk.blue('>>'), 'Creating font files')
result.fonts = await fonts(config, result)
log(chalk.blue('>>'), 'Creating css files')
result.css = await css(config, result)
log(chalk.blue('>>'), 'Creating js files')
result.javascript = await javascript(config, result)
log(chalk.blue('>>'), 'Creating html files')
result.html = await html(config, result)
log(chalk.blue('>>'), 'Creating PWA manifest')
result.pwa = await pwa_manifest(config, result)*/
//log(chalk.blue('>>'), 'Creating serviceworker file')
//result.serviceworker = await serviceworker(config, result)
/*log(chalk.blue('>>'), 'Creating .htaccess')
result.htaccess = await htaccess(config, result)
log(chalk.blue('>>'), 'Deploying to server')
result.deploy = await deploy(config, result)
log(chalk.blue('>>'), 'Done without errors')*/
} catch(err) {
log(chalk.red('>>'), 'Error:')
log(chalk.red('>>'), err)
}
})()

39
build/lib/request.js Normal file
View File

@@ -0,0 +1,39 @@
const http = require('http')
const https = require('https')
const {promisify} = require('util')
https.get[promisify.custom] = function getAsyncHttps (options) {
return new Promise((resolve, reject) => {
const req = https.get(options, res => {
if (res.statusCode >= 400) return reject(new Error(res.statusCode))
res.end = new Promise(resolve => res.on('end', resolve))
resolve(res)
})
req.on('error', reject)
req.on('timeout', () => reject(new Error('timeout')) && req.abort())
})
}
http.get[promisify.custom] = function getAsyncHttp (options) {
return new Promise((resolve, reject) => {
const req = http.get(options, res => {
if (res.statusCode >= 400) return reject(new Error(res.statusCode))
res.end = new Promise(resolve => res.on('end', resolve))
resolve(res)
})
req.on('error', reject)
req.on('timeout', () => reject(new Error('timeout')) && req.abort())
})
}
const parseJSONData = (data, resolve, reject) => {
try {
resolve(JSON.parse(data.read()))
} catch (error) {
reject(error)
}
}
module.exports.parseJSONData = parseJSONData
module.exports.httpsGetAsync = promisify(https.get)
module.exports.httpGetAsync = promisify(http.get)

BIN
build/node_modules/.DS_Store generated vendored Normal file

Binary file not shown.

1
build/node_modules/.bin/JSONStream generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../JSONStream/bin.js

1
build/node_modules/.bin/acorn generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../acorn/bin/acorn

1
build/node_modules/.bin/advpng generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../advpng-bin/cli.js

1
build/node_modules/.bin/autoprefixer-info generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../autoprefixer/bin/autoprefixer-info

1
build/node_modules/.bin/babylon generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../babylon/bin/babylon.js

1
build/node_modules/.bin/bin-version-check generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../bin-version-check/cli.js

1
build/node_modules/.bin/browser-pack generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../browser-pack/bin/cmd.js

1
build/node_modules/.bin/browserify generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../browserify/bin/cmd.js

1
build/node_modules/.bin/browserslist generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../browserslist/cli.js

1
build/node_modules/.bin/color-support generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../color-support/bin.js

1
build/node_modules/.bin/csso generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../csso/bin/csso

1
build/node_modules/.bin/cwebp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../cwebp-bin/cli.js

1
build/node_modules/.bin/deps-sort generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../deps-sort/bin/cmd.js

1
build/node_modules/.bin/detect-libc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../detect-libc/bin/detect-libc.js

1
build/node_modules/.bin/esparse generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../esprima/bin/esparse.js

1
build/node_modules/.bin/esvalidate generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../esprima/bin/esvalidate.js

1
build/node_modules/.bin/executable generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../executable/cli.js

1
build/node_modules/.bin/extract-zip generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../extract-zip/cli.js

1
build/node_modules/.bin/find-versions generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../find-versions/cli.js

1
build/node_modules/.bin/google-closure-compiler-js generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../google-closure-compiler-js/cmd.js

1
build/node_modules/.bin/guetzli generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../guetzli/cli.js

1
build/node_modules/.bin/handlebars generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../handlebars/bin/handlebars

1
build/node_modules/.bin/he generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../he/bin/he

1
build/node_modules/.bin/html-minifier generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../html-minifier/cli.js

1
build/node_modules/.bin/http2-push-manifest generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../http2-push-manifest/bin/http2-push-manifest

1
build/node_modules/.bin/image-size generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../image-size/bin/image-size.js

1
build/node_modules/.bin/inline-require generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../inline-require/index.js

1
build/node_modules/.bin/insert-module-globals generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../insert-module-globals/bin/cmd.js

1
build/node_modules/.bin/jpeg-recompress generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jpeg-recompress-bin/cli.js

1
build/node_modules/.bin/jpegoptim generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jpegoptim-bin/cli.js

1
build/node_modules/.bin/jpegtran generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jpegtran-bin/cli.js

1
build/node_modules/.bin/js-yaml generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../js-yaml/bin/js-yaml.js

1
build/node_modules/.bin/jsesc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../jsesc/bin/jsesc

1
build/node_modules/.bin/json5 generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../json5/lib/cli.js

1
build/node_modules/.bin/lnfs generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../lnfs/cli.js

1
build/node_modules/.bin/loose-envify generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../loose-envify/cli.js

1
build/node_modules/.bin/lpad-align generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../lpad-align/cli.js

1
build/node_modules/.bin/markdown-it generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../markdown-it/bin/markdown-it.js

1
build/node_modules/.bin/miller-rabin generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../miller-rabin/bin/miller-rabin

1
build/node_modules/.bin/mime generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mime/cli.js

1
build/node_modules/.bin/mkdirp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mkdirp/bin/cmd.js

1
build/node_modules/.bin/module-deps generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../module-deps/bin/cmd.js

1
build/node_modules/.bin/mozjpeg generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../mozjpeg/cli.js

1
build/node_modules/.bin/mqpacker generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../css-mqpacker/bin/mqpacker.js

1
build/node_modules/.bin/node-gyp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-gyp/bin/node-gyp.js

1
build/node_modules/.bin/node-pre-gyp generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-pre-gyp/bin/node-pre-gyp

1
build/node_modules/.bin/nopt generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../nopt/bin/nopt.js

1
build/node_modules/.bin/npm-path generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../npm-path/bin/npm-path

1
build/node_modules/.bin/npm-which generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../npm-which/bin/npm-which.js

1
build/node_modules/.bin/optipng generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../optipng-bin/cli.js

1
build/node_modules/.bin/phantomjs generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../phantomjs-prebuilt/bin/phantomjs

1
build/node_modules/.bin/pixelmatch generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../pixelmatch/bin/pixelmatch

1
build/node_modules/.bin/pngcrush generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../pngcrush-bin/cli.js

1
build/node_modules/.bin/pngout generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../pngout-bin/cli.js

1
build/node_modules/.bin/pngquant generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../pngquant-bin/cli.js

1
build/node_modules/.bin/prebuild-install generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../prebuild-install/bin.js

1
build/node_modules/.bin/prepack generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../prepack/bin/prepack.js

1
build/node_modules/.bin/prepack-repl generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../prepack/bin/prepack-repl.js

1
build/node_modules/.bin/rc generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../rc/index.js

1
build/node_modules/.bin/rimraf generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../rimraf/bin.js

1
build/node_modules/.bin/seek-bunzip generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../seek-bzip/bin/seek-bunzip

1
build/node_modules/.bin/seek-table generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../seek-bzip/bin/seek-bzip-table

1
build/node_modules/.bin/semver generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../semver/bin/semver

1
build/node_modules/.bin/sha.js generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sha.js/bin.js

1
build/node_modules/.bin/sshpk-conv generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sshpk/bin/sshpk-conv

1
build/node_modules/.bin/sshpk-sign generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sshpk/bin/sshpk-sign

1
build/node_modules/.bin/sshpk-verify generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sshpk/bin/sshpk-verify

1
build/node_modules/.bin/strip-dirs generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../strip-dirs/cli.js

1
build/node_modules/.bin/strip-indent generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../strip-indent/cli.js

1
build/node_modules/.bin/stylehacks generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../stylehacks/dist/cli.js

1
build/node_modules/.bin/svg2png generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../svg2png/bin/svg2png-cli.js

1
build/node_modules/.bin/svgo generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../svgo/bin/svgo

1
build/node_modules/.bin/sw-precache generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../sw-precache/cli.js

1
build/node_modules/.bin/tlds generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../tlds/bin.js

1
build/node_modules/.bin/uglifyjs generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../uglify-es/bin/uglifyjs

1
build/node_modules/.bin/umd generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../umd/bin/cli.js

1
build/node_modules/.bin/uuid generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../uuid/bin/uuid

1
build/node_modules/.bin/vulcanize generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../vulcanize/bin/vulcanize

1
build/node_modules/.bin/which generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../which/bin/which

1
build/node_modules/.bin/zopfli generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-zopfli/bin/zopfli

1
build/node_modules/.bin/zopflipng generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../node-zopfli/bin/zopflipng

View File

@@ -0,0 +1,27 @@
{
"lang": "en-US",
"display": "standalone",
"orientation": "natural",
"splash_screens": [{
"src": "splash/lowres",
"sizes": "320x240"
}, {
"src": "splash/hd_small",
"sizes": "1334x750"
}, {
"src": "splash/hd_hi",
"sizes": "1920x1080",
"density": 3
}],
"prefer_related_applications": "true",
"related_applications": [{
"platform": "play",
"url": "https://play.google.com/store/apps/details?id=com.example.app1",
"id": "com.example.app1"
}, {
"platform": "itunes",
"url": "https://itunes.apple.com/app/example-app1/id123456789",
}, {
"platform": "web"
}]
}

22
build/node_modules/@pwa/manifest/assets/manifest.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "Name for App and Splash Screen",
"short_name": "Short name for Icon and Task",
"icons": [{
"src": "icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
}, {
"src": "icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
}, {
"src": "icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}],
"start_url": "./?utm_source=web_app_manifest",
"display": "standalone",
"orientation": "natural",
"background_color": "#FFFFFF",
"theme_color": "#3F51B5"
}

90
build/node_modules/@pwa/manifest/index.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
'use strict';
const path = require('path');
const oassign = require('object-assign');
const writeJSON = require('write-json-file');
const loadJSON = require('load-json-file');
const readPkgUp = require('read-pkg-up');
const isCssColorHex = require('is-css-color-hex');
const isCssColorName = require('is-css-color-name');
function validate(vals, pkg) {
const presets = {
dir: ['ltr', 'rtl', 'auto'],
icons: ['72', '96', '128', '144', '152', '192', '384', '512'],
display: ['fullscreen', 'standalone', 'minimal-ui', 'browser'],
orientation: [
'any', 'natural', 'landscape', 'landscape-primary',
'landscape-secondary', 'portrait', 'portrait-primary',
'portrait-secondary'
]
};
const err = m => new Error(m + ' has an invalid value: ' + vals[m]);
const hasPreset = (m, v) => presets[m].indexOf(v) >= 0;
const isCssColorVal = v => isCssColorHex(v) || isCssColorName(v);
const shortize = name => name.slice(0, 12);
if (vals.display && !hasPreset('display', vals.display)) {
throw err('display');
}
if (vals.orientation && !hasPreset('orientation', vals.orientation)) {
throw err('orientation');
}
if (!vals.name && pkg && pkg.name) {
vals.name = pkg.name;
vals.short_name = pkg.name;
}
if (vals.short_name) {
vals.short_name = shortize(vals.short_name);
}
if (vals.background_color && !isCssColorVal(vals.background_color)) {
throw err('background_color');
}
if (vals.theme_color && !isCssColorVal(vals.theme_color)) {
throw err('theme_color');
}
if (vals.dir && !hasPreset('dir', vals.dir)) {
throw err('dir');
}
return vals;
}
function manifestDir(dir) {
return path.join(dir, 'manifest.json');
}
module.exports = function (opts) {
opts = oassign({}, opts);
return readPkgUp({}).then(res => {
opts = validate(opts, res.pkg);
})
.then(() => loadJSON(path.join(__dirname, './assets/manifest.json')))
.then(manifest => {
oassign(manifest, opts);
return manifest;
});
};
module.exports.write = function (dir, manifest) {
return writeJSON(manifestDir(dir), manifest);
};
module.exports.write.sync = function (dir, manifest) {
return writeJSON.sync(manifestDir(dir), manifest);
};
module.exports.read = function (dir) {
return loadJSON(manifestDir(dir));
};
module.exports.read.sync = function (dir) {
return loadJSON.sync(manifestDir(dir));
};

21
build/node_modules/@pwa/manifest/license generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) ragingwind <ragingwind@gmail.com> (ragingwind.html)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,102 @@
'use strict';
const x = module.exports;
const ESC = '\u001B[';
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
x.cursorTo = (x, y) => {
if (typeof x !== 'number') {
throw new TypeError('The `x` argument is required');
}
if (typeof y !== 'number') {
return ESC + (x + 1) + 'G';
}
return ESC + (y + 1) + ';' + (x + 1) + 'H';
};
x.cursorMove = (x, y) => {
if (typeof x !== 'number') {
throw new TypeError('The `x` argument is required');
}
let ret = '';
if (x < 0) {
ret += ESC + (-x) + 'D';
} else if (x > 0) {
ret += ESC + x + 'C';
}
if (y < 0) {
ret += ESC + (-y) + 'A';
} else if (y > 0) {
ret += ESC + y + 'B';
}
return ret;
};
x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
x.cursorLeft = ESC + 'G';
x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
x.cursorGetPosition = ESC + '6n';
x.cursorNextLine = ESC + 'E';
x.cursorPrevLine = ESC + 'F';
x.cursorHide = ESC + '?25l';
x.cursorShow = ESC + '?25h';
x.eraseLines = count => {
let clear = '';
for (let i = 0; i < count; i++) {
clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
}
if (count) {
clear += x.cursorLeft;
}
return clear;
};
x.eraseEndLine = ESC + 'K';
x.eraseStartLine = ESC + '1K';
x.eraseLine = ESC + '2K';
x.eraseDown = ESC + 'J';
x.eraseUp = ESC + '1J';
x.eraseScreen = ESC + '2J';
x.scrollUp = ESC + 'S';
x.scrollDown = ESC + 'T';
x.clearScreen = '\u001Bc';
x.beep = '\u0007';
x.image = (buf, opts) => {
opts = opts || {};
let ret = '\u001B]1337;File=inline=1';
if (opts.width) {
ret += `;width=${opts.width}`;
}
if (opts.height) {
ret += `;height=${opts.height}`;
}
if (opts.preserveAspectRatio === false) {
ret += ';preserveAspectRatio=0';
}
return ret + ':' + buf.toString('base64') + '\u0007';
};
x.iTerm = {};
x.iTerm.setCwd = cwd => '\u001B]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,82 @@
{
"_from": "ansi-escapes@^3.0.0",
"_id": "ansi-escapes@3.0.0",
"_inBundle": false,
"_integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==",
"_location": "/@pwa/manifest/ansi-escapes",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ansi-escapes@^3.0.0",
"name": "ansi-escapes",
"escapedName": "ansi-escapes",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/@pwa/manifest/inquirer"
],
"_resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz",
"_shasum": "ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92",
"_spec": "ansi-escapes@^3.0.0",
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/@pwa/manifest/node_modules/inquirer",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/ansi-escapes/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "ANSI escape codes for manipulating the terminal",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/ansi-escapes#readme",
"keywords": [
"ansi",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"escapes",
"formatting",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text",
"vt100",
"sequence",
"control",
"code",
"codes",
"cursor",
"iterm",
"iterm2"
],
"license": "MIT",
"name": "ansi-escapes",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/ansi-escapes.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0"
}

View File

@@ -0,0 +1,174 @@
# ansi-escapes [![Build Status](https://travis-ci.org/sindresorhus/ansi-escapes.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-escapes)
> [ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
## Install
```
$ npm install ansi-escapes
```
## Usage
```js
const ansiEscapes = require('ansi-escapes');
// Moves the cursor two rows up and to the left
process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
//=> '\u001B[2A\u001B[1000D'
```
## API
### cursorTo(x, [y])
Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
### cursorMove(x, [y])
Set the position of the cursor relative to its current position.
### cursorUp(count)
Move cursor up a specific amount of rows. Default is `1`.
### cursorDown(count)
Move cursor down a specific amount of rows. Default is `1`.
### cursorForward(count)
Move cursor forward a specific amount of rows. Default is `1`.
### cursorBackward(count)
Move cursor backward a specific amount of rows. Default is `1`.
### cursorLeft
Move cursor to the left side.
### cursorSavePosition
Save cursor position.
### cursorRestorePosition
Restore saved cursor position.
### cursorGetPosition
Get cursor position.
### cursorNextLine
Move cursor to the next line.
### cursorPrevLine
Move cursor to the previous line.
### cursorHide
Hide cursor.
### cursorShow
Show cursor.
### eraseLines(count)
Erase from the current cursor position up the specified amount of rows.
### eraseEndLine
Erase from the current cursor position to the end of the current line.
### eraseStartLine
Erase from the current cursor position to the start of the current line.
### eraseLine
Erase the entire current line.
### eraseDown
Erase the screen from the current line down to the bottom of the screen.
### eraseUp
Erase the screen from the current line up to the top of the screen.
### eraseScreen
Erase the screen and move the cursor the top left position.
### scrollUp
Scroll display up one line.
### scrollDown
Scroll display down one line.
### clearScreen
Clear the terminal screen.
### beep
Output a beeping sound.
### image(input, [options])
Display an image.
*Currently only supported on iTerm2 >=3*
See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
#### input
Type: `Buffer`
Buffer of an image. Usually read in with `fs.readFile()`.
#### options
##### width
##### height
Type: `string` `number`
The width and height are given as a number followed by a unit, or the word "auto".
- `N`: N character cells.
- `Npx`: N pixels.
- `N%`: N percent of the session's width or height.
- `auto`: The image's inherent size will be used to determine an appropriate dimension.
##### preserveAspectRatio
Type: `boolean`<br>
Default: `true`
### iTerm.setCwd([path])
Type: `string`<br>
Default: `process.cwd()`
[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
## Related
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -0,0 +1,10 @@
'use strict';
module.exports = () => {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
].join('|');
return new RegExp(pattern, 'g');
};

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,85 @@
{
"_from": "ansi-regex@^3.0.0",
"_id": "ansi-regex@3.0.0",
"_inBundle": false,
"_integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"_location": "/@pwa/manifest/ansi-regex",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "ansi-regex@^3.0.0",
"name": "ansi-regex",
"escapedName": "ansi-regex",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/@pwa/manifest/strip-ansi"
],
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"_shasum": "ed0317c322064f79466c02966bddb605ab37d998",
"_spec": "ansi-regex@^3.0.0",
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/@pwa/manifest/node_modules/strip-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/chalk/ansi-regex/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Regular expression for matching ANSI escape codes",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/chalk/ansi-regex#readme",
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"license": "MIT",
"name": "ansi-regex",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/ansi-regex.git"
},
"scripts": {
"test": "xo && ava",
"view-supported": "node fixtures/view-codes.js"
},
"version": "3.0.0"
}

View File

@@ -0,0 +1,46 @@
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install ansi-regex
```
## Usage
```js
const ansiRegex = require('ansi-regex');
ansiRegex().test('\u001B[4mcake\u001B[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
//=> ['\u001B[4m', '\u001B[0m']
```
## FAQ
### Why do you test for codes not in the ECMA 48 standard?
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

View File

@@ -0,0 +1,39 @@
'use strict';
const restoreCursor = require('restore-cursor');
let hidden = false;
exports.show = stream => {
const s = stream || process.stderr;
if (!s.isTTY) {
return;
}
hidden = false;
s.write('\u001b[?25h');
};
exports.hide = stream => {
const s = stream || process.stderr;
if (!s.isTTY) {
return;
}
restoreCursor();
hidden = true;
s.write('\u001b[?25l');
};
exports.toggle = (force, stream) => {
if (force !== undefined) {
hidden = force;
}
if (hidden) {
exports.show(stream);
} else {
exports.hide(stream);
}
};

Some files were not shown because too many files have changed in this diff Show More