1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

10 Commits

19 changed files with 4656 additions and 2624 deletions

5
.gulp.json Normal file
View File

@ -0,0 +1,5 @@
{
"flags": {
"gulpfile": "gulpfile.cjs"
}
}

View File

@ -4,6 +4,8 @@ Connector for Mobilizon allows you to display the upcoming events of [Mobilizon]
More details can be found in the [WordPress Plugin Directory](https://wordpress.org/plugins/connector-mobilizon/).
The current changelog can be under [source/changelog.txt](source/changelog.txt).
## Development
### Setup

7167
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
{
"name": "connector-mobilizon",
"version": "0.7.0",
"version": "0.8.0",
"description": "Display Mobilizon events in WordPress.",
"private": true,
"type": "module",
"scripts": {
"build-dev": "webpack --mode=development && gulp inject",
"build-prod": "ava && webpack --mode=production && gulp inject",
@ -25,21 +26,24 @@
"dependencies": {
"graphql": "^16.2.0",
"graphql-request": "^3.7.0",
"luxon": "^2.2.0",
"luxon": "^2.3.0",
"object-hash": "^2.2.0"
},
"devDependencies": {
"ava": "^3.15.0",
"c8": "^7.10.0",
"@babel/core": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"ava": "^4.0.1",
"babel-loader": "^8.2.3",
"c8": "^7.11.0",
"copy-webpack-plugin": "^10.2.0",
"eslint": "^8.4.1",
"eslint-plugin-ava": "^13.1.0",
"eslint": "^8.6.0",
"eslint-plugin-ava": "^13.2.0",
"esm": "^3.2.25",
"gulp": "^4.0.2",
"gulp-replace": "^1.1.3",
"husky": "^7.0.4",
"jsdom": "^19.0.0",
"lint-staged": "^12.1.3",
"lint-staged": "^12.1.7",
"prettier": "2.5.1",
"rimraf": "^3.0.2",
"webpack": "^5.65.0",
@ -48,16 +52,13 @@
"ava": {
"files": [
"./source/**/*test.js"
],
"require": [
"esm"
]
},
"additionalDetails": {
"niceName": "Connector for Mobilizon",
"phpMinimumVersion": 7.4,
"wordpressMinimumVersion": 5.6,
"wordpressTestedUpToVersion": 5.8
"wordpressTestedUpToVersion": 5.9
},
"lint-staged": {
"source/**/*.js": "eslint",

View File

@ -6,6 +6,16 @@
#### Fixed
#### Security
### [0.8.0] - 2022-01-09
#### Added
- Add support for older browsers using babel
#### Changed
- Confirm compatibility with WordPress 5.9
- Update dependencies
#### Fixed
- Use ES modules correctly
- Trim events' location
### [0.7.0] - 2021-12-23
#### Added
- Add specific error message for the case the group is not found

View File

@ -1,5 +1,5 @@
import test from 'ava'
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
test('#getShortDate usual date', (t) => {
const d = new DateTimeWrapper({ text: '2020-12-24T16:45:00Z' })

View File

@ -1,7 +1,7 @@
import test from 'ava'
import { JSDOM } from 'jsdom'
import { displayEvents, displayErrorMessage } from './events-displayer'
import { displayEvents, displayErrorMessage } from './events-displayer.js'
let document

View File

@ -1,5 +1,5 @@
import Formatter from './formatter'
import { createAnchorElement } from './html-creator'
import Formatter from './formatter.js'
import { createAnchorElement } from './html-creator.js'
export function displayEvents({ data, document, list }) {
const locale = list.getAttribute('data-locale')

View File

@ -1,5 +1,5 @@
import { displayEvents, displayErrorMessage } from './events-displayer'
import * as GraphqlWrapper from './graphql-wrapper'
import { displayEvents, displayErrorMessage } from './events-displayer.js'
import * as GraphqlWrapper from './graphql-wrapper.js'
const NAME = '<wordpress-name>'

View File

@ -1,5 +1,5 @@
import test from 'ava'
import Formatter from './formatter'
import Formatter from './formatter.js'
test('#formatDate one date', (t) => {
const date = Formatter.formatDate({
@ -53,16 +53,21 @@ test('#formatDate second date is null with short offset name', (t) => {
})
test('#formatLocation both parameters', (t) => {
const date = Formatter.formatLocation({ description: 'a', locality: 'b' })
t.is(date, 'a, b')
const location = Formatter.formatLocation({ description: 'a', locality: 'b' })
t.is(location, 'a, b')
})
test('#formatLocation description only', (t) => {
const date = Formatter.formatLocation({ description: 'a' })
t.is(date, 'a')
const location = Formatter.formatLocation({ description: 'a' })
t.is(location, 'a')
})
test('#formatLocation description with space only', (t) => {
const location = Formatter.formatLocation({ description: ' ' })
t.is(location, '')
})
test('#formatLocation locality only', (t) => {
const date = Formatter.formatLocation({ locality: 'a' })
t.is(date, 'a')
const location = Formatter.formatLocation({ locality: 'a' })
t.is(location, 'a')
})

View File

@ -1,4 +1,4 @@
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
export default class Formatter {
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {
@ -31,8 +31,8 @@ export default class Formatter {
static formatLocation({ description, locality }) {
let location = ''
if (description) {
location += description
if (description && description.trim()) {
location += description.trim()
}
if (location && locality) {
location += ', '

View File

@ -1,6 +1,6 @@
import SessionCache from './session-cache'
import SessionCache from './session-cache.js'
import { request } from 'graphql-request'
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
export function getUpcomingEvents({ url, limit }) {
const query = `

View File

@ -1,7 +1,7 @@
import test from 'ava'
import { JSDOM } from 'jsdom'
import { createAnchorElement } from './html-creator'
import { createAnchorElement } from './html-creator.js'
let document

View File

@ -1,5 +1,5 @@
import test from 'ava'
import hash from './object-hash-wrapper'
import hash from './object-hash-wrapper.js'
test('#hash object', (t) => {
t.is(hash({ foo: 'bar' }), 'a75c05bdca7d704bdfcd761913e5a4e4636e956b')

View File

@ -1,5 +1,5 @@
import test from 'ava'
import SessionCache from './session-cache'
import SessionCache from './session-cache.js'
const fakeStorage = {
elements: {},

View File

@ -1,4 +1,4 @@
import hash from './object-hash-wrapper'
import hash from './object-hash-wrapper.js'
const MAX_AGE_IN_MS = 120000

View File

@ -36,6 +36,16 @@ The source code is available on [Github](https://github.com/dwaxweiler/connector
## Changelog
### [0.8.0] - 2022-01-09
#### Added
- Add support for older browsers using babel
#### Changed
- Confirm compatibility with WordPress 5.9
- Update dependencies
#### Fixed
- Use ES modules correctly
- Trim events' location
### [0.7.0] - 2021-12-23
#### Added
- Add specific error message for the case the group is not found

View File

@ -11,6 +11,20 @@ module.exports = {
filename: 'events-loader.js',
path: path.resolve(__dirname, 'build/' + '/front'),
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { targets: 'defaults' }]],
},
},
},
],
},
plugins: [
new CopyPlugin({
patterns: [