mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-13 21:33:32 +08:00
fix: remove release version drift from locks and tests
This commit is contained in:
@@ -11,6 +11,7 @@ PLUGIN_JSON=".claude-plugin/plugin.json"
|
|||||||
MARKETPLACE_JSON=".claude-plugin/marketplace.json"
|
MARKETPLACE_JSON=".claude-plugin/marketplace.json"
|
||||||
CODEX_PLUGIN_JSON=".codex-plugin/plugin.json"
|
CODEX_PLUGIN_JSON=".codex-plugin/plugin.json"
|
||||||
OPENCODE_PACKAGE_JSON=".opencode/package.json"
|
OPENCODE_PACKAGE_JSON=".opencode/package.json"
|
||||||
|
OPENCODE_PACKAGE_LOCK_JSON=".opencode/package-lock.json"
|
||||||
README_FILE="README.md"
|
README_FILE="README.md"
|
||||||
|
|
||||||
# Function to show usage
|
# Function to show usage
|
||||||
@@ -46,7 +47,7 @@ if ! git diff --quiet || ! git diff --cached --quiet; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify versioned manifests exist
|
# Verify versioned manifests exist
|
||||||
for FILE in "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$README_FILE"; do
|
for FILE in "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE"; do
|
||||||
if [[ ! -f "$FILE" ]]; then
|
if [[ ! -f "$FILE" ]]; then
|
||||||
echo "Error: $FILE not found"
|
echo "Error: $FILE not found"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -93,7 +94,7 @@ update_package_lock_version() {
|
|||||||
lock.packages[""].version = version;
|
lock.packages[""].version = version;
|
||||||
}
|
}
|
||||||
fs.writeFileSync(file, `${JSON.stringify(lock, null, 2)}\n`);
|
fs.writeFileSync(file, `${JSON.stringify(lock, null, 2)}\n`);
|
||||||
' "$PACKAGE_LOCK_JSON" "$VERSION"
|
' "$1" "$VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_readme_version_row() {
|
update_readme_version_row() {
|
||||||
@@ -116,15 +117,16 @@ update_readme_version_row() {
|
|||||||
|
|
||||||
# Update all shipped package/plugin manifests
|
# Update all shipped package/plugin manifests
|
||||||
update_version "$ROOT_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$ROOT_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_package_lock_version
|
update_package_lock_version "$PACKAGE_LOCK_JSON"
|
||||||
update_version "$PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_version "$MARKETPLACE_JSON" "0,/\"version\": *\"[^\"]*\"/s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$MARKETPLACE_JSON" "0,/\"version\": *\"[^\"]*\"/s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
|
update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON"
|
||||||
update_readme_version_row
|
update_readme_version_row
|
||||||
|
|
||||||
# Stage, commit, tag, and push
|
# Stage, commit, tag, and push
|
||||||
git add "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$README_FILE"
|
git add "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE"
|
||||||
git commit -m "chore: bump plugin version to $VERSION"
|
git commit -m "chore: bump plugin version to $VERSION"
|
||||||
git tag "v$VERSION"
|
git tag "v$VERSION"
|
||||||
git push origin main "v$VERSION"
|
git push origin main "v$VERSION"
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ const assert = require('assert');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const CURRENT_PACKAGE_VERSION = JSON.parse(
|
||||||
|
fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf8')
|
||||||
|
).version;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
createInstallState,
|
createInstallState,
|
||||||
@@ -66,7 +69,7 @@ function runTests() {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
source: {
|
source: {
|
||||||
repoVersion: '1.10.0',
|
repoVersion: CURRENT_PACKAGE_VERSION,
|
||||||
repoCommit: 'abc123',
|
repoCommit: 'abc123',
|
||||||
manifestVersion: 1,
|
manifestVersion: 1,
|
||||||
},
|
},
|
||||||
@@ -100,7 +103,7 @@ function runTests() {
|
|||||||
},
|
},
|
||||||
operations: [],
|
operations: [],
|
||||||
source: {
|
source: {
|
||||||
repoVersion: '1.10.0',
|
repoVersion: CURRENT_PACKAGE_VERSION,
|
||||||
repoCommit: 'abc123',
|
repoCommit: 'abc123',
|
||||||
manifestVersion: 1,
|
manifestVersion: 1,
|
||||||
},
|
},
|
||||||
@@ -154,7 +157,7 @@ function runTests() {
|
|||||||
},
|
},
|
||||||
operations: [operation],
|
operations: [operation],
|
||||||
source: {
|
source: {
|
||||||
repoVersion: '1.10.0',
|
repoVersion: CURRENT_PACKAGE_VERSION,
|
||||||
repoCommit: 'abc123',
|
repoCommit: 'abc123',
|
||||||
manifestVersion: 1,
|
manifestVersion: 1,
|
||||||
},
|
},
|
||||||
@@ -208,7 +211,7 @@ function runTests() {
|
|||||||
skippedModules: [],
|
skippedModules: [],
|
||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
repoVersion: '1.10.0',
|
repoVersion: CURRENT_PACKAGE_VERSION,
|
||||||
repoCommit: 'abc123',
|
repoCommit: 'abc123',
|
||||||
manifestVersion: 1,
|
manifestVersion: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ const assert = require('assert');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const CURRENT_PACKAGE_VERSION = JSON.parse(
|
||||||
|
fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf8')
|
||||||
|
).version;
|
||||||
|
|
||||||
const { resolveEccRoot, INLINE_RESOLVE } = require('../../scripts/lib/resolve-ecc-root');
|
const { resolveEccRoot, INLINE_RESOLVE } = require('../../scripts/lib/resolve-ecc-root');
|
||||||
|
|
||||||
@@ -181,7 +184,7 @@ function runTests() {
|
|||||||
const homeDir = createTempDir();
|
const homeDir = createTempDir();
|
||||||
try {
|
try {
|
||||||
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'ecc']);
|
const expected = setupLegacyPluginInstall(homeDir, ['marketplace', 'ecc']);
|
||||||
setupPluginCache(homeDir, 'ecc', 'affaan-m', '1.10.0');
|
setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||||
assert.strictEqual(result, expected);
|
assert.strictEqual(result, expected);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -193,7 +196,7 @@ function runTests() {
|
|||||||
if (test('discovers plugin root from cache directory', () => {
|
if (test('discovers plugin root from cache directory', () => {
|
||||||
const homeDir = createTempDir();
|
const homeDir = createTempDir();
|
||||||
try {
|
try {
|
||||||
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', '1.10.0');
|
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||||
assert.strictEqual(result, expected);
|
assert.strictEqual(result, expected);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -205,7 +208,7 @@ function runTests() {
|
|||||||
const homeDir = createTempDir();
|
const homeDir = createTempDir();
|
||||||
try {
|
try {
|
||||||
const claudeDir = setupStandardInstall(homeDir);
|
const claudeDir = setupStandardInstall(homeDir);
|
||||||
setupPluginCache(homeDir, 'ecc', 'affaan-m', '1.10.0');
|
setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||||
assert.strictEqual(result, claudeDir,
|
assert.strictEqual(result, claudeDir,
|
||||||
'Standard install should take precedence over plugin cache');
|
'Standard install should take precedence over plugin cache');
|
||||||
@@ -218,7 +221,7 @@ function runTests() {
|
|||||||
const homeDir = createTempDir();
|
const homeDir = createTempDir();
|
||||||
try {
|
try {
|
||||||
setupPluginCache(homeDir, 'everything-claude-code', 'legacy-org', '1.7.0');
|
setupPluginCache(homeDir, 'everything-claude-code', 'legacy-org', '1.7.0');
|
||||||
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', '1.10.0');
|
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||||
const result = resolveEccRoot({ envRoot: '', homeDir });
|
const result = resolveEccRoot({ envRoot: '', homeDir });
|
||||||
// Should find one of them (either is valid)
|
// Should find one of them (either is valid)
|
||||||
assert.ok(
|
assert.ok(
|
||||||
@@ -311,7 +314,7 @@ function runTests() {
|
|||||||
if (test('INLINE_RESOLVE discovers plugin cache when env var is unset', () => {
|
if (test('INLINE_RESOLVE discovers plugin cache when env var is unset', () => {
|
||||||
const homeDir = createTempDir();
|
const homeDir = createTempDir();
|
||||||
try {
|
try {
|
||||||
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', '1.10.0');
|
const expected = setupPluginCache(homeDir, 'ecc', 'affaan-m', CURRENT_PACKAGE_VERSION);
|
||||||
const { execFileSync } = require('child_process');
|
const { execFileSync } = require('child_process');
|
||||||
const result = execFileSync('node', [
|
const result = execFileSync('node', [
|
||||||
'-e', `console.log(${INLINE_RESOLVE})`,
|
'-e', `console.log(${INLINE_RESOLVE})`,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const repoRootWithSep = `${repoRoot}${path.sep}`;
|
|||||||
const packageJsonPath = path.join(repoRoot, 'package.json');
|
const packageJsonPath = path.join(repoRoot, 'package.json');
|
||||||
const packageLockPath = path.join(repoRoot, 'package-lock.json');
|
const packageLockPath = path.join(repoRoot, 'package-lock.json');
|
||||||
const opencodePackageJsonPath = path.join(repoRoot, '.opencode', 'package.json');
|
const opencodePackageJsonPath = path.join(repoRoot, '.opencode', 'package.json');
|
||||||
|
const opencodePackageLockPath = path.join(repoRoot, '.opencode', 'package-lock.json');
|
||||||
|
|
||||||
let passed = 0;
|
let passed = 0;
|
||||||
let failed = 0;
|
let failed = 0;
|
||||||
@@ -69,6 +70,7 @@ function assertSafeRepoRelativePath(relativePath, label) {
|
|||||||
|
|
||||||
const rootPackage = loadJsonObject(packageJsonPath, 'package.json');
|
const rootPackage = loadJsonObject(packageJsonPath, 'package.json');
|
||||||
const packageLock = loadJsonObject(packageLockPath, 'package-lock.json');
|
const packageLock = loadJsonObject(packageLockPath, 'package-lock.json');
|
||||||
|
const opencodePackageLock = loadJsonObject(opencodePackageLockPath, '.opencode/package-lock.json');
|
||||||
const expectedVersion = rootPackage.version;
|
const expectedVersion = rootPackage.version;
|
||||||
|
|
||||||
test('package.json has version field', () => {
|
test('package.json has version field', () => {
|
||||||
@@ -351,6 +353,12 @@ test('.opencode/package.json version matches package.json', () => {
|
|||||||
assert.strictEqual(opencodePackage.version, expectedVersion);
|
assert.strictEqual(opencodePackage.version, expectedVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('.opencode/package-lock.json root version matches package.json', () => {
|
||||||
|
assert.strictEqual(opencodePackageLock.version, expectedVersion);
|
||||||
|
assert.ok(opencodePackageLock.packages && opencodePackageLock.packages[''], 'Expected .opencode/package-lock root package entry');
|
||||||
|
assert.strictEqual(opencodePackageLock.packages[''].version, expectedVersion);
|
||||||
|
});
|
||||||
|
|
||||||
test('README version row matches package.json', () => {
|
test('README version row matches package.json', () => {
|
||||||
const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf8');
|
const readme = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf8');
|
||||||
const match = readme.match(/^\| \*\*Version\*\* \| Plugin \| Plugin \| Reference config \| ([0-9][0-9.]*) \|$/m);
|
const match = readme.match(/^\| \*\*Version\*\* \| Plugin \| Plugin \| Reference config \| ([0-9][0-9.]*) \|$/m);
|
||||||
|
|||||||
Reference in New Issue
Block a user