* 2.24.1

- Updated dependencies
- MCP Server: better compatibility with Windows
- MCP Server: allow using a custom root for better flexibility
- Version Check: use package.json version instead of number of commits
- Prettier: reformatted some files
- Add SSH_AUTH_SOCK to dev passThroughEnv to solve SSH issues; handle execSync errors
- Use GIT_SSH to fix SSH issues on Windows
- Updated Stripe version
- Updated application version from 2.24.0 to 2.24.1 in package.json.
- Enhanced error handling in billing services to include error causes for better debugging.
This commit is contained in:
Giancarlo Buomprisco
2026-02-26 18:22:35 +08:00
committed by GitHub
parent f3ac595d06
commit ca585e09be
41 changed files with 2322 additions and 1803 deletions

View File

@@ -47,6 +47,7 @@ export default defineConfig(
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'preserve-caught-error': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },

View File

@@ -13,6 +13,7 @@
"format": "prettier --check \"**/*.{js,json}\""
},
"dependencies": {
"@eslint/js": "catalog:",
"@next/eslint-plugin-next": "catalog:",
"@types/eslint": "catalog:",
"eslint-config-next": "catalog:",

View File

@@ -1,42 +1,37 @@
import { execSync } from 'child_process';
import { readFileSync } from 'fs';
import path from 'path';
import { execFileSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import path from 'node:path';
const endpoint = 'https://makerkit.dev/api/license/check';
function runGitCommand(...args) {
try {
return execFileSync('git', args, {
encoding: 'utf8',
stdio: 'pipe',
}).trim();
} catch {
return '';
}
}
async function checkLicense() {
let gitUser, gitEmail;
try {
gitUser = execSync('git config user.username').toString().trim();
gitUser = runGitCommand('config', 'user.username');
if (!gitUser) {
gitUser = execSync('git config user.name').toString().trim();
}
gitEmail = execSync('git config user.email').toString().trim();
} catch (error) {
console.warn(`Error checking git user: ${error.message}`);
if (!gitUser) {
gitUser = runGitCommand('config', 'user.name');
}
if (!gitUser && !gitEmail) {
gitEmail = runGitCommand('config', 'user.email');
if (!gitUser || !gitEmail) {
throw new Error(
"Please set the git user name with the command 'git config user.username <username>'. The username needs to match the GitHub username in your Makerkit organization.",
);
}
try {
gitEmail = execSync('git config user.email').toString().trim();
} catch (error) {
console.info('Error getting git config:', error.message);
if (!gitUser) {
throw new Error(
"Please set the git user name with the command 'git config user.username <username>'. The username needs to match the GitHub username in your Makerkit organization.",
);
}
}
const searchParams = new URLSearchParams();
searchParams.append('username', gitUser);
@@ -77,9 +72,7 @@ function checkVisibility() {
let remoteUrl;
try {
remoteUrl = execSync('git config --get remote.origin.url')
.toString()
.trim();
remoteUrl = runGitCommand('config', '--get', 'remote.origin.url');
} catch (error) {
return Promise.resolve();
}
@@ -158,6 +151,8 @@ async function main() {
console.error(`Check failed with error: ${error.message}`);
process.exit(1);
});
process.exit(0);
} catch (error) {
console.error(`Check failed with error: ${error.message}`);

View File

@@ -1,93 +1,166 @@
import { execSync } from 'node:child_process';
import { execFileSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { checkPendingMigrations } from './migrations.mjs';
const isWindows = process.platform === 'win32';
function runGitCommand(command) {
function runGitCommand(...args) {
try {
return execSync(command, { encoding: 'utf8', stdio: 'pipe' }).trim();
} catch (error) {
return execFileSync('git', args, {
encoding: 'utf8',
stdio: 'pipe',
timeout: 15000,
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
}).trim();
} catch {
return null;
}
}
function checkMakerkitVersion() {
// Fetch the latest changes from upstream without merging
const fetchResult = runGitCommand('git fetch upstream');
function log(color, message) {
const colors = { red: 31, yellow: 33, green: 32, cyan: 36 };
const code = colors[color] ?? 0;
if (fetchResult === null) {
console.info(
'\x1b[33m%s\x1b[0m',
if (isWindows) {
console.log(message);
} else {
console.log(`\x1b[${code}m%s\x1b[0m`, message);
}
}
function getLocalVersion() {
try {
// Use git repo root to match upstream/main:package.json path
const repoRoot = runGitCommand('rev-parse', '--show-toplevel');
const root = repoRoot || process.cwd();
const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
return pkg.version;
} catch {
return null;
}
}
function getUpstreamVersion() {
const raw = runGitCommand('show', 'upstream/main:package.json');
if (!raw) return null;
try {
return JSON.parse(raw).version;
} catch {
return null;
}
}
function parseVersion(version) {
if (typeof version !== 'string') return null;
// Strip pre-release suffix (e.g. "1.3.0-canary.1" → "1.3.0")
const clean = version.split('-')[0];
const parts = clean.split('.').map(Number);
if (parts.length < 3 || parts.some(Number.isNaN)) {
return null;
}
return { major: parts[0], minor: parts[1], patch: parts[2] };
}
function compareTuples(a, b) {
if (a.major !== b.major) return a.major > b.major ? 1 : -1;
if (a.minor !== b.minor) return a.minor > b.minor ? 1 : -1;
if (a.patch !== b.patch) return a.patch > b.patch ? 1 : -1;
return 0;
}
function compareVersions(local, upstream) {
const l = parseVersion(local);
const u = parseVersion(upstream);
if (!l || !u) return 'success';
const cmp = compareTuples(l, u);
if (cmp > 0) return 'canary';
if (cmp === 0) return 'success';
// Upstream is ahead — determine severity
if (l.major < u.major || l.minor < u.minor) return 'critical';
if (u.patch - l.patch > 3) return 'critical';
return 'warning';
}
function checkMakerkitVersion() {
// Check if upstream remote exists before attempting fetch
const upstreamUrl = runGitCommand('remote', 'get-url', 'upstream');
if (!upstreamUrl) {
log(
'yellow',
"⚠️ You have not setup 'upstream'. Please set up the upstream remote so you can update your Makerkit version.",
);
return;
}
// Get the number of commits the local branch is behind upstream
const behindCount = runGitCommand('git rev-list --count HEAD..upstream/main');
// Fetch only main branch from upstream (may fail with SSH auth issues)
const fetchResult = runGitCommand('fetch', '--quiet', 'upstream', 'main');
if (behindCount === null) {
console.warn(
"Failed to get commit count. Ensure you're on a branch that tracks upstream/main.",
if (fetchResult === null) {
log(
'yellow',
'⚠️ Could not fetch from upstream. Checking cached upstream/main data...',
);
if (isWindows && upstreamUrl.includes('git@')) {
log(
'yellow',
'💡 Tip: On Windows, SSH remotes may not authenticate automatically. Consider switching to HTTPS:\n' +
` git remote set-url upstream ${upstreamUrl.replace(/^git@([^:]+):/, 'https://$1/').replace(/\.git$/, '')}`,
);
}
}
const localVersion = getLocalVersion();
const upstreamVersion = getUpstreamVersion();
if (!localVersion || !upstreamVersion) {
console.warn('Failed to read version from package.json.');
return;
}
const count = parseInt(behindCount, 10);
const { severity } = getSeveriyLevel(count);
const severity = compareVersions(localVersion, upstreamVersion);
if (severity === 'critical') {
// error emoji: ❌
console.log(
'\x1b[31m%s\x1b[0m',
'❌ Your Makerkit version is outdated. Please update to the latest version.',
if (severity === 'canary') {
log(
'cyan',
`🚀 Running canary version (${localVersion}), ahead of stable (${upstreamVersion}).`,
);
} else if (severity === 'critical') {
log(
'red',
`❌ Your Makerkit version (${localVersion}) is outdated. Latest is ${upstreamVersion}.`,
);
} else if (severity === 'warning') {
console.log(
'\x1b[33m%s\x1b[0m',
'⚠️ Your Makerkit version is outdated! Best to update to the latest version.',
log(
'yellow',
`⚠️ Your Makerkit version (${localVersion}) is behind. Latest is ${upstreamVersion}.`,
);
} else {
console.log('\x1b[32m%s\x1b[0m', '✅ Your Makerkit version is up to date!');
log('green', `✅ Your Makerkit version (${localVersion}) is up to date!`);
}
if (count > 0) {
logInstructions(count);
if (severity === 'warning' || severity === 'critical') {
log('yellow', 'Please update for bug fixes and optimizations.');
log('cyan', 'To update, run: git pull upstream main');
}
}
function logInstructions(count) {
console.log(
'\x1b[33m%s\x1b[0m',
`You are ${count} commit(s) behind the latest version.`,
);
console.log(
'\x1b[33m%s\x1b[0m',
'Please consider updating to the latest version for bug fixes and optimizations that your version does not have.',
);
console.log('\x1b[36m%s\x1b[0m', 'To update, run: git pull upstream main');
try {
checkMakerkitVersion();
} catch {
// Version check is informational — never block the dev server
}
function getSeveriyLevel(count) {
if (count > 5) {
return {
severity: 'critical',
};
}
if (count > 0) {
return {
severity: 'warning',
};
}
return {
severity: 'success',
};
}
checkMakerkitVersion();
checkPendingMigrations();