Skip to content
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
6 changes: 2 additions & 4 deletions upload-api/migration-wordpress/libs/content_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ var globalPrefix = '';
const generateUid = (suffix) => {
const isPresent = restrictedUid?.find((item) => item === globalPrefix);

return isPresent
? `${globalPrefix
return isPresent ? `${globalPrefix
.replace(/^\d+/, '')
.replace(/[^a-zA-Z0-9]+/g, '_')
.replace(/(^_+)|(_+$)/g, '')
Expand Down Expand Up @@ -519,8 +518,7 @@ async function extractContentTypes(affix) {

const isPresent = restrictedUid?.find((item) => item === affix);
globalPrefix = isPresent ? affix : '';
const schemaJson = ContentTypesSchema.map(({ title, uid, schema, options }, index) => {
//console.log(`Mapping item at index ${index}:`, generateSchema(title, uid, schema, options));
const schemaJson = ContentTypesSchema.map(({ title, uid, schema, options },) => {
return generateSchema(title, uid, schema, options);
});

Expand Down
3 changes: 1 addition & 2 deletions upload-api/migration-wordpress/libs/extractLocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const extractLocale = (path) => {
const items = jsonData?.rss?.channel?.item || [];
items.forEach((item) => {
if (item['wp:postmeta']) {
const postMeta = Array.isArray(item['wp:postmeta'])
? item['wp:postmeta']
const postMeta = Array.isArray(item['wp:postmeta'])? item['wp:postmeta']
: [item['wp:postmeta']];
postMeta.forEach((meta) => {
if (meta['wp:meta_key']?.toLowerCase() === 'language' && meta['wp:meta_value']) {
Expand Down
2 changes: 1 addition & 1 deletion upload-api/src/controllers/sitecore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const createSitecoreMapper = async (filePath: string = "", projectId: string | s
data: JSON.stringify(fieldMapping),
};

const {data, status} = await axios.request(config);
const {data} = await axios.request(config);

if (data?.data?.content_mapper?.length) {
deleteFolderSync(infoMap?.path);
Expand Down
4 changes: 2 additions & 2 deletions upload-api/src/controllers/wordpress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { extractContentTypes, contentTypeMaker, extractLocale } = require('migrat



const createWordpressMapper = async (filePath: string = "", projectId: string | string[], app_token: string | string[], affix: string | string[], config: object) => {
const createWordpressMapper = async (filePath: string = "", projectId: string | string[], app_token: string | string[], affix: string | string[]) => {
try {

const localeData = await extractLocale(filePath);
Expand All @@ -31,7 +31,7 @@ const createWordpressMapper = async (filePath: string = "", projectId: string |
},
data: JSON.stringify(fieldMapping),
};
const {data, status} = await axios.request(config);
const {data} = await axios.request(config);
if (data?.data?.content_mapper?.length) {
logger.info('Validation success:', {
status: HTTP_CODES?.OK,
Expand Down
2 changes: 1 addition & 1 deletion upload-api/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import rateLimit from "express-rate-limit";
import fs from "fs";
import path from "path";
import xml2js from 'xml2js'
import { HTTP_TEXTS, HTTP_CODES, MIGRATION_DATA_CONFIG } from '../constants';
import { HTTP_TEXTS, HTTP_CODES} from '../constants';
import logger from "../utils/logger";

const getFileName = (params: { Key: string }) => {
Expand Down
6 changes: 3 additions & 3 deletions upload-api/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cliux, messageHandler } from '@contentstack/cli-utilities';
import isEmpty from 'lodash.isempty';

const migFunction = () => {
console.log('test');
};
// const migFunction = () => {
// console.log('test');
// };

function inquireRequireFieldValidation(input: any): string | boolean {
if (isEmpty(input)) {
Expand Down
2 changes: 1 addition & 1 deletion upload-api/src/services/contentful/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const createContentfulMapper = async (
},
data: JSON.stringify(initialMapper)
};
const { data, status } = await axios.request(req);
const { data} = await axios.request(req);
if (data?.data?.content_mapper?.length) {
logger.info('Validation success:', {
status: HTTP_CODES?.OK,
Expand Down
2 changes: 1 addition & 1 deletion upload-api/src/services/createMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const createMapper = async (
}

case 'wordpress': {
return createWordpressMapper(filePath, projectId, app_token, affix, config);
return createWordpressMapper(filePath, projectId, app_token, affix);
}

// case 'aem': {
Expand Down
2 changes: 1 addition & 1 deletion upload-api/src/validators/aem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function aemValidator({ data }: ValidatorProps) {
for (const fileName of fileNames) {
const file: any = data?.files?.[fileName];
if (!file?.dir) {
const content = await file.async('string');
// const content = await file.async('string');
if (`content.${test}.root`) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions upload-api/src/validators/wordpress/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import Config from '../../models/wordpress.json';
import * as Cheerio from 'cheerio';

Expand Down