Skip to content

Commit 3626b33

Browse files
chore: pre-commit checks and ci (#3)
* chore(repo): setup pre-commit checks * chore(repo): setup github CI * chore(repo): fix lint and pnpm * chore(repo): fix branch name
1 parent 654aef5 commit 3626b33

File tree

12 files changed

+9603
-3006
lines changed

12 files changed

+9603
-3006
lines changed

.commitlintrc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'scope-enum': [
5+
2,
6+
'always',
7+
[
8+
'qwik-angular',
9+
'add-angular-to-qwik',
10+
'repo', // anything related to managing the repo itself
11+
],
12+
],
13+
'scope-empty': [2, 'never'],
14+
},
15+
};

.eslintrc.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
{
2525
"files": ["*.ts", "*.tsx"],
2626
"extends": ["plugin:@nx/typescript"],
27-
"rules": {}
27+
"rules": {
28+
"@typescript-eslint/no-explicit-any": "off"
29+
}
2830
},
2931
{
3032
"files": ["*.js", "*.jsx"],

.github/workflows/ci.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
# Needed for nx-set-shas within nx-cloud-main.yml, when run on the main branch
10+
permissions:
11+
actions: read
12+
contents: read
13+
14+
jobs:
15+
main:
16+
name: Nx Cloud - Main Job
17+
uses: nrwl/ci/.github/workflows/[email protected]
18+
with:
19+
working-directory: '.'
20+
main-branch-name: master
21+
number-of-agents: 3
22+
init-commands: |
23+
pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
24+
parallel-commands: |
25+
pnpm exec nx-cloud record -- pnpm exec nx format:check
26+
parallel-commands-on-agents: |
27+
pnpm exec nx affected --target=lint --parallel=3
28+
pnpm exec nx affected --target=test --parallel=3 --ci --code-coverage
29+
pnpm exec nx affected --target=build --parallel=3
30+
31+
agents:
32+
name: Nx Cloud - Agents
33+
uses: nrwl/ci/.github/workflows/[email protected]
34+
with:
35+
number-of-agents: 3
36+
working-directory: '.'

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm exec commitlint --edit $1

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm exec lint-staged

.lintstagedrc.mjs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { relative } from 'path';
2+
import { workspaceRoot } from '@nx/devkit';
3+
4+
export default {
5+
'**/*': (files) =>
6+
`pnpx nx format:write --files=${files
7+
.map((f) => relative(workspaceRoot, f))
8+
.join(',')}`,
9+
'{apps,libs,packages,tools}/**/*.{ts,tsx,js,jsx}': 'eslint',
10+
};

package.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
"name": "@qwik-angular/source",
33
"version": "0.0.0",
44
"license": "MIT",
5-
"scripts": {},
5+
"scripts": {
6+
"prepare": "husky install"
7+
},
68
"private": true,
9+
"packageManager": "[email protected]",
10+
"engines": {
11+
"pnpm": "^8.0.0"
12+
},
713
"devDependencies": {
814
"@builder.io/qwik": "~1.2.6",
915
"@builder.io/qwik-city": "~1.2.6",
1016
"@nx/angular": "17.1.1",
17+
"@nx/devkit": "17.1.1",
1118
"@nx/eslint-plugin": "17.1.1",
1219
"@nx/js": "17.1.1",
1320
"@nx/vite": "17.1.1",
@@ -37,7 +44,11 @@
3744
"vite-tsconfig-paths": "~4.2.0",
3845
"vitest": "~0.32.0",
3946
"yargs": "^17.7.2",
40-
"@nx/eslint": "17.1.1"
47+
"@nx/eslint": "17.1.1",
48+
"husky": "^8.0.0",
49+
"@commitlint/cli": "^17.6.5",
50+
"@commitlint/config-conventional": "^17.6.5",
51+
"lint-staged": "^13.2.2"
4152
},
4253
"nx": {
4354
"includedScripts": []

packages/add-angular-to-qwik/bin/add-angular-to-qwik.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function getRelevantPackageManagerCommand() {
135135
}
136136

137137
function cleanup(isQwikNxInstalled: boolean, uninstallCmd: string) {
138-
rmSync('.nx', {force: true, recursive: true});
138+
rmSync('.nx', { force: true, recursive: true });
139139
rmSync('project.json');
140140
if (!isQwikNxInstalled) {
141141
execSync(`${uninstallCmd} qwik-nx nx`, { stdio: [0, 1, 2] });

packages/qwik-angular/src/lib/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ClientRenderer {
2727
private readonly knownInputs = new Set();
2828
private readonly knownOutputs = new Set();
2929

30-
private readonly outputHandlers = new Map<string, Function>();
30+
private readonly outputHandlers = new Map<string, (value?: any) => void>();
3131

3232
private readonly onDestroy$ = new Subject<void>();
3333

packages/qwik-angular/src/lib/qwikify.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { Internal, QwikifyOptions, QwikifyProps } from './types';
1919
import { renderFromServer } from './server';
2020
import { useWakeupSignal } from './wake-up-signal';
2121

22-
export function qwikifyQrl<PROPS extends {}>(
22+
export function qwikifyQrl<PROPS extends Record<string, any>>(
2323
angularCmp$: QRL<Type<unknown>>,
2424
qwikifyOptions?: QwikifyOptions
2525
) {

packages/qwik-angular/src/lib/wake-up-signal.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isServer } from '@builder.io/qwik/build';
33
import type { QwikifyOptions, QwikifyProps } from './types';
44

55
export const useWakeupSignal = (
6-
props: QwikifyProps<{}>,
6+
props: QwikifyProps<Record<string, any>>,
77
opts: QwikifyOptions = {}
88
) => {
99
const signal = useSignal(false);

0 commit comments

Comments
 (0)