Use package JSON version

Use package JSON version

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-01-26 15:51:10 +07:00
parent 7d1df3c36d
commit 560e3debe3
No known key found for this signature in database
GPG Key ID: BD80F68D68D8F7F2

View File

@ -36,6 +36,8 @@ import { createModel as templatesModel } from '@anticrm/model-templates'
import { createModel as textEditorModel } from '@anticrm/model-text-editor'
import { createModel as viewModel } from '@anticrm/model-view'
import { createModel as workbenchModel } from '@anticrm/model-workbench'
import { readFileSync } from 'fs'
import { join } from 'path'
const builder = new Builder()
@ -68,11 +70,14 @@ const builders = [
for (const b of builders) {
b(builder)
}
const packageFile = readFileSync(join(__dirname, '..', 'package.json')).toString()
const json = JSON.parse(packageFile)
const packageVersion = json.version.split('.')
export const version: Data<Version> = {
major: 0,
minor: 6,
patch: 0
major: parseInt(packageVersion[0]),
minor: parseInt(packageVersion[1]),
patch: parseInt(packageVersion[2])
}
builder.createDoc(core.class.Version, core.space.Model, version, core.version.Model)