Merge pull request 'upgrade' (#2) from upgrade into main
## Détails - Upgrade npm packages - Fix breaking change on [9.5.2](https://github.com/directus/directus/releases/tag/v9.5.2) - Upgrade package version Reviewed-on: https://git.weko.io/resilien/directus-to-markdown/pulls/2
This commit is contained in:
commit
bed1ea7676
|
@ -53,9 +53,9 @@ const config = {
|
|||
}
|
||||
```
|
||||
|
||||
### readManyOption
|
||||
### readByQueryOption
|
||||
|
||||
`readManyOption` match https://docs.directus.io/reference/sdk/#read-multiple-items
|
||||
`readByQueryOption` match https://docs.directus.io/reference/sdk/#read-by-query
|
||||
|
||||
### Export to specific path
|
||||
|
||||
|
@ -73,9 +73,10 @@ const config = {
|
|||
contentKey: 'body',
|
||||
collections: {
|
||||
news: {
|
||||
readManyOption: {
|
||||
readByQueryOption: {
|
||||
fields: ['title', 'slug', 'date', 'image', 'image_credit', 'draft', 'body'],
|
||||
filter: { draft: { _eq: 'false' } }
|
||||
filter: { draft: { _eq: 'false' } },
|
||||
limit: -1
|
||||
},
|
||||
pathBuilder: (article) => {
|
||||
if (article.slug) {
|
||||
|
|
4
index.js
4
index.js
|
@ -78,8 +78,8 @@ export default class DirectusToMarkdown {
|
|||
async export() {
|
||||
for (const collectionName in this.collections) {
|
||||
const collection = this.collections[collectionName]
|
||||
const readManyOption = collection.readManyOption
|
||||
const items = (await this.directus.items(collectionName).readMany(readManyOption)).data
|
||||
const readByQueryOption = collection.readByQueryOption
|
||||
const items = (await this.directus.items(collectionName).readByQuery(readByQueryOption)).data
|
||||
for (const item of items) {
|
||||
const itemPath = collection.pathBuilder(item)
|
||||
if (!fs.existsSync(itemPath)) {
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
"version": "0.2.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@directus/sdk": "^9.5.0",
|
||||
"@directus/sdk": "^9.5.2",
|
||||
"js-yaml": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@directus/sdk": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-9.5.0.tgz",
|
||||
"integrity": "sha512-zrQmE8Wde5ITKhTpeYgJgb+QhFc8ySq/mFPfLq1+vO/xzvx5mg7v1OER1tMs7Byq3X/78euZCN4rxrvVRWQGNA==",
|
||||
"version": "9.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-9.5.2.tgz",
|
||||
"integrity": "sha512-E9VM8nNQfgeEl/tfZmcvf7es0ArqYQPjZDevxQ+hPk4OCqZ3raJHPa9+sqkDnKS763Q0DdnsfZ2Lb+iUUuE5nw==",
|
||||
"dependencies": {
|
||||
"axios": "^0.24.0"
|
||||
}
|
||||
|
@ -35,9 +35,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
||||
"version": "1.14.9",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
|
||||
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
|
@ -67,9 +67,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@directus/sdk": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-9.5.0.tgz",
|
||||
"integrity": "sha512-zrQmE8Wde5ITKhTpeYgJgb+QhFc8ySq/mFPfLq1+vO/xzvx5mg7v1OER1tMs7Byq3X/78euZCN4rxrvVRWQGNA==",
|
||||
"version": "9.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@directus/sdk/-/sdk-9.5.2.tgz",
|
||||
"integrity": "sha512-E9VM8nNQfgeEl/tfZmcvf7es0ArqYQPjZDevxQ+hPk4OCqZ3raJHPa9+sqkDnKS763Q0DdnsfZ2Lb+iUUuE5nw==",
|
||||
"requires": {
|
||||
"axios": "^0.24.0"
|
||||
}
|
||||
|
@ -88,9 +88,9 @@
|
|||
}
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
|
||||
"version": "1.14.9",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
|
||||
"integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "4.1.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@resilien/directus-to-markdown",
|
||||
"version": "0.2.0",
|
||||
"version": "1.0.0",
|
||||
"description": "Export Directus items to markdown files with assets",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -21,7 +21,7 @@
|
|||
"license": "ISC",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@directus/sdk": "^9.5.0",
|
||||
"@directus/sdk": "^9.5.2",
|
||||
"js-yaml": "^4.1.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue