mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 13:47:26 +03:00
typescript to copy json files
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
a78f96ba7d
commit
13db52c104
@ -6,11 +6,8 @@
|
|||||||
"license": "EPL-2.0",
|
"license": "EPL-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "heft build",
|
"build": "heft build",
|
||||||
"build:docs": "api-extractor run --local",
|
"start": "node lib/index.js",
|
||||||
"test": "jest",
|
"lint:fix": "eslint --fix src"
|
||||||
"lint": "ts-standard src",
|
|
||||||
"lint:fix": "eslint --fix ./src",
|
|
||||||
"format": "prettier --write 'src/**/*.{ts*,js*,yml}' && ts-standard --fix src"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@anticrm/platform-rig":"~0.6.0",
|
"@anticrm/platform-rig":"~0.6.0",
|
||||||
|
@ -14,4 +14,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
export { start } from './server'
|
import { start } from './server'
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
start(3333)
|
||||||
|
@ -21,7 +21,7 @@ import { DevSession } from './session'
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export async function start (): Promise<void> {
|
export async function start (port: number, host?: string): Promise<void> {
|
||||||
const storage = await createStorage()
|
const storage = await createStorage()
|
||||||
startJsonRpc(server => new DevSession(server, storage), 3333)
|
startJsonRpc(server => new DevSession(server, storage), port, host)
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ import type {
|
|||||||
import { getResource } from '@anticrm/platform'
|
import { getResource } from '@anticrm/platform'
|
||||||
import core, { ModelDb, TxDb, Hierarchy, DOMAIN_TX, DefaultTxFactory } from '@anticrm/core'
|
import core, { ModelDb, TxDb, Hierarchy, DOMAIN_TX, DefaultTxFactory } from '@anticrm/core'
|
||||||
|
|
||||||
|
import * as txJson from './model.tx.json'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
@ -37,10 +39,6 @@ export interface ServerStorage {
|
|||||||
tx: (tx: Tx) => Promise<Tx[]>
|
tx: (tx: Tx) => Promise<Tx[]>
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getModel (): Promise<Tx[]> {
|
|
||||||
return import('./model.tx.json') as unknown as Tx[]
|
|
||||||
}
|
|
||||||
|
|
||||||
class DevStorage implements ServerStorage {
|
class DevStorage implements ServerStorage {
|
||||||
private readonly txFactory: DefaultTxFactory
|
private readonly txFactory: DefaultTxFactory
|
||||||
|
|
||||||
@ -91,8 +89,7 @@ class DevStorage implements ServerStorage {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export async function createStorage (): Promise<ServerStorage> {
|
export async function createStorage (): Promise<ServerStorage> {
|
||||||
const txes = await getModel()
|
const txes = txJson as unknown as Tx[]
|
||||||
|
|
||||||
const hierarchy = new Hierarchy()
|
const hierarchy = new Hierarchy()
|
||||||
for (const tx of txes) hierarchy.tx(tx)
|
for (const tx of txes) hierarchy.tx(tx)
|
||||||
|
|
||||||
|
@ -157,7 +157,6 @@ export class Hierarchy {
|
|||||||
this.attributes.set(_class, attributes)
|
this.attributes.set(_class, attributes)
|
||||||
}
|
}
|
||||||
attributes.set(attribute.name, attribute)
|
attributes.set(attribute.name, attribute)
|
||||||
console.log('added attribute:', _class, attribute.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttribute (_class: Ref<Class<Obj>>, name: string): AnyAttribute {
|
getAttribute (_class: Ref<Class<Obj>>, name: string): AnyAttribute {
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
/**
|
||||||
|
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/heft/typescript.schema.json",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be set to "copy" or "hardlink". If set to "copy", copy files from cache.
|
||||||
|
* If set to "hardlink", files will be hardlinked to the cache location.
|
||||||
|
* This option is useful when producing a tarball of build output as TAR files don't
|
||||||
|
* handle these hardlinks correctly. "hardlink" is the default behavior.
|
||||||
|
*/
|
||||||
|
// "copyFromCacheMode": "copy",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If provided, emit these module kinds in addition to the modules specified in the tsconfig.
|
||||||
|
* Note that this option only applies to the main tsconfig.json configuration.
|
||||||
|
*/
|
||||||
|
"additionalModuleKindsToEmit": [
|
||||||
|
// {
|
||||||
|
// /**
|
||||||
|
// * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext"
|
||||||
|
// */
|
||||||
|
// "moduleKind": "amd",
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * (Required) The name of the folder where the output will be written.
|
||||||
|
// */
|
||||||
|
// "outFolderName": "lib-amd"
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the intermediary folder that tests will use. Because Jest uses the
|
||||||
|
* Node.js runtime to execute tests, the module format must be CommonJS.
|
||||||
|
*
|
||||||
|
* The default value is "lib".
|
||||||
|
*/
|
||||||
|
// "emitFolderNameForTests": "lib-commonjs",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set to "true", the TSlint task will not be invoked.
|
||||||
|
*/
|
||||||
|
// "disableTslint": true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this to change the maximum number of file handles that will be opened concurrently for writing.
|
||||||
|
* The default is 50.
|
||||||
|
*/
|
||||||
|
// "maxWriteParallelism": 50,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes the way files should be statically coped from src to TS output folders
|
||||||
|
*/
|
||||||
|
"staticAssetsToCopy": {
|
||||||
|
/**
|
||||||
|
* File extensions that should be copied from the src folder to the destination folder(s).
|
||||||
|
*/
|
||||||
|
"fileExtensions": [".json"]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glob patterns that should be explicitly included.
|
||||||
|
*/
|
||||||
|
// "includeGlobs": [
|
||||||
|
// "some/path/*.js"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Glob patterns that should be explicitly excluded. This takes precedence over globs listed
|
||||||
|
* in "includeGlobs" and files that match the file extensions provided in "fileExtensions".
|
||||||
|
*/
|
||||||
|
// "excludeGlobs": [
|
||||||
|
// "some/path/*.css"
|
||||||
|
// ]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user