property-wize-types
v2.0.25
Published
Define data types for front end and backend
Downloads
1,566
Readme
Using property-wize-types Project's Type Definitions
The property-wize-types
project is a library for defining types for frontend and middleware projects. You can add new type files under the src/types
folder of the property-wize-types
project. After adding a new type file, run the npm run generate-index
command to generate the index.ts
file. Then, run npx tsc
command to compile the project.
In the other two projects, dependencies to the property-wize-types
project have been configured, and after compilation, you can use the newly added types in these two projects.
Steps
Add New Type Definitions: Add the new type file to the
src/types
folder of theproperty-wize-types
project.Generate
index.ts
File: Run the following command to generate theindex.ts
file:
npm run generate-index
- Compile the Project: Run the following command to compile the project:
npx tsc
- Use in Other Projects:
Dependencies to the
property-wize-types
project have already been configured in the other two projects. You can directly import and use the newly added types.
Example
Suppose you have added a new type file named NewType.ts
to the src/types
folder. Follow these steps:
- Define the new type in the
NewType.ts
file. - Run
npm run generate-index
to generate theindex.ts
file. - Run
npx tsc
to compile the project. - Import and use the
NewType
type in the other projects.
// Importing the newly added type in other projects
import { NewType } from 'property-wize-types';
Publish the property-wize-types
Project manually
After adding new type definitions and compiling the project, you can publish the property-wize-types
project to npm. Run the following command to publish the project:
./publish -v -p
This will update the version and publish the property-wize-types
project to npm with the version specified in the package.json
file.
Before you can do this, need to run npm login
on the commandline window to login to npm. This will redirect to the webpage, where you can enter your username and password. After logging in, you can run the publish
command to publish the project.
Publish the property-wize-types
Project automatically
Run the following script to update the version only.
./publish -v
Once the changes is pushed or merged into dev branch. Github workflow will automatically publish the package.