Skip to content

Commit

Permalink
feat: add sketch lib and demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
BaggersIO committed Apr 3, 2024
1 parent fb5ebdc commit ad2d8ea
Show file tree
Hide file tree
Showing 45 changed files with 791 additions and 1,008 deletions.
51 changes: 18 additions & 33 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,32 @@
{
"root": true,
"ignorePatterns": ["!**/*"],
"plugins": ["@nx"],
"ignorePatterns": ["**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@angular-eslint/directive-selector": [
"@nx/enforce-module-boundaries": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
],
"extends": ["./.eslintrc.json"]
}
44 changes: 44 additions & 0 deletions apps/demo-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
],
"extends": ["../../.eslintrc.json"]
}
26 changes: 26 additions & 0 deletions apps/demo-app/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable */
export default {
displayName: 'demo-app',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/sketch',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],
};
26 changes: 13 additions & 13 deletions project.json → apps/demo-app/project.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "sketch",
"$schema": "node_modules/nx/schemas/project-schema.json",
"name": "demo-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "app",
"sourceRoot": "./src",
"sourceRoot": "apps/demo-app/src",
"tags": [],
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/sketch",
"index": "./src/index.html",
"browser": "./src/main.ts",
"index": "apps/demo-app/src/index.html",
"browser": "apps/demo-app/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "./tsconfig.app.json",
"assets": ["./src/favicon.ico", "./src/assets"],
"styles": ["./src/styles.css"],
"tsConfig": "apps/demo-app/tsconfig.app.json",
"assets": ["apps/demo-app/src/favicon.ico", "apps/demo-app/src/assets"],
"styles": ["apps/demo-app/src/styles.css"],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -47,31 +47,31 @@
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "sketch:build:production"
"buildTarget": "demo-app:build:production"
},
"development": {
"buildTarget": "sketch:build:development"
"buildTarget": "demo-app:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "sketch:build"
"buildTarget": "demo-app:build"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["./src"]
"lintFilePatterns": ["apps/demo-app/src"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectName}"],
"options": {
"jestConfig": "jest.config.ts"
"jestConfig": "apps/demo-app/jest.config.ts"
}
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { NxWelcomeComponent } from './nx-welcome.component';

@Component({
standalone: true,
imports: [NxWelcomeComponent, RouterModule],
imports: [RouterModule],
selector: 'app-root',
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
title = 'sketch';
}
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.app.json → apps/demo-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/out-tsc",
"outDir": "../../dist/out-tsc",
"types": []
},
"files": ["src/main.ts"],
Expand Down
19 changes: 2 additions & 17 deletions tsconfig.json → apps/demo-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
{
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2022",
"module": "esnext",
"lib": ["es2020", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {},
"useDefineForClassFields": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand All @@ -36,12 +22,11 @@
"path": "./tsconfig.spec.json"
}
],
"compileOnSave": false,
"exclude": ["node_modules", "tmp"],
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
},
"extends": "../../tsconfig.base.json"
}
2 changes: 1 addition & 1 deletion tsconfig.spec.json → apps/demo-app/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/out-tsc",
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
Expand Down
4 changes: 1 addition & 3 deletions e2e/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["src/**/*.{ts,js,tsx,jsx}"],
"rules": {}
}
],
"extends": ["plugin:playwright/recommended"],
"plugins": ["@nx"]
"extends": ["plugin:playwright/recommended", "../.eslintrc.json"]
}
2 changes: 1 addition & 1 deletion e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$schema": "../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/src",
"implicitDependencies": ["sketch"],
"implicitDependencies": ["demo-app"],
"// targets": "to see all targets run: nx show project e2e --web",
"targets": {}
}
2 changes: 1 addition & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../dist/out-tsc",
Expand Down
31 changes: 5 additions & 26 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
/* eslint-disable */
export default {
displayName: 'sketch',
preset: './jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: './coverage/sketch',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],
};
import { getJestProjectsAsync } from '@nx/jest';

export default async () => ({
projects: await getJestProjectsAsync(),
});
43 changes: 43 additions & 0 deletions libs/sketch/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "sk",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "sk",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
7 changes: 7 additions & 0 deletions libs/sketch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# sketch

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test sketch` to execute the unit tests.
Loading

0 comments on commit ad2d8ea

Please sign in to comment.