mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
dd42ebf712 | |||
0c6bf3d3a4 | |||
77b58ccf07 | |||
184d5627a3 | |||
ec12889815 | |||
4270145a55 | |||
3ed5129cd2 | |||
6dca75b2ce | |||
647629b5a9 | |||
fa91324f18 |
5
.gulp.json
Normal file
5
.gulp.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"flags": {
|
||||||
|
"gulpfile": "gulpfile.cjs"
|
||||||
|
}
|
||||||
|
}
|
@ -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/).
|
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
|
## Development
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
7167
package-lock.json
generated
7167
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "connector-mobilizon",
|
"name": "connector-mobilizon",
|
||||||
"version": "0.7.0",
|
"version": "0.8.0",
|
||||||
"description": "Display Mobilizon events in WordPress.",
|
"description": "Display Mobilizon events in WordPress.",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build-dev": "webpack --mode=development && gulp inject",
|
"build-dev": "webpack --mode=development && gulp inject",
|
||||||
"build-prod": "ava && webpack --mode=production && gulp inject",
|
"build-prod": "ava && webpack --mode=production && gulp inject",
|
||||||
@ -25,21 +26,24 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graphql": "^16.2.0",
|
"graphql": "^16.2.0",
|
||||||
"graphql-request": "^3.7.0",
|
"graphql-request": "^3.7.0",
|
||||||
"luxon": "^2.2.0",
|
"luxon": "^2.3.0",
|
||||||
"object-hash": "^2.2.0"
|
"object-hash": "^2.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^3.15.0",
|
"@babel/core": "^7.16.7",
|
||||||
"c8": "^7.10.0",
|
"@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",
|
"copy-webpack-plugin": "^10.2.0",
|
||||||
"eslint": "^8.4.1",
|
"eslint": "^8.6.0",
|
||||||
"eslint-plugin-ava": "^13.1.0",
|
"eslint-plugin-ava": "^13.2.0",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"gulp-replace": "^1.1.3",
|
"gulp-replace": "^1.1.3",
|
||||||
"husky": "^7.0.4",
|
"husky": "^7.0.4",
|
||||||
"jsdom": "^19.0.0",
|
"jsdom": "^19.0.0",
|
||||||
"lint-staged": "^12.1.3",
|
"lint-staged": "^12.1.7",
|
||||||
"prettier": "2.5.1",
|
"prettier": "2.5.1",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
@ -48,16 +52,13 @@
|
|||||||
"ava": {
|
"ava": {
|
||||||
"files": [
|
"files": [
|
||||||
"./source/**/*test.js"
|
"./source/**/*test.js"
|
||||||
],
|
|
||||||
"require": [
|
|
||||||
"esm"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"additionalDetails": {
|
"additionalDetails": {
|
||||||
"niceName": "Connector for Mobilizon",
|
"niceName": "Connector for Mobilizon",
|
||||||
"phpMinimumVersion": 7.4,
|
"phpMinimumVersion": 7.4,
|
||||||
"wordpressMinimumVersion": 5.6,
|
"wordpressMinimumVersion": 5.6,
|
||||||
"wordpressTestedUpToVersion": 5.8
|
"wordpressTestedUpToVersion": 5.9
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"source/**/*.js": "eslint",
|
"source/**/*.js": "eslint",
|
||||||
|
@ -6,6 +6,16 @@
|
|||||||
#### Fixed
|
#### Fixed
|
||||||
#### Security
|
#### 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
|
### [0.7.0] - 2021-12-23
|
||||||
#### Added
|
#### Added
|
||||||
- Add specific error message for the case the group is not found
|
- Add specific error message for the case the group is not found
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import DateTimeWrapper from './date-time-wrapper'
|
import DateTimeWrapper from './date-time-wrapper.js'
|
||||||
|
|
||||||
test('#getShortDate usual date', (t) => {
|
test('#getShortDate usual date', (t) => {
|
||||||
const d = new DateTimeWrapper({ text: '2020-12-24T16:45:00Z' })
|
const d = new DateTimeWrapper({ text: '2020-12-24T16:45:00Z' })
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import { JSDOM } from 'jsdom'
|
import { JSDOM } from 'jsdom'
|
||||||
|
|
||||||
import { displayEvents, displayErrorMessage } from './events-displayer'
|
import { displayEvents, displayErrorMessage } from './events-displayer.js'
|
||||||
|
|
||||||
let document
|
let document
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Formatter from './formatter'
|
import Formatter from './formatter.js'
|
||||||
import { createAnchorElement } from './html-creator'
|
import { createAnchorElement } from './html-creator.js'
|
||||||
|
|
||||||
export function displayEvents({ data, document, list }) {
|
export function displayEvents({ data, document, list }) {
|
||||||
const locale = list.getAttribute('data-locale')
|
const locale = list.getAttribute('data-locale')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { displayEvents, displayErrorMessage } from './events-displayer'
|
import { displayEvents, displayErrorMessage } from './events-displayer.js'
|
||||||
import * as GraphqlWrapper from './graphql-wrapper'
|
import * as GraphqlWrapper from './graphql-wrapper.js'
|
||||||
|
|
||||||
const NAME = '<wordpress-name>'
|
const NAME = '<wordpress-name>'
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import Formatter from './formatter'
|
import Formatter from './formatter.js'
|
||||||
|
|
||||||
test('#formatDate one date', (t) => {
|
test('#formatDate one date', (t) => {
|
||||||
const date = Formatter.formatDate({
|
const date = Formatter.formatDate({
|
||||||
@ -53,16 +53,21 @@ test('#formatDate second date is null with short offset name', (t) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('#formatLocation both parameters', (t) => {
|
test('#formatLocation both parameters', (t) => {
|
||||||
const date = Formatter.formatLocation({ description: 'a', locality: 'b' })
|
const location = Formatter.formatLocation({ description: 'a', locality: 'b' })
|
||||||
t.is(date, 'a, b')
|
t.is(location, 'a, b')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('#formatLocation description only', (t) => {
|
test('#formatLocation description only', (t) => {
|
||||||
const date = Formatter.formatLocation({ description: 'a' })
|
const location = Formatter.formatLocation({ description: 'a' })
|
||||||
t.is(date, '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) => {
|
test('#formatLocation locality only', (t) => {
|
||||||
const date = Formatter.formatLocation({ locality: 'a' })
|
const location = Formatter.formatLocation({ locality: 'a' })
|
||||||
t.is(date, 'a')
|
t.is(location, 'a')
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import DateTimeWrapper from './date-time-wrapper'
|
import DateTimeWrapper from './date-time-wrapper.js'
|
||||||
|
|
||||||
export default class Formatter {
|
export default class Formatter {
|
||||||
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {
|
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {
|
||||||
@ -31,8 +31,8 @@ export default class Formatter {
|
|||||||
|
|
||||||
static formatLocation({ description, locality }) {
|
static formatLocation({ description, locality }) {
|
||||||
let location = ''
|
let location = ''
|
||||||
if (description) {
|
if (description && description.trim()) {
|
||||||
location += description
|
location += description.trim()
|
||||||
}
|
}
|
||||||
if (location && locality) {
|
if (location && locality) {
|
||||||
location += ', '
|
location += ', '
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SessionCache from './session-cache'
|
import SessionCache from './session-cache.js'
|
||||||
import { request } from 'graphql-request'
|
import { request } from 'graphql-request'
|
||||||
import DateTimeWrapper from './date-time-wrapper'
|
import DateTimeWrapper from './date-time-wrapper.js'
|
||||||
|
|
||||||
export function getUpcomingEvents({ url, limit }) {
|
export function getUpcomingEvents({ url, limit }) {
|
||||||
const query = `
|
const query = `
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import { JSDOM } from 'jsdom'
|
import { JSDOM } from 'jsdom'
|
||||||
|
|
||||||
import { createAnchorElement } from './html-creator'
|
import { createAnchorElement } from './html-creator.js'
|
||||||
|
|
||||||
let document
|
let document
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import hash from './object-hash-wrapper'
|
import hash from './object-hash-wrapper.js'
|
||||||
|
|
||||||
test('#hash object', (t) => {
|
test('#hash object', (t) => {
|
||||||
t.is(hash({ foo: 'bar' }), 'a75c05bdca7d704bdfcd761913e5a4e4636e956b')
|
t.is(hash({ foo: 'bar' }), 'a75c05bdca7d704bdfcd761913e5a4e4636e956b')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import SessionCache from './session-cache'
|
import SessionCache from './session-cache.js'
|
||||||
|
|
||||||
const fakeStorage = {
|
const fakeStorage = {
|
||||||
elements: {},
|
elements: {},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import hash from './object-hash-wrapper'
|
import hash from './object-hash-wrapper.js'
|
||||||
|
|
||||||
const MAX_AGE_IN_MS = 120000
|
const MAX_AGE_IN_MS = 120000
|
||||||
|
|
||||||
|
@ -36,6 +36,16 @@ The source code is available on [Github](https://github.com/dwaxweiler/connector
|
|||||||
|
|
||||||
## Changelog
|
## 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
|
### [0.7.0] - 2021-12-23
|
||||||
#### Added
|
#### Added
|
||||||
- Add specific error message for the case the group is not found
|
- Add specific error message for the case the group is not found
|
||||||
|
@ -11,6 +11,20 @@ module.exports = {
|
|||||||
filename: 'events-loader.js',
|
filename: 'events-loader.js',
|
||||||
path: path.resolve(__dirname, 'build/' + '/front'),
|
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: [
|
plugins: [
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [
|
patterns: [
|
Reference in New Issue
Block a user