Skip to content

Commit 5a1d8df

Browse files
committed
Merge branch 'dev' of github.com:contentstack/migration-v2-node-server into feature/dropdown-field-choices
2 parents 857c318 + 50c63ba commit 5a1d8df

File tree

1 file changed

+124
-13
lines changed

1 file changed

+124
-13
lines changed

.github/workflows/repo-sync.yml

Lines changed: 124 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,81 @@ jobs:
9797
git clean -fdX # Remove untracked files and directories
9898
git gc --prune=now # Garbage collect and prune unreachable objects
9999
100-
# Remove unused imports and missing file references
100+
# echo "Installing ESLint dependencies..."
101+
# npm install --save-dev eslint @eslint/js globals
102+
103+
# if [ ! -f "eslint.config.cjs" ]; then
104+
# echo "Creating default ESLint config..."
105+
# cat <<EOL > eslint.config.cjs
106+
# const js = require("@eslint/js");
107+
# const globals = require("globals");
108+
109+
# module.exports = [
110+
# js.configs.recommended,
111+
# {
112+
# languageOptions: {
113+
# ecmaVersion: "latest",
114+
# sourceType: "module",
115+
# globals: globals.node,
116+
# },
117+
# rules: {
118+
# "no-unused-vars": "warn",
119+
# "no-console": "off"
120+
# }
121+
# }
122+
# ];
123+
# EOL
124+
# fi
125+
126+
# # Remove unused imports and missing file references
101127
# echo "Running ESLint to remove unused imports..."
102128
# npm install eslint -g
103129
# eslint . --fix
104130
105-
echo "Running autoflake to remove unused imports..."
106-
pip install autoflake
107-
autoflake --remove-all-unused-imports --recursive --in-place .
131+
# echo "Running autoflake to remove unused imports..."
132+
# pip install autoflake
133+
# autoflake --remove-all-unused-imports --recursive --in-place .
108134
109-
echo "Running ts-prune to remove unused file references..."
110-
npm install -g ts-prune
111-
ts-prune | awk '{print $1}' | xargs rm -f
135+
# echo "Running ts-prune to remove unused file references..."
136+
# npm install -g ts-prune
137+
# ts-prune | awk '{print $1}' | xargs rm -f
112138
113139
rsync -av --delete ${{ env.RSYNC_SITECORE_API_SRC_SERVICES_EXCLUDES }} ../api/ ./api/
114140
rsync -av --delete ../cli/ ./cli/
115141
rsync -av --delete ../ui/ ./ui/
116142
rsync -av --delete ${{ env.RSYNC_SITECORE_UPLOAD_API_SRC_EXCLUDES }} ../upload-api/src/ ./upload-api/src/
117143
rsync -av --delete ../upload-api/migration-sitecore/ ./upload-api/migration-sitecore/
144+
145+
# Ensure tsconfig.json exists, create a default one if missing
146+
if [ ! -f "tsconfig.json" ]; then
147+
echo "Creating default tsconfig.json..."
148+
cat <<EOL > tsconfig.json
149+
{
150+
"compilerOptions": {
151+
"target": "ES6",
152+
"module": "CommonJS",
153+
"strict": true,
154+
"esModuleInterop": true,
155+
"skipLibCheck": true,
156+
"forceConsistentCasingInFileNames": true
157+
},
158+
"include": ["src/**/*"],
159+
"exclude": ["node_modules", "dist"]
160+
}
161+
EOL
162+
fi
163+
164+
# Remove unused imports
165+
npx ts-remove-unused-imports api/
166+
npx ts-remove-unused-imports ui/
167+
npx ts-remove-unused-imports upload-api/
168+
169+
# Remove missing imports
170+
npx ts-prune | grep -E '^(api/|ui/|upload-api/)/' | awk '{print $1}' | xargs -I {} sed -i '/import/d' {}
171+
172+
# Format code
173+
npx prettier --write .
174+
118175
git add .
119176
git commit -m "Sync changes from migration-v2 PR #${{ github.event.pull_request.number }}"
120177
git push origin sync-from-migration-v2-${{ github.event.pull_request.number }}
@@ -163,10 +220,37 @@ jobs:
163220
git clean -fdX # Remove untracked files and directories
164221
git gc --prune=now # Garbage collect and prune unreachable objects
165222
223+
echo "Installing ESLint dependencies..."
224+
npm install --save-dev eslint @eslint/js globals
225+
226+
if [ ! -f "eslint.config.cjs" ]; then
227+
echo "Creating default ESLint config..."
228+
cat <<EOL > eslint.config.cjs
229+
const js = require("@eslint/js");
230+
const globals = require("globals");
231+
232+
module.exports = [
233+
js.configs.recommended,
234+
{
235+
languageOptions: {
236+
ecmaVersion: "latest",
237+
sourceType: "module",
238+
globals: globals.node,
239+
},
240+
rules: {
241+
"no-unused-vars": "warn",
242+
"no-console": "off"
243+
}
244+
}
245+
];
246+
EOL
247+
fi
248+
249+
166250
# Remove unused imports and missing file references
167-
# echo "Running ESLint to remove unused imports..."
168-
# npm install eslint -g
169-
# eslint . --fix
251+
echo "Running ESLint to remove unused imports..."
252+
npm install eslint -g
253+
eslint . --fix
170254
171255
echo "Running autoflake to remove unused imports..."
172256
pip install autoflake
@@ -229,10 +313,37 @@ jobs:
229313
git clean -fdX # Remove untracked files and directories
230314
git gc --prune=now # Garbage collect and prune unreachable objects
231315
316+
echo "Installing ESLint dependencies..."
317+
npm install --save-dev eslint @eslint/js globals
318+
319+
if [ ! -f "eslint.config.cjs" ]; then
320+
echo "Creating default ESLint config..."
321+
cat <<EOL > eslint.config.cjs
322+
const js = require("@eslint/js");
323+
const globals = require("globals");
324+
325+
module.exports = [
326+
js.configs.recommended,
327+
{
328+
languageOptions: {
329+
ecmaVersion: "latest",
330+
sourceType: "module",
331+
globals: globals.node,
332+
},
333+
rules: {
334+
"no-unused-vars": "warn",
335+
"no-console": "off"
336+
}
337+
}
338+
];
339+
EOL
340+
fi
341+
342+
232343
# Remove unused imports and missing file references
233-
# echo "Running ESLint to remove unused imports..."
234-
# npm install eslint -g
235-
# eslint . --fix
344+
echo "Running ESLint to remove unused imports..."
345+
npm install eslint -g
346+
eslint . --fix
236347
237348
echo "Running autoflake to remove unused imports..."
238349
pip install autoflake

0 commit comments

Comments
 (0)