Skip to content

Commit bf66a5f

Browse files
alistair3149claude
andcommitted
feat: initial AGGrid extension — Scribunto library for AG Grid data grids
AGGrid is a MediaWiki extension (MW 1.43+, requires Scribunto) exposing a Lua library, mw.ext.aggrid.render( gridOptions ), that renders AG Grid Community data grids on wiki pages. - The Lua table mirrors AG Grid's gridOptions 1:1 (columnDefs and rowData required). PHP validates it, normalizes Lua 1-indexed sequences into JSON arrays, and emits a <div class="ext-aggrid"> placeholder carrying the config in a Sanitizer-reserved data-mw-aggrid-options attribute (returned via a strip marker). The hook is wired via HookHandlers implementing Scribunto's ScribuntoExternalLibrariesHook. - Client-side, the vendored AG Grid Community 35.3.0 UMD bundle is loaded from its static asset URL (ResourceLoader's wikimedia/minify <= 2.10.0 corrupts AG Grid's ES2020 BigInt literals) and mounted on each placeholder via mw.hook('wikipage.content'), with an ext-aggrid--init guard against double-mounting. - Meta/tooling/CI adapted from TabberNeue (lint, Phan, PHPUnit, Vitest, dependabot, release-please); ResourceLoader/ForeignResources wiring from FloatingUI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 parents  commit bf66a5f

41 files changed

Lines changed: 23204 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# see https://github.com/CppCXY/EmmyLuaCodeStyle
2+
[*.lua]
3+
# [basic]
4+
5+
# optional space/tab
6+
indent_style = space
7+
# if indent_style is space, this is valid
8+
indent_size = 4
9+
# if indent_style is tab, this is valid
10+
tab_width = 4
11+
# none/single/double
12+
quote_style = single
13+
14+
continuation_indent = 4
15+
## extend option
16+
# continuation_indent.before_block = 4
17+
# continuation_indent.in_expr = 4
18+
# continuation_indent.in_table = 4
19+
20+
# this mean utf8 length , if this is 'unset' then the line width is no longer checked
21+
# this option decides when to chopdown the code
22+
max_line_length = 120
23+
24+
# optional crlf/lf/cr/auto, if it is 'auto', in windows it is crlf other platforms are lf
25+
# in neovim the value 'auto' is not a valid option, please use 'unset'
26+
end_of_line = crlf
27+
28+
# none/ comma / semicolon / only_kv_colon
29+
table_separator_style = none
30+
31+
#optional keep/never/always/smart
32+
trailing_table_separator = keep
33+
34+
# keep/remove/remove_table_only/remove_string_only
35+
call_arg_parentheses = keep
36+
37+
detect_end_of_line = false
38+
39+
# this will check text end with new line
40+
insert_final_newline = true
41+
42+
# [space]
43+
space_around_table_field_list = true
44+
45+
space_before_attribute = true
46+
47+
space_before_function_open_parenthesis = false
48+
49+
space_before_function_call_open_parenthesis = false
50+
51+
space_before_closure_open_parenthesis = true
52+
53+
# optional always/only_string/only_table/none
54+
# or true/false
55+
space_before_function_call_single_arg = always
56+
## extend option
57+
## always/keep/none
58+
# space_before_function_call_single_arg.table = always
59+
## always/keep/none
60+
# space_before_function_call_single_arg.string = always
61+
62+
space_before_open_square_bracket = false
63+
64+
space_inside_function_call_parentheses = true
65+
66+
space_inside_function_param_list_parentheses = true
67+
68+
space_inside_square_brackets = false
69+
70+
# like t[#t+1] = 1
71+
space_around_table_append_operator = false
72+
73+
ignore_spaces_inside_function_call = false
74+
75+
# detail number or 'keep'
76+
space_before_inline_comment = 1
77+
78+
# [operator space]
79+
space_around_math_operator = true
80+
81+
space_after_comma = true
82+
83+
space_after_comma_in_for_statement = true
84+
85+
# true/false or none/always/no_space_asym
86+
space_around_concat_operator = true
87+
88+
space_around_logical_operator = true
89+
90+
# true/false or none/always/no_space_asym
91+
space_around_assign_operator = true
92+
93+
# [align]
94+
95+
align_call_args = false
96+
97+
align_function_params = true
98+
99+
align_continuous_assign_statement = true
100+
101+
align_continuous_rect_table_field = true
102+
103+
align_continuous_line_space = 2
104+
105+
align_if_branch = false
106+
107+
# option none / always / contain_curly/
108+
align_array_table = true
109+
110+
align_continuous_similar_call_args = false
111+
112+
align_continuous_inline_comment = true
113+
# option none / always / only_call_stmt
114+
align_chain_expr = none
115+
116+
# [indent]
117+
118+
never_indent_before_if_condition = false
119+
120+
never_indent_comment_on_if_branch = false
121+
122+
keep_indents_on_empty_lines = false
123+
124+
# [line space]
125+
126+
# The following configuration supports four expressions
127+
# keep
128+
# fixed(n)
129+
# min(n)
130+
# max(n)
131+
# for eg. min(2)
132+
133+
line_space_after_if_statement = keep
134+
135+
line_space_after_do_statement = keep
136+
137+
line_space_after_while_statement = keep
138+
139+
line_space_after_repeat_statement = keep
140+
141+
line_space_after_for_statement = keep
142+
143+
line_space_after_local_or_assign_statement = keep
144+
145+
line_space_after_function_statement = fixed(2)
146+
147+
line_space_after_expression_statement = keep
148+
149+
line_space_after_comment = keep
150+
151+
line_space_around_block = fixed(1)
152+
153+
# [line break]
154+
break_all_list_when_line_exceed = true
155+
156+
auto_collapse_lines = false
157+
158+
break_before_braces = false
159+
160+
# [preference]
161+
ignore_space_after_colon = false
162+
163+
remove_call_expression_list_finish_comma = false
164+
# keep / always / same_line / replace_with_newline / never
165+
end_statement_with_semicolon = replace_with_newline

‎.eslintignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/docs/
2+
/i18n/
3+
/modules/lib/
4+
/node_modules/
5+
/vendor/

‎.eslintrc.json‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"wikimedia/server"
5+
],
6+
"overrides": [
7+
{
8+
"files": [ "vitest.config.js" ],
9+
"parserOptions": {
10+
"sourceType": "module"
11+
},
12+
"rules": {
13+
"n/no-missing-require": "off"
14+
}
15+
},
16+
{
17+
"files": [ "tests/vitest/**/*.js" ],
18+
"globals": {
19+
"vi": "readonly",
20+
"describe": "readonly",
21+
"it": "readonly",
22+
"expect": "readonly",
23+
"beforeEach": "readonly",
24+
"afterEach": "readonly",
25+
"beforeAll": "readonly",
26+
"afterAll": "readonly"
27+
},
28+
"rules": {
29+
"n/no-missing-require": "off",
30+
"no-undef": "off",
31+
"strict": "off",
32+
"no-underscore-dangle": "off"
33+
}
34+
}
35+
]
36+
}

‎.github/dependabot.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "composer"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "npm"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"

‎.github/workflows/ci.yml‎

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "**"
10+
- "!dependabot/**"
11+
- "!release-please--branches--**"
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
changes:
19+
name: Detect changes
20+
runs-on: ubuntu-24.04-arm
21+
timeout-minutes: 5
22+
outputs:
23+
php: ${{ steps.filter.outputs.php_any_changed }}
24+
script: ${{ steps.filter.outputs.script_any_changed }}
25+
stylesheet: ${{ steps.filter.outputs.stylesheet_any_changed }}
26+
i18n: ${{ steps.filter.outputs.i18n_any_changed }}
27+
steps:
28+
- uses: actions/checkout@v6
29+
- uses: tj-actions/changed-files@v47
30+
id: filter
31+
with:
32+
files_yaml: |
33+
php:
34+
- includes/**/*.php
35+
- tests/**/*.php
36+
- tests/parser/**/*.txt
37+
- extension.json
38+
- composer.json
39+
- composer.lock
40+
- .phan/config.php
41+
- .github/workflows/ci.yml
42+
script:
43+
- modules/**/*.js
44+
- tests/vitest/**
45+
- vitest.config.js
46+
- package.json
47+
- package-lock.json
48+
- .eslintrc.json
49+
- .github/workflows/ci.yml
50+
stylesheet:
51+
- modules/**/*.css
52+
- modules/**/*.less
53+
- package.json
54+
- package-lock.json
55+
- .github/workflows/ci.yml
56+
i18n:
57+
- i18n/*.json
58+
- package.json
59+
- package-lock.json
60+
- .github/workflows/ci.yml
61+
62+
lint:
63+
needs: changes
64+
if: >-
65+
needs.changes.outputs.php == 'true' ||
66+
needs.changes.outputs.script == 'true' ||
67+
needs.changes.outputs.stylesheet == 'true' ||
68+
needs.changes.outputs.i18n == 'true'
69+
uses: StarCitizenTools/mediawiki-ci-workflows/.github/workflows/lint.yml@main
70+
with:
71+
lint-php: ${{ needs.changes.outputs.php == 'true' }}
72+
lint-js: ${{ needs.changes.outputs.script == 'true' }}
73+
lint-styles: ${{ needs.changes.outputs.stylesheet == 'true' }}
74+
lint-i18n: ${{ needs.changes.outputs.i18n == 'true' }}
75+
runner: ubuntu-24.04-arm
76+
77+
analyze-php:
78+
needs: changes
79+
if: needs.changes.outputs.php == 'true'
80+
uses: StarCitizenTools/mediawiki-ci-workflows/.github/workflows/analyze-php.yml@main
81+
with:
82+
project-type: extension
83+
project-name: AGGrid
84+
extra-extensions: Scribunto
85+
runner: ubuntu-24.04-arm
86+
87+
test-js:
88+
needs: changes
89+
if: needs.changes.outputs.script == 'true'
90+
uses: StarCitizenTools/mediawiki-ci-workflows/.github/workflows/test-js.yml@main
91+
with:
92+
runner: ubuntu-24.04-arm
93+
94+
test-php:
95+
needs: changes
96+
if: needs.changes.outputs.php == 'true'
97+
uses: StarCitizenTools/mediawiki-ci-workflows/.github/workflows/test-php.yml@main
98+
with:
99+
project-type: extension
100+
project-name: AGGrid
101+
extra-extensions: Scribunto
102+
runner: ubuntu-24.04-arm
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
name: release-please
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@v5
17+
with:
18+
token: ${{ secrets.WORKFLOW_TOKEN }}

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/composer.lock
2+
/vendor
3+
/node_modules
4+
.eslintcache

‎.luarc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"diagnostics.globals": [
3+
"mw"
4+
],
5+
"runtime.version": "Lua 5.1"
6+
}

‎.phan/config.php‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
4+
5+
// Scribunto is a hard dependency — include it for type resolution when available.
6+
$scribuntoDir = __DIR__ . '/../../../extensions/Scribunto';
7+
if ( is_dir( $scribuntoDir ) ) {
8+
$cfg['directory_list'][] = $scribuntoDir;
9+
$cfg['exclude_analysis_directory_list'][] = $scribuntoDir;
10+
}
11+
12+
return $cfg;

‎.phpcs.xml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
4+
<file>.</file>
5+
<arg name="extensions" value="php"/>
6+
<arg name="encoding" value="UTF-8"/>
7+
<exclude-pattern>*/vendor/*</exclude-pattern>
8+
<exclude-pattern>*/out/*</exclude-pattern>
9+
</ruleset>

0 commit comments

Comments
 (0)