mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Fix model version approach (#4413)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
28dca6632c
commit
261cd3b4df
16
.github/workflows/main.yml
vendored
16
.github/workflows/main.yml
vendored
@ -66,8 +66,8 @@ jobs:
|
|||||||
- name: Installing...
|
- name: Installing...
|
||||||
run: node common/scripts/install-run-rush.js install
|
run: node common/scripts/install-run-rush.js install
|
||||||
|
|
||||||
- name: Setting model version from git release...
|
- name: Model version from git tags
|
||||||
run: node common/scripts/install-run-rush.js bump-model-version
|
run: node common/scripts/install-run-rush.js model-version
|
||||||
|
|
||||||
- name: Building...
|
- name: Building...
|
||||||
run: node common/scripts/install-run-rush.js build
|
run: node common/scripts/install-run-rush.js build
|
||||||
@ -258,6 +258,18 @@ jobs:
|
|||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
||||||
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Installing...
|
||||||
|
run: node common/scripts/install-run-rush.js install
|
||||||
|
|
||||||
|
- name: Model version from git tags
|
||||||
|
run: node common/scripts/install-run-rush.js model-version
|
||||||
|
|
||||||
|
- name: Building...
|
||||||
|
run: node common/scripts/install-run-rush.js build
|
||||||
|
|
||||||
|
- name: Print model version
|
||||||
|
run: node common/scripts/install-run-rush.js model-version
|
||||||
|
|
||||||
- name: Bundle
|
- name: Bundle
|
||||||
run: node common/scripts/install-run-rush.js bundle
|
run: node common/scripts/install-run-rush.js bundle
|
||||||
- name: Docker build
|
- name: Docker build
|
||||||
|
@ -303,15 +303,7 @@
|
|||||||
"summary": "show model version",
|
"summary": "show model version",
|
||||||
"description": "show model version",
|
"description": "show model version",
|
||||||
"safeForSimultaneousRushProcesses": true,
|
"safeForSimultaneousRushProcesses": true,
|
||||||
"shellCommand": "cd ./models/all/ && npx ts-node ./src/__showversion.ts"
|
"shellCommand": "npx node ./common/scripts/show_version.js"
|
||||||
},
|
|
||||||
{
|
|
||||||
"commandKind": "global",
|
|
||||||
"name": "bump-model-version",
|
|
||||||
"summary": "set model version from git + patch +1",
|
|
||||||
"description": "set current model version",
|
|
||||||
"safeForSimultaneousRushProcesses": true,
|
|
||||||
"shellCommand": "cd ./models/all/ && npx ts-node ./src/__bumpversion.ts"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"commandKind": "global",
|
"commandKind": "global",
|
||||||
|
@ -97,7 +97,7 @@ dependencies:
|
|||||||
version: file:projects/collaborator.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5)
|
version: file:projects/collaborator.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5)
|
||||||
'@rush-temp/collaborator-client':
|
'@rush-temp/collaborator-client':
|
||||||
specifier: file:./projects/collaborator-client.tgz
|
specifier: file:./projects/collaborator-client.tgz
|
||||||
version: file:projects/collaborator-client.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5)
|
version: file:projects/collaborator-client.tgz(svelte@4.2.5)(ts-node@10.9.1)
|
||||||
'@rush-temp/contact':
|
'@rush-temp/contact':
|
||||||
specifier: file:./projects/contact.tgz
|
specifier: file:./projects/contact.tgz
|
||||||
version: file:projects/contact.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1)
|
version: file:projects/contact.tgz(@types/node@16.11.68)(esbuild@0.16.17)(svelte@4.2.5)(ts-node@10.9.1)
|
||||||
@ -18166,28 +18166,16 @@ packages:
|
|||||||
- ts-node
|
- ts-node
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/collaborator-client.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5):
|
file:projects/collaborator-client.tgz(svelte@4.2.5)(ts-node@10.9.1):
|
||||||
resolution: {integrity: sha512-Y2u0DCP4rKKaMr/xXErbICh/BhNLqPCEf4G/IQO2zffTM0uzMB0Iep4nitc2JQ/jbrpcH17mvIgKULdjZzUJng==, tarball: file:projects/collaborator-client.tgz}
|
resolution: {integrity: sha512-GmFWK9622Fi4YG2ICnCrvLaE6un6N12CHzLViYJiN9o7oLS9fyzzdihncVC/FUBVPu1ON/Vab7PKmZMen+vWFQ==, tarball: file:projects/collaborator-client.tgz}
|
||||||
id: file:projects/collaborator-client.tgz
|
id: file:projects/collaborator-client.tgz
|
||||||
name: '@rush-temp/collaborator-client'
|
name: '@rush-temp/collaborator-client'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
'@hocuspocus/server': 2.9.0(bufferutil@4.0.7)(yjs@13.6.8)
|
|
||||||
'@hocuspocus/transformer': 2.9.0(@tiptap/pm@2.1.12)(y-prosemirror@1.2.1)(yjs@13.6.8)
|
|
||||||
'@tiptap/core': 2.1.12(@tiptap/pm@2.1.12)
|
|
||||||
'@tiptap/html': 2.1.12(@tiptap/core@2.1.12)(@tiptap/pm@2.1.12)
|
|
||||||
'@types/body-parser': 1.19.3
|
|
||||||
'@types/compression': 1.7.3
|
|
||||||
'@types/cors': 2.8.14
|
|
||||||
'@types/express': 4.17.18
|
|
||||||
'@types/jest': 29.5.5
|
'@types/jest': 29.5.5
|
||||||
'@types/node': 16.11.68
|
'@types/node': 16.11.68
|
||||||
'@types/ws': 8.5.6
|
|
||||||
'@typescript-eslint/eslint-plugin': 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.54.0)(typescript@5.2.2)
|
'@typescript-eslint/eslint-plugin': 6.11.0(@typescript-eslint/parser@6.11.0)(eslint@8.54.0)(typescript@5.2.2)
|
||||||
'@typescript-eslint/parser': 6.11.0(eslint@8.54.0)(typescript@5.2.2)
|
'@typescript-eslint/parser': 6.11.0(eslint@8.54.0)(typescript@5.2.2)
|
||||||
body-parser: 1.19.2
|
|
||||||
compression: 1.7.4
|
|
||||||
cors: 2.8.5
|
|
||||||
cross-env: 7.0.3
|
cross-env: 7.0.3
|
||||||
esbuild: 0.16.17
|
esbuild: 0.16.17
|
||||||
eslint: 8.54.0
|
eslint: 8.54.0
|
||||||
@ -18195,39 +18183,24 @@ packages:
|
|||||||
eslint-plugin-import: 2.28.1(eslint@8.54.0)
|
eslint-plugin-import: 2.28.1(eslint@8.54.0)
|
||||||
eslint-plugin-n: 15.7.0(eslint@8.54.0)
|
eslint-plugin-n: 15.7.0(eslint@8.54.0)
|
||||||
eslint-plugin-promise: 6.1.1(eslint@8.54.0)
|
eslint-plugin-promise: 6.1.1(eslint@8.54.0)
|
||||||
express: 4.18.2
|
|
||||||
jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1)
|
jest: 29.7.0(@types/node@16.11.68)(ts-node@10.9.1)
|
||||||
mongodb: 4.17.1
|
|
||||||
prettier: 3.1.0
|
prettier: 3.1.0
|
||||||
prettier-plugin-svelte: 3.1.0(prettier@3.1.0)(svelte@4.2.5)
|
prettier-plugin-svelte: 3.1.0(prettier@3.1.0)(svelte@4.2.5)
|
||||||
ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2)
|
ts-jest: 29.1.1(esbuild@0.16.17)(jest@29.7.0)(typescript@5.2.2)
|
||||||
ts-node: 10.9.1(@types/node@16.11.68)(typescript@5.2.2)
|
|
||||||
typescript: 5.2.2
|
typescript: 5.2.2
|
||||||
ws: 8.14.2(bufferutil@4.0.7)
|
|
||||||
y-prosemirror: 1.2.1(prosemirror-model@1.19.3)(yjs@13.6.8)
|
|
||||||
yjs: 13.6.8
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@babel/core'
|
- '@babel/core'
|
||||||
- '@jest/types'
|
- '@jest/types'
|
||||||
- '@swc/core'
|
|
||||||
- '@swc/wasm'
|
|
||||||
- '@tiptap/pm'
|
|
||||||
- aws-crt
|
|
||||||
- babel-jest
|
- babel-jest
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
- bufferutil
|
|
||||||
- node-notifier
|
- node-notifier
|
||||||
- prosemirror-model
|
|
||||||
- prosemirror-state
|
|
||||||
- prosemirror-view
|
|
||||||
- supports-color
|
- supports-color
|
||||||
- svelte
|
- svelte
|
||||||
- utf-8-validate
|
- ts-node
|
||||||
- y-protocols
|
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/collaborator.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5):
|
file:projects/collaborator.tgz(@tiptap/pm@2.1.12)(bufferutil@4.0.7)(prosemirror-model@1.19.3)(svelte@4.2.5):
|
||||||
resolution: {integrity: sha512-3i/AaU2M+nAeTR6IvfoGu0Wv586kiA3g2lBd+yIujeJ8hD1ZZxaF6rbfJ7YD8E/BwOkBuFUoz5XVYKSTrszH4w==, tarball: file:projects/collaborator.tgz}
|
resolution: {integrity: sha512-DF7F2NpWmslkwkGxwZ8nDLPvzRuK3nDEibOqhvTVyrikrfoaa6pwuSVfWP4W5fAUEBNGLssmHPn+ycCJjImFgQ==, tarball: file:projects/collaborator.tgz}
|
||||||
id: file:projects/collaborator.tgz
|
id: file:projects/collaborator.tgz
|
||||||
name: '@rush-temp/collaborator'
|
name: '@rush-temp/collaborator'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
@ -21152,7 +21125,7 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/presentation.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1):
|
file:projects/presentation.tgz(@types/node@16.11.68)(esbuild@0.16.17)(postcss-load-config@4.0.1)(postcss@8.4.31)(ts-node@10.9.1):
|
||||||
resolution: {integrity: sha512-7305Y8JSskN+8NyIXiggwQKSAO9h59z3dM2ZbM1Dmr5xETAU3h12rQm2YhR2DnshPpOuc9FV1JCNXMLctWrMuQ==, tarball: file:projects/presentation.tgz}
|
resolution: {integrity: sha512-h+mThVeZ7IO2sPO2XCzF3WMEkXtvOYD+wK41cdAh5QRnc8f2x9TJuUVFBZHwx7vBE9QJR+6t//xpuhHbUf6opg==, tarball: file:projects/presentation.tgz}
|
||||||
id: file:projects/presentation.tgz
|
id: file:projects/presentation.tgz
|
||||||
name: '@rush-temp/presentation'
|
name: '@rush-temp/presentation'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// Copyright © 2022 Hardcore Engineering Inc.
|
// Copyright © 2024 Hardcore Engineering Inc.
|
||||||
//
|
//
|
||||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
// 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
|
// you may not use this file except in compliance with the License. You may
|
||||||
@ -13,14 +13,11 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { exec } from 'child_process'
|
const exec = require('child_process').exec
|
||||||
import { writeFileSync } from 'fs'
|
|
||||||
import currentVersion from './version.json'
|
|
||||||
|
|
||||||
exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
|
exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
|
||||||
if (err !== null) {
|
if (err !== null) {
|
||||||
console.log('Error', err)
|
console.log('"0.6.0"')
|
||||||
process.exit(1)
|
|
||||||
}
|
}
|
||||||
const rawVersion = stdout.trim().replace('v', '').split('.')
|
const rawVersion = stdout.trim().replace('v', '').split('.')
|
||||||
if (rawVersion.length === 3) {
|
if (rawVersion.length === 3) {
|
||||||
@ -29,12 +26,6 @@ exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
|
|||||||
minor: parseInt(rawVersion[1]),
|
minor: parseInt(rawVersion[1]),
|
||||||
patch: parseInt(rawVersion[2])
|
patch: parseInt(rawVersion[2])
|
||||||
}
|
}
|
||||||
const newVersion = JSON.stringify(version)
|
console.log(`"${version.major}.${version.minor}.${version.patch}"`)
|
||||||
if (JSON.stringify(currentVersion) !== newVersion) {
|
|
||||||
console.log('Bumping version from', currentVersion, 'to', version)
|
|
||||||
writeFileSync('./src/version.json', newVersion)
|
|
||||||
} else {
|
|
||||||
console.log('same version already')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -9,12 +9,12 @@
|
|||||||
"build:watch": "tsc",
|
"build:watch": "tsc",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"start": "ts-node src/__start.ts",
|
"start": "ts-node src/__start.ts",
|
||||||
"bundle": "esbuild src/__start.ts --bundle --minify --platform=node --define:process.env.MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle.js",
|
"bundle": "esbuild src/__start.ts --bundle --minify --platform=node --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle.js",
|
||||||
"docker:build": "docker build -t hardcoreeng/tool .",
|
"docker:build": "docker build -t hardcoreeng/tool .",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging",
|
||||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
|
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool",
|
||||||
"run-local": "cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) GIT_REVISION=$(git describe --all --long) node -r ts-node/register --max-old-space-size=18000 ./src/__start.ts",
|
"run-local": "cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node -r ts-node/register --max-old-space-size=18000 ./src/__start.ts",
|
||||||
"run": "cross-env node -r ts-node/register --max-old-space-size=8000 ./src/__start.ts",
|
"run": "cross-env node -r ts-node/register --max-old-space-size=8000 MODEL_VERSION=$(node ../../common/scripts/show_version.js) ./src/__start.ts",
|
||||||
"upgrade": "rushx run-local upgrade",
|
"upgrade": "rushx run-local upgrade",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"format": "format src",
|
"format": "format src",
|
||||||
|
@ -18,7 +18,7 @@ import { prepareTools as prepareToolsRaw } from '@hcengineering/server-tool'
|
|||||||
import { Data, Tx, Version } from '@hcengineering/core'
|
import { Data, Tx, Version } from '@hcengineering/core'
|
||||||
import { MinioService } from '@hcengineering/minio'
|
import { MinioService } from '@hcengineering/minio'
|
||||||
import { MigrateOperation } from '@hcengineering/model'
|
import { MigrateOperation } from '@hcengineering/model'
|
||||||
import builder, { migrateOperations, version } from '@hcengineering/model-all'
|
import builder, { migrateOperations, getModelVersion } from '@hcengineering/model-all'
|
||||||
import { devTool } from '.'
|
import { devTool } from '.'
|
||||||
|
|
||||||
import { addLocation } from '@hcengineering/platform'
|
import { addLocation } from '@hcengineering/platform'
|
||||||
@ -69,7 +69,7 @@ function prepareTools (): {
|
|||||||
} {
|
} {
|
||||||
const enabled = (process.env.MODEL_ENABLED ?? '*').split(',').map((it) => it.trim())
|
const enabled = (process.env.MODEL_ENABLED ?? '*').split(',').map((it) => it.trim())
|
||||||
const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.trim())
|
const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.trim())
|
||||||
return { ...prepareToolsRaw(builder(enabled, disabled).getTxes()), version, migrateOperations }
|
return { ...prepareToolsRaw(builder(enabled, disabled).getTxes()), version: getModelVersion(), migrateOperations }
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`tools git_version: ${process.env.GIT_REVISION ?? ''} model_version: ${process.env.MODEL_VERSION ?? ''}`)
|
console.log(`tools git_version: ${process.env.GIT_REVISION ?? ''} model_version: ${process.env.MODEL_VERSION ?? ''}`)
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:watch": "tsc",
|
"build:watch": "tsc",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"genmodel": "ts-node src/__genmodel.ts",
|
|
||||||
"version": "ts-node src/__showversion.ts",
|
|
||||||
"bumpversion": "ts-node src/__bumpversion.ts",
|
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"format": "format src"
|
"format": "format src"
|
||||||
},
|
},
|
||||||
|
@ -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}"`)
|
|
@ -14,7 +14,6 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import core, { coreId, type Data, type PluginConfiguration, type Ref, type Tx, type Version } from '@hcengineering/core'
|
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 { Builder } from '@hcengineering/model'
|
||||||
import { activityId, createModel as activityModel } from '@hcengineering/model-activity'
|
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 presentation, { presentationId, createModel as presentationModel } from '@hcengineering/model-presentation'
|
||||||
import recruit, { recruitId, createModel as recruitModel } from '@hcengineering/model-recruit'
|
import recruit, { recruitId, createModel as recruitModel } from '@hcengineering/model-recruit'
|
||||||
import { requestId, createModel as requestModel } from '@hcengineering/model-request'
|
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 { serverAttachmentId, createModel as serverAttachmentModel } from '@hcengineering/model-server-attachment'
|
||||||
import { serverCalendarId, createModel as serverCalendarModel } from '@hcengineering/model-server-calendar'
|
import { serverCalendarId, createModel as serverCalendarModel } from '@hcengineering/model-server-calendar'
|
||||||
import { serverChunterId, createModel as serverChunterModel } from '@hcengineering/model-server-chunter'
|
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 { serverNotificationId, createModel as serverNotificationModel } from '@hcengineering/model-server-notification'
|
||||||
import { serverRecruitId, createModel as serverRecruitModel } from '@hcengineering/model-server-recruit'
|
import { serverRecruitId, createModel as serverRecruitModel } from '@hcengineering/model-server-recruit'
|
||||||
import { serverRequestId, createModel as serverRequestModel } from '@hcengineering/model-server-request'
|
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 { serverTagsId, createModel as serverTagsModel } from '@hcengineering/model-server-tags'
|
||||||
import { serverTaskId, createModel as serverTaskModel } from '@hcengineering/model-server-task'
|
import { serverTaskId, createModel as serverTaskModel } from '@hcengineering/model-server-task'
|
||||||
import { serverTelegramId, createModel as serverTelegramModel } from '@hcengineering/model-server-telegram'
|
import { serverTelegramId, createModel as serverTelegramModel } from '@hcengineering/model-server-telegram'
|
||||||
import { serverTrackerId, createModel as serverTrackerModel } from '@hcengineering/model-server-tracker'
|
import { serverTrackerId, createModel as serverTrackerModel } from '@hcengineering/model-server-tracker'
|
||||||
import { serverViewId, createModel as serverViewModel } from '@hcengineering/model-server-view'
|
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 setting, { settingId, createModel as settingModel } from '@hcengineering/model-setting'
|
||||||
import { supportId, createModel as supportModel } from '@hcengineering/model-support'
|
import { supportId, createModel as supportModel } from '@hcengineering/model-support'
|
||||||
import { tagsId, createModel as tagsModel } from '@hcengineering/model-tags'
|
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'
|
import { type Plugin } from '@hcengineering/platform'
|
||||||
|
|
||||||
export const version: Data<Version> = jsonVersion as Data<Version>
|
|
||||||
|
|
||||||
interface ConfigurablePlugin extends Omit<Data<PluginConfiguration>, 'pluginId' | 'transactions'> {}
|
interface ConfigurablePlugin extends Omit<Data<PluginConfiguration>, 'pluginId' | 'transactions'> {}
|
||||||
|
|
||||||
type BuilderConfig = [(b: Builder) => void, Plugin] | [(b: Builder) => void, Plugin, ConfigurablePlugin | undefined]
|
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
|
* @public
|
||||||
* @param enabled - a set of enabled plugins
|
* @param enabled - a set of enabled plugins
|
||||||
@ -308,7 +317,7 @@ export default function buildModel (enabled: string[] = ['*'], disabled: string[
|
|||||||
builder.onTx = undefined
|
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
|
return builder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{ "major": 0, "minor": 6, "patch": 144 }
|
|
@ -9,7 +9,7 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:watch": "tsc",
|
"build:watch": "tsc",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"bundle": "esbuild src/__start.ts --bundle --minify --platform=node > bundle.js",
|
"bundle": "esbuild src/__start.ts --bundle --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --minify --platform=node > bundle.js",
|
||||||
"docker:build": "docker build -t hardcoreeng/account .",
|
"docker:build": "docker build -t hardcoreeng/account .",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/account staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/account staging",
|
||||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/account",
|
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/account",
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
import { getMethods } from '@hcengineering/account'
|
import { getMethods } from '@hcengineering/account'
|
||||||
import { Tx } from '@hcengineering/core'
|
import { Tx } from '@hcengineering/core'
|
||||||
import builder, { migrateOperations, version } from '@hcengineering/model-all'
|
import builder, { migrateOperations, getModelVersion } from '@hcengineering/model-all'
|
||||||
import { serveAccount } from '.'
|
import { serveAccount } from '.'
|
||||||
|
|
||||||
const enabled = (process.env.MODEL_ENABLED ?? '*').split(',').map((it) => it.trim())
|
const enabled = (process.env.MODEL_ENABLED ?? '*').split(',').map((it) => it.trim())
|
||||||
@ -23,4 +23,4 @@ const disabled = (process.env.MODEL_DISABLED ?? '').split(',').map((it) => it.tr
|
|||||||
|
|
||||||
const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[]
|
const txes = JSON.parse(JSON.stringify(builder(enabled, disabled).getTxes())) as Tx[]
|
||||||
|
|
||||||
serveAccount(getMethods(version, txes, migrateOperations))
|
serveAccount(getMethods(getModelVersion(), txes, migrateOperations))
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:watch": "tsc",
|
"build:watch": "tsc",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"bundle": "esbuild src/__start.ts --define:process.env.MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) --bundle --minify --platform=node --external:sharp > bundle.js & rm -rf ./dist && cp -r ../../dev/prod/dist . && cp -r ../../dev/prod/public/* ./dist/ && rm ./dist/config.json",
|
"bundle": "esbuild src/__start.ts --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --bundle --minify --platform=node --external:sharp > bundle.js & rm -rf ./dist && cp -r ../../dev/prod/dist . && cp -r ../../dev/prod/public/* ./dist/ && rm ./dist/config.json",
|
||||||
"docker:build": "docker build -t hardcoreeng/front .",
|
"docker:build": "docker build -t hardcoreeng/front .",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/front staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/front staging",
|
||||||
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/front",
|
"docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/front",
|
||||||
"docker:tbuild": "docker build -t hardcoreeng/front . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/front",
|
"docker:tbuild": "docker build -t hardcoreeng/front . --platform=linux/amd64 && ../../common/scripts/docker_tag_push.sh hardcoreeng/front",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"format": "format src",
|
"format": "format src",
|
||||||
"run-local": "cross-env MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost TRANSACTOR_URL=ws://localhost:3333 SERVER_SECRET='secret' ACCOUNTS_URL=http://localhost:3000 UPLOAD_URL=/files ELASTIC_URL=http://localhost:9200 MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) PUBLIC_DIR='.' ts-node ./src/__start.ts",
|
"run-local": "cross-env MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost TRANSACTOR_URL=ws://localhost:3333 SERVER_SECRET='secret' ACCOUNTS_URL=http://localhost:3000 UPLOAD_URL=/files ELASTIC_URL=http://localhost:9200 MODEL_VERSION=$(node ../../common/scripts/show_version.js) PUBLIC_DIR='.' ts-node ./src/__start.ts",
|
||||||
"test": "jest --passWithNoTests --silent"
|
"test": "jest --passWithNoTests --silent"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
"author": "Anticrm Platform Contributors",
|
"author": "Anticrm Platform Contributors",
|
||||||
"license": "EPL-2.0",
|
"license": "EPL-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env MONGO_URL=mongodb://localhost:27017 ELASTIC_URL=http://localhost:9200 MINIO_ENDPOINT=localhost MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin METRICS_CONSOLE=false SERVER_SECRET=secret REKONI_URL=http://localhost:4004 FRONT_URL=http://localhost:8080 MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) GIT_REVISION=$(git describe --all --long) node --nolazy -r ts-node/register src/__start.ts",
|
"start": "cross-env MONGO_URL=mongodb://localhost:27017 ELASTIC_URL=http://localhost:9200 MINIO_ENDPOINT=localhost MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin METRICS_CONSOLE=false SERVER_SECRET=secret REKONI_URL=http://localhost:4004 FRONT_URL=http://localhost:8080 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --nolazy -r ts-node/register src/__start.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"bundle": "esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node --external:bufferutil --define:process.env.MODEL_VERSION=$(node ../../models/all/lib/__showversion.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle.js",
|
"bundle": "esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node --external:bufferutil --define:process.env.MODEL_VERSION=$(node ../../common/scripts/show_version.js) --define:process.env.GIT_REVISION=$(../../common/scripts/git_version.sh) > bundle.js",
|
||||||
"bundle:u": "esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node > bundle.js && mkdir -p ./dist && cp -r ./node_modules/uWebSockets.js/*.node ./dist",
|
"bundle:u": "esbuild src/__start.ts --bundle --sourcemap=inline --minify --platform=node > bundle.js && mkdir -p ./dist && cp -r ./node_modules/uWebSockets.js/*.node ./dist",
|
||||||
"docker:build": "docker build -t hardcoreeng/transactor .",
|
"docker:build": "docker build -t hardcoreeng/transactor .",
|
||||||
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/transactor staging",
|
"docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/transactor staging",
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import builder, { migrateOperations, version } from '@hcengineering/model-all'
|
import builder, { migrateOperations, getModelVersion } from '@hcengineering/model-all'
|
||||||
import { randomBytes } from 'crypto'
|
import { randomBytes } from 'crypto'
|
||||||
import { Db, MongoClient } from 'mongodb'
|
import { Db, MongoClient } from 'mongodb'
|
||||||
import accountPlugin, { getAccount, getMethods, getWorkspace } from '..'
|
import accountPlugin, { getAccount, getMethods, getWorkspace } from '..'
|
||||||
@ -22,7 +22,7 @@ import { setMetadata } from '@hcengineering/platform'
|
|||||||
|
|
||||||
const DB_NAME = 'test_accounts'
|
const DB_NAME = 'test_accounts'
|
||||||
|
|
||||||
const methods = getMethods(version, builder().getTxes(), migrateOperations)
|
const methods = getMethods(getModelVersion(), builder().getTxes(), migrateOperations)
|
||||||
|
|
||||||
describe('server', () => {
|
describe('server', () => {
|
||||||
const dbUri = process.env.MONGO_URL ?? 'mongodb://localhost:27017'
|
const dbUri = process.env.MONGO_URL ?? 'mongodb://localhost:27017'
|
||||||
|
Loading…
Reference in New Issue
Block a user