This is a template project for all you aspiring video game developers out there! Want to use your web application skills for creating an awesome video game?
This repository will give you a great starting point!
- Clone the repository using 'Use template' (and don't forget to give us a Star / Follow on Github, please!)
- Select which framework from 'apps/' folder you are going to use and remove the others if necessary.
- Search + Replace all instances of 'example-app-"frameworkName"-e2e' with your app name (important to do this first)
- Search + Replace all instances of 'example-app-"frameworkName"' with your app name
- Change the folder names for example-app-frameworkName and example-app-frameworkName-e2e to what you named for steps #1 and #2
- Search + Replace all instances of 'openforge-ionic-monorepo-example' with your project name
- 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...
npm install
npx nx run example-app-angular:serve
(where example-app-angular is the name you replaced with above)
You should now load your example app!
To run the license checker, use
npx license-checker --summary
or vanilla npx license-checker
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...
After any project is created by NX, we MUST add StyleLint
nx g nx-stylelint:configuration --project
The normal NX command to generate an app is nx g @nrwl/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
When using Nx, you can create multiple applications and libraries in the same workspace.
Since Nx doesn't officially support Vue, we configured this project to make it work for you 😎
Nx supports Vite Visit Nx Official docs for Vite to learn more, and Vite supports Vue, so we used this configs to run Vue into our monorepos!
- Run
npm create vite@latest my-vue-app -- --template vue
. - Run
cd my-vue-app && npm install
. - Go to
apps/my-vue-app
and create a newproject.json
. - Copy the
properties
from theproject.json
file fromapps/example-vue-app
and paste it inside the newproject.json
file generated for the new Vue application in the step 3. - Inside the new
project.json
file generated, replace allexample-app-vue
instances with the name of your Vue app created in step 1. - Now you just need to
extends
thetsconfig.base.json
root file in yourtsconfig.json
Vue application file by adding"extends": "../../tsconfig.base.json"
at the top of the array.
And that's it! You will be able to run and serve your Vue application by running nx serve your-app-name
(where your-app-name is the name of the application you created).
We are using Capacitor to run the project in mobile. We configured Capacitor to be able to run in monorepos, so if you want to add capacitor into your application follow this steps:
- Make sure you have run
nx build your-app-name
(Whereyour-app-name
will be the name of your application). - Make sure your application has the
package.json
created, if not create one at the root of you application folderapps/your-application-folder
and add the folowing properties:"name": your-app-name
,"version": "0.0.0"
,"licence: "MIT""
,"private: true"
,"dependencies: {}"
,"devDependencies": {}
(whereyour-app-name
will be replaced with your currently application name). - Go to
apps/your-app-name
and runnpm install @capacitor/cli --save-dev
, then runnpm install @capacitor/core
. - Nowe it's time to initialize Capacitor. Go to
apps/your-app-name
and runnpx cap init
. - In the project root folder, search for the
ionic.config.json
file and addyour-app-name
as a new project in theprojects
array. You can copy&paste the example one and just replace all instances.
- At the root of your project, run
ionic capacitor add platform --project=your-app-name
(Whereplatform
could beios
|android
) (Whereyour-project-name
will be the project name you set into theionic.config.json
file).
- Run
nx build your-app-name
(Whereyour-app-name
will be the name of your application). - Run
cd apps/your-app-name && npx cap copy
. - Run
cd apps/your-app-name && npx cap sync
. - Run
cd apps/your-app-name && npx cap open platform
. (Whereplatform
could beios
|android
)
Visit the Nx Documentation to learn more.
Run nx g @nrwl/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
.
Run npx nx run example-app-angular:serve
for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
Run nx g @nrwl/react:component my-component --project=my-app
to generate a new component.
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.
Run nx test my-app
to execute the unit tests via Jest.
Run nx affected:test
to execute the unit tests affected by a change.
Run ng e2e my-app
to execute the end-to-end tests via Cypress.
Run nx affected:e2e
to execute the end-to-end tests affected by a change.
Run nx dep-graph
to see a diagram of the dependencies of your projects.