diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index 9963224c2d..97d0616eb3 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -35,8 +35,41 @@ - - + + + + + + {{ 'AbpIdentity::UserInformations' | abpLocalization }} + + + + + + + {{ 'AbpIdentity::Roles' | abpLocalization }} + + + + {{ + roles[i].name + }} + + + + + + diff --git a/npm/verdaccio-containers/.gitignore b/npm/verdaccio-containers/.gitignore new file mode 100644 index 0000000000..784b55966b --- /dev/null +++ b/npm/verdaccio-containers/.gitignore @@ -0,0 +1,2 @@ +publish-packages/abp/ +serve-app/app \ No newline at end of file diff --git a/npm/verdaccio-containers/README.md b/npm/verdaccio-containers/README.md new file mode 100644 index 0000000000..cb4a35fa21 --- /dev/null +++ b/npm/verdaccio-containers/README.md @@ -0,0 +1,40 @@ +## Running containers that publishing packages to the Verdaccio + +### Goal + +We test all templates before the releasing. However, since we test packages without publishing, we may be faced breaking errors. That's why, this compose prepares the real-like test environment. + + +The duty of this compose is to publish the packages to the [Verdaccio](https://verdaccio.org/) (a custom NPM server) running in the container and to serve the Angular pro template (copied from `abp/templates/app/angular` folder) that is consumed these packages from the Verdaccio. + + +### Before starting + +Make sure the [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) are installed on your PC. + +Before starting, the following command should be run to prepare the environment: + +```bash +npm install && npm run prepare +``` + +### Getting Started + +To build and up the compose, run the following command: + +```bash +docker-compose rm -f && docker-compose build --build-arg next_version="" && docker-compose up +``` + +> Be sure to replace the "" with the version you want published. E.g: 4.1.0 + +This command; +- Removes the containers if worked before +- Builds the containers +- Runs the containers. + +The processes may take 30~ minutes. + +The Angular app will be running when you see the "Listening on http://localhost:4200" log. If you see the log, open the browser and navigate to the http://localhost:4200. + +The running Angular app can connect to the backend that is running on http://localhost:44305. Go to the `abp/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator` folder and run the project to create (or update) the database. Then run the HttpApiHost project which is in the `abp/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds` folder. Then refresh the browser. You'll see the Angular app is working properly. diff --git a/npm/verdaccio-containers/docker-compose.yml b/npm/verdaccio-containers/docker-compose.yml new file mode 100644 index 0000000000..e4abb3362f --- /dev/null +++ b/npm/verdaccio-containers/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3.9' + +services: + verdaccio: + image: verdaccio/verdaccio:4.0 + container_name: 'verdaccio' + networks: + - docker_network + environment: + - VERDACCIO_PORT=4873 + ports: + - '4873:4873' + expose: + - '4873/tcp' + publish: + build: + context: ./publish-packages + dockerfile: Dockerfile + args: + next_version: '' + container_name: 'verdaccio_publish' + networks: + - docker_network + depends_on: + - verdaccio + expose: + - '4872' + app: + build: ./serve-app + container_name: 'verdaccio_app' + networks: + - docker_network + depends_on: + - publish + ports: + - '4200:4200' + expose: + - '4200/tcp' +networks: + docker_network: + driver: bridge diff --git a/npm/verdaccio-containers/package-lock.json b/npm/verdaccio-containers/package-lock.json new file mode 100644 index 0000000000..31f1319658 --- /dev/null +++ b/npm/verdaccio-containers/package-lock.json @@ -0,0 +1,50 @@ +{ + "name": "verdaccio-publish", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + } + } +} diff --git a/npm/verdaccio-containers/package.json b/npm/verdaccio-containers/package.json new file mode 100644 index 0000000000..310b896fb9 --- /dev/null +++ b/npm/verdaccio-containers/package.json @@ -0,0 +1,16 @@ +{ + "name": "verdaccio-publish", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "prepare": "node prepare" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "fs-extra": "^9.0.1" + }, + "devDependencies": {} +} diff --git a/npm/verdaccio-containers/prepare.js b/npm/verdaccio-containers/prepare.js new file mode 100644 index 0000000000..d88cc6fe5a --- /dev/null +++ b/npm/verdaccio-containers/prepare.js @@ -0,0 +1,16 @@ +const fse = require('fs-extra'); +const path = require('path') + + +// packages +fse.removeSync(path.join(__dirname, 'publish-packages/abp')) + +fse.removeSync(path.join(__dirname, '../ng-packs/node_modules')) +fse.removeSync(path.join(__dirname, '../ng-packs/scripts/node_modules')) +fse.copySync(path.join(__dirname, '../ng-packs'), path.join(__dirname, 'publish-packages/abp/npm/ng-packs'), {overwrite: true, errorOnExist: false, }) + +// app angular template +fse.removeSync(path.join(__dirname, 'serve-app/app')) + +fse.removeSync(path.join(__dirname, '../../templates/app/angular/node_modules')); +fse.copySync(path.join(__dirname, '../../templates/app/angular'), path.join(__dirname, 'serve-app/app'), {overwrite: true, errorOnExist: false, }) diff --git a/npm/verdaccio-containers/publish-packages/Dockerfile b/npm/verdaccio-containers/publish-packages/Dockerfile new file mode 100644 index 0000000000..77a72bde19 --- /dev/null +++ b/npm/verdaccio-containers/publish-packages/Dockerfile @@ -0,0 +1,12 @@ +FROM node:14 +ARG next_version +ENV next_version=$next_version +RUN mkdir /publish +COPY . /publish +WORKDIR /publish +EXPOSE 4872/tcp + +RUN apt-get update +RUN apt-get install nano +RUN chmod +x ./entrypoint.sh +CMD /bin/bash ./entrypoint.sh \ No newline at end of file diff --git a/npm/verdaccio-containers/publish-packages/entrypoint.sh b/npm/verdaccio-containers/publish-packages/entrypoint.sh new file mode 100644 index 0000000000..f796d3eca6 --- /dev/null +++ b/npm/verdaccio-containers/publish-packages/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash +echo "v" $next_version " packages to be published to the verdaccio" + + +echo "Waiting for the Verdaccio" +while ! curl -v --silent verdaccio:4873 &> /dev/null +do + printf "%c" "." +done + +var="$(curl -v --silent verdaccio:4873 2>&1 | grep Trying)" +echo $var + +curl -XPUT -H "Content-type: application/json" -d '{ "name": "volo", "password": "123456", "email": "verdaccio@volo.com" }' 'verdaccio:4873/-/user/org.couchdb.user:your_username' + +npx npm-cli-login -u volo -p 123456 -e "verdaccio@volo.com" -r "http://verdaccio:4873" +npm whoami --registry http://verdaccio:4873 + + +cd /publish/abp/npm/ng-packs/scripts + +npm install + +echo "Running the publish script for abp packages" + +npm run publish-packages -- --nextVersion $next_version --skipGit --registry "http://verdaccio:4873" + +cd /publish/abp/npm/ng-packs + +echo '@abp:registry=http://verdaccio:4873' >> .npmrc + +npx npm-check-updates --filter '/^@(abp)\/.*$/' --registry http://verdaccio:4873 --target greatest --packageFile package.json -u + +cd scripts + +npm install + +echo "Running the publish script for abp packages" + +npm run publish-packages -- --nextVersion $next_version --skipGit --registry "http://verdaccio:4873" \ No newline at end of file diff --git a/npm/verdaccio-containers/serve-app/Dockerfile b/npm/verdaccio-containers/serve-app/Dockerfile new file mode 100644 index 0000000000..0f44bc2558 --- /dev/null +++ b/npm/verdaccio-containers/serve-app/Dockerfile @@ -0,0 +1,10 @@ +FROM node:14 +RUN mkdir /app +COPY . /app +WORKDIR /app +EXPOSE 4200/tcp + +RUN apt-get update +RUN apt-get install nano +RUN chmod +x ./entrypoint.sh +CMD /bin/bash ./entrypoint.sh \ No newline at end of file diff --git a/npm/verdaccio-containers/serve-app/entrypoint.sh b/npm/verdaccio-containers/serve-app/entrypoint.sh new file mode 100644 index 0000000000..4d6d71b86b --- /dev/null +++ b/npm/verdaccio-containers/serve-app/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash +while ping -c1 publish &> /dev/null +do echo "Waiting for publishing to be done"; sleep 10; +done; + +echo "Serving app" + +cd /app/app + +echo "@abp:registry=http://verdaccio:4873" >> .npmrc +echo '@volo:registry=http://verdaccio:4873' >> .npmrc + +npx npm-check-updates --filter '/^@(abp|volo)\/.*$/' --registry http://verdaccio:4873 --target greatest --packageFile package.json -u + +yarn + +yarn ng build --prod + +cd dist/MyProjectName + +npx http-server-spa . index.html 4200 \ No newline at end of file