The best way would be to discuss an issue or an improvement first:
To update docs, simply go to the page you want to edit on https://ng-mocks.sudo.eu/ and click on the "Edit this page" link at the bottom of the page.
- install
docker: https://hub.docker.com - install
docker-compose: https://docs.docker.com/compose/install/ - install
nvm: https://github.com/nvm-sh/nvm#installing-and-updating
- install
docker: https://hub.docker.com - install
docker-compose: https://docs.docker.com/compose/install/ - install
nvm: https://github.com/nvm-sh/nvm#installing-and-updating
- install
Git BASH: https://gitforwindows.org - install
dockerforWSL: https://docs.docker.com/desktop/windows/wsl/ - install
docker-compose: https://docs.docker.com/compose/install/ - install
nvm: https://github.com/nvm-sh/nvm#installing-and-updating
To develop ng-mocks you need to use bash and WSL in case if you are on Windows.
-
start
dockerand ensure it's running -
open a
bashsession in a terminal (Git BASH on Windows) -
execute
sh ./docker-compose.sh
-
it will take a while, but afterwards you have all dependencies installed
nvm use
npm run testnvm use
npm run test:debug-
login to a Windows OS: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms
-
install
git-scm: https://git-scm.com/download/win -
install
nodeandnpm: https://nodejs.org -
open
Git Bashand executeexport IE_BIN="/c/Program Files/Internet Explorer/iexplore.exe" cd /c/ && rm -Rf ng-mocks && mkdir ng-mocks && cd ng-mocks find /z/ng-mocks -maxdepth 1 -not -name ng-mocks -not -name .git -not -name docs -not -name e2e -not -name node_modules -exec cp -r {} . \; npm ci --no-optional --ignore-scripts npm run test
-
You need to create a
.envfile with the next content:GH_TOKEN=<GITHUB_TOKEN> NPM_TOKEN=<NPM_TOKEN> GIT_AUTHOR_NAME=<YOUR_NAME> GIT_AUTHOR_EMAIL=<YOUR_EMAIL> GIT_COMMITTER_NAME=<YOUR_NAME> GIT_COMMITTER_EMAIL=<YOUR_EMAIL>
An example of it is:
GH_TOKEN=123123123 NPM_TOKEN=123123123 GIT_AUTHOR_NAME="Best Coder" GIT_AUTHOR_EMAIL=best@coder.com GIT_COMMITTER_NAME="Best Coder" GIT_COMMITTER_EMAIL=best@coder.com
-
execute
npm run release -- --no-ci- to generate a release and publish it on github.com -
execute
npm publish ./tmp/ng-mocks-N.N.N.tgz- to publish it on npmjs.com -
profit
First, you need to install the new Angular version somewhere.
Below is an example how to add Angular 17 to ng-mocks.
Let's create a fresh project with @angular/cli v17.
The name of the project should be a + version: a17.
npx '@angular/cli@^17' new \
--routing \
--skip-git=true \
--skip-tests=true \
--style=css \
--ssr=false \
a17Basically, the requirements are:
- no default tests are needed
- no git repo is needed
- no styles are needed, css is enough
- no ssr is needed
- routing IS needed
The next step is:
- move
a17folder tong-mocks/e2efolder - delete
.vscodefolder inng-mocks/e2e/a17 - delete
.editorconfigfile inng-mocks/e2e/a17 - change
.gitignoreto be the same as in the prev version:ng-mocks/e2e/a16/.gitignore - change
angular.jsonto be similar as in the prev version:ng-mocks/e2e/a16/angular.jsonprojects/a17/schematicsshould be empty- remove
projects/a17/architect/build/options/assets - remove
projects/a17/architect/build/options/styles - remove
projects/a17/architect/build/options/scripts - change
projects/a17/architect/build/options/tsConfigtotsconfig.json - remove
projects/a17/architect/build/configurations/production/budgets - remove
projects/a17/architect/extract-i18n - remove
projects/a17/architect/test/options/assets - remove
projects/a17/architect/test/options/styles - remove
projects/a17/architect/test/options/scripts - change
projects/a17/architect/test/options/tsConfigtotsconfig.json - add
projects/a17/architect/test/options/mainwith the value ofsrc/test.ts - add
projects/a17/architect/test/options/karmaConfigwith the value ofkarma.conf.js - add
projects/libas it is in the prev version:ng-mocks/e2e/a16/angular.json
- change
package.jsonto be similar as in the prev version:ng-mocks/e2e/a16/package.jsonnameshould bea17descriptionshould beAngular 17privateshould betrue- replace
scriptsas it is in the prev version:ng-mocks/e2e/a16/package.json - remove flexible versions (
^~) independenciesas it is in the prev version:ng-mocks/e2e/a16/package.json - remove flexible versions (
^~) indevDependenciesas it is in the prev version:ng-mocks/e2e/a16/package.json - in
devDependencies, add@types/jest,jest,jest-preset-angular,ng-packagr,puppeteer,ts-nodewhich support the desired angular version - add
engineswith the correctnpmwhich supports the desired angular version
- delete
README.md - merge
tsconfig.app.jsonandtsconfig.spec.jsonintotsconfig.jsonas it is in the prev version:ng-mocks/e2e/a16/tsconfig.json- add
compilerOptions/baseUrlwith the value of./ - add
compilerOptions/typesas it is in the prev version:ng-mocks/e2e/a16/tsconfig.json - add
compilerOptions/skipLibCheckas it is in the prev version:ng-mocks/e2e/a16/tsconfig.json - change
compilerOptions/noImplicitOverridetofalse - add
filesas it is in the prev version:ng-mocks/e2e/a16/tsconfig.json - add
includeas it is in the prev version:ng-mocks/e2e/a16/tsconfig.json - delete
tsconfig.app.json - delete
tsconfig.spec.json
- add
- add
.nvmrcwhich supports the desired angular version - add
jest.config.tsas it is in the prev version:ng-mocks/e2e/a16/jest.config.ts - add
karma.conf.jsas it is in the prev version:ng-mocks/e2e/a16/karma.conf.js - add
ng-package.jsonas it is in the prev version:ng-mocks/e2e/a16/ng-package.json - delete
ng-mocks/e2e/a17/src/app - delete
ng-mocks/e2e/a17/src/assets - delete
ng-mocks/e2e/a17/src/favicon.ico - delete
ng-mocks/e2e/a17/src/style.css - remove
<link rel="icon">fromng-mocks/e2e/a17/src/index.html - change
ng-mocks/e2e/a17/src/main.tsas it is in the prev version:ng-mocks/e2e/a16/src/main.ts - add
ng-mocks/e2e/a17/src/test.tsas it is in the prev version:ng-mocks/e2e/a16/src/test.ts - add
ng-mocks/e2e/a17/src/setup-jest.tsas it is in the prev version:ng-mocks/e2e/a16/src/setup-jest.ts
- update
ng-mocks/package.json, search fora16and extended scripts to supporta17 - update
ng-mocks/docker-compose.yml, search fora16and copy blocks to supporta17with the right node version - update
ng-mocks/docker-compose.sh, search fora16and copy blocks to supporta17with the right command to installpuppeteer - update
ng-mocks/.dockerignore, search fora16and copy blocks to supporta17 - update
ng-mocks/.github/dependabot.yml, search fora16and copy blocks to supporta17 - update
ng-mocks/.circleci/config.yml, search fora16and copy blocks to supporta17 - update
ng-mocks/.eslintrc.yml, search fora16and copy blocks to supporta17 - execute
sh docker-compose.sh a17inng-mocksto install dependencies fora17, it might require--forceat this moment
- update
ng-mocks/package.jsonto point to the new angular version in dependencies - execute
sh docker-compose.sh rootinng-mocksto install the dependencies
Replace a16 with the new version below.
- execute
nvm installinng-mocks - execute
nvm use - execute
npm run build - execute
npm run clean:a16 - execute
npm run s:a16 - execute
npm run s:app:a16 - execute
npm run s:test:a16 - execute
npm run test:a16 - tests should pass successfully without failures
- update the version table in
ng-mocks/docs/articles/index.md - update the migration guide in
docs/articles/migrations.md - update the version table in
ng-mocks/README.md - update
descriptioninlibs/ng-mocks/package.json - update
peerDependenciesinlibs/ng-mocks/package.json
- create a PR against the main branch
- verify that CI doesn't fail
- verify that CI has covered the new version
- release the new version of
ng-mocks