Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into europnet-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
CoryChaplin committed Sep 3, 2023
2 parents 806e47b + 0e712f5 commit 83ebd30
Show file tree
Hide file tree
Showing 113 changed files with 8,787 additions and 10,114 deletions.
35 changes: 24 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const rulesDirPlugin = require('eslint-plugin-rulesdir');

rulesDirPlugin.RULES_DIR = 'build/eslint/rules/';

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
parser: '@babel/eslint-parser',
sourceType: 'module',
},
extends: [
'plugin:vue/recommended',
'@vue/airbnb',
'standard'
'standard',
],
env: {
'browser': true,
browser: true,
},
// required to lint *.vue files
plugins: [
Expand All @@ -27,11 +28,11 @@ module.exports = {
'rulesdir/class-name-prefix': 'warn',
'class-methods-use-this': 0,
'comma-dangle': ['error', {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'never',
'exports': 'never',
'functions': 'ignore'
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'never',
exports: 'never',
functions: 'ignore',
}],
'import/extensions': 0,
'import/no-cycle': 0,
Expand All @@ -43,7 +44,7 @@ module.exports = {
'no-continue': 0,
'no-else-return': 0,
'no-multi-assign': 0,
'no-param-reassign': ['error', { 'props': false }],
'no-param-reassign': ['error', { props: false }],
'no-plusplus': 0,
'no-prototype-builtins': 0,
'no-control-regex': 0,
Expand All @@ -54,16 +55,28 @@ module.exports = {
'prefer-object-spread': 0,
'prefer-promise-reject-errors': 0,
'prefer-template': 0,
'quote-props': ['error', 'consistent-as-needed'],
'semi': ['error', 'always'],
'space-before-function-paren': ['error', 'never'],
'vue/component-definition-name-casing': 0,
'vue/html-indent': ['error', 4],
'vue/max-attributes-per-line': 0,
'vue/multi-word-component-names': 0,
'vue/multiline-html-element-content-newline': 0,
'vue/no-mutating-props': 0,
'vue/no-unused-components': 0,
'vue/no-v-html': 0,
'vue/require-prop-types': 0,
'vue/one-component-per-file': 0,
'vue/require-default-prop': 0,
'vue/require-prop-types': 0,
'vue/singleline-html-element-content-newline': 0,
'vuejs-accessibility/anchor-has-content': 0,
'vuejs-accessibility/click-events-have-key-events': 0,
'vuejs-accessibility/form-control-has-label': 0,
'vuejs-accessibility/iframe-has-title': 0,
'vuejs-accessibility/interactive-supports-focus': 0,
'vuejs-accessibility/label-has-for': 0,
'vuejs-accessibility/mouse-events-have-key-events': 0,
},
overrides: [{
files: [
Expand Down
32 changes: 13 additions & 19 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '12.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: yarn test
- run: yarn lint
node-version: '18.x'
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile --non-interactive --prefer-offline

- name: Test
run: yarn test

- name: Lint
run: yarn lint
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: 'kiwiirc/kiwiirc_packager'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-${{ github.event.inputs.ubuntu }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: 'kiwiirc/kiwiirc_packager'
ref: ${{ github.event.inputs.packager }}
Expand Down
9 changes: 9 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
printWidth: 120,
quoteProps: 'consistent',
semi: true,
singleQuote: true,
trailingComma: 'es5',
tabWidth: 4,
jsdocVerticalAlignment: true,
};
19 changes: 16 additions & 3 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
module.exports = {
extends: 'stylelint-config-standard',
extends: ['stylelint-config-standard', 'stylelint-config-recommended-vue'],
overrides: [
{
files: ['**/*.html'],
customSyntax: 'postcss-html',
},
],
rules: {
indentation: 4,
'no-descending-specificity': null,
'alpha-value-notation': null,
'color-function-notation': null,
'declaration-no-important': true,
'indentation': 4,
'no-descending-specificity': null,
'no-empty-first-line': null,
'property-no-vendor-prefix': null,
'selector-class-pattern': null,
'shorthand-property-no-redundant-values': null,
'string-quotes': 'single',
},
};
13 changes: 10 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
module.exports = {
presets: [['@vue/cli-plugin-babel/preset', { useBuiltIns: 'entry', modules: 'commonjs' }]],
plugins: [
['@babel/plugin-transform-runtime', { corejs: 3, useESModules: true }],
presets: [
[
'@vue/cli-plugin-babel/preset',
{
useBuiltIns: 'entry',
modules: 'commonjs',
corejs: { version: 3, proposals: true },
},
],
],
plugins: [['@babel/plugin-transform-runtime', { corejs: 3, useESModules: true }]],
env: {
test: {
plugins: [
Expand Down
92 changes: 92 additions & 0 deletions build/webpack/convert-locales.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
const fs = require('fs');
const path = require('path');
const i18nextConv = require('i18next-conv');

class ConvertLocalesPlugin {
apply(compiler) {
const pluginName = this.constructor.name;
const fileDependencies = new Set();

compiler.hooks.beforeRun.tapAsync(pluginName, (compilation, callback) => {
// run in build mode
convertLocales(fileDependencies, callback);
});

compiler.hooks.watchRun.tapAsync(pluginName, (compilation, callback) => {
// run in dev mode
convertLocales(fileDependencies, callback);
});

compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback) => {
// Add file dependencies
fileDependencies.forEach((dependency) => {
compilation.fileDependencies.add(dependency);
});

callback();
});
}
}

async function convertLocales(fileDependencies, callback) {
fileDependencies.clear();
const sourceDir = path.resolve('src/res/locales/');
const outputDir = path.resolve('static/locales/');

const awaitPromises = new Set();
const availableLangs = new Set();

const files = fs.readdirSync(sourceDir).filter((f) => path.extname(f) === '.po');
files.forEach((file) => {
const match = file.match(/^app.([a-z_-]+).po$/i);
if (!match) {
return;
}

const locale = match[1];
const lcLocale = locale.toLowerCase();
const outputPath = path.join(outputDir, lcLocale + '.json');
const sourcePath = path.join(sourceDir, file);

const concatLocale = () => new Promise((resolve) => {
let data = Buffer.alloc(0);
files.forEach((localeFile) => {
if (!localeFile.endsWith(`.${locale}.po`)) {
return;
}
const content = fs.readFileSync(path.join(sourceDir, localeFile));
data = Buffer.concat([data, content]);
});
resolve(data);
});

const promise = concatLocale()
.then((data) => i18nextConv.gettextToI18next(locale, data))
.then((json) => writeIfChanged(outputPath, json));

awaitPromises.add(promise);
availableLangs.add(lcLocale);
fileDependencies.add(sourcePath);
});

// Write available.json
const availablePath = path.join(sourceDir, 'available.json');
const content = JSON.stringify({
locales: Array.from(availableLangs),
});
writeIfChanged(availablePath, content);

await Promise.all(awaitPromises);
callback();
}

function writeIfChanged(file, _data) {
const data = Buffer.from(_data);
if (fs.existsSync(file) && data.equals(fs.readFileSync(file))) {
return;
}

fs.writeFileSync(file, data);
}

module.exports = ConvertLocalesPlugin;
73 changes: 0 additions & 73 deletions build/webpack/locales.js

This file was deleted.

Loading

0 comments on commit 83ebd30

Please sign in to comment.