mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +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",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"build:docs": "api-extractor run --local",
|
||||
"test": "jest",
|
||||
"lint": "ts-standard src",
|
||||
"lint:fix": "eslint --fix ./src",
|
||||
"format": "prettier --write 'src/**/*.{ts*,js*,yml}' && ts-standard --fix src"
|
||||
"start": "node lib/index.js",
|
||||
"lint:fix": "eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/platform-rig":"~0.6.0",
|
||||
|
@ -14,4 +14,7 @@
|
||||
// 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
|
||||
*/
|
||||
export async function start (): Promise<void> {
|
||||
export async function start (port: number, host?: string): Promise<void> {
|
||||
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 core, { ModelDb, TxDb, Hierarchy, DOMAIN_TX, DefaultTxFactory } from '@anticrm/core'
|
||||
|
||||
import * as txJson from './model.tx.json'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
@ -37,10 +39,6 @@ export interface ServerStorage {
|
||||
tx: (tx: Tx) => Promise<Tx[]>
|
||||
}
|
||||
|
||||
async function getModel (): Promise<Tx[]> {
|
||||
return import('./model.tx.json') as unknown as Tx[]
|
||||
}
|
||||
|
||||
class DevStorage implements ServerStorage {
|
||||
private readonly txFactory: DefaultTxFactory
|
||||
|
||||
@ -91,8 +89,7 @@ class DevStorage implements ServerStorage {
|
||||
* @returns
|
||||
*/
|
||||
export async function createStorage (): Promise<ServerStorage> {
|
||||
const txes = await getModel()
|
||||
|
||||
const txes = txJson as unknown as Tx[]
|
||||
const hierarchy = new Hierarchy()
|
||||
for (const tx of txes) hierarchy.tx(tx)
|
||||
|
||||
|
@ -157,7 +157,6 @@ export class Hierarchy {
|
||||
this.attributes.set(_class, attributes)
|
||||
}
|
||||
attributes.set(attribute.name, attribute)
|
||||
console.log('added attribute:', _class, attribute.name)
|
||||
}
|
||||
|
||||
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