Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/303 repository improvement #305

Merged
merged 9 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand All @@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
35 changes: 20 additions & 15 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
"projects/**/*",
"src/**/*-examples.component.html"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:prettier/recommended"
],
"rules": {
"@angular-eslint/component-selector": [
Expand All @@ -28,12 +25,10 @@
"type": "element"
}
],
"@angular-eslint/directive-selector": [
"prettier/prettier": [
"error",
{
"prefix": "it",
"style": "camelCase",
"type": "attribute"
"printWidth": 140
}
]
}
Expand All @@ -43,9 +38,19 @@
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility",
"plugin:prettier/recommended"
],
"rules": {}
"rules": {
"prettier/prettier": [
"error",
{
"parser": "angular",
"printWidth": 140
}
]
}
}
]
}
6 changes: 4 additions & 2 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Lint commits

on:
push:
branches:
- main
pull_request:
branches:
- main
name: Lint commits

jobs:
lint-commits:
runs-on: ubuntu-latest
Expand All @@ -16,5 +18,5 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install @commitlint/cli
- run: npm install @commitlint/config-conventional @commitlint/cli
- run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD
71 changes: 36 additions & 35 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
name: Generate new release
# Workflow base: https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions

name: Publish release

on:
push:
tags:
- 'v1*'
workflow_dispatch:

permissions:
contents: read # for checkout

jobs:
build:
release:
# Run job only on main branch
if: github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: git config
- name: Install dependencies
run: npm ci
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures

- name: Build library
run: npm run build:lib
- name: Copy readme and npmrc files to dist folder
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: mv .npmrc-dist .npmrc
- run: npm ci
- run: npm run build:lib
- name: Publish package to NPM
run: cp .npmrc dist/design-angular-kit/.npmrc && cd dist/design-angular-kit && npm publish --tag unstable
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm i extract-changelog-release
- name: Generate Release Body
run: npx extract-changelog-release > RELEASE_BODY.md
- uses: ncipollo/release-action@v1
with:
bodyFile: 'RELEASE_BODY.md'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish on gh-pages
run: |
npm run build
cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npm run documentation-deploy-to-gh-pages
cp README.md dist/design-angular-kit/README.md
cp .npmrc dist/design-angular-kit/.npmrc

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: italia/[email protected]
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
project_name: Design Angular Kit
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
branches:
- main
name: CI

jobs:
run-build-and-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm i
- run: npm ci
- run: npm run build
- run: npm run build:lib
- run: npm run test
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/slack-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Slack notification

on:
push:
tags:
- 'v1*'

jobs:
notification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Notify new release on Slack
uses: italia/[email protected]
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL }}
project_name: Design Angular Kit
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
name: Update documentation

on:
workflow_dispatch:
workflow_run:
workflows: ["Publish release"]
branches:
- main
types:
- completed

jobs:
build:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: git config
- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: npm ci
- run: npm run build
- run: cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html

- name: Install dependencies
run: npm ci

- name: Build documentation
run: |
npm run build
cp dist/design-angular-kit-bundle/index.html dist/design-angular-kit-bundle/404.html

- name: Publish on gh-pages
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
Expand Down
24 changes: 15 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# dependencies
**/node_modules
# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
Expand All @@ -17,21 +20,24 @@
.settings/
*.sublime-workspace

# IDE - VSCode
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
# Miscellaneous
/.angular/cache
/.sass-cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
# System files
.DS_Store
Thumbs.db

Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
11 changes: 11 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"*.ts": [
"prettier --write",
"eslint"
],
"*.html": [
"eslint",
"prettier --write"
],
"*.scss": "prettier --write"
}
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
message="chore(release): %s :tada:"
registry=https://registry.npmjs.org/
always-auth=true
tag=unstable
4 changes: 0 additions & 4 deletions .npmrc-dist

This file was deleted.

Loading
Loading