Skip to content

Commit 3850db0

Browse files
authored
Merge pull request #477 from contentstack/dev
Dev
2 parents 646198a + d896d2c commit 3850db0

File tree

24 files changed

+470
-23
lines changed

24 files changed

+470
-23
lines changed

.DS_Store

6 KB
Binary file not shown.

.github/workflows/repo-sync.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Sync Changes to different CMS repos on PR Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed] # Triggers when a PR is closed
6+
branches:
7+
- dev # Change this to your default branch if needed
8+
9+
env:
10+
BRANCH : dev # Change this to your default branch if needed
11+
SITECORE_REPO: contentstack-expert-services/migration-tool-sitecore
12+
CONTENTFUL_REPO: contentstack-expert-services/migration-tool-contentful
13+
WORDPRESS_REPO: contentstack-expert-services/migration-tool-wordpress
14+
RSYNC_SITECORE_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts/' --exclude 'src/services/wordpress.service.ts/'" # Exclude contentful and wordpress services
15+
RSYNC_CONTENTFUL_EXCLUDES: "--exclude 'src/services/wordpress.service.ts/' --exclude 'src/services/sitecore.service.ts/'" # Exclude wordpress and sitecore services
16+
RSYNC_WORDPRESS_EXCLUDES: "--exclude 'src/services/contentful/' --exclude 'src/services/contentful.service.ts/' --exclude 'src/services/sitecore.service.ts/'" # Exclude contentful and sitecore services
17+
18+
jobs:
19+
sync-on-merge:
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
26+
steps:
27+
- name: Check if PR was merged
28+
id: check_merge
29+
run: |
30+
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then
31+
echo "PR was merged. Proceeding with sync."
32+
echo "merged=true" >> $GITHUB_ENV
33+
else
34+
echo "PR was closed without merging. Skipping sync."
35+
echo "merged=false" >> $GITHUB_ENV
36+
fi
37+
shell: bash
38+
39+
- name: Checkout migration-v2
40+
if: env.merged == 'true'
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0 # Fetch full history to compare changes
44+
45+
- name: Detect changed files
46+
if: env.merged == 'true'
47+
id: file_changes
48+
uses: dorny/paths-filter@v3
49+
with:
50+
filters: |
51+
api:
52+
- 'api/**'
53+
cli:
54+
- 'cli/**'
55+
ui:
56+
- 'ui/**'
57+
upload-api:
58+
- 'upload-api/src/**'
59+
migration-sitecore:
60+
- 'upload-api/migration-sitecore/**'
61+
migration-contentful:
62+
- 'upload-api/migration-contentful/**'
63+
migration-wordpress:
64+
- 'upload-api/migration-wordpress/**'
65+
index:
66+
- 'index.js'
67+
68+
- name: Setup Git
69+
if: env.merged == 'true'
70+
run: |
71+
git config --global user.name "github-actions"
72+
git config --global user.email "[email protected]"
73+
74+
- name: Sync changes to sitecore-repo (if applicable)
75+
if: |
76+
env.merged == 'true' &&
77+
(
78+
steps.file_changes.outputs.api == 'true' ||
79+
steps.file_changes.outputs.cli == 'true' ||
80+
steps.file_changes.outputs.ui == 'true' ||
81+
steps.file_changes.outputs.upload-api == 'true' ||
82+
steps.file_changes.outputs.migration-sitecore == 'true' ||
83+
steps.file_changes.outputs.index == 'true'
84+
)
85+
run: |
86+
git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ env.SITECORE_REPO }}.git
87+
cd migration-tool-sitecore
88+
git checkout -b sync-from-migration-v2-${{ github.event.pull_request.number }}
89+
rsync -av --delete $RSYNC_SITECORE_EXCLUDES ../api/ ./api/
90+
rsync -av --delete ../cli/ ./cli/
91+
rsync -av --delete ../ui/ ./ui/
92+
rsync -av --delete ../upload-api/src ./upload-api/src
93+
rsync -av --delete ../upload-api/migration-sitecore ./upload-api/migration-sitecore
94+
git add .
95+
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
96+
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
97+
98+
- name: Create PR in sitecore-repo
99+
if: |
100+
env.merged == 'true' &&
101+
(
102+
steps.file_changes.outputs.api == 'true' ||
103+
steps.file_changes.outputs.cli == 'true' ||
104+
steps.file_changes.outputs.ui == 'true' ||
105+
steps.file_changes.outputs.upload-api == 'true' ||
106+
steps.file_changes.outputs.migration-sitecore == 'true' ||
107+
steps.file_changes.outputs.index == 'true'
108+
)
109+
run: |
110+
gh pr create --repo ${{ env.SITECORE_REPO }} \
111+
--title "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}" \
112+
--body "This PR syncs changes from migration-v2:\n${{ github.event.pull_request.html_url }}" \
113+
--head sync-from-migration-v2-${{ github.event.pull_request.number }} \
114+
--base ${{ env.BRANCH }}
115+
env:
116+
GH_TOKEN: ${{ secrets.GH_PAT }}

api/.DS_Store

6 KB
Binary file not shown.

api/src/.DS_Store

8 KB
Binary file not shown.

api/src/constants/app/index.json

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3429,6 +3429,239 @@
34293429
"environment": "blt0b5712e5b06ac8b6",
34303430
"locale": "en-us"
34313431
}
3432+
},
3433+
{
3434+
"uid": "bltd54177d2353a7558",
3435+
"_version": 7,
3436+
"locale": "en-us",
3437+
"ACL": {},
3438+
"_in_progress": false,
3439+
"app_type": [
3440+
{
3441+
"uid": "blte9d290b2e9e0931e",
3442+
"_content_type_uid": "app_types",
3443+
"title": "Stack App"
3444+
}
3445+
],
3446+
"app_uid": "6227528cd2485c001994d262",
3447+
"built_by": [
3448+
{
3449+
"_content_type_uid": "organizations",
3450+
"_version": 3,
3451+
"locale": "en-us",
3452+
"uid": "bltec929d731b1f9d85",
3453+
"ACL": {},
3454+
"_in_progress": false,
3455+
"accelerator": [],
3456+
"additional_info": "",
3457+
"app": [],
3458+
"automation": [],
3459+
"badges": [],
3460+
"collections": [],
3461+
"created_at": "2022-03-29T11:12:21.999Z",
3462+
"created_by": "blt89b5b90cb9e7c645",
3463+
"date": null,
3464+
"description": "Contentstack - Headless CMS",
3465+
"is_this_a_guide": false,
3466+
"linked_app": [],
3467+
"logo": {
3468+
"_version": 2,
3469+
"is_dir": false,
3470+
"uid": "bltd1599ef0db421778",
3471+
"ACL": {},
3472+
"content_type": "image/svg+xml",
3473+
"created_at": "2022-03-29T11:10:05.681Z",
3474+
"created_by": "blt89b5b90cb9e7c645",
3475+
"description": "",
3476+
"file_size": "3347",
3477+
"filename": "Logo.svg",
3478+
"parent_uid": null,
3479+
"tags": [],
3480+
"title": "Contentstack",
3481+
"updated_at": "2024-07-23T07:59:25.044Z",
3482+
"updated_by": "blt7314f6e631536c9d",
3483+
"publish_details": {
3484+
"environment": "blt0b5712e5b06ac8b6",
3485+
"locale": "en-us",
3486+
"time": "2024-07-23T08:16:12.228Z",
3487+
"user": "blt7314f6e631536c9d"
3488+
},
3489+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/bltd1599ef0db421778/669f62ddf2780933e9679fae/Logo.svg"
3490+
},
3491+
"metadata": {
3492+
"page_title": "",
3493+
"page_description": "",
3494+
"page_thumb": {
3495+
"_version": 3,
3496+
"is_dir": false,
3497+
"uid": "blt2af4c7391167e253",
3498+
"ACL": {},
3499+
"content_type": "image/webp",
3500+
"created_at": "2022-03-29T11:11:02.983Z",
3501+
"created_by": "blt89b5b90cb9e7c645",
3502+
"description": "",
3503+
"file_size": "73804",
3504+
"filename": "Cs_Marketplace.webp",
3505+
"parent_uid": "blt9dddaa4b9192231d",
3506+
"tags": [],
3507+
"title": "Marketplace_Hero.jpg",
3508+
"updated_at": "2024-06-19T12:55:48.327Z",
3509+
"updated_by": "bltb79b1c5ff2fe28ae",
3510+
"publish_details": {
3511+
"environment": "blt0b5712e5b06ac8b6",
3512+
"locale": "en-us",
3513+
"time": "2024-06-19T12:56:08.635Z",
3514+
"user": "bltb79b1c5ff2fe28ae"
3515+
},
3516+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/blt2af4c7391167e253/6672d5545c79863c672295ca/Cs_Marketplace.webp"
3517+
},
3518+
"twitter_title": "",
3519+
"twitter_description": "",
3520+
"opengraph_title": "",
3521+
"opengraph_description": "",
3522+
"canonical_url": "",
3523+
"json_ld": "",
3524+
"robots": ""
3525+
},
3526+
"partner_details": {
3527+
"categories": [],
3528+
"documentation_links": [],
3529+
"external_links": [],
3530+
"company_info": "",
3531+
"website": {
3532+
"title": "",
3533+
"href": ""
3534+
},
3535+
"location": [],
3536+
"headquarters": "",
3537+
"consultants": "",
3538+
"projects": "",
3539+
"cta": {
3540+
"title": "",
3541+
"link": ""
3542+
},
3543+
"services": "",
3544+
"use_cases": "",
3545+
"other_headlines": [],
3546+
"related_articles": [],
3547+
"video_section": {
3548+
"title": "",
3549+
"description": "",
3550+
"video_embed_code": ""
3551+
},
3552+
"download_cta": {
3553+
"title": "",
3554+
"href": ""
3555+
}
3556+
},
3557+
"partner_facets": [],
3558+
"starter": [],
3559+
"tags": [],
3560+
"title": "Contentstack",
3561+
"updated_at": "2024-12-11T11:41:35.586Z",
3562+
"updated_by": "blt05ac693470ad5ff7",
3563+
"url": "/contentstack",
3564+
"publish_details": {
3565+
"environment": "blt0b5712e5b06ac8b6",
3566+
"locale": "en-us",
3567+
"time": "2025-01-28T10:07:08.871Z",
3568+
"user": "blt05ac693470ad5ff7"
3569+
}
3570+
}
3571+
],
3572+
"category": [
3573+
{
3574+
"uid": "blte953c795ff59241c",
3575+
"_content_type_uid": "categories",
3576+
"title": "Development"
3577+
}
3578+
],
3579+
"coming_soon": false,
3580+
"created_at": "2022-03-29T11:13:00.640Z",
3581+
"created_by": "blt89b5b90cb9e7c645",
3582+
"description": "<p>To further enhance the business user experience, Contentstack provides prebuilt custom field extensions that let you extend the functionality of your custom fields to serve your unique business needs while providing a native Contentstack look and feel.</p><p>Using Contentstack Custom Fields, you can now input a JSON text into an entry field. With the JSON Editor custom field, you can view, edit and format JSON text, code, trees, etc. within your Contentstack entry.</p>",
3583+
"dynamic_links": [],
3584+
"feature_types": [
3585+
{
3586+
"feature_type": [
3587+
{
3588+
"uid": "blt6b35fa46f253a6bd",
3589+
"_content_type_uid": "app_features",
3590+
"title": "Custom Field"
3591+
}
3592+
],
3593+
"_metadata": {
3594+
"uid": "cs3b4ec101f90bd171"
3595+
},
3596+
"description": "While creating entries, you can add a JSON code."
3597+
}
3598+
],
3599+
"icon": {
3600+
"_version": 1,
3601+
"is_dir": false,
3602+
"uid": "blt38b2ab4ea0da2357",
3603+
"ACL": {},
3604+
"content_type": "image/svg+xml",
3605+
"created_at": "2022-03-29T11:09:08.207Z",
3606+
"created_by": "blt89b5b90cb9e7c645",
3607+
"file_size": "6981",
3608+
"filename": "json-editor.svg",
3609+
"parent_uid": "blt2eb26851df9c0e2e",
3610+
"tags": [],
3611+
"title": "json-editor.svg",
3612+
"updated_at": "2022-03-29T11:09:08.207Z",
3613+
"updated_by": "blt89b5b90cb9e7c645",
3614+
"publish_details": {
3615+
"environment": "blt0b5712e5b06ac8b6",
3616+
"locale": "en-us",
3617+
"time": "2025-01-28T10:07:08.871Z",
3618+
"user": "blt05ac693470ad5ff7"
3619+
},
3620+
"url": "https://eu-images.contentstack.com/v3/assets/blt8f94ebff857fe1ae/blt38b2ab4ea0da2357/6242e8d49eb79b7d7303c4bd/json-editor.svg"
3621+
},
3622+
"installation_url": "#!/apps/6227528cd2485c001994d262/install",
3623+
"links": {
3624+
"source_code": "",
3625+
"documentation": "",
3626+
"others": [],
3627+
"end_user_license_agreement": "https://www.contentstack.com/legal/eula-for-contentstack-proprietary-marketplace-apps/"
3628+
},
3629+
"seo": {
3630+
"canonical_url": "",
3631+
"description": "",
3632+
"image": null,
3633+
"robots": "",
3634+
"title": ""
3635+
},
3636+
"static_links": [
3637+
{
3638+
"type": "Documentation",
3639+
"url": "https://www.contentstack.com/docs/developers/marketplace-apps/json-editor/",
3640+
"_metadata": {
3641+
"uid": "csda257d0ac99cc671"
3642+
}
3643+
},
3644+
{
3645+
"type": "End-User License Agreement",
3646+
"url": "https://www.contentstack.com/legal/eula-for-contentstack-proprietary-marketplace-apps/",
3647+
"_metadata": {
3648+
"uid": "cs920e968d62d4580b"
3649+
}
3650+
}
3651+
],
3652+
"summary": "Enables users to view, edit, and format input data in JSON.",
3653+
"tags": [],
3654+
"title": "JSON Editor",
3655+
"updated_at": "2025-01-24T11:19:14.626Z",
3656+
"updated_by": "blt05ac693470ad5ff7",
3657+
"url": "/marketplace/json-editor",
3658+
"use_cases": "<p><strong>Easy To Interpret:</strong> The JSON editor locates errors instantly, eliminating the need to locate errors within the entire code. In addition, it provides multiple view options like code, text, tree to name a few.</p><p><strong>Validation made simple: </strong>You can validate and check for any necessary fixes in just a few seconds. In addition, because JSON does not have many elements like XML, you can even practice your coding and see the results instantly.</p>",
3659+
"publish_details": {
3660+
"time": "2025-01-28T10:55:14.197Z",
3661+
"user": "blt05ac693470ad5ff7",
3662+
"environment": "blt0b5712e5b06ac8b6",
3663+
"locale": "en-us"
3664+
}
34323665
}
34333666
],
34343667
"count": 11

api/src/services/contentful.service.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,21 @@ async function writeFile(dirPath: string, filename: string, data: any) {
180180
console.error('Error writing ${dirPath}/${filename}::', err);
181181
}
182182
}
183-
const damApp = (type: string, data: any) => {
183+
184+
function convertToArray(data: any) {
185+
if (typeof data === 'object' && data !== null && !Array.isArray(data)) {
186+
return [data]// Converts object values into an array
187+
}
188+
return data; // Return as is if it's already an array or not an object
189+
}
190+
191+
const mktApp = (type: string, data: any) => {
184192
switch (type) {
185193
case 'zjcnWgBknf9zB7IM9HZjE':
186194
return transformCloudinaryObject(data);
195+
case 'objectEditor': {
196+
return convertToArray(data);
197+
}
187198
}
188199
}
189200

@@ -247,7 +258,7 @@ const processField = (
247258
}
248259

249260
case 'app': {
250-
return damApp(fieldData?.otherCmsType, lang_value)
261+
return mktApp(fieldData?.otherCmsType, lang_value)
251262
}
252263

253264
case 'boolean': {

0 commit comments

Comments
 (0)