@stackbit/types
Advanced tools
Comparing version 0.4.0-staging.0 to 0.4.0-staging.1
import type { FieldType } from './model-fields'; | ||
export declare const InterfaceVersion: "0.2.0"; | ||
/** | ||
@@ -4,0 +3,0 @@ * Front-end frameworks supported by Stackbit without any additional |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RICH_TEXT_HINT_MAX_LENGTH = exports.RICH_TEXT_MARK_TYPES = exports.RICH_TEXT_NODE_TYPES = exports.STYLE_PROPS_VALUES = exports.STYLE_PROPS = exports.FIELD_TYPES = exports.FIELD_TYPE = exports.CMS_NAMES = exports.SSG_NAMES = exports.InterfaceVersion = void 0; | ||
exports.InterfaceVersion = '0.2.0'; | ||
exports.RICH_TEXT_HINT_MAX_LENGTH = exports.RICH_TEXT_MARK_TYPES = exports.RICH_TEXT_NODE_TYPES = exports.STYLE_PROPS_VALUES = exports.STYLE_PROPS = exports.FIELD_TYPES = exports.FIELD_TYPE = exports.CMS_NAMES = exports.SSG_NAMES = void 0; | ||
/** | ||
@@ -6,0 +5,0 @@ * Front-end frameworks supported by Stackbit without any additional |
@@ -8,3 +8,2 @@ /// <reference types="node" /> | ||
import type { UpdateOperation, UpdateOperationField } from './content-source-operation'; | ||
import { InterfaceVersion } from './consts'; | ||
/** | ||
@@ -423,3 +422,3 @@ * A class implementing the `ContentSourceInterface` allows Stackbit to | ||
*/ | ||
interfaceVersion: typeof InterfaceVersion; | ||
interfaceVersion: string; | ||
/** | ||
@@ -426,0 +425,0 @@ * The current version of the Content Source module. This should be the |
@@ -9,3 +9,3 @@ import type { Version } from './content-source'; | ||
}; | ||
export declare function getInterfaceVersion(): "0.2.0"; | ||
export declare function getInterfaceVersion(): Promise<any>; | ||
export declare function getVersion(options?: { | ||
@@ -12,0 +12,0 @@ packageJsonPath?: string; |
@@ -25,13 +25,18 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defineStackbitConfig = exports.isDocumentFieldOneOfFieldTypes = exports.isModelFieldOneOfFieldTypes = exports.isOneOfFieldTypes = exports.getLocalizedFieldForLocale = exports.isLocalizedField = exports.getVersion = exports.getInterfaceVersion = void 0; | ||
const consts_1 = require("./consts"); | ||
function getInterfaceVersion() { | ||
return consts_1.InterfaceVersion; | ||
const path_1 = __importDefault(require("path")); | ||
async function getInterfaceVersion() { | ||
const packageJson = await Promise.resolve().then(() => __importStar(require(path_1.default.join(__dirname, '../package.json')))); | ||
return packageJson.version; | ||
} | ||
exports.getInterfaceVersion = getInterfaceVersion; | ||
async function getVersion(options = {}) { | ||
const interfaceVersion = await getInterfaceVersion(); | ||
if (options.contentSourceVersion) { | ||
return { | ||
interfaceVersion: consts_1.InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: options.contentSourceVersion | ||
@@ -43,3 +48,3 @@ }; | ||
return { | ||
interfaceVersion: consts_1.InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: packageJson.version | ||
@@ -50,3 +55,3 @@ }; | ||
return { | ||
interfaceVersion: consts_1.InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: '' | ||
@@ -53,0 +58,0 @@ }; |
{ | ||
"name": "@stackbit/types", | ||
"version": "0.4.0-staging.0", | ||
"description": "Types for Stackbit config and Content Source Interface", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"/dist", | ||
"/src" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"build": "rm -rf dist && tsc", | ||
"watch": "rm -rf dist && tsc -w", | ||
"prettier": "prettier --write src", | ||
"prepack": "npm test && npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/stackbit/stackbit.git" | ||
}, | ||
"keywords": [ | ||
"stackbit" | ||
], | ||
"author": "Stackbit Inc.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/stackbit/stackbit/issues" | ||
}, | ||
"homepage": "https://github.com/stackbit/stackbit#readme", | ||
"devDependencies": { | ||
"@types/node": "^18.11.7", | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/parser": "^5.41.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"jest": "^29.2.2", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.8.4" | ||
}, | ||
"gitHead": "f4d3d35b36a78b28cb41f26279f7e3afd47d9691" | ||
"name": "@stackbit/types", | ||
"version": "0.4.0-staging.1", | ||
"description": "Types for Stackbit config and Content Source Interface", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"/dist", | ||
"/src" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"build": "rm -rf dist && tsc", | ||
"watch": "rm -rf dist && tsc -w", | ||
"prettier": "prettier --write src", | ||
"prepack": "npm test && npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/stackbit/stackbit.git" | ||
}, | ||
"keywords": [ | ||
"stackbit" | ||
], | ||
"author": "Stackbit Inc.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/stackbit/stackbit/issues" | ||
}, | ||
"homepage": "https://github.com/stackbit/stackbit#readme", | ||
"devDependencies": { | ||
"@types/node": "^18.11.7", | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/parser": "^5.41.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"jest": "^29.2.2", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.8.4" | ||
}, | ||
"gitHead": "26179052977e93a43a80be7d70b0eb76b3c0a0eb" | ||
} |
import type { FieldType } from './model-fields'; | ||
export const InterfaceVersion = '0.2.0' as const; | ||
/** | ||
@@ -6,0 +4,0 @@ * Front-end frameworks supported by Stackbit without any additional |
@@ -6,3 +6,2 @@ import type { ChildProcessWithoutNullStreams } from 'child_process'; | ||
import type { UpdateOperation, UpdateOperationField } from './content-source-operation'; | ||
import { InterfaceVersion } from './consts'; | ||
@@ -433,3 +432,3 @@ /** | ||
*/ | ||
interfaceVersion: typeof InterfaceVersion; | ||
interfaceVersion: string; | ||
/** | ||
@@ -507,3 +506,7 @@ * The current version of the Content Source module. This should be the | ||
export type CommandRunner = (command: string, args?: string[], options?: { cwd?: string; shell?: boolean; env?: NodeJS.ProcessEnv }) => Promise<RunResult>; | ||
export type CommandRunner = ( | ||
command: string, | ||
args?: string[], | ||
options?: { cwd?: string; shell?: boolean; env?: NodeJS.ProcessEnv } | ||
) => Promise<RunResult>; | ||
@@ -510,0 +513,0 @@ export interface GitFileCommitDescriptor { |
@@ -0,1 +1,2 @@ | ||
import path from 'path'; | ||
import type { Version } from './content-source'; | ||
@@ -11,3 +12,2 @@ import type { FieldType, Field, FieldForType } from './model-fields'; | ||
} from './content-source-document-fields'; | ||
import { InterfaceVersion } from './consts'; | ||
@@ -18,10 +18,14 @@ export type Simplify<T> = { | ||
export function getInterfaceVersion() { | ||
return InterfaceVersion; | ||
export async function getInterfaceVersion() { | ||
const packageJson = await import(path.join(__dirname, '../package.json')); | ||
return packageJson.version; | ||
} | ||
export async function getVersion(options: { packageJsonPath?: string; contentSourceVersion?: string; } = {}): Promise<Version> { | ||
export async function getVersion( | ||
options: { packageJsonPath?: string; contentSourceVersion?: string } = {} | ||
): Promise<Version> { | ||
const interfaceVersion = await getInterfaceVersion(); | ||
if (options.contentSourceVersion) { | ||
return { | ||
interfaceVersion: InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: options.contentSourceVersion | ||
@@ -32,3 +36,3 @@ }; | ||
return { | ||
interfaceVersion: InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: packageJson.version | ||
@@ -38,3 +42,3 @@ }; | ||
return { | ||
interfaceVersion: InterfaceVersion, | ||
interfaceVersion: interfaceVersion, | ||
contentSourceVersion: '' | ||
@@ -41,0 +45,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
200406
4128
2