Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dwimberger committed Nov 23, 2024
0 parents commit 2546ab8
Show file tree
Hide file tree
Showing 30 changed files with 922 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .auto-changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"package": true,
"output": "CHANGELOG.md",
"template": "compact",
"unreleased": false,
"commitLimit": false,
"ignoreCommitPattern": "^(?!.*\\(\\#\\d+\\)$).*",
"releaseSummary": false
}
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.java]
ij_java_imports_layout = $*, |, javax.**, java.**, |, *

[*.gradle]
indent_size = 4

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[Makefile]
indent_size = 4
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: build
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/build
- name: Run Build
run: npm nest build

9 changes: 9 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: cache
on:
pull_request:
types:
- closed
jobs:
cache_cleanup:
name: Clean up cache
uses: evva-sfw/workflows/.github/workflows/cache.yml@main
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: lint
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
permissions:
id-token: write
attestations: write
jobs:
lint_all:
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
steps:
- uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- run: npm i
- run: npm run lint
29 changes: 29 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: npm
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
npm_check-package-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
test-app/node_modules
key: node-modules
- name: NPM Install
run: npm i
- name: Check if git is clean
uses: CatChen/check-git-status-action@v1
with:
fail-if-not-clean: true
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release and publish to npm
on:
workflow_dispatch:
inputs:
input_version:
type: choice
description: What type of release?
options:
- patch
- minor
- major

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.BOT_SSH_PRIVATE_KEY }}
- name: Debug inputs
run: |
echo "Type of release:${{ github.event.inputs.input_version }} from user ${GITHUB_ACTOR}"
git config --list
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
test-app/node_modules
.yarn/cache
key: node-modules
- name: Import GPG key
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: GPG user IDs
run: |
echo "fingerprint: ${{ steps.import-gpg.outputs.fingerprint }}"
echo "keyid: ${{ steps.import-gpg.outputs.keyid }}"
echo "name: ${{ steps.import-gpg.outputs.name }}"
echo "email: ${{ steps.import-gpg.outputs.email }}"
- name: git config
run: |
git config user.name "${{ steps.import-gpg.outputs.name }}"
git config user.email "${{ steps.import-gpg.outputs.email }}"
- name: Install dependencies
run: npm i

- name: Authenticate with registry
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Run release-it
run: npx release-it ${{ github.event.inputs.input_version }} --ci
env:
BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: '${{ github.workspace }}/*.tgz'
14 changes: 14 additions & 0 deletions .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: semantic
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
permissions:
pull-requests: read
jobs:
semantic_pr-name:
name: semantic_pr-name
uses: evva-sfw/workflows/.github/workflows/semantic.yml@main
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: test
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Capacitor Web
uses: ./.github/actions/capacitor-setup-web
- name: Run Tests
run: npm run test

10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
node_modules
.idea
.VSCode
dist
yarn.lock
*.tsbuildinfo
# Package results
*.gz
*.tgz
Empty file added .npmignore
Empty file.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
dist
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
87 changes: 87 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
"hooks": {
"after:bump": [
"rm -f *.tgz",
"yarn pack --out '%s_%v.tgz'",
"npx auto-changelog -c .auto-changelog"
]
},
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "${version}",
"commitArgs": [
"-S"
],
"tagArgs": [
"-s"
]
},
"npm": {
"publish": true,
"publishArgs": [
"--provenance"
]
},
"github": {
"release": true,
"assets": [
"*.tgz"
],
"tokenRef": "BOT_GITHUB_TOKEN"
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "🎉 Features"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "perf",
"section": "⚡️ Performance Improvements"
},
{
"type": "revert",
"section": "⏪️ Reverts"
},
{
"type": "docs",
"section": "📝 Documentation"
},
{
"type": "style",
"section": "🎨 Styles"
},
{
"type": "refactor",
"section": "🔀 Code Refactoring"
},
{
"type": "test",
"section": "🧪 Tests"
},
{
"type": "build",
"section": "⚙️ Build System"
},
{
"type": "ci",
"section": "🚀 Continuous Integration"
},
{
"type": "chore",
"section": "🧹 Chore"
}
]
},
"infile": "CHANGELOG.md"
}
}
}
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Contributing

This guide provides instructions for contributing to this Capacitor plugin.

## Developing

### Local Setup

1. Fork and clone the repo.
1. Install the dependencies.

```shell
npm install
```

### Scripts

#### `npm run build`

It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/`. These files are used in apps with bundlers when your plugin is imported.

#### `npm run lint` / `npm run fmt`

Check formatting and code quality, autoformat/autofix if possible.

This template is integrated with TSLint, Prettier. Using these tools is completely optional, but strives to have consistent code style and structure for easier cooperation.

## Publishing

There is a `prepack` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:

```shell
npm publish
```

> **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.
Loading

0 comments on commit 2546ab8

Please sign in to comment.