Skip to content

Commit

Permalink
Merge pull request #114 from ngneat/migrate-to-nx-workspace
Browse files Browse the repository at this point in the history
Migrate to nx workspace
  • Loading branch information
shaharkazaz authored Nov 12, 2023
2 parents 35dfce3 + e86e1c3 commit 41bdced
Show file tree
Hide file tree
Showing 78 changed files with 38,301 additions and 18,563 deletions.
12 changes: 0 additions & 12 deletions .browserslistrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
65 changes: 65 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"settings": {
"import/resolver": {
"typescript": {
"project": ["libs/*/tsconfig.json", "tsconfig.base.json"]
}
}
},
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript", "plugin:import/recommended", "plugin:import/typescript"],
"rules": {
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling"],
"newlines-between": "always"
}
]
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["**/*.spec.ts", "**/mocks.ts", "**/test-setup.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@angular-eslint/component-class-suffix": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
},
{
"files": ["**/types.ts", "**/helpers.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
14 changes: 14 additions & 0 deletions .github/actions/node-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Setup Node and install dependencies'
description: 'Setup Node and install dependencies'

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v3
with:
node-version: 18.17.0
cache: 'npm'

- name: Install dependencies
run: npm ci
shell: bash
File renamed without changes.
File renamed without changes.
47 changes: 23 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,45 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.17.0
cache: 'npm'

- name: Install dependencies
run: npm i
- name: Setup node
uses: ./.github/actions/node-setup

- name: Build
run: npm run build:lib
test:

build-playground:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.17.0
cache: 'npm'

- name: Install dependencies
run: npm i
- name: Setup node
uses: ./.github/actions/node-setup

- name: Run tests
run: npm run test:lib:headless
- name: Build playground
run: npm run build

build-playground:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18.17.0
cache: 'npm'
- name: Setup node
uses: ./.github/actions/node-setup

- name: Install dependencies
run: npm i
- name: Run tests
run: npm run ci:test

- name: Build playground
run: npm run build
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup node
uses: ./.github/actions/node-setup

- name: Run tests
run: npm run ci:lint
13 changes: 4 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
node_modules

# IDEs and editors
/.idea
Expand All @@ -29,10 +23,8 @@ speed-measure-plugin*.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand All @@ -45,3 +37,6 @@ testem.log
# System Files
.DS_Store
Thumbs.db

.angular
.nx
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"

npx --no-install 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 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run hooks:pre-commit && npx lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["nrwl.angular-console", "angular.ng-template", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ First, create the component to be displayed in the modal:
import { DialogService, DialogRef } from '@ngneat/dialog';

interface Data {
title: string
title: string;
}

@Component({
template: `
<h1>{{title}}</h1>
<h1>{{ title }}</h1>
<button (click)="ref.close(true)">Close</button>
`,
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelloWorldComponent {
ref: DialogRef<Data, boolean> = inject(DialogRef);
Expand Down Expand Up @@ -133,7 +133,7 @@ import { DialogService, DialogRef } from '@ngneat/dialog';
<button (click)="ref.close()">Close</button>
`,
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelloWorldComponent {
ref: DialogRef<Data> = inject(DialogRef);
Expand Down Expand Up @@ -244,10 +244,13 @@ bootstrapApplication(AppComponent, {
providers: [
provideDialogConfig({
closeButton: boolean,
enableClose: boolean | 'onlyLastStrategy' | {
escape: boolean | 'onlyLastStrategy',
backdrop: boolean | 'onlyLastStrategy',
},
enableClose:
boolean |
'onlyLastStrategy' |
{
escape: boolean | 'onlyLastStrategy',
backdrop: boolean | 'onlyLastStrategy',
},
backdrop: boolean,
resizable: boolean,
draggable: boolean,
Expand Down Expand Up @@ -286,16 +289,17 @@ this.dialog.open(compOrTemplate, {
```

### Enable close

The `enableClose` property can be configured for each dialog.
It can either be an object with the keys `escape` and `backdrop` for more granular control,
or one of the values described below directly.
The latter will apply the set value to both close triggers (escape and backdrop).

If set to `true`, clicking on the backdrop or pressing the escape key will close the modal.
If set to `true`, clicking on the backdrop or pressing the escape key will close the modal.
If set to `false`, this behavior will be disabled.

Additionally, the property can be set to the string value `'onlyLastStrategy'`.
In this case, the behavior will only apply to the last dialog that was opened, and not to any other dialog.
Additionally, the property can be set to the string value `'onlyLastStrategy'`.
In this case, the behavior will only apply to the last dialog that was opened, and not to any other dialog.
By default, this should be the top-most dialog and behave as `true`.

## Custom Sizes
Expand Down
Loading

0 comments on commit 41bdced

Please sign in to comment.