feat: merge static version with latest and add license

BREAKING CHANGE: Now only one tag will be published: `latest`. This tag will include both the standard and latest version
This commit is contained in:
Joxit 2021-03-31 07:10:50 +02:00
parent 7d095916db
commit 1173453f72
No known key found for this signature in database
GPG key ID: F526592B8E012263
24 changed files with 151 additions and 288 deletions

6
rollup/copy-transform.js Normal file
View file

@ -0,0 +1,6 @@
export default function (contents, name) {
if (name.endsWith('.svg')) {
return contents.toString('utf8').split(/\n */).join(' ').replace(/\s+/g, ' ').trim();
}
return contents;
}

View file

@ -1,21 +1,26 @@
import fs from 'fs';
const useref = /<!--\s*build:([a-z]+) ([-a-zA-Z./]+)\s*-->.*?<!--\s*endbuild\s*-->/;
const useref = /<!--\s*build:([a-z]+) ([-a-zA-Z./]+)\s*-->(.*?)<!--\s*endbuild\s*-->/ms;
const generateBalise = (type, output) => {
switch(type) {
const generateBalise = (type, output, body, opts = {}) => {
switch (type) {
case 'css':
return `<link href="${output}" rel="stylesheet" type="text/css">`;
case 'js':
return `<script src="${output}"></script>`
return `<script src="${output}"></script>`;
case 'keep':
return opts[output] ? body : '';
}
}
};
export default function(src) {
let html = fs.readFileSync(src).toString().replace(/>\n+\s*/g, '>');
export default function (src, opts) {
let html = fs
.readFileSync(src)
.toString()
.replace(/>\n+\s*/g, '>');
while (useref.test(html)) {
const [ raw, type, output ] = useref.exec(html);
html = html.replace(raw, generateBalise(type, output));
const [raw, type, output, body] = useref.exec(html);
html = html.replace(raw, generateBalise(type, output, body, opts));
}
return html;
}
}

18
rollup/license.js Normal file
View file

@ -0,0 +1,18 @@
export default `/*
* Copyright (C) 2016-2021 Jones Magloire @Joxit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @license AGPL
*/`