mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(core): Pick up release version and date from package.json (no-changelog) (#13666)
This commit is contained in:
committed by
GitHub
parent
9ba9443460
commit
093cc982b8
@@ -14,7 +14,13 @@ import { ensureError, sleep, UserError } from 'n8n-workflow';
|
||||
|
||||
import type { AbstractServer } from '@/abstract-server';
|
||||
import config from '@/config';
|
||||
import { LICENSE_FEATURES, inDevelopment, inTest } from '@/constants';
|
||||
import {
|
||||
LICENSE_FEATURES,
|
||||
N8N_VERSION,
|
||||
N8N_RELEASE_DATE,
|
||||
inDevelopment,
|
||||
inTest,
|
||||
} from '@/constants';
|
||||
import * as CrashJournal from '@/crash-journal';
|
||||
import * as Db from '@/db';
|
||||
import { getDataDeduplicationService } from '@/deduplication';
|
||||
@@ -63,15 +69,14 @@ export abstract class BaseCommand extends Command {
|
||||
async init(): Promise<void> {
|
||||
this.errorReporter = Container.get(ErrorReporter);
|
||||
|
||||
const { releaseDate } = this.globalConfig.generic;
|
||||
const { backendDsn, n8nVersion, environment, deploymentName } = this.globalConfig.sentry;
|
||||
const { backendDsn, environment, deploymentName } = this.globalConfig.sentry;
|
||||
await this.errorReporter.init({
|
||||
serverType: this.instanceSettings.instanceType,
|
||||
dsn: backendDsn,
|
||||
environment,
|
||||
release: n8nVersion,
|
||||
release: N8N_VERSION,
|
||||
serverName: deploymentName,
|
||||
releaseDate,
|
||||
releaseDate: N8N_RELEASE_DATE,
|
||||
});
|
||||
initExpressionEvaluator();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { readFileSync, statSync } from 'fs';
|
||||
import type { n8n } from 'n8n-core';
|
||||
import type { ITaskDataConnections } from 'n8n-workflow';
|
||||
import { jsonParse, TRIMMED_TASK_DATA_CONNECTIONS_KEY } from 'n8n-workflow';
|
||||
@@ -18,9 +18,10 @@ export const TEMPLATES_DIR = join(CLI_DIR, 'templates');
|
||||
export const NODES_BASE_DIR = dirname(require.resolve('n8n-nodes-base'));
|
||||
export const EDITOR_UI_DIST_DIR = join(dirname(require.resolve('n8n-editor-ui')), 'dist');
|
||||
|
||||
export function getN8nPackageJson() {
|
||||
return jsonParse<n8n.PackageJson>(readFileSync(join(CLI_DIR, 'package.json'), 'utf8'));
|
||||
}
|
||||
const packageJsonPath = join(CLI_DIR, 'package.json');
|
||||
const n8nPackageJson = jsonParse<n8n.PackageJson>(readFileSync(packageJsonPath, 'utf8'));
|
||||
export const N8N_VERSION = n8nPackageJson.version;
|
||||
export const N8N_RELEASE_DATE = statSync(packageJsonPath).mtime;
|
||||
|
||||
export const STARTING_NODES = [
|
||||
'@n8n/n8n-nodes-langchain.manualChatTrigger',
|
||||
@@ -28,8 +29,6 @@ export const STARTING_NODES = [
|
||||
'n8n-nodes-base.manualTrigger',
|
||||
];
|
||||
|
||||
export const N8N_VERSION = getN8nPackageJson().version;
|
||||
|
||||
export const NODE_PACKAGE_PREFIX = 'n8n-nodes-';
|
||||
|
||||
export const STARTER_TEMPLATE_NAME = `${NODE_PACKAGE_PREFIX}starter`;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { InstanceSettings, Logger } from 'n8n-core';
|
||||
import type { IWorkflowBase } from 'n8n-workflow';
|
||||
|
||||
import config from '@/config';
|
||||
import { getN8nPackageJson, inDevelopment } from '@/constants';
|
||||
import { inDevelopment, N8N_VERSION } from '@/constants';
|
||||
import { isApiEnabled } from '@/public-api';
|
||||
import {
|
||||
ENV_VARS_DOCS_URL,
|
||||
@@ -175,7 +175,7 @@ export class InstanceRiskReporter implements RiskReporter {
|
||||
private async getOutdatedState() {
|
||||
let versions = [];
|
||||
|
||||
const localVersion = getN8nPackageJson().version;
|
||||
const localVersion = N8N_VERSION;
|
||||
|
||||
try {
|
||||
versions = await this.getNextVersions(localVersion).then((v) => this.removeIconData(v));
|
||||
|
||||
@@ -114,9 +114,8 @@ export const MOCK_PACKAGE: InstalledPackages[] = [
|
||||
export function simulateOutdatedInstanceOnce(versionName = MOCK_01110_N8N_VERSION.name) {
|
||||
const baseUrl = Container.get(GlobalConfig).versionNotifications.endpoint + '/';
|
||||
|
||||
jest
|
||||
.spyOn(constants, 'getN8nPackageJson')
|
||||
.mockReturnValueOnce({ name: 'n8n', version: versionName });
|
||||
// @ts-expect-error readonly export
|
||||
constants.N8N_VERSION = versionName;
|
||||
|
||||
nock(baseUrl).get(versionName).reply(200, [MOCK_01110_N8N_VERSION, MOCK_09990_N8N_VERSION]);
|
||||
}
|
||||
@@ -124,9 +123,8 @@ export function simulateOutdatedInstanceOnce(versionName = MOCK_01110_N8N_VERSIO
|
||||
export function simulateUpToDateInstance(versionName = MOCK_09990_N8N_VERSION.name) {
|
||||
const baseUrl = Container.get(GlobalConfig).versionNotifications.endpoint + '/';
|
||||
|
||||
jest
|
||||
.spyOn(constants, 'getN8nPackageJson')
|
||||
.mockReturnValueOnce({ name: 'n8n', version: versionName });
|
||||
// @ts-expect-error readonly export
|
||||
constants.N8N_VERSION = versionName;
|
||||
|
||||
nock(baseUrl).persist().get(versionName).reply(200, [MOCK_09990_N8N_VERSION]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user