This library provides a bunch of isomorphic modules and configurations to work as a foundation for another V4 libraries and contents many base classes and structures, such as queue, persistent key-value storage, subclasses to work with promises, etc.
// Register Prelude in the top level of your project
require('@v4fire/core');
const {watch} = require('@v4fire/core/lib/core/object/watch').default;
const {proxy} = watch({a: 1}, console.log);
proxy.a++;
Also, you can require modules by using import
.
// Register Prelude in the top level of your project
import '@v4fire/core';
import watch from '@v4fire/core/lib/core/object/watch/index.js';
const {proxy} = watch({a: 1}, console.log);
proxy.a++;
At first, you should install dependencies using npm
:
npm ci
After this you should compile a configuration for TypeScript:
npx gulp build:tsconfig
All build config files are placed within the config
folder. File names of config files are tied with a value of the NODE_ENV
environment variable.
Build scripts, such as Gulp or Webpack, are contained within the build
folder.
To build your project, you should run the following script:
npm run build
Before running tests, your project should be built. There are several scripts that run tests:
// runs tests that check typing
npm run test:typescript
// runs tests that check code quality
npm run test:eslint
// runs both previous tests
npm run test:linters
// runs unit tests
npm run test:jasmine
// runs all tests
npm test
During test development, it's convenient when the project is rebuilt automatically after changes in code. For this purpose, you can use the following script:
npm run dev
Then you can run tests that you are currently developing:
npx jasmine ./dist/server/path/to/*.spec.js