Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions packages/oc/src/registry/domain/validators/templace-oc-version.ts
Original file line number Diff line number Diff line change
@@ -1,33 +0,0 @@
import path from 'node:path';
import fs from 'fs-extra';
import semver from 'semver';

const packageInfo = fs.readJsonSync(
path.join(__dirname, '..', '..', '..', '..', 'package.json')
);

type OkResult = { isValid: true };
type ErrorResult = {
isValid: false;
error: {
registryVersion: string;
minOcVersion: string;
code: string;
};
};
type Result = OkResult | ErrorResult;

export default function templateOcVersion(minOcVersion: string): Result {
if (semver.lt(packageInfo.version, minOcVersion)) {
return {
isValid: false,
error: {
registryVersion: packageInfo.version,
minOcVersion,
code: 'old_version'
}
};
}

return { isValid: true };
}
33 changes: 33 additions & 0 deletions packages/oc/src/registry/domain/validators/template-oc-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import path from 'node:path';
import fs from 'fs-extra';
import semver from 'semver';

const packageInfo = fs.readJsonSync(
path.join(__dirname, '..', '..', '..', '..', 'package.json')
);

type OkResult = { isValid: true };
type ErrorResult = {
isValid: false;
error: {
registryVersion: string;
minOcVersion: string;
code: string;
};
};
type Result = OkResult | ErrorResult;

export default function templateOcVersion(minOcVersion: string): Result {
if (semver.lt(packageInfo.version, minOcVersion)) {
return {
isValid: false,
error: {
registryVersion: packageInfo.version,
minOcVersion,
code: 'old_version'
}
};
}

return { isValid: true };
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComponentsDetails } from '../../../types';
import dateStringified from '../../../utils/date-stringify';

interface UnformmatedComponentHistory {
interface UnformattedComponentHistory {
name: string;
version: string;
publishDate: number;
Expand All @@ -18,7 +18,7 @@ export interface ComponentHistory {
export default function getComponentsHistory(
history: ComponentsDetails
): ComponentHistory[] {
const result: UnformmatedComponentHistory[] = [];
const result: UnformattedComponentHistory[] = [];

for (const [name, versions] of Object.entries(history.components)) {
for (const [version, details] of Object.entries(versions)) {
Expand Down