()
| 78 | * This approach keeps version comparison logic simple while maintaining traceability via the SHA. |
| 79 | */ |
| 80 | export async function assertMinVersion(): Promise<void> { |
| 81 | if (process.env.NODE_ENV === 'test') { |
| 82 | return |
| 83 | } |
| 84 | |
| 85 | try { |
| 86 | const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT<{ |
| 87 | minVersion: string |
| 88 | }>('ncode_version_config', { minVersion: '0.0.0' }) |
| 89 | |
| 90 | if ( |
| 91 | versionConfig.minVersion && |
| 92 | lt(MACRO.VERSION, versionConfig.minVersion) |
| 93 | ) { |
| 94 | // biome-ignore lint/suspicious/noConsole:: intentional console output |
| 95 | console.error(` |
| 96 | It looks like your version of Code (${MACRO.VERSION}) needs an update. |
| 97 | A newer version (${versionConfig.minVersion} or higher) is required to continue. |
| 98 | |
| 99 | To update, please run: |
| 100 | code update |
| 101 | |
| 102 | This will ensure you have access to the latest features and improvements. |
| 103 | `) |
| 104 | gracefulShutdownSync(1) |
| 105 | } |
| 106 | } catch (error) { |
| 107 | logError(error as Error) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Returns the maximum allowed version for the current user type. |
no test coverage detected