https://github.com/openforge/ionic-monorepo-template
A template project for NRWL's NX, Ionic Framework, Stylelint, Eslint, and more from the OpenForge mobile app team.
https://github.com/openforge/ionic-monorepo-template
Last synced: 11 months ago
JSON representation
A template project for NRWL's NX, Ionic Framework, Stylelint, Eslint, and more from the OpenForge mobile app team.
- Host: GitHub
- URL: https://github.com/openforge/ionic-monorepo-template
- Owner: openforge
- License: gpl-3.0
- Created: 2022-02-04T21:24:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-05T13:35:31.000Z (over 1 year ago)
- Last Synced: 2024-08-05T15:35:09.494Z (over 1 year ago)
- Language: TypeScript
- Size: 6.75 MB
- Stars: 20
- Watchers: 2
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Official Website |
Opportunities |
Mobile Academy
Leading By Example.
# OpenForge Ionic Monorepo Example
This is a template project for all Ionic + Angular Monorepos.
It was generated using a combination of [Nx](https://nx.dev), Ionic [Thanks to Eric Jeker's Post on Ionic + Nrwl](https://medium.com/@eric.jeker/how-to-integrate-ionic-in-nrwl-nx-3493fcb7e85e), [StyleLint](https://stylelint.io/), and [ESLint](https://eslint.org/).
# Instructions
1. Clone the repository using 'Use template' (and don't forget to give us a Star / Follow on Github, please!)
2. Search + Replace all instances of 'example-app-e2e' with your app name (important to do this first)
3. Search + Replace all instances of 'example-app' with your app name
4. Change the folder names for example-app and example-app-e2e to what you named for steps #1 and #2
5. Search + Replace all instances of 'openforge-ionic-monorepo-example' with your project name
6. Search + Replace 'company-name' with your company name. This is the NX project scope that allows you to import libraries using @company-name
That's it for the renaming! Now to test...
7. npm install
8. npx nx run example-app:serve (where example-app is the name you replaced with above)
You should now load your example app!
# Important - Utilizing this Repo
Most of the commands to generate projects/capabilities/apps are default to NX, Ionic, or Angular (in that order), so we will NOT include their specific instructions since as the packages update so will the documentation.
With that said, there are some special things to keep in mind...
## Generating a Project - Additional Step
After any project is created by NX, we MUST add StyleLint
nx g nx-stylelint:configuration --project
## Generate an application
The normal NX command to generate an app is `nx g @nx/react:app my-app` ; however, there are some special steps to generate an Ionic App. These are defined well in [Eric Jeker's post here](https://medium.com/@eric.jeker/how-to-integrate-ionic-in-nrwl-nx-3493fcb7e85e)
When using Nx, you can create multiple applications and libraries in the same workspace.
# NX Original Instructions
## Further help
Visit the [Nx Documentation](https://nx.dev) to learn more.
## Generate a library
Run `nx g @nx/react:lib my-lib` to generate a library.
> You can also use any of the plugins above to generate libraries as well.
Libraries are shareable across libraries and applications. They can be imported from `@openforge-ionic-monorepo-example/mylib`.
## Development server
Run `npx nx run example-app:serve` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `nx g @nx/react:component my-component --project=my-app` to generate a new component.
## Build
Run `nx build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `nx test my-app` to execute the unit tests via [Jest](https://jestjs.io).
Run `nx affected:test` to execute the unit tests affected by a change.
## Running end-to-end tests
Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io).
Run `nx affected:e2e` to execute the end-to-end tests affected by a change.
## Understand your workspace
Run `nx dep-graph` to see a diagram of the dependencies of your projects.