Skip to content

Commit

Permalink
chore: pre-commit checks and ci (#3)
Browse files Browse the repository at this point in the history
* chore(repo): setup pre-commit checks

* chore(repo): setup github CI

* chore(repo): fix lint and pnpm

* chore(repo): fix branch name
  • Loading branch information
dmitry-stepanenko authored Nov 18, 2023
1 parent 654aef5 commit 3626b33
Show file tree
Hide file tree
Showing 12 changed files with 9,603 additions and 3,006 deletions.
15 changes: 15 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [
2,
'always',
[
'qwik-angular',
'add-angular-to-qwik',
'repo', // anything related to managing the repo itself
],
],
'scope-empty': [2, 'never'],
},
};
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["*.js", "*.jsx"],
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches:
- main
pull_request:

# Needed for nx-set-shas within nx-cloud-main.yml, when run on the main branch
permissions:
actions: read
contents: read

jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/[email protected]
with:
working-directory: '.'
main-branch-name: master
number-of-agents: 3
init-commands: |
pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
parallel-commands: |
pnpm exec nx-cloud record -- pnpm exec nx format:check
parallel-commands-on-agents: |
pnpm exec nx affected --target=lint --parallel=3
pnpm exec nx affected --target=test --parallel=3 --ci --code-coverage
pnpm exec nx affected --target=build --parallel=3
agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/[email protected]
with:
number-of-agents: 3
working-directory: '.'
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm exec 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"

pnpm exec lint-staged
10 changes: 10 additions & 0 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { relative } from 'path';
import { workspaceRoot } from '@nx/devkit';

export default {
'**/*': (files) =>
`pnpx nx format:write --files=${files
.map((f) => relative(workspaceRoot, f))
.join(',')}`,
'{apps,libs,packages,tools}/**/*.{ts,tsx,js,jsx}': 'eslint',
};
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
"name": "@qwik-angular/source",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"scripts": {
"prepare": "husky install"
},
"private": true,
"packageManager": "[email protected]",
"engines": {
"pnpm": "^8.0.0"
},
"devDependencies": {
"@builder.io/qwik": "~1.2.6",
"@builder.io/qwik-city": "~1.2.6",
"@nx/angular": "17.1.1",
"@nx/devkit": "17.1.1",
"@nx/eslint-plugin": "17.1.1",
"@nx/js": "17.1.1",
"@nx/vite": "17.1.1",
Expand Down Expand Up @@ -37,7 +44,11 @@
"vite-tsconfig-paths": "~4.2.0",
"vitest": "~0.32.0",
"yargs": "^17.7.2",
"@nx/eslint": "17.1.1"
"@nx/eslint": "17.1.1",
"husky": "^8.0.0",
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"lint-staged": "^13.2.2"
},
"nx": {
"includedScripts": []
Expand Down
2 changes: 1 addition & 1 deletion packages/add-angular-to-qwik/bin/add-angular-to-qwik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function getRelevantPackageManagerCommand() {
}

function cleanup(isQwikNxInstalled: boolean, uninstallCmd: string) {
rmSync('.nx', {force: true, recursive: true});
rmSync('.nx', { force: true, recursive: true });
rmSync('project.json');
if (!isQwikNxInstalled) {
execSync(`${uninstallCmd} qwik-nx nx`, { stdio: [0, 1, 2] });
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-angular/src/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ClientRenderer {
private readonly knownInputs = new Set();
private readonly knownOutputs = new Set();

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

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

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-angular/src/lib/qwikify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { Internal, QwikifyOptions, QwikifyProps } from './types';
import { renderFromServer } from './server';
import { useWakeupSignal } from './wake-up-signal';

export function qwikifyQrl<PROPS extends {}>(
export function qwikifyQrl<PROPS extends Record<string, any>>(
angularCmp$: QRL<Type<unknown>>,
qwikifyOptions?: QwikifyOptions
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-angular/src/lib/wake-up-signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isServer } from '@builder.io/qwik/build';
import type { QwikifyOptions, QwikifyProps } from './types';

export const useWakeupSignal = (
props: QwikifyProps<{}>,
props: QwikifyProps<Record<string, any>>,
opts: QwikifyOptions = {}
) => {
const signal = useSignal(false);
Expand Down
Loading

0 comments on commit 3626b33

Please sign in to comment.