mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
Fix model version approach (#4413)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// Copyright © 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { exec } from 'child_process'
|
||||
import { writeFileSync } from 'fs'
|
||||
import currentVersion from './version.json'
|
||||
|
||||
exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
|
||||
if (err !== null) {
|
||||
console.log('Error', err)
|
||||
process.exit(1)
|
||||
}
|
||||
const rawVersion = stdout.trim().replace('v', '').split('.')
|
||||
if (rawVersion.length === 3) {
|
||||
const version = {
|
||||
major: parseInt(rawVersion[0]),
|
||||
minor: parseInt(rawVersion[1]),
|
||||
patch: parseInt(rawVersion[2])
|
||||
}
|
||||
const newVersion = JSON.stringify(version)
|
||||
if (JSON.stringify(currentVersion) !== newVersion) {
|
||||
console.log('Bumping version from', currentVersion, 'to', version)
|
||||
writeFileSync('./src/version.json', newVersion)
|
||||
} else {
|
||||
console.log('same version already')
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,23 +0,0 @@
|
||||
//
|
||||
// Copyright © 2020 Anticrm Platform Contributors.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import builder from '.'
|
||||
// import { writeFileSync } from 'fs'
|
||||
|
||||
const content = JSON.stringify(builder().getTxes(), undefined, 2)
|
||||
console.log(content)
|
||||
// writeFileSync('../../dev/storage/src/model.tx.json', content)
|
||||
// writeFileSync('../../server/workspace/src/model.tx.json', content)
|
||||
// writeFileSync('../../dev/tool/src/model.tx.json', content)
|
||||
@@ -1,17 +0,0 @@
|
||||
//
|
||||
// Copyright © 2020 Anticrm Platform Contributors.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import version from './version.json'
|
||||
console.log(`"${version.major}.${version.minor}.${version.patch}"`)
|
||||
+15
-6
@@ -14,7 +14,6 @@
|
||||
//
|
||||
|
||||
import core, { coreId, type Data, type PluginConfiguration, type Ref, type Tx, type Version } from '@hcengineering/core'
|
||||
import jsonVersion from './version.json'
|
||||
|
||||
import { Builder } from '@hcengineering/model'
|
||||
import { activityId, createModel as activityModel } from '@hcengineering/model-activity'
|
||||
@@ -34,6 +33,7 @@ import { preferenceId, createModel as preferenceModel } from '@hcengineering/mod
|
||||
import presentation, { presentationId, createModel as presentationModel } from '@hcengineering/model-presentation'
|
||||
import recruit, { recruitId, createModel as recruitModel } from '@hcengineering/model-recruit'
|
||||
import { requestId, createModel as requestModel } from '@hcengineering/model-request'
|
||||
import { serverActivityId, createModel as serverActivityModel } from '@hcengineering/model-server-activity'
|
||||
import { serverAttachmentId, createModel as serverAttachmentModel } from '@hcengineering/model-server-attachment'
|
||||
import { serverCalendarId, createModel as serverCalendarModel } from '@hcengineering/model-server-calendar'
|
||||
import { serverChunterId, createModel as serverChunterModel } from '@hcengineering/model-server-chunter'
|
||||
@@ -46,13 +46,12 @@ import { serverLeadId, createModel as serverLeadModel } from '@hcengineering/mod
|
||||
import { serverNotificationId, createModel as serverNotificationModel } from '@hcengineering/model-server-notification'
|
||||
import { serverRecruitId, createModel as serverRecruitModel } from '@hcengineering/model-server-recruit'
|
||||
import { serverRequestId, createModel as serverRequestModel } from '@hcengineering/model-server-request'
|
||||
import { serverSettingId, createModel as serveSettingModel } from '@hcengineering/model-server-setting'
|
||||
import { createModel as serveSettingModel, serverSettingId } from '@hcengineering/model-server-setting'
|
||||
import { serverTagsId, createModel as serverTagsModel } from '@hcengineering/model-server-tags'
|
||||
import { serverTaskId, createModel as serverTaskModel } from '@hcengineering/model-server-task'
|
||||
import { serverTelegramId, createModel as serverTelegramModel } from '@hcengineering/model-server-telegram'
|
||||
import { serverTrackerId, createModel as serverTrackerModel } from '@hcengineering/model-server-tracker'
|
||||
import { serverViewId, createModel as serverViewModel } from '@hcengineering/model-server-view'
|
||||
import { serverActivityId, createModel as serverActivityModel } from '@hcengineering/model-server-activity'
|
||||
import setting, { settingId, createModel as settingModel } from '@hcengineering/model-setting'
|
||||
import { supportId, createModel as supportModel } from '@hcengineering/model-support'
|
||||
import { tagsId, createModel as tagsModel } from '@hcengineering/model-tags'
|
||||
@@ -69,12 +68,22 @@ import { createModel as serverTranslate, translateId } from '@hcengineering/mode
|
||||
|
||||
import { type Plugin } from '@hcengineering/platform'
|
||||
|
||||
export const version: Data<Version> = jsonVersion as Data<Version>
|
||||
|
||||
interface ConfigurablePlugin extends Omit<Data<PluginConfiguration>, 'pluginId' | 'transactions'> {}
|
||||
|
||||
type BuilderConfig = [(b: Builder) => void, Plugin] | [(b: Builder) => void, Plugin, ConfigurablePlugin | undefined]
|
||||
|
||||
export function getModelVersion (): Data<Version> {
|
||||
const rawVersion = (process.env.MODEL_VERSION ?? '0.6.0').trim().replace('v', '').split('.')
|
||||
if (rawVersion.length === 3) {
|
||||
return {
|
||||
major: parseInt(rawVersion[0]),
|
||||
minor: parseInt(rawVersion[1]),
|
||||
patch: parseInt(rawVersion[2])
|
||||
}
|
||||
}
|
||||
return { major: 0, minor: 6, patch: 0 }
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @param enabled - a set of enabled plugins
|
||||
@@ -308,7 +317,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
|
||||
builder.onTx = undefined
|
||||
}
|
||||
|
||||
builder.createDoc(core.class.Version, core.space.Model, version, core.version.Model)
|
||||
builder.createDoc(core.class.Version, core.space.Model, getModelVersion(), core.version.Model)
|
||||
return builder
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{ "major": 0, "minor": 6, "patch": 144 }
|
||||
Reference in New Issue
Block a user