style: Fix eslint warnings
parent
cd8a71f584
commit
15eb3df690
|
@ -19,6 +19,7 @@
|
||||||
"test:unit": "jest --verbose"
|
"test:unit": "jest --verbose"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@strapi/strapi": "^4.0.0-beta.12",
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
"cli-table": "^0.3.6",
|
"cli-table": "^0.3.6",
|
||||||
"commander": "^8.3.0",
|
"commander": "^8.3.0",
|
||||||
|
|
|
@ -103,17 +103,17 @@ const handleAction = async (type, skipConfirm) => {
|
||||||
const onSuccess = (name) => console.log(`${chalk.green('[success]')} Imported ${name}`);
|
const onSuccess = (name) => console.log(`${chalk.green('[success]')} Imported ${name}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await app.plugin('config-sync').service('main').importAllConfig(null, onSuccess)
|
await app.plugin('config-sync').service('main').importAllConfig(null, onSuccess);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`${chalk.red('[error]')} Something went wrong during the import. ${e}`)
|
console.log(`${chalk.red('[error]')} Something went wrong during the import. ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type === 'export') {
|
if (type === 'export') {
|
||||||
try {
|
try {
|
||||||
await app.plugin('config-sync').service('main').exportAllConfig();
|
await app.plugin('config-sync').service('main').exportAllConfig();
|
||||||
console.log(`${chalk.green('[success]')} Exported config`)
|
console.log(`${chalk.green('[success]')} Exported config`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`${chalk.red('[error]')} Something went wrong during the export. ${e}`)
|
console.log(`${chalk.red('[error]')} Something went wrong during the export. ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const difference = require('../utils/getObjectDiff');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main controllers for config import/export.
|
* Main controllers for config import/export.
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
const { logMessage, sanitizeConfig, dynamicSort } = require('../utils');
|
const { logMessage, sanitizeConfig, dynamicSort } = require('../utils');
|
||||||
const difference = require('../utils/getObjectDiff');
|
const difference = require('../utils/getArrayDiff');
|
||||||
const arrayDifference = require('../utils/getArrayDiff');
|
|
||||||
|
|
||||||
|
|
||||||
const ConfigType = class ConfigType {
|
const ConfigType = class ConfigType {
|
||||||
constructor(queryString, configPrefix, uid, jsonFields, relations) {
|
constructor(queryString, configPrefix, uid, jsonFields, relations) {
|
||||||
|
@ -122,8 +120,8 @@ const ConfigType = class ConfigType {
|
||||||
existingConfig = sanitizeConfig(existingConfig, relationName, relationSortField);
|
existingConfig = sanitizeConfig(existingConfig, relationName, relationSortField);
|
||||||
configContent = sanitizeConfig(configContent, relationName, relationSortField);
|
configContent = sanitizeConfig(configContent, relationName, relationSortField);
|
||||||
|
|
||||||
const configToAdd = arrayDifference(configContent[relationName], existingConfig[relationName], relationSortField);
|
const configToAdd = difference(configContent[relationName], existingConfig[relationName], relationSortField);
|
||||||
const configToDelete = arrayDifference(existingConfig[relationName], configContent[relationName], relationSortField);
|
const configToDelete = difference(existingConfig[relationName], configContent[relationName], relationSortField);
|
||||||
|
|
||||||
await Promise.all(configToDelete.map(async (config) => {
|
await Promise.all(configToDelete.map(async (config) => {
|
||||||
await relationQueryApi.delete({
|
await relationQueryApi.delete({
|
||||||
|
|
Loading…
Reference in New Issue