Browse Source

Procedure for downloading highlight.js

Currently slightly broken due to a bug in a dependency
microsub
J. King 5 years ago
parent
commit
7dee5498d8
  1. 51
      RoboFile.php
  2. 2
      docs/theme/arsse/highlight.pack.js
  3. 9
      package.json
  4. 3
      vendor-bin/robo/composer.json
  5. 59
      vendor-bin/robo/composer.lock
  6. 80
      yarn.lock

51
RoboFile.php

@ -1,6 +1,7 @@
<?php
use Robo\Result;
use splitbrain\PHPArchive\Zip;
class RoboFile extends \Robo\Tasks {
const BASE = __DIR__.\DIRECTORY_SEPARATOR;
@ -200,6 +201,54 @@ class RoboFile extends \Robo\Tasks {
$themeout = realpath(self::BASE."docs/theme/arsse/");
$scss = $themesrc."/arsse.scss";
$css = $themeout."/arsse.css";
return $this->taskExec($postcss)->arg($scss)->option("-o", $css)->args($args)->run();
// start a collection; this stops after the first failure
$t = $this->collectionBuilder();
$tmp = $t->tmpDir().\DIRECTORY_SEPARATOR;
// install dependencies via Yarn
$t->taskExec("yarn install");
// compile the stylesheet
$t->taskExec($postcss)->arg($scss)->option("-o", $css);
// download highlight.js
$t->addCode(function() use ($tmp, $themeout) {
$languages = ["php", "bash", "shell", "xml", "nginx", "apache"];
$post = http_build_query((function($langs) {
$out = [];
foreach($langs as $l) {
$out[$l.".js"] = "on";
}
return $out;
})($languages));
$conn = fopen("https://highlightjs.org/download/", "r");
if ($conn === false) {
throw new Exception("Unable to download Highlight.js");
}
foreach (stream_get_meta_data($conn)['wrapper_data'] as $field) {
if (preg_match("/^Set-Cookie: csrftoken=([^;]+)/i", $field, $cookie)) {
break;
}
}
$token = stream_get_contents($conn);
preg_match("/<input type='hidden' name='csrfmiddlewaretoken' value='([^']*)'/", $token, $token);
$post = "csrfmiddlewaretoken={$token[1]}&$post";
$hljs = file_get_contents("https://highlightjs.org/download/", false, stream_context_create(['http' => [
'method' => "POST",
'content' => $post,
'header' => [
"Referer: https://highlightjs.org/download/",
"Cookie: csrftoken={$cookie[1]}",
"Content-Type: application/x-www-form-urlencoded",
],
]]));
if ($hljs === false) {
throw new Exception("Unable to download Highlight.js");
} else {
file_put_contents($tmp."highlightjs.zip", $hljs);
}
$z = new Zip;
$z->open($tmp."highlightjs.zip");
$z->extract($themeout, "", "", "highlight.pack.js");
}, "downloadHighlightjs");
// execute the collection
return $t->run();
}
}

2
docs/theme/arsse/highlight.pack.js

File diff suppressed because one or more lines are too long

9
package.json

@ -1,14 +1,13 @@
{
"devDependencies": {
"postcss-cli": "^6.1.3",
"postcss-custom-media": "^7.0.8",
"postcss-import": "^12.0.1",
"postcss-media-minmax": "^4.0.0",
"autoprefixer": "^9.6.1",
"postcss-cli": "^6.1.3",
"postcss-csso": "^3.0.0",
"postcss-custom-media": "^7.0.8",
"postcss-custom-properties": "^9.0.2",
"postcss-discard-comments": "^4.0.2",
"postcss-mixins": "^6.2.2",
"postcss-import": "^12.0.1",
"postcss-media-minmax": "^4.0.0",
"postcss-nested": "^4.1.2",
"postcss-sassy-mixins": "^2.1.0",
"postcss-scss": "^2.0.0"

3
vendor-bin/robo/composer.json

@ -3,5 +3,8 @@
"consolidation/robo": "^1.1",
"pear/archive_tar": "^1.4",
"symfony/process": "^3.0"
},
"require-dev": {
"splitbrain/php-archive": "^1.1"
}
}

59
vendor-bin/robo/composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "87a37068875d67919f797af9dc08e108",
"content-hash": "0f7d93d4c470b72b0f6f0bc0317d603f",
"packages": [
{
"name": "consolidation/annotated-command",
@ -1734,7 +1734,62 @@
"time": "2019-04-06T14:04:46+00:00"
}
],
"packages-dev": [],
"packages-dev": [
{
"name": "splitbrain/php-archive",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"ext-bz2": "*",
"ext-zip": "*",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8"
},
"suggest": {
"ext-iconv": "Used for proper filename encode handling",
"ext-mbstring": "Can be used alternatively for handling filename encoding"
},
"type": "library",
"autoload": {
"psr-4": {
"splitbrain\\PHPArchive\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Gohr",
"email": "andi@splitbrain.org"
}
],
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
"keywords": [
"archive",
"extract",
"tar",
"unpack",
"unzip",
"zip"
],
"time": "2018-09-09T12:13:53+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],

80
yarn.lock

@ -109,7 +109,7 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=
array-union@^1.0.1, array-union@^1.0.2:
array-union@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=
@ -126,11 +126,6 @@ array-unique@^0.3.2:
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=
arrify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=
assign-symbols@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
@ -254,11 +249,6 @@ callsites@^2.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50"
integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=
camelcase-css@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5"
integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==
camelcase@^5.0.0:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
@ -494,14 +484,6 @@ detect-libc@^1.0.2:
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
dir-glob@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034"
integrity sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==
dependencies:
arrify "^1.0.1"
path-type "^3.0.0"
dir-glob@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4"
@ -593,7 +575,7 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"
fast-glob@^2.0.2, fast-glob@^2.2.6:
fast-glob@^2.2.6:
version "2.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw==
@ -723,7 +705,7 @@ glob@^6.0.4:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.2, glob@^7.1.3:
glob@^7.1.3:
version "7.1.4"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
@ -735,19 +717,6 @@ glob@^7.1.2, glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"
globby@^8.0.1:
version "8.0.2"
resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.2.tgz#5697619ccd95c5275dbb2d6faa42087c1a941d8d"
integrity sha512-yTzMmKygLp8RUpG1Ymu2VXPSJQZjNAZPD4ywgYEaG7e4tBJeUQBO8OpXrf1RCNcEs5alsoJYPAMiIHP0cmeC7w==
dependencies:
array-union "^1.0.1"
dir-glob "2.0.0"
fast-glob "^2.0.2"
glob "^7.1.2"
ignore "^3.3.5"
pify "^3.0.0"
slash "^1.0.0"
globby@^9.0.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d"
@ -834,11 +803,6 @@ ignore-walk@^3.0.1:
dependencies:
minimatch "^3.0.4"
ignore@^3.3.5:
version "3.3.10"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==
ignore@^4.0.3:
version "4.0.6"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
@ -1606,14 +1570,6 @@ postcss-import@^12.0.1:
read-cache "^1.0.0"
resolve "^1.1.7"
postcss-js@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-2.0.2.tgz#a5e75d3fb9d85b28e1d2bd57956c115665ea8542"
integrity sha512-HxXLw1lrczsbVXxyC+t/VIfje9ZeZhkkXE8KpFa3MEKfp2FyHDv29JShYY9eLhYrhLyWWHNIuwkktTfLXu2otw==
dependencies:
camelcase-css "^2.0.1"
postcss "^7.0.17"
postcss-load-config@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-2.1.0.tgz#c84d692b7bb7b41ddced94ee62e8ab31b417b003"
@ -1629,17 +1585,6 @@ postcss-media-minmax@^4.0.0:
dependencies:
postcss "^7.0.2"
postcss-mixins@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/postcss-mixins/-/postcss-mixins-6.2.2.tgz#3acea63271e2c75db62fb80bc1c29e1a609a4742"
integrity sha512-QqEZamiAMguYR6d2h73XXEHZgkxs03PlbU0PqgqtdCnbRlMLFNQgsfL/Td0rjIe2SwpLXOQyB9uoiLWa4GR7tg==
dependencies:
globby "^8.0.1"
postcss "^7.0.17"
postcss-js "^2.0.2"
postcss-simple-vars "^5.0.2"
sugarss "^2.0.0"
postcss-nested@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-4.1.2.tgz#8e0570f736bfb4be5136e31901bf2380b819a561"
@ -1690,13 +1635,6 @@ postcss-simple-vars@^1.2.0:
dependencies:
postcss "^5.0.13"
postcss-simple-vars@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/postcss-simple-vars/-/postcss-simple-vars-5.0.2.tgz#e2f81b3d0847ddd4169816b6d141b91d51e6e22e"
integrity sha512-xWIufxBoINJv6JiLb7jl5oElgp+6puJwvT5zZHliUSydoLz4DADRB3NDDsYgfKVwojn4TDLiseoC65MuS8oGGg==
dependencies:
postcss "^7.0.14"
postcss-value-parser@^3.2.3:
version "3.3.1"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
@ -1929,11 +1867,6 @@ signal-exit@^3.0.0:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
slash@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=
slash@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44"
@ -2063,13 +1996,6 @@ strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
sugarss@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/sugarss/-/sugarss-2.0.0.tgz#ddd76e0124b297d40bf3cca31c8b22ecb43bc61d"
integrity sha512-WfxjozUk0UVA4jm+U1d736AUpzSrNsQcIbyOkoE364GrtWmIrFdk5lksEupgWMD4VaT/0kVx1dobpiDumSgmJQ==
dependencies:
postcss "^7.0.2"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"

Loading…
Cancel
Save