Commit 6046d7a0 authored by JosephK's avatar JosephK
Browse files

Merge branch 'master' into 'master'

️ vue-fs 21.12.7

See merge request !17
parents d5aa2fc9 d265a9c2
Pipeline #466254 passed with stages
in 2 minutes and 32 seconds
node_modules/
dist/
npm-debug.log
pnpm-lock.yaml
tools/backup/
tools/tmp/
src/translations/*/sfs.yml
commons
src/translations/*/hos.yml
src/translations/*/sfs.yml
public/wiki/
public/wiki.json
......@@ -13,7 +13,6 @@ pages:
stage: deploy
script:
- npm run commons
- npm run sfs && npm run hos
- npm run prod
- rm -r public/ && mv -f dist/$(echo $CI_PAGES_URL | cut -d/ -f4-)/ public/
- find public -type f -iregex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -execdir gzip -f --keep {} \;
......@@ -39,7 +38,6 @@ production:
# - apt-get --yes --force-yes install rsync
script:
- npm run commons
- npm run sfs && npm run hos
- npm run prod -- --base=abc
- rm -r public/ && mv dist/ public/
- cp ./public/abc/fr/index.html ./public/abc/index.html
......
/* eslint-disable global-require */
/* eslint-disable import/no-commonjs */
/* eslint-disable import/no-extraneous-dependencies */
const download = require('download');
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
......@@ -120,41 +118,20 @@ for (let j = 0; j < env.views.length; j += 1) {
}
/* --- Wiki ----------------------------------------------------------------- */
fs.writeFileSync(path.resolve(__dirname, '../public/wiki.json'), '[]');
async function downloadWikiFiles(json) {
const files = [...new Set( // no duplicate
Array.from( // find files in the wiki pages
JSON.stringify(json).matchAll(/\(uploads\/(.*?)\)/g),
m => `${env.wiki.base}uploads/${m[1]}`,
),
)];
await Promise.all(files.map(url => download(
url,
url.replace(`${env.wiki.base}uploads/`, './public/wiki/').replace(/([^/]+$)/, ''),
)));
}
if (env.wiki.api !== '') {
fs.mkdirSync(path.resolve(__dirname, '../public/wiki/'), { recursive: true });
env.assets.push(
{ from: path.resolve(__dirname, '../public/wiki.json'), to: 'wiki.json' },
{ from: path.resolve(__dirname, '../public/wiki/'), to: 'wiki/' },
);
// Download json
download(env.wiki.api, './public/', { filename: 'wiki.json' })
.then(() => {
const json = require('../public/wiki.json'); // eslint-disable-line
// Get wiki data
const wiki = require('../src/wiki')(env, json);
// Download attached files
downloadWikiFiles(json);
// RSS
require('./feed')(env, wiki);
})
.catch((err) => { console.error(err); }); // eslint-disable-line
// Import json
const json = require('../public/wiki.json');
// Get wiki data
const wiki = require('../src/wiki')(env, json);
// RSS
require('./feed')(env, wiki);
} else {
fs.writeFileSync(path.resolve(__dirname, '../public/wiki.json'), '[]');
}
/* --- Symlinks-------------------------------------------------------------- */
......
......@@ -30,7 +30,7 @@ function buildFeeds(env, wiki) {
.slice() // shallow copy of the array
.sort() // posts sorted
.reverse() // with latest in first
.slice(0, 10) // and only 10 posts kept in the feed
.slice(0, 5) // and only 5 posts kept in the feed
.forEach((date) => {
feed.addItem({
content: marked(wiki[lg][type].posts[date].text),
......
This diff is collapsed.
{
"name": "vue-fs-template",
"description": "Vue skeleton with i18n router",
"version": "21.7.7",
"version": "21.12.7",
"author": "JosephK",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"commons": "rm -rf node_modules/vue-fs-commons && npm i git+https://git@framagit.org/framasoft/vue-fs/commons.git#master && npm i",
"sfs": "node_modules/vue-fs-commons/tools/copy-sfs-translations.sh",
"hos": "node_modules/vue-fs-commons/tools/copy-hos-translations.sh",
"commons": "rm -rf node_modules/vue-fs-commons && npm i git+https://git@framagit.org/framasoft/vue-fs/commons.git#master && node_modules/vue-fs-commons/tools/prepare-commons.sh",
"dev": "rm -rf dist && cross-env NODE_ENV=development webpack-dev-server",
"prod": "rm -rf dist && cross-env NODE_ENV=production webpack --progress --hide-modules"
},
......@@ -16,7 +13,7 @@
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"iconslk": "^0.1.6",
"laue": "^0.2.0",
"laue": "^0.2.1",
"lodash": "^4.17.21",
"marked": "^0.7.0",
"roboto-fontface": "^0.10.0",
......@@ -38,7 +35,6 @@
"cross-env": "^5.2.1",
"css-hot-loader": "^1.4.4",
"css-loader": "^2.1.1",
"download": "^8.0.0",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-import-resolver-webpack": "^0.11.1",
......
......@@ -3,6 +3,8 @@ config:
'link', 'metrics', 'people', 'soft', 'src']
defaultLang: en
framanav: true
hos: true
sfs: true
translate: https://weblate.framasoft.org/projects/framacalc/
meta:
title: '@:txt.calc - @:meta.lead'
......
......@@ -35,13 +35,10 @@ function formatWiki(env, data) {
let url = front.match(/url: (.+)/)
? front.match(/url: (.+)/)[1]
: '';
if (url === '' && type === 'news') {
url = `${env.url}news#${date}`;
}
/* setting for FAQ */
const id = front.match(/id: ([a-zA-Z-]+)/)
? front.match(/id: ([a-zA-Z-]+)/)[1]
const id = front.match(/id: ([a-zA-Z0-9-]+)/)
? front.match(/id: ([a-zA-Z0-9-]+)/)[1]
: '';
const cat = front.match(/cat: ([a-zA-Z-]+)/)
......@@ -76,11 +73,18 @@ function formatWiki(env, data) {
/* News or newsletter */
if (/^news/.test(type)) {
if (url === '') {
url = type === 'news'
? `${env.url}news#${date}`
: `${env.url}newsletter/?nl=${id}`;
}
if (wiki[lg][type].posts === undefined) {
wiki[lg][type].posts = {};
}
wiki[lg][type].posts[date] = {};
Object.assign(wiki[lg][type].posts[date], {
id,
img,
url,
title,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment