Skip to content
Merged

Dev #557

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
69b5f9e
eslint config creation
RohitKini Mar 19, 2025
95c2f7e
Merge pull request #532 from contentstack/feature/workflow
RohitKini Mar 19, 2025
0ef03eb
workflow check
RohitKini Mar 19, 2025
fd83bc4
Merge pull request #533 from contentstack/feature/workflow
RohitKini Mar 19, 2025
8d7b1e2
workflow changes
RohitKini Mar 19, 2025
e7fe0cc
Merge pull request #534 from contentstack/feature/workflow
RohitKini Mar 19, 2025
36f6c05
workflow changes test
RohitKini Mar 19, 2025
68f997f
Merge pull request #535 from contentstack/feature/workflow
RohitKini Mar 19, 2025
e624631
workflow changes
RohitKini Mar 19, 2025
492c8f2
Language mapper UI modified
sayalijoshi27 Mar 19, 2025
2100862
Merge pull request #536 from contentstack/feature/workflow
RohitKini Mar 19, 2025
52ebefc
workflow check
RohitKini Mar 19, 2025
865d106
Merge pull request #537 from contentstack/feature/workflow
RohitKini Mar 19, 2025
1cfe208
workflow npm changes
RohitKini Mar 19, 2025
f55c9bd
Merge pull request #538 from contentstack/feature/workflow
RohitKini Mar 19, 2025
fe7c7d6
check
RohitKini Mar 19, 2025
910b52f
Merge pull request #539 from contentstack/feature/workflow
RohitKini Mar 19, 2025
9a26931
workflow changes
RohitKini Mar 19, 2025
0a66686
Merge pull request #540 from contentstack/feature/workflow
RohitKini Mar 19, 2025
f787953
workflow changes 123
RohitKini Mar 19, 2025
f833b5b
Merge pull request #542 from contentstack/feature/workflow
RohitKini Mar 19, 2025
0043fbd
workflow changes 456
RohitKini Mar 19, 2025
a98b7c2
workflow changes 456
RohitKini Mar 19, 2025
5036a7e
Merge pull request #543 from contentstack/feature/workflow
RohitKini Mar 19, 2025
6c98d65
workflow changes 123456
RohitKini Mar 19, 2025
894e952
Merge pull request #544 from contentstack/feature/workflow
RohitKini Mar 19, 2025
8eb2b01
workflow changes 123456
RohitKini Mar 19, 2025
824ddee
Merge pull request #545 from contentstack/feature/workflow
RohitKini Mar 19, 2025
870cfa9
workflow changes 123456
RohitKini Mar 19, 2025
7177266
workflow changes 123456
RohitKini Mar 19, 2025
1c885aa
workflow changes 123456
RohitKini Mar 19, 2025
4031395
Merge pull request #546 from contentstack/feature/workflow
RohitKini Mar 19, 2025
595c93b
final prune checking
RohitKini Mar 19, 2025
50c63ba
Merge pull request #547 from contentstack/feature/workflow
RohitKini Mar 19, 2025
857c318
refactor:code for locale api call in destination stack and checkbox m…
AishDani Mar 19, 2025
5a1d8df
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Mar 19, 2025
dada53e
Merge pull request #548 from contentstack/feature/dropdown-field-choices
RohitKini Mar 19, 2025
0d64665
added mapper
umeshmore45 Mar 19, 2025
722a599
fix:resolved the bug [CMG-414] and added tooltip content to fetch ico…
AishDani Mar 20, 2025
046f2d1
UI and text changes added suggested by Docs team
sayalijoshi27 Mar 20, 2025
0aa565c
Code formatting
sayalijoshi27 Mar 20, 2025
374c012
Dev changes merged
sayalijoshi27 Mar 20, 2025
ca99c14
workflow eslint
RohitKini Mar 20, 2025
9d7032c
workflow eslint
RohitKini Mar 20, 2025
40ca137
Merge pull request #550 from contentstack/feature/workflow
RohitKini Mar 20, 2025
734109b
workflow eslint
RohitKini Mar 20, 2025
0de055b
Merge pull request #551 from contentstack/feature/workflow
RohitKini Mar 20, 2025
a1e9fa1
added mapper
umeshmore45 Mar 20, 2025
c96f44c
Merge pull request #549 from contentstack/feature/locale-mapper-fix
sayalijoshi27 Mar 20, 2025
159fe45
refactor:fluckering issue while rendering steps and re-validate the f…
AishDani Mar 20, 2025
00ef00d
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Mar 20, 2025
b90d13d
fix:removed fetch tooltip for conflict texts
AishDani Mar 20, 2025
8077c17
added code
umeshmore45 Mar 20, 2025
b0d69a4
Merge pull request #553 from contentstack/feature/CMG-566-test-stack
RohitKini Mar 21, 2025
a04cff5
Merge branch 'dev' of github.com:contentstack/migration-v2-node-serve…
AishDani Mar 21, 2025
aa5df75
fix:revalidate case in validation
AishDani Mar 21, 2025
f71dce2
resloved bugs
umeshmore45 Mar 23, 2025
e7ea1cf
fix:refacor the spelling mistake of warn msg and [CMG-535]
AishDani Mar 24, 2025
7c12375
Merge pull request #554 from contentstack/feature/CMG-533-Bugs
sayalijoshi27 Mar 24, 2025
f888fb8
refactor:undefined notification error in legacy cms
AishDani Mar 24, 2025
43b0455
Merge pull request #552 from contentstack/feature/dropdown-field-choices
sayalijoshi27 Mar 24, 2025
3086647
Dev changes merged
sayalijoshi27 Mar 24, 2025
223d3e0
Merge pull request #555 from contentstack/feature/content-mapper
RohitKini Mar 24, 2025
a2b1d1a
code refac
umeshmore45 Mar 24, 2025
ece10b6
Merge pull request #556 from contentstack/feature/CMG-533-Bugs
sayalijoshi27 Mar 24, 2025
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
140 changes: 127 additions & 13 deletions .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,84 @@ jobs:
git clean -fdX # Remove untracked files and directories
git gc --prune=now # Garbage collect and prune unreachable objects

# Remove unused imports and missing file references
# echo "Installing ESLint dependencies..."
npm install --save-dev eslint @eslint/js globals


# if [ ! -f "eslint.config.cjs" ]; then
# echo "Creating default ESLint config..."
# cat <<EOL > eslint.config.cjs
# const js = require("@eslint/js");
# const globals = require("globals");

# module.exports = [
# js.configs.recommended,
# {
# languageOptions: {
# ecmaVersion: "latest",
# sourceType: "module",
# globals: globals.node,
# },
# rules: {
# "no-unused-vars": "warn",
# "no-console": "off"
# }
# }
# ];
# EOL
# fi

# # Remove unused imports and missing file references
# echo "Running ESLint to remove unused imports..."
# npm install eslint -g
# eslint . --fix

echo "Running autoflake to remove unused imports..."
pip install autoflake
autoflake --remove-all-unused-imports --recursive --in-place .
# echo "Running autoflake to remove unused imports..."
# pip install autoflake
# autoflake --remove-all-unused-imports --recursive --in-place .

echo "Running ts-prune to remove unused file references..."
npm install -g ts-prune
ts-prune | awk '{print $1}' | xargs rm -f
# echo "Running ts-prune to remove unused file references..."
# npm install -g ts-prune
# ts-prune | awk '{print $1}' | xargs rm -f

rsync -av --delete ${{ env.RSYNC_SITECORE_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
rsync -av --delete ../cli/ ./cli/
rsync -av --delete ../ui/ ./ui/
rsync -av --delete ${{ env.RSYNC_SITECORE_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
rsync -av --delete ../upload-api/migration-sitecore/ ./upload-api/migration-sitecore/

# Ensure tsconfig.json exists, create a default one if missing
# if [ ! -f "tsconfig.json" ]; then
# echo "Creating default tsconfig.json..."
# cat <<EOL > tsconfig.json
# {
# "compilerOptions": {
# "target": "ES6",
# "module": "CommonJS",
# "strict": true,
# "esModuleInterop": true,
# "skipLibCheck": true,
# "forceConsistentCasingInFileNames": true
# },
# "include": ["src/**/*"],
# "exclude": ["node_modules", "dist"]
# }
# EOL
# fi

# Remove unused imports
# npx ts-remove-unused-imports api/
# npx ts-remove-unused-imports ui/
# npx ts-remove-unused-imports upload-api/

# Remove missing imports
# npx ts-prune | grep -E '^(api/|ui/|upload-api/)/' | awk '{print $1}' | xargs -I {} sed -i '/import/d' {}

# # Format code
# npx prettier --write .

# eslint api/ ui/ upload-api/ --rule 'import/no-unresolved: error' --format compact | awk -F ':' '{print $1}' | sort -u | xargs -I {} sed -i '/import/d' {}

git add .
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
Expand Down Expand Up @@ -163,10 +223,37 @@ jobs:
git clean -fdX # Remove untracked files and directories
git gc --prune=now # Garbage collect and prune unreachable objects

echo "Installing ESLint dependencies..."
npm install --save-dev eslint @eslint/js globals

if [ ! -f "eslint.config.cjs" ]; then
echo "Creating default ESLint config..."
cat <<EOL > eslint.config.cjs
const js = require("@eslint/js");
const globals = require("globals");

module.exports = [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: globals.node,
},
rules: {
"no-unused-vars": "warn",
"no-console": "off"
}
}
];
EOL
fi


# Remove unused imports and missing file references
# echo "Running ESLint to remove unused imports..."
# npm install eslint -g
# eslint . --fix
echo "Running ESLint to remove unused imports..."
npm install eslint -g
eslint . --fix

echo "Running autoflake to remove unused imports..."
pip install autoflake
Expand Down Expand Up @@ -229,10 +316,37 @@ jobs:
git clean -fdX # Remove untracked files and directories
git gc --prune=now # Garbage collect and prune unreachable objects

echo "Installing ESLint dependencies..."
npm install --save-dev eslint @eslint/js globals

if [ ! -f "eslint.config.cjs" ]; then
echo "Creating default ESLint config..."
cat <<EOL > eslint.config.cjs
const js = require("@eslint/js");
const globals = require("globals");

module.exports = [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: globals.node,
},
rules: {
"no-unused-vars": "warn",
"no-console": "off"
}
}
];
EOL
fi


# Remove unused imports and missing file references
# echo "Running ESLint to remove unused imports..."
# npm install eslint -g
# eslint . --fix
echo "Running ESLint to remove unused imports..."
npm install eslint -g
eslint . --fix

echo "Running autoflake to remove unused imports..."
pip install autoflake
Expand Down
16 changes: 8 additions & 8 deletions api/src/services/migration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ const startTestMigration = async (req: Request): Promise<any> => {
case CMS.SITECORE_V9:
case CMS.SITECORE_V10: {
if (packagePath) {
await siteCoreService?.createEntry({ packagePath, contentTypes, master_locale: project?.stackDetails?.master_locale, destinationStackId: project?.current_test_stack_id, projectId, keyMapper: project?.mapperKeys });
await siteCoreService?.createLocale(req, project?.current_test_stack_id, projectId);
await siteCoreService?.createEntry({ packagePath, contentTypes, master_locale: project?.stackDetails?.master_locale, destinationStackId: project?.current_test_stack_id, projectId, keyMapper: project?.mapperKeys, project });
await siteCoreService?.createLocale(req, project?.current_test_stack_id, projectId, project);
await siteCoreService?.createVersionFile(project?.current_test_stack_id);
}
break;
Expand Down Expand Up @@ -306,8 +306,8 @@ const startMigration = async (req: Request): Promise<any> => {
case CMS.SITECORE_V9:
case CMS.SITECORE_V10: {
if (packagePath) {
await siteCoreService?.createEntry({ packagePath, contentTypes, master_locale: project?.stackDetails?.master_locale, destinationStackId: project?.destination_stack_id, projectId, keyMapper: project?.mapperKeys });
await siteCoreService?.createLocale(req, project?.destination_stack_id, projectId);
await siteCoreService?.createEntry({ packagePath, contentTypes, master_locale: project?.stackDetails?.master_locale, destinationStackId: project?.destination_stack_id, projectId, keyMapper: project?.mapperKeys, project });
await siteCoreService?.createLocale(req, project?.destination_stack_id, projectId, project);
await siteCoreService?.createVersionFile(project?.destination_stack_id);
}
break;
Expand Down Expand Up @@ -417,18 +417,18 @@ const getLogs = async (req: Request): Promise<any> => {
*/
export const createSourceLocales = async (req: Request) => {

const projectId = req.params.projectId;
const locales = req.body.locale
const projectId = req?.params?.projectId;
const locales = req?.body?.locale;
console.info("🚀 ~ createSourceLocales ~ locales:", locales);

try {
// Find the project with the specified projectId
await ProjectModelLowdb?.read?.();
const index = ProjectModelLowdb?.chain?.get?.("projects")?.findIndex?.({ id: projectId })?.value?.();
if (index > -1) {
if (typeof index === "number" && index > -1) {
ProjectModelLowdb?.update?.((data: any) => {
data.projects[index].source_locales = locales;
});
// Write back the updated projects
} else {
logger.error(`Project with ID: ${projectId} not found`, {
status: HTTP_CODES?.NOT_FOUND,
Expand Down
17 changes: 13 additions & 4 deletions api/src/services/org.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import logger from "../utils/logger.js";
import { HTTP_TEXTS, HTTP_CODES } from "../constants/index.js";
import { ExceptionFunction } from "../utils/custom-errors.utils.js";
import { BadRequestError } from "../utils/custom-errors.utils.js";
import ProjectModelLowdb from "../models/project-lowdb.js";

/**
* Retrieves all stacks based on the provided request.
Expand Down Expand Up @@ -38,7 +39,6 @@ const getAllStacks = async (req: Request): Promise<LoginServiceType> => {
},
})
);
// console.info(err, res);
if (err) {
logger.error(
getLogMessage(
Expand All @@ -63,11 +63,20 @@ const getAllStacks = async (req: Request): Promise<LoginServiceType> => {
);
});
}
// const locale:any[]
// const locale = await getStackLocal(token_payload, stacks);
await ProjectModelLowdb?.read?.();
const testStacks = ProjectModelLowdb?.chain?.get?.("projects")?.flatMap?.("test_stacks")?.value?.();
if (testStacks?.length > 0) {
const filterStacks = [];
for (const stack of stacks ?? []) {
const isPresent = testStacks?.find?.((testStack: any) => testStack?.stackUid === stack?.api_key);
if (isPresent === undefined) {
filterStacks?.push(stack);
}
}
stacks = filterStacks;
}
return {
data: {
// stacks: locale,
stacks,
},
status: res.status,
Expand Down
Loading