Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Sep 4, 2024
1 parent 5f319e9 commit 41bae67
Show file tree
Hide file tree
Showing 26 changed files with 481 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/i18n/
/node_modules/
/vendor/
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"root": true,
"extends": [
"wikimedia/server"
]
}
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
119 changes: 119 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Lint

on:
push:
branches:
- "**"
- "!**dependabot/**"
- "!**release-please--**"
pull_request:
branches:
- "**"
- "!**dependabot/**"
- "!**release-please--**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.

- name: Cache dependencies
uses: actions/cache@v4
with:
path: /home/runner/cache
key: ${{ runner.os }}-${{ hashFiles('**/*.lock') }}

- name: Install dependencies
run: |
composer validate
composer install --prefer-dist --no-progress
npm install --save-dev
# Check for changed files
- name: Check for PHP changes
id: changed-php
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: "true"
files: |
includes/**/*.php
- name: Check for script changes
id: changed-script
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: "true"
files: |
resources/**/*.js
- name: Check for stylesheet changes
id: changed-stylesheet
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: "true"
files: |
resources/**/*.css
resources/**/*.less
- name: Check for i18n changes
id: changed-i18n
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: "true"
files: |
i18n/*.json
# Bypass the phpcbf non-standard exit code
- name: Lint PHP
if: steps.changed-php.outputs.any_changed == 'true'
continue-on-error: true
run: |
sh ./bin/phpcbf.sh
composer fix
composer test
- name: Lint script
if: steps.changed-script.outputs.any_changed == 'true'
continue-on-error: true
run: |
npm run lint:fix:js
npm run lint:js
- name: Lint stylesheet
if: steps.changed-stylesheet.outputs.any_changed == 'true'
continue-on-error: true
run: |
npm run lint:fix:styles
npm run lint:styles
- name: Lint i18n
if: steps.changed-i18n.outputs.any_changed == 'true'
continue-on-error: true
run: |
npm run lint:i18n
# Only patch code when it is a push event
- name: Push the changes
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! git diff --exit-code --quiet; then
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git add .
git commit -am "ci: 👷 lint code to MediaWiki standards" -m "Check commit and GitHub actions for more details"
git pull --rebase
git push
else
echo "No changes to commit"
fi
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/composer.lock
/vendor
/node_modules
.eslintcache
3 changes: 3 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
9 changes: 9 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php"/>
<arg name="encoding" value="UTF-8"/>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/out/*</exclude-pattern>
</ruleset>
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1"
}
9 changes: 9 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"stylelint-config-idiomatic-order",
"stylelint-config-wikimedia"
],
"rules": {
"selector-max-id": null
}
}
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct).
7 changes: 7 additions & 0 deletions FloatingUI.magic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
$magicWords = [];

/** English (English) */
$magicWords['en'] = [
'floatingui' => [ 0, 'floatingui' ]
];
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# FloatingUI

The FloatingUI extension implements [Floating UI](https://floating-ui.com) library in MediaWiki.

[Extension:FloatingUI on MediaWiki](https://www.mediawiki.org/wiki/Extension:FloatingUI).

## Requirements
* [MediaWiki](https://www.mediawiki.org) 1.39 or later

## Installation
You can get the extension via Git (specifying FloatingUI as the destination directory):

git clone https://github.com/StarCitizenTools/mediawiki-extensions-FloatingUI.git FloatingUI

Or [download it as zip archive](https://github.com/StarCitizenTools/mediawiki-extensions-FloatingUI/archive/main.zip).

In either case, the "FloatingUI" extension should end up in the "extensions" directory
of your MediaWiki installation. If you got the zip archive, you will need to put it
into a directory called FloatingUI.
8 changes: 8 additions & 0 deletions bin/phpcbf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Force phpcbf to exit with zero
# See https://github.com/squizlabs/PHP_CodeSniffer/issues/1818#issuecomment-354420927

root=$( dirname $0 )/..

$root/vendor/bin/phpcbf

exit 0
54 changes: 54 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "starcitizentools/floating-ui",
"type": "mediawiki-extension",
"description": "Implements the FloatingUI Javascript library.",
"keywords": [
"MediaWiki",
"FloatingUI",
"extension"
],
"homepage": "https://www.mediawiki.org/wiki/Extension:FloatingUI",
"readme": "README.md",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "alistair3149",
"email": "[email protected]",
"role": "Developer"
}
],
"support": {
"forum": "https://www.mediawiki.org/wiki/Extension_talk:FloatingUI",
"wiki": "https://www.mediawiki.org/wiki/Extension:FloatingUI",
"source": "https://github.com/StarCitizenTools/mediawiki-extensions-FloatingUI"
},
"require": {
"composer/installers": ">=1.0.1"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "44.0.0",
"mediawiki/mediawiki-phan-config": "0.14.0",
"mediawiki/minus-x": "1.1.3",
"php-parallel-lint/php-console-highlighter": "1.0.0",
"php-parallel-lint/php-parallel-lint": "1.4.0"
},
"scripts": {
"fix": [
"minus-x fix .",
"phpcbf"
],
"test": [
"parallel-lint . --exclude vendor --exclude node_modules",
"phpcs --config-set ignore_warnings_on_exit 1",
"phpcs -p -s",
"minus-x check ."
],
"phan": "phan -d . --long-progress-bar"
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
53 changes: 53 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "FloatingUI",
"version": "0.0.1",
"author": [
"alistair3149"
],
"url": "https://www.mediawiki.org/wiki/Extension:FloatingUI",
"descriptionmsg": "floatingui-desc",
"type": "parserhook",
"license-name": "GPL-3.0-or-later",
"requires": {
"MediaWiki": ">= 1.39.0"
},
"MessagesDirs": {
"FloatingUI": [
"/i18n"
]
},
"ExtensionMessagesFiles": {
"FloatingUIMagic": "FloatingUI.magic.php"
},
"AutoloadNamespaces": {
"MediaWiki\\Extension\\FloatingUI\\": "includes/"
},
"ResourceModules": {
"ext.floatingUI.lib": {
"scripts": [
"ext.floatingUI.lib/core.js",
"ext.floatingUI.lib/dom.js"
]
}
},
"ResourceFileModulePaths": {
"localBasePath": "modules",
"remoteExtPath": "FloatingUI/modules"
},
"Hooks": {
"ParserFirstCallInit": "parser"
},
"HookHandlers": {
"parser": {
"class": "MediaWiki\\Extension\\FloatingUI\\Hooks"
}
},
"attributes": {
"CodeMirror": {
"TagModes": {
"floatingui": "text/mediawiki"
}
}
},
"manifest_version": 2
}
8 changes: 8 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"@metadata": {
"authors": [
"alistair3149"
]
},
"floatingui-desc": "Implements the FloatingUI Javascript library."
}
Loading

0 comments on commit 41bae67

Please sign in to comment.