Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: refactoring, dependency updates, ... #709

Merged
merged 4 commits into from
Apr 30, 2021
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ jobs:
php occ user:setting quotatest files quota "0"
- name: Setup Notes app
working-directory: ../server/
run: |
php occ app:enable notes
php occ app:check-code notes
run: php occ app:enable notes
- name: Create some reference notes
working-directory: ../
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ lint-php-phpcs:

lint-php-cs-fixer:
# PHP Coding Standards Fixer (with Nextcloud coding standards)
vendor/bin/php-cs-fixer fix --dry-run --diff --format=checkstyle | vendor/bin/cs2pr --colorize
vendor/bin/php-cs-fixer fix --dry-run --diff


lint-js:
Expand Down
9 changes: 1 addition & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
module.exports = {
plugins: [
'@babel/plugin-syntax-dynamic-import',
],
presets: [
[ '@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 } ],
]
}
module.exports = require('@nextcloud/babel-config')
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"require-dev": {
"christophwurst/nextcloud": ">=20",
"nextcloud/coding-standard": "^0.5.0",
"friendsofphp/php-cs-fixer": "!=2.18.4",
"friendsofphp/php-cs-fixer": "^2.18.6",
"squizlabs/php_codesniffer": "3.*",
"phan/phan": "^4.0",
"guzzlehttp/guzzle": "^7.0",
Expand Down
2,670 changes: 1,890 additions & 780 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
"@nextcloud/dialogs": "^3.1.2",
"@nextcloud/event-bus": "^1.2.0",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^3.8.0",
"@nextcloud/router": "^2.0.0",
"@nextcloud/vue": "^3.9.0",
"@nextcloud/vue-dashboard": "^2.0.0",
"@nextcloud/webpack-vue-config": "^4.0.1",
"diff": "^5.0.0",
"easymde": "^2.14.0",
"markdown-it": "^12.0.4",
"stylelint-webpack-plugin": "^2.1.1",
"easymde": "^2.15.0",
"markdown-it": "^12.0.6",
"vue": "^2.6.12",
"vue-fragment": "1.5.1",
"vue-material-design-icons": "^4.11.0",
Expand All @@ -39,37 +37,38 @@
"node": ">=10.0.0"
},
"devDependencies": {
"@babel/core": "^7.13.14",
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.13.14",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.13.12",
"@babel/preset-env": "^7.14.0",
"@nextcloud/babel-config": "^1.0.0-beta.1",
"@nextcloud/browserslist-config": "^2.1.0",
"@nextcloud/eslint-config": "^5.0.0",
"@nextcloud/eslint-plugin": "^2.0.0",
"@nextcloud/webpack-vue-config": "^4.0.3",
"babel-loader": "^8.2.2",
"core-js": "^3.10.0",
"css-loader": "^4.3.0",
"eslint": "^7.23.0",
"eslint": "^7.25.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"eslint-plugin-vue": "^7.8.0",
"eslint-webpack-plugin": "^2.5.3",
"eslint-plugin-vue": "^7.9.0",
"eslint-webpack-plugin": "^2.5.4",
"file-loader": "^6.2.0",
"node-polyfill-webpack-plugin": "^1.1.0",
"sass": "^1.32.8",
"sass": "^1.32.12",
"sass-loader": "^10.1.1",
"style-loader": "^2.0.0",
"stylelint": "^13.12.0",
"stylelint": "^13.13.0",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.19.0",
"stylelint-webpack-plugin": "^2.1.1",
"url-loader": "^4.1.1",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",
"webpack": "^5.28.0",
"webpack-cli": "^4.6.0",
"webpack-merge": "^5.7.3"
"webpack": "^5.36.2",
"webpack-cli": "^4.6.0"
}
}
8 changes: 0 additions & 8 deletions src/NotesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,3 @@ export const getCategories = (maxLevel, details) => {
return categories
}
}

export const categoryLabel = (category) => {
return category === '' ? t('notes', 'Uncategorized') : category.replace(/\//g, ' / ')
}

export const routeIsNewNote = ($route) => {
return {}.hasOwnProperty.call($route.query, 'new')
}
8 changes: 8 additions & 0 deletions src/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ export const copyNote = (from, to, exclude) => {
})
return to
}

export const categoryLabel = (category) => {
return category === '' ? t('notes', 'Uncategorized') : category.replace(/\//g, ' / ')
}

export const routeIsNewNote = ($route) => {
return {}.hasOwnProperty.call($route.query, 'new')
}
5 changes: 3 additions & 2 deletions src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
import { DashboardWidget, DashboardWidgetItem } from '@nextcloud/vue-dashboard'
import { EmptyContent } from '@nextcloud/vue'
import { generateUrl } from '@nextcloud/router'
import { getDashboardData, categoryLabel } from '../NotesService'
import { getDashboardData } from '../NotesService'
import { categoryLabel } from '../Util'

export default {
name: 'Dashboard',
Expand Down Expand Up @@ -96,7 +97,7 @@ export default {
</script>
<style scoped>
.note-item-favorite {
background: var(--icon-star-dark-fc0);
background: var(--icon-star-dark-FC0, var(--icon-star-dark-fc0));
}

.note-item {
Expand Down
3 changes: 2 additions & 1 deletion src/components/NavigationCategoriesItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import {
AppNavigationCounter,
} from '@nextcloud/vue'

import { getCategories, categoryLabel } from '../NotesService'
import { getCategories } from '../NotesService'
import { categoryLabel } from '../Util'

import store from '../store'

Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from '@nextcloud/vue'
import { Fragment } from 'vue-fragment'

import { categoryLabel } from '../NotesService'
import { categoryLabel } from '../Util'
import NavigationCategoriesItem from './NavigationCategoriesItem'
import NavigationNoteItem from './NavigationNoteItem'
import store from '../store'
Expand Down
3 changes: 2 additions & 1 deletion src/components/NavigationNoteItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
} from '@nextcloud/vue'
import { showError } from '@nextcloud/dialogs'

import { categoryLabel, setFavorite, setTitle, fetchNote, deleteNote, routeIsNewNote } from '../NotesService'
import { setFavorite, setTitle, fetchNote, deleteNote } from '../NotesService'
import { categoryLabel, routeIsNewNote } from '../Util'

export default {
name: 'NavigationNoteItem',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ import { emit } from '@nextcloud/event-bus'
import SyncAlertIcon from 'vue-material-design-icons/SyncAlert'

import { config } from '../config'
import { fetchNote, refreshNote, saveNote, saveNoteManually, autotitleNote, routeIsNewNote, conflictSolutionLocal, conflictSolutionRemote } from '../NotesService'
import { fetchNote, refreshNote, saveNote, saveNoteManually, autotitleNote, conflictSolutionLocal, conflictSolutionRemote } from '../NotesService'
import { routeIsNewNote } from '../Util'
import TheEditor from './EditorEasyMDE'
import ThePreview from './EditorMarkdownIt'
import ConflictSolution from './ConflictSolution'
Expand Down
3 changes: 2 additions & 1 deletion src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ import {
} from '@nextcloud/vue'
import moment from '@nextcloud/moment'

import { categoryLabel, getCategories, setFavorite, setCategory, saveNoteManually } from '../NotesService'
import { getCategories, setFavorite, setCategory, saveNoteManually } from '../NotesService'
import { categoryLabel } from '../Util'
import store from '../store'

export default {
Expand Down
2 changes: 1 addition & 1 deletion tests/api/AbstractAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function checkReferenceNote(
$messagePrefix.': Property '.$key.' (reference note: '.$refNote->title.')'
);
if (strlen($refNote->$key) !== strlen($note->$key)) {
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'/^ \(\d+\)$/',
substr($note->$key, strlen($refNote->$key)),
$messagePrefix.': Property '.$key.' suffix (reference note: '.$refNote->title.')'
Expand Down
2 changes: 1 addition & 1 deletion tests/api/CommonAPITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testGetNotesWithEtag(array $refNotes) : void {
$this->checkResponse($response1, 'Initial response', 200);
$this->assertTrue($response1->hasHeader('ETag'), 'Initial response has ETag header');
$etag = $response1->getHeaderLine('ETag');
$this->assertRegExp('/^"[[:alnum:]]{32}"$/', $etag, 'ETag format');
$this->assertMatchesRegularExpression('/^"[[:alnum:]]{32}"$/', $etag, 'ETag format');

// Test If-None-Match with ETag
$response2 = $this->http->request('GET', 'notes', [ 'headers' => [ 'If-None-Match' => $etag ] ]);
Expand Down
9 changes: 2 additions & 7 deletions webpack.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
const webpackConfig = require('@nextcloud/webpack-vue-config')
const path = require('path')
const { merge } = require('webpack-merge')

const config = {
entry: {
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
},
}
webpackConfig.entry.dashboard = path.join(__dirname, 'src', 'dashboard.js')

module.exports = merge(webpackConfig, config)
module.exports = webpackConfig