|
| 1 | + |
| 2 | +# typescript-mean-models |
| 3 | + |
| 4 | +The models of the Typescript MEAN(MongoDB-Express-Angular-Node) Stack Boilerplate. |
| 5 | + |
| 6 | +## Models |
| 7 | + |
| 8 | +Since both the backend and the frontend are using the same data-structure, the data-models are stored and maintained independently. |
| 9 | + |
| 10 | +In order to write new models, add a new `my-model.model.ts` file and export it in `index.d.ts`. Once you're done, you can `npm version patch` (or `yarn version`) and then `npm publish` (or `yarn publish`). Like this, the models are retrievable by `npm` (or, `yarn`) in the `backend-` and `frontend-`projects, in order for them to be truly separated into their own git repos. |
| 11 | + |
| 12 | + |
| 13 | +Step 1. Updates the package version. |
| 14 | + <https://yarnpkg.com/en/docs/cli/version> |
| 15 | +```bash |
| 16 | +// question New Version: |
| 17 | +$ yarn version |
| 18 | +``` |
| 19 | +> ```js |
| 20 | +> info Current version: 0.0.1 |
| 21 | +> question New version: 0.1.0 |
| 22 | +> info New version: 0.1.0 |
| 23 | +> Done in 9.42s. |
| 24 | +> ``` |
| 25 | +
|
| 26 | +Step 2-A. Publishes a package to the `npm` registry. |
| 27 | + <https://yarnpkg.com/en/docs/cli/publish> |
| 28 | +```bash |
| 29 | +$ yarn publish |
| 30 | +``` |
| 31 | +> Publishes the package defined by the `package.json` in the current directory. |
| 32 | +
|
| 33 | + |
| 34 | +Step 2-B. Publishes a package to the `github` repository. |
| 35 | + |
| 36 | +(1). [Create a new repository](https://help.github.com/articles/creating-a-new-repository/) on GitHub. |
| 37 | + |
| 38 | + To avoid errors, do not initialize the new repository with `README`, `license`, or `gitignore` files. |
| 39 | +``` |
| 40 | +Repository name: typescript-mean-models |
| 41 | +``` |
| 42 | + |
| 43 | +(2). Open Terminal and change the current working directory to your local project. |
| 44 | +Then process git commands: |
| 45 | + |
| 46 | +> Show the working tree status: |
| 47 | +
|
| 48 | +```bash |
| 49 | +$ git status |
| 50 | +``` |
| 51 | + |
| 52 | +> If you haven’t initialised a Git repository in the project directory, |
| 53 | +> use the below command to initialise the local directory as Git repository: |
| 54 | +
|
| 55 | +```bash |
| 56 | +$ git init |
| 57 | +``` |
| 58 | + |
| 59 | +> Push the local repository to `Github` site: |
| 60 | +
|
| 61 | +```bash |
| 62 | +$ git add . |
| 63 | +$ git commit -m "first commit" |
| 64 | +$ git remote add origin https://github.com/CodebitsDesign/typescript-mean-models.git |
| 65 | +$ git push -u origin master |
| 66 | +``` |
| 67 | +> > and you can simply use the command `git push` next time. |
| 68 | +
|
0 commit comments