@@ -45,6 +45,24 @@ function isEslintDependency(depName) {
4545 return ESLINT_PATTERNS . some ( ( pattern ) => depName . startsWith ( pattern ) )
4646}
4747
48+ /**
49+ * Find platform-rig in node_modules
50+ */
51+ function findPlatformRigPath ( ) {
52+ // Try to find platform-rig in node_modules
53+ const cwd = process . cwd ( )
54+ const possiblePaths = [ path . join ( cwd , 'common' , 'scripts' , 'node_modules' , '@hcengineering' , 'platform-rig' ) ]
55+
56+ for ( const platformRigPath of possiblePaths ) {
57+ const packageJsonPath = path . join ( platformRigPath , 'package.json' )
58+ if ( fs . existsSync ( packageJsonPath ) ) {
59+ return platformRigPath
60+ }
61+ }
62+
63+ return null
64+ }
65+
4866/**
4967 * Get ESLint dev dependencies from platform-rig package.json
5068 */
@@ -128,18 +146,18 @@ function main() {
128146 console . log ( '🔍 Syncing ESLint dependencies from platform-rig to all packages...\n' )
129147
130148 try {
131- // Get all Rush projects
132- const projects = getRushProjects ( )
133- console . log ( `Found ${ projects . length } projects in Rush workspace\n` )
134-
135- // Find platform-rig project
136- const platformRigProject = projects . find ( ( p ) => p . name === '@hcengineering/platform-rig' )
137- if ( ! platformRigProject ) {
138- throw new Error ( 'platform-rig package not found in Rush workspace' )
149+ // Find platform-rig in node_modules
150+ const platformRigPath = findPlatformRigPath ( )
151+ if ( ! platformRigPath ) {
152+ console . log ( '⚠️ platform-rig package not found in node_modules. Skipping sync.' )
153+ console . log ( ' Make sure @hcengineering/platform-rig is installed as a dependency.' )
154+ return
139155 }
140156
157+ console . log ( `📍 Found platform-rig at: ${ platformRigPath } \n` )
158+
141159 // Get ESLint dependencies from platform-rig
142- const eslintDeps = getEslintDepsFromPlatformRig ( platformRigProject . fullPath )
160+ const eslintDeps = getEslintDepsFromPlatformRig ( platformRigPath )
143161
144162 if ( Object . keys ( eslintDeps ) . length === 0 ) {
145163 console . log ( '⚠️ No ESLint dependencies found in platform-rig' )
@@ -152,6 +170,10 @@ function main() {
152170 }
153171 console . log ( )
154172
173+ // Get all Rush projects
174+ const projects = getRushProjects ( )
175+ console . log ( `Found ${ projects . length } projects in Rush workspace\n` )
176+
155177 // Update all packages
156178 let updatedCount = 0
157179 let skippedCount = 0
0 commit comments