Skip to content

Commit 8f20604

Browse files
authored
Merge pull request #73 from shiftcode/#63-update-ng
#63 update ng and some housekeeping
2 parents fd14c98 + 2057068 commit 8f20604

134 files changed

Lines changed: 4368 additions & 3598 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.commitlintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
extends:
2-
- "@commitlint/config-angular"
2+
- '@commitlint/config-angular'
33
rules:
44
'header-max-length': [2, 'always', 100]

.eslintrc.cjs

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
name: Check for execution
3333
uses: shiftcode/github-action-skip@v4.0.0
3434
with:
35-
skipOnCommitMsg: "[skip_build]"
35+
skipOnCommitMsg: '[skip_build]'
3636
githubToken: ${{ secrets.GITHUB_TOKEN }}
3737
build:
3838
runs-on: ubuntu-latest
@@ -63,6 +63,9 @@ jobs:
6363
# install dependencies
6464
- name: Install
6565
run: HUSKY=0 npm ci --include=optional
66+
# check formatting
67+
- name: Check Formatting
68+
run: npm run format:ci
6669
# lint
6770
- name: Lint
6871
run: npm run lint:ci

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
npx lint-staged && npx lerna exec --concurrency 1 --stream lint-staged
1+
npx lerna exec --concurrency 1 --stream lint-staged && npx lint-staged

.lintstagedrc.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# !! no source on root !!
2-
# sort package.json keys
31
./package.json:
4-
- sort-package-json
2+
- npx sort-package-json
3+
4+
'*':
5+
- npm run format:staged

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,59 @@ Public Angular libraries used in various shiftcode projects.
1616
> for previous versions.
1717
1818
## Angular to Lib Version Mapping
19+
1920
Shows the mapping between the angular version and our lib versions.
2021

2122
| Angular Version | Lib Version |
22-
|-----------------|-------------------------------|
23+
| --------------- | ----------------------------- |
2324
| `^21` | `^13` |
2425
| `^20` | `^11 \|\| ^12` |
25-
| `^19` | `^7 \|\| ^8 \|\| ^9 \|\| ^10` |
26-
| `^18` | `^6` |
26+
| `^19` | `^7 \|\| ^8 \|\| ^9 \|\| ^10` |
27+
| `^18` | `^6` |
2728
| `^17` | `^5` |
2829
| `^16` | `^4` |
2930
| `^15` | `^3` |
3031
| `^14` | `^2` |
3132
| `^13` | `^1` |
3233

33-
3434
## Anatomy of this workspace
35+
3536
Package manager client: `npm`
3637

3738
Individual packages can depend on each other, the dependency is resolved using ts paths (see ./tsconfig.json) make sure to build the package you depend on. Or change the tsconfig.paths to reference the files under `src` directory.
3839

3940
Lerna is used to publish the packages and to run commands in multiple packages.
4041

41-
4242
## Dependencies
43+
4344
All dependencies of a library are defined as peerDependencies (except tslib)
45+
4446
### root dependencies + libs peerDependencies
47+
4548
When adding a peerDependency it must also be added to the root package.json as 'normal' dependency.
4649

4750
## Versioning
51+
4852
When opening a PR lerna publishes a new prerelease version with the preId `-prXX.{COUNT}`.
4953
By creating this version lerna creates a commit with the updated versions in the package.json. It does not update the PeerDependencies versions.
5054

5155
After merging the PR back to the master a new release is published with the graduated version (eg. `1.0.1-pr55.7` -> `1.0.1`).
5256

5357
### Hint
58+
5459
If it happens that you already have another commit locally, before updating the branch with this `build(release):..` commit:
60+
5561
> use `rebase` instead of `merge`
5662
5763
## Add new library
64+
5865
1. run `ng generate library my-lib`
5966
2. change `libs/my-lib/package.json#name` to `@shiftcode/ngx-my-lib`
6067
3. alter `libs/my-lib/ng-package.json#dest` to `./dist`
6168
4. add `"assets": [ "LICENSE", "CHANGELOG.md" ],` to `libs/my-lib/ng-package.json`
6269
5. alter `tsconfig.json#compilerOptions.paths` `my-lib` entry to `@shifcode/ng-my-lib` and edit paths according to #3
6370
6. update tsconfig files like other libs
6471
7. change from karma config to jest:
65-
1. remove `libs/my-lib/src/test.ts`
66-
2. remove `libs/my-lib/karam-config.js`
67-
3. in `angular.json` replace the libs test architect to `"test": { "builder": "@angular-builders/jest:run" }`
68-
72+
8. remove `libs/my-lib/src/test.ts`
73+
9. remove `libs/my-lib/karam-config.js`
74+
10. in `angular.json` replace the libs test architect to `"test": { "builder": "@angular-builders/jest:run" }`

angular.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"defaultConfiguration": "production"
2424
},
2525
"test": {
26-
"builder":"@angular-devkit/build-angular:jest",
26+
"builder": "@angular-devkit/build-angular:jest",
2727
"options": {
2828
"tsConfig": "tsconfig.spec.json",
2929
"polyfills": ["zone.js", "zone.js/testing"]
@@ -74,16 +74,9 @@
7474
"index": "apps/styleguide/src/index.html",
7575
"tsConfig": "apps/styleguide/tsconfig.app.json",
7676
"inlineStyleLanguage": "scss",
77-
"polyfills": [
78-
"zone.js"
79-
],
80-
"assets": [
81-
"apps/styleguide/src/favicon.ico",
82-
"apps/styleguide/src/assets"
83-
],
84-
"styles": [
85-
"apps/styleguide/src/styles.scss"
86-
],
77+
"polyfills": ["zone.js"],
78+
"assets": ["apps/styleguide/src/favicon.ico", "apps/styleguide/src/assets"],
79+
"styles": ["apps/styleguide/src/styles.scss"],
8780
"scripts": [],
8881
"browser": "apps/styleguide/src/main.ts"
8982
},

apps/styleguide/.eslintrc.cjs

Lines changed: 0 additions & 31 deletions
This file was deleted.

apps/styleguide/.lintstagedrc.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
"*.{ts,html}":
2-
- npm run prettier:staged
1+
'{src,test}/**/*.{ts,html}':
32
- npm run lint:staged
4-
src/**/*.scss:
5-
- npm run prettier:staged
6-
# sort package.json keys
73
./package.json:
84
- sort-package-json

apps/styleguide/eslint.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// eslint-disable-next-line import/no-internal-modules
2+
import { defineScAngularConfig } from '@shiftcode/eslint-config-recommended/angular'
3+
4+
export default defineScAngularConfig(
5+
{
6+
languageOptions: {
7+
parserOptions: {
8+
project: ['./tsconfig.lint.json'],
9+
},
10+
},
11+
},
12+
{
13+
files: ['**/*.ts'],
14+
rules: {
15+
'import/no-extraneous-dependencies': ['error', { packageDir: '../..' }],
16+
17+
'@angular-eslint/component-selector': ['error', { type: 'element', prefix: 'sg', style: 'kebab-case' }],
18+
'@angular-eslint/directive-selector': ['error', { type: 'attribute', prefix: 'sg', style: 'camelCase' }],
19+
'@angular-eslint/no-pipe-impure': 'error',
20+
'@angular-eslint/prefer-inject': 'error',
21+
'@angular-eslint/prefer-signals': 'error',
22+
'@angular-eslint/prefer-output-emitter-ref': 'error',
23+
'@angular-eslint/prefer-output-readonly': 'error',
24+
'@angular-eslint/use-component-selector': 'error',
25+
},
26+
},
27+
{
28+
files: ['**/*.{js,mjs,cjs}'],
29+
rules: {
30+
'no-undef': 'off',
31+
},
32+
},
33+
)

0 commit comments

Comments
 (0)