Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
webpack.config.js
/node_modules/
/dist/
102 changes: 87 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
const utils = require('./build/utils');

module.exports = {
root: true,

env: {
browser: true,
es6: true,
node: true,
},

parser: 'vue-eslint-parser',

parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 2020,
extraFileExtensions: ['.vue'],
sourceType: 'module',
},

plugins: ['@kiwiirc', 'jsdoc'],

extends: [
'plugin:vue/recommended',
'eslint:recommended',
'@vue/airbnb',
'standard',
],
env: {
browser: true,

settings: {
'import/resolver': {
alias: {
map: [
['@', utils.pathResolve('src')],
],
extensions: ['.js', '.vue', '.json'],
},
},
},
// required to lint *.vue files
plugins: [
'vue',
],
// add your custom rules here

rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',

'@kiwiirc/class-name-prefix': 'warn',

'class-methods-use-this': 0,
'comma-dangle': ['error', {
arrays: 'always-multiline',
Expand All @@ -27,39 +53,85 @@ module.exports = {
functions: 'ignore',
}],
'import/extensions': 0,
'import/no-extraneous-dependencies': 0,
'import/no-unresolved': 0,
'import/no-cycle': 0,
'import/no-unresolved': [2, {
ignore: [
// These files will not exist if lint is run before the first build
'/res/locales/available\\.json$',
'/static/locales/\\S+\\.json$',
],
}],
'import/prefer-default-export': 0,
'indent': ['error', 4],
// 'max-len': ['error', { code: 120 }],
'max-classes-per-file': 0,
'no-continue': 0,
'no-control-regex': 0,
'no-else-return': 0,
'no-multi-assign': 0,
'no-param-reassign': ['error', { props: false }],
'no-plusplus': 0,
'no-prototype-builtins': 0,
'prefer-promise-reject-errors': 0,
'quote-props': ['error', 'consistent-as-needed'],
'no-control-regex': 0,
'object-shorthand': 0,
'operator-linebreak': 0,
'prefer-const': 0,
'prefer-destructuring': 0,
'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/html-closing-bracket-spacing': 0,
'space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
}],
'vue/html-indent': ['error', 4],
'vue/max-len': [
'error',
{
code: 120,
template: 120,
tabWidth: 4,
comments: 120,
ignoreComments: true,
},
],
'vue/max-attributes-per-line': 0,
'vue/singleline-html-element-content-newline': 0,
'vue/multi-word-component-names': 0,
'vue/multiline-html-element-content-newline': 0,
'vue/no-mutating-props': ['error', {
shallowOnly: true,
}],
'vue/no-v-html': 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,
'vuejs-accessibility/media-has-caption': 0,
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
],
env: {
jest: true,
},
},
{
files: ['webpack.config.js', 'build/**/*.js'],
rules: {
'import/no-extraneous-dependencies': 0,
'no-console': 0,
},
},
],
};
160 changes: 160 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Release Workflow

on:
pull_request:
types:
- opened
- closed
- reopened
- synchronize

jobs:
check-release:
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.release-title.outputs.release_version }}
steps:
- name: Check if PR title is a release title
id: release-title
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = context.payload.pull_request.title || '';
const versionRegex = /^Release v(\d+\.\d+\.\d+)$/;
const match = title.match(versionRegex);
console.log('match', match);
core.setOutput("release_version", match ? match[1] : '');

pull-request:
runs-on: ubuntu-latest
needs: check-release
if: needs.check-release.outputs.release_version != '' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize')
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Check package.json version
run: |
version=$(node -p "require('./package.json').version")
if [[ $version != "${{ needs.check-release.outputs.release_version }}" ]]; then
echo "PR does not match package.json version"
exit 1
fi

- name: Install dependencies
run: yarn install

- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Check for release id in PR message
id: check-release-id
uses: actions/github-script@v7
with:
script: |
const regex = /Release ID: (\d+)/;
const match = context.payload.pull_request.body?.match(regex);
const releaseId = match ? match[1] : null;
core.setOutput('release_id', releaseId);

- name: Create draft release
if: steps.check-release-id.outputs.release_id == ''
id: create-release-id
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${{ needs.check-release.outputs.release_version }}`,
name: context.payload.pull_request.title,
draft: true
});

core.setOutput("release_id", release.data.id);

- name: Append release id to PR message
if: steps.create-release-id.outputs.release_id != ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const releaseId = ${{ steps.create-release-id.outputs.release_id }};
const currentBody = context.payload.pull_request.body || '';
const newBody = `${currentBody}\n\nRelease ID: ${releaseId}`;
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
body: newBody
});

merged-request:
runs-on: ubuntu-latest
needs: check-release
if: needs.check-release.outputs.release_version != '' && github.event.action == 'closed' && github.event.pull_request.merged
permissions:
contents: write

steps:
- name: Check for release id in PR message
id: check-release-id
uses: actions/github-script@v7
with:
script: |
const regex = /Release ID: (\d+)/;
const match = context.payload.pull_request.body.match(regex);
const releaseId = match ? match[1] : null;

if (!releaseId) {
core.setFailed("PR does not contain a release id");
}
core.setOutput('release_id', releaseId);

- name: Checkout Repository
uses: actions/checkout@v4

- name: Check package.json version
run: |
version=$(node -p "require('./package.json').version")
if [[ $version != "${{ needs.check-release.outputs.release_version }}" ]]; then
echo "PR does not match package.json version"
exit 1
fi

- name: Install dependencies
run: yarn install

- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Create zip
run: |
mv dist plugins
zip -r -9 "${{ github.event.repository.name }}-v${{ needs.check-release.outputs.release_version }}.zip" plugins

- name: Attach zip to draft release
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fileName = "${{ github.event.repository.name }}-v${{ needs.check-release.outputs.release_version }}.zip";
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ steps.check-release-id.outputs.release_id }},
name: fileName,
data: require('fs').readFileSync(fileName)
});
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
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,
};
Loading