Skip to content

Commit c4e72eb

Browse files
authored
Merge pull request #166 from mariohmol/angular20-support
feat: Angular 20 support with CI pipeline and bug fixes
2 parents f999dbd + a13e03e commit c4e72eb

29 files changed

Lines changed: 9916 additions & 8302 deletions

.eslintrc.json

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"createDefaultProgram": true
1717
},
1818
"extends": [
19-
"plugin:@angular-eslint/ng-cli-compat",
20-
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
19+
"plugin:@angular-eslint/recommended",
2120
"plugin:@angular-eslint/template/process-inline-templates"
2221
],
2322
"rules": {
@@ -37,38 +36,7 @@
3736
"style": "camelCase"
3837
}
3938
],
40-
"@typescript-eslint/consistent-type-definitions": "error",
41-
"@typescript-eslint/dot-notation": "off",
42-
"@typescript-eslint/explicit-member-accessibility": [
43-
"off",
44-
{
45-
"accessibility": "explicit"
46-
}
47-
],
48-
"@typescript-eslint/member-delimiter-style": [
49-
"off",
50-
{
51-
"multiline": {
52-
"delimiter": "none",
53-
"requireLast": true
54-
},
55-
"singleline": {
56-
"delimiter": "semi",
57-
"requireLast": false
58-
}
59-
}
60-
],
61-
"@typescript-eslint/no-use-before-define": "error",
62-
"@typescript-eslint/semi": [
63-
"off",
64-
null
65-
],
66-
"brace-style": [
67-
"error",
68-
"1tbs"
69-
],
70-
"id-blacklist": "off",
71-
"id-match": "off",
39+
"@angular-eslint/component-class-suffix": "off",
7240
"no-underscore-dangle": "off",
7341
"valid-typeof": "error"
7442
}

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
name: Lint
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: pnpm/action-setup@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 22
18+
cache: "pnpm"
19+
- run: pnpm install --frozen-lockfile
20+
- name: Lint
21+
run: ./node_modules/.bin/ng lint
22+
23+
build-and-test:
24+
name: Build & Test
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: pnpm/action-setup@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 22
32+
cache: "pnpm"
33+
- run: pnpm install --frozen-lockfile
34+
35+
- name: Build library
36+
run: ./node_modules/.bin/ng build --project ang-jsoneditor
37+
38+
- name: Build demo app
39+
run: ./node_modules/.bin/ng build
40+
41+
- name: Run unit tests
42+
run: ./node_modules/.bin/ng test --project ang-jsoneditor --watch=false --browsers=ChromeHeadless

.github/workflows/pages.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write # to commit docs/
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: true
16+
17+
jobs:
18+
deploy:
19+
name: Build & Deploy
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: pnpm/action-setup@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 22
31+
cache: "pnpm"
32+
33+
- run: pnpm install --frozen-lockfile
34+
35+
- name: Build library
36+
run: ./node_modules/.bin/ng build --project ang-jsoneditor
37+
38+
- name: Build demo for GitHub Pages
39+
run: ./node_modules/.bin/ng build --base-href /ang-jsoneditor/ --output-path dist/pages
40+
41+
- name: Flatten browser output into docs/
42+
run: |
43+
rm -rf docs
44+
mkdir docs
45+
cp -r dist/pages/browser/. docs/
46+
rm -rf dist/pages
47+
48+
- name: Commit updated docs/
49+
run: |
50+
git config user.name "github-actions[bot]"
51+
git config user.email "github-actions[bot]@users.noreply.github.com"
52+
git add docs/
53+
git diff --cached --quiet || git commit -m "chore: update GitHub Pages demo [skip ci]"
54+
git push
55+
56+
- uses: actions/configure-pages@v4
57+
58+
- uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: docs
61+
62+
- id: deployment
63+
uses: actions/deploy-pages@v4

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write # needed for npm provenance
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: "pnpm"
23+
registry-url: "https://registry.npmjs.org"
24+
25+
- run: pnpm install --frozen-lockfile
26+
27+
- name: Build library
28+
run: ./node_modules/.bin/ng build --project ang-jsoneditor
29+
30+
- name: Copy README into dist
31+
run: cp README.md dist/ang-jsoneditor/README.md
32+
33+
- name: Publish
34+
run: npm publish --provenance --access public
35+
working-directory: dist/ang-jsoneditor
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Angular Json Editor
22

3-
[![Build Status](https://travis-ci.org/mariohmol/ang-jsoneditor.svg?branch=master)](https://travis-ci.org/mariohmol/ang-jsoneditor)
3+
[![CI](https://github.com/mariohmol/ang-jsoneditor/actions/workflows/ci.yml/badge.svg)](https://github.com/mariohmol/ang-jsoneditor/actions/workflows/ci.yml)
4+
[![npm version](https://badge.fury.io/js/ang-jsoneditor.svg)](https://www.npmjs.com/package/ang-jsoneditor)
45

56
Angular Json Editor (wrapper for [jsoneditor](https://github.com/josdejong/jsoneditor)). View/Edit Json file with formatting.
67

7-
[StackBlitz template](https://stackblitz.com/edit/ang-jsoneditor)
8+
**[Live Demo](https://mariohmol.github.io/ang-jsoneditor/)** | [StackBlitz template](https://stackblitz.com/edit/ang-jsoneditor)
89

9-
Working with latest Angular 18/19.
10+
Working with Angular 17 / 18 / 19 / 20.
1011

1112
![Demo Image](/src/assets/printDemo.png)
1213

@@ -163,12 +164,16 @@ makeOptions = () => {
163164

164165
# Demo
165166

166-
Demo component files are included in Git Project.
167+
Live demo: **[https://mariohmol.github.io/ang-jsoneditor/](https://mariohmol.github.io/ang-jsoneditor/)**
167168

168-
Demo Project with a lot of different implementations (ngInit, change event and others):
169-
[https://github.com/mariohmol/ang-jsoneditor/tree/master/src/app/demo)
169+
Demo component files are included in the Git project under [`src/app/demo`](https://github.com/mariohmol/ang-jsoneditor/tree/master/src/app/demo), with examples for ngInit, change events, reactive forms, and more.
170170

171-
When publishing it to npm, look over this docs: https://docs.npmjs.com/misc/developers
171+
To rebuild the demo locally:
172+
```sh
173+
npm run build:pages
174+
```
175+
176+
When publishing to npm, see: https://docs.npmjs.com/misc/developers
172177

173178
# Collaborate
174179

angular.json

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"prefix": "app",
1616
"architect": {
1717
"build": {
18-
"builder": "@angular-devkit/build-angular:application",
18+
"builder": "@angular/build:application",
1919
"options": {
2020
"outputPath": "dist/ang-jsoneditor-demo",
2121
"index": "src/index.html",
@@ -59,7 +59,7 @@
5959
"defaultConfiguration": "production"
6060
},
6161
"serve": {
62-
"builder": "@angular-devkit/build-angular:dev-server",
62+
"builder": "@angular/build:dev-server",
6363
"configurations": {
6464
"production": {
6565
"buildTarget": "ang-jsoneditor-demo:build:production"
@@ -71,13 +71,22 @@
7171
"defaultConfiguration": "development"
7272
},
7373
"extract-i18n": {
74-
"builder": "@angular-devkit/build-angular:extract-i18n",
74+
"builder": "@angular/build:extract-i18n",
7575
"options": {
7676
"buildTarget": "ang-jsoneditor-demo:build"
7777
}
7878
},
79+
"lint": {
80+
"builder": "@angular-eslint/builder:lint",
81+
"options": {
82+
"lintFilePatterns": [
83+
"src/**/*.ts",
84+
"src/**/*.html"
85+
]
86+
}
87+
},
7988
"test": {
80-
"builder": "@angular-devkit/build-angular:karma",
89+
"builder": "@angular/build:karma",
8190
"options": {
8291
"polyfills": [
8392
"zone.js",
@@ -104,7 +113,7 @@
104113
"prefix": "lib",
105114
"architect": {
106115
"build": {
107-
"builder": "@angular-devkit/build-angular:ng-packagr",
116+
"builder": "@angular/build:ng-packagr",
108117
"options": {
109118
"project": "projects/ang-jsoneditor/ng-package.json"
110119
},
@@ -118,8 +127,17 @@
118127
},
119128
"defaultConfiguration": "production"
120129
},
130+
"lint": {
131+
"builder": "@angular-eslint/builder:lint",
132+
"options": {
133+
"lintFilePatterns": [
134+
"projects/ang-jsoneditor/**/*.ts",
135+
"projects/ang-jsoneditor/**/*.html"
136+
]
137+
}
138+
},
121139
"test": {
122-
"builder": "@angular-devkit/build-angular:karma",
140+
"builder": "@angular/build:karma",
123141
"options": {
124142
"tsConfig": "projects/ang-jsoneditor/tsconfig.spec.json",
125143
"polyfills": [
@@ -134,10 +152,30 @@
134152
"schematics": {
135153
"@schematics/angular:component": {
136154
"prefix": "app",
137-
"style": "css"
155+
"style": "css",
156+
"type": "component"
138157
},
139158
"@schematics/angular:directive": {
140-
"prefix": "app"
159+
"prefix": "app",
160+
"type": "directive"
161+
},
162+
"@schematics/angular:service": {
163+
"type": "service"
164+
},
165+
"@schematics/angular:guard": {
166+
"typeSeparator": "."
167+
},
168+
"@schematics/angular:interceptor": {
169+
"typeSeparator": "."
170+
},
171+
"@schematics/angular:module": {
172+
"typeSeparator": "."
173+
},
174+
"@schematics/angular:pipe": {
175+
"typeSeparator": "."
176+
},
177+
"@schematics/angular:resolver": {
178+
"typeSeparator": "."
141179
}
142180
},
143181
"cli": {

0 commit comments

Comments
 (0)