Skip to content

Commit

Permalink
Inline plugin version checks, remove versions.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
simondotm committed Apr 1, 2024
1 parent 172bdb5 commit 5003a12
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion packages/nx-firebase/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './versions'
export * from './workspace'
export * from './update-tsconfig'
export * from './project-name'
Expand Down
5 changes: 0 additions & 5 deletions packages/nx-firebase/src/utils/versions.ts

This file was deleted.

10 changes: 7 additions & 3 deletions packages/nx-firebase/src/utils/workspace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { logger, readJsonFile, workspaceRoot } from '@nx/devkit'
import { pluginNxVersion, pluginNxVersionMajor } from './versions'
import { packageVersions } from '../__generated__/nx-firebase-versions'

// Declare target version of Nx that the plugin is currently compatible with
export const pluginNxVersion = `^${packageVersions.nx}`

type PackageJson = {
dependencies: {
Expand Down Expand Up @@ -49,10 +52,11 @@ function readNxWorkspaceVersion(): WorkspaceVersion {
export const workspaceNxVersion = readNxWorkspaceVersion()

export function checkNxVersion() {
const pluginNxVersionMajor = parseInt(packageVersions.nx.split('.')[0])
if (workspaceNxVersion) {
if (workspaceNxVersion.major > pluginNxVersionMajor) {
if (workspaceNxVersion.major !== pluginNxVersionMajor) {
logger.warn(
`WARNING: @simondotm/nx-firebase plugin for Nx version (${pluginNxVersion}) may not be compatible with your version of Nx (${workspaceNxVersion.version})`,
`WARNING: @simondotm/nx-firebase plugin v${packageVersions.pluginVersion} was built for Nx major version ${pluginNxVersion}, and may not be compatible with your version of Nx (${workspaceNxVersion.version})`,
)
}
} else {
Expand Down

0 comments on commit 5003a12

Please sign in to comment.