arena-split-core
v0.0.23-SNAPSHOT
Published
## Typescript application following Domain Driven Design principles
Downloads
6
Keywords
Readme
Arena Split Core
Typescript application following Domain Driven Design principles
Development
To start the project you need to have the following tools installed:
- Node.js v20
- NPM v10
- WebStorm or any other IDE that supports Typescript
- Git
Installation of the repository
Clone the repo
git clone [email protected]:carlosupreme/arena-split-core.git
Navigate to the
arena-split-core
foldercd arena-split-core
Inmediately after cloning the repository you need to move to the
develop
branchgit checkout develop
And create your own branch
git checkout -b my-new-feature
Install the dependencies
npm install
Run the tests
npm run test
Build the application to ensure everything is working fine
npm run build
Developing in the Core
Once you have the application running you can start developing in the core. The core is the main application that will be
used by other applications like the api
or the web
application.
When you are developing in the core application you need to follow these steps
Do Test Driven Development
please, write the test first and then write the code to make the test pass
Deployment
Suppose that you made a new feature (with tests).
You can deploy the core application to npm
and then other developers that are using the core will have your
changes.
Just run the following commands:
Obviously the tests should be passing before deploying, so ensure that
npm run test
If you added new classes or interfaces that should be exported, ensure that the corresponding index.ts
file is updated with the new exports
This index files has the following format:
Just the layer application and domain.
Starts with the bounded context name and -
and then the layer name (domain or application).
Let's say that you added a new Domain value object called UserName
to the friends
bounded context, you should update the friends-domain.ts
file
// friends-domain.ts before
export * from "./value-objects/Email";
export * from "./value-objects/FullName";
// friends-domain.ts after
export * from "./value-objects/Email";
export * from "./value-objects/FullName";
export * from "./value-objects/UserName"; // added
Then run the following command to build the application
npm run build
The successful output should look like this:
> [email protected] build
> tsup
CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v8.1.0
CLI Using tsup config: /home/carlos/programacion/arena-aplit/core/package.json
CLI Target: es2020
CLI Cleaning output folder
CJS Build start
ESM Build start
ESM dist/index.mjs 8.00 KB
ESM dist/index.mjs.map 17.60 KB
ESM ⚡️ Build success in 44ms
CJS dist/index.js 9.77 KB
CJS dist/index.js.map 17.83 KB
CJS ⚡️ Build success in 45ms
DTS Build start
DTS ⚡️ Build success in 1475ms
DTS dist/index.d.ts 5.64 KB
DTS dist/index.d.mts 5.64 KB
After that, change the package.json
version to a new version, following our versioning guide
.
package.json before
{
"version": "1.1.0"
}
package.json after
{
"version": "1.2.0"
}
And then publish it to npm
npm publish --tag latest
If everything goes well commit your branch and push it to the remote repository
git add . && git commit -m 'new feature' && git push origin my-new-feature
Finally open a pull request to the develop
branch and wait for the approval