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
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
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
docker
forWSL
: https://docs.docker.com/desktop/windows/wsl/ - install
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
docker
and ensure it's running -
open a
bash
session in a terminal (Git BASH on Windows) -
execute
sh ./compose.sh
-
it will take a while, but afterwards you have all dependencies installed
nvm use
npm run test
nvm 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
node
andnpm
: https://nodejs.org -
open
Git Bash
and 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
.env
file 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=[email protected] GIT_COMMITTER_NAME="Best Coder" GIT_COMMITTER_EMAIL=[email protected]
-
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 \
a17
Basically, 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
a17
folder tong-mocks/e2e
folder - delete
.vscode
folder inng-mocks/e2e/a17
- delete
.editorconfig
file inng-mocks/e2e/a17
- change
.gitignore
to be the same as in the prev version:ng-mocks/e2e/a16/.gitignore
- change
angular.json
to be similar as in the prev version:ng-mocks/e2e/a16/angular.json
projects/a17/schematics
should 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/tsConfig
totsconfig.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/tsConfig
totsconfig.json
- add
projects/a17/architect/test/options/main
with the value ofsrc/test.ts
- add
projects/a17/architect/test/options/karmaConfig
with the value ofkarma.conf.js
- add
projects/lib
as it is in the prev version:ng-mocks/e2e/a16/angular.json
- change
package.json
to be similar as in the prev version:ng-mocks/e2e/a16/package.json
name
should bea17
description
should beAngular 17
private
should betrue
- replace
scripts
as it is in the prev version:ng-mocks/e2e/a16/package.json
- remove flexible versions (
^~
) independencies
as it is in the prev version:ng-mocks/e2e/a16/package.json
- remove flexible versions (
^~
) indevDependencies
as 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-node
which support the desired angular version - add
engines
with the correctnpm
which supports the desired angular version
- delete
README.md
- merge
tsconfig.app.json
andtsconfig.spec.json
intotsconfig.json
as it is in the prev version:ng-mocks/e2e/a16/tsconfig.json
- add
compilerOptions/baseUrl
with the value of./
- add
compilerOptions/types
as it is in the prev version:ng-mocks/e2e/a16/tsconfig.json
- add
compilerOptions/skipLibCheck
as it is in the prev version:ng-mocks/e2e/a16/tsconfig.json
- change
compilerOptions/noImplicitOverride
tofalse
- add
files
as it is in the prev version:ng-mocks/e2e/a16/tsconfig.json
- add
include
as it is in the prev version:ng-mocks/e2e/a16/tsconfig.json
- delete
tsconfig.app.json
- delete
tsconfig.spec.json
- add
- add
.nvmrc
which supports the desired angular version - add
jest.config.ts
as it is in the prev version:ng-mocks/e2e/a16/jest.config.ts
- add
karma.conf.js
as it is in the prev version:ng-mocks/e2e/a16/karma.conf.js
- add
ng-package.json
as 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.ts
as it is in the prev version:ng-mocks/e2e/a16/src/main.ts
- add
ng-mocks/e2e/a17/src/test.ts
as it is in the prev version:ng-mocks/e2e/a16/src/test.ts
- add
ng-mocks/e2e/a17/src/setup-jest.ts
as it is in the prev version:ng-mocks/e2e/a16/src/setup-jest.ts
- update
ng-mocks/package.json
, search fora16
and extended scripts to supporta17
- update
ng-mocks/compose.yml
, search fora16
and copy blocks to supporta17
with the right node version - update
ng-mocks/compose.sh
, search fora16
and copy blocks to supporta17
with the right command to installpuppeteer
- update
ng-mocks/.dockerignore
, search fora16
and copy blocks to supporta17
- update
ng-mocks/.github/dependabot.yml
, search fora16
and copy blocks to supporta17
- update
ng-mocks/.circleci/config.yml
, search fora16
and copy blocks to supporta17
- update
ng-mocks/.eslintrc.yml
, search fora16
and copy blocks to supporta17
- execute
sh compose.sh a17
inng-mocks
to install dependencies fora17
, it might require--force
at this moment incompose.yml
in the command for the new version
- update
ng-mocks/package.json
to point to the new angular version in dependencies - execute
sh compose.sh root
inng-mocks
to install the dependencies
Replace a16
with the new version below.
- execute
nvm install
inng-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
description
inlibs/ng-mocks/package.json
- update
peerDependencies
inlibs/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