Skip to content

Commit

Permalink
Repo refactor (#7)
Browse files Browse the repository at this point in the history
- [x] bump all deps
- [x] configure vite
- [x] refactor code
  - [x] remove globals
  - [x] add chrome compatibility
  - [x] rewrite docs
- [x] build test dev component
  - [x] test log
  - [x] test debug
  - [x] test info
  - [x] test warn
  - [x] test error
  - [x] test critical
  - [x] test run
  - [x] test success
- [x] configure vitest
- [x] refactor tests
- [x] configure Playwright
- [x] write e2e tests
- [x] configure peer dependencies
- [x] add GH actions
- [x] add NPM publish
- [x] test imports locally
- [x] bump version
- [x] update CHANGELOG
- [ ] publish new version

Fixes slipmatio/slipmatio#83
  • Loading branch information
Uninen authored Jul 5, 2023
1 parent 8fdfee6 commit 91a9b52
Show file tree
Hide file tree
Showing 39 changed files with 2,430 additions and 4,602 deletions.
29 changes: 29 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
extends: [
'plugin:vue/vue3-recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'plugin:security/recommended',
],
parserOptions: {
ecmaVersion: 'latest',
},
rules: {
'no-var': 'error',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'comma-dangle': ['error', 'only-multiline'],
'id-length': [2, { exceptions: ['i', 'j', '_'] }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '_' }],
},
globals: {
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
withDefaults: 'readonly',
},
}
15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

9 changes: 0 additions & 9 deletions .github/dependabot.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": [
"config:base",
"group:all",
":widenPeerDependencies",
"config:basic-github-automerge"
],
"enabledManagers": [
"npm"
],
"packageRules": [
{
"matchManagers": [
"npm"
],
"automerge": true,
"stabilityDays": 2
},
{
"matchPackagePatterns": [
"npm"
],
"rangeStrategy": "auto"
}
],
"timezone": "Europe/Helsinki",
"dependencyDashboard": true
}
62 changes: 62 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: E2E Test

on:
push:
branches:
- main
paths:
- '.github/workflows/e2e.yml'
- 'pnpm-lock.yaml'
- 'src/**/*.ts'
- 'src/**/*.vue'
- 'tests/e2e/*.spec.ts'
pull_request:
paths:
- '.github/workflows/e2e.yml'
- 'pnpm-lock.yaml'
- 'src/**/*.ts'
- 'src/**/*.vue'
- 'tests/e2e/*.spec.ts'
workflow_dispatch:

concurrency:
group: e2e-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
e2e-tests:
runs-on: ubuntu-latest

env:
DEBUG: 0
PLAYWRIGHT_BROWSERS_PATH: 0

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: /home/runner/.local/share/pnpm/store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: true
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'

- name: Install Playwright browsers
run: npx playwright install --with-deps

- name: Run e2e tests
run: pnpm test-e2e-ci

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: test-results/
retention-days: 30
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- uses: actions/setup-node@v3
with:
node-version: 18

- run: |
pnpm i --frozen-lockfile
pnpm build
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build + Test

on:
push:
branches:
- main
paths:
- '.github/workflows/test.yml'
- 'pnpm-lock.yaml'
- 'src/**/*.ts'
- 'src/**/*.vue'
- 'tests/unit/*.ts'
pull_request:
paths:
- '.github/workflows/test.yml'
- 'pnpm-lock.yaml'
- 'src/**/*.ts'
- 'src/**/*.vue'
- 'tests/unit/*.ts'
workflow_dispatch:

concurrency:
group: test-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
env:
DEBUG: 0

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: pnpm i --frozen-lockfile

- name: Build
run: pnpm build

- name: Test
run: pnpm test

- name: Component Coverage
uses: davelosert/vitest-coverage-report-action@v1.4.0
if: ${{ always() }}
with:
working-directory: ./
vite-config-path: ./vite.config.ts
46 changes: 31 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
.DS_Store
node_modules
coverage
npm-debug.log
yarn-error.log
.nyc_output
dist
package-lock.json
.DS_Store
tests/e2e
plugins
build
/index.d.ts
/index.d.ts.map
/index.js
/index.js.map
/global
/vue

/tests/e2e/videos/
/tests/e2e/screenshots/
/instrumented
/coverage
.nyc_output

# local env files
.env
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

test-results

LOCAL_NOTES.md
32 changes: 0 additions & 32 deletions .gitlab-ci.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### 0.1.0 - 2023-07-06

- Refactor: revamped whole repo structure + tooling to match other Slipmat.io projects
- Feat: added proper `logger.run()` support for Chromium-based browsers.
- Chore: bumped all deps.

### 0.0.9 - 2020-11-07

- Fix: explicitly name files to include in tha npm package.
Expand Down
Loading

0 comments on commit 91a9b52

Please sign in to comment.