Skip to content

Commit

Permalink
feat: up to pnpm 9
Browse files Browse the repository at this point in the history
WIP up mise

WIP format 4 spaces

WIP tst lib

WIP add sub lib

WIP lib no sub

WIP test 2
  • Loading branch information
gipo355 committed Jun 27, 2024
1 parent 1a177d4 commit 6e06d1c
Show file tree
Hide file tree
Showing 41 changed files with 565 additions and 9 deletions.
7 changes: 7 additions & 0 deletions packages/testlibng-nosub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# testlibng-nosub

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

## Running unit tests

Run `nx test testlibng-nosub` to execute the unit tests.
59 changes: 59 additions & 0 deletions packages/testlibng-nosub/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { FlatCompat } = require('@eslint/eslintrc');
const baseConfig = require('../../eslint.config.js');
const js = require('@eslint/js');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});

module.exports = [
...baseConfig,
...compat
.config({
extends: [
'plugin:@nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
],
})
.map((config) => ({
...config,
files: ['**/*.ts'],
rules: {
...config.rules,
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'lib',
style: 'camelCase',
},
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'lib',
style: 'kebab-case',
},
],
},
})),
...compat
.config({ extends: ['plugin:@nx/angular-template'] })
.map((config) => ({
...config,
files: ['**/*.html'],
rules: {
...config.rules,
},
})),
...compat.config({ parser: 'jsonc-eslint-parser' }).map((config) => ({
...config,
files: ['**/*.json'],
rules: {
...config.rules,
'@nx/dependency-checks': 'error',
},
})),
];
22 changes: 22 additions & 0 deletions packages/testlibng-nosub/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'testlibng-nosub',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/packages/testlibng-nosub',
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',
],
};
7 changes: 7 additions & 0 deletions packages/testlibng-nosub/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/packages/testlibng-nosub",
"lib": {
"entryFile": "src/index.ts"
}
}
17 changes: 17 additions & 0 deletions packages/testlibng-nosub/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@gipo355/testlibng-nosub",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^18.0.0",
"@angular/core": "^18.0.0"
},
"exports": {
"./test": {
"types": "./test.d.ts",
"esm2022": "./esm2022/lib/test/test.component.mjs",
"esm": "./esm2022/lib/test/test.component.mjs",
"default": "./fesm2022/lib/test/test.component.mjs"
}
},
"sideEffects": false
}
36 changes: 36 additions & 0 deletions packages/testlibng-nosub/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "testlibng-nosub",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/testlibng-nosub/src",
"prefix": "lib",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/angular:package",
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
"options": {
"project": "packages/testlibng-nosub/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "packages/testlibng-nosub/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "packages/testlibng-nosub/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/testlibng-nosub/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
2 changes: 2 additions & 0 deletions packages/testlibng-nosub/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/testlibng-nosub/testlibng-nosub.component';
export * from './lib/test/test.component';
1 change: 1 addition & 0 deletions packages/testlibng-nosub/src/lib/test/test.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>test works!</p>
Empty file.
21 changes: 21 additions & 0 deletions packages/testlibng-nosub/src/lib/test/test.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TestComponent } from './test.component';

describe('TestComponent', () => {
let component: TestComponent;
let fixture: ComponentFixture<TestComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TestComponent],
}).compileComponents();

fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
11 changes: 11 additions & 0 deletions packages/testlibng-nosub/src/lib/test/test.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
selector: 'lib-test',
standalone: true,
imports: [CommonModule],
templateUrl: './test.component.html',
styleUrl: './test.component.scss',
})
export class TestComponent {}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>testlibng-nosub works!</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TestlibngNosubComponent } from './testlibng-nosub.component';

describe('TestlibngNosubComponent', () => {
let component: TestlibngNosubComponent;
let fixture: ComponentFixture<TestlibngNosubComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TestlibngNosubComponent],
}).compileComponents();

fixture = TestBed.createComponent(TestlibngNosubComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
selector: 'lib-testlibng-nosub',
standalone: true,
imports: [CommonModule],
templateUrl: './testlibng-nosub.component.html',
styleUrl: './testlibng-nosub.component.css',
})
export class TestlibngNosubComponent {}
8 changes: 8 additions & 0 deletions packages/testlibng-nosub/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
29 changes: 29 additions & 0 deletions packages/testlibng-nosub/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "es2022",
"useDefineForClassFields": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
17 changes: 17 additions & 0 deletions packages/testlibng-nosub/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"src/**/*.spec.ts",
"src/test-setup.ts",
"jest.config.ts",
"src/**/*.test.ts"
],
"include": ["src/**/*.ts"]
}
9 changes: 9 additions & 0 deletions packages/testlibng-nosub/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}
16 changes: 16 additions & 0 deletions packages/testlibng-nosub/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"target": "es2016",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
7 changes: 7 additions & 0 deletions packages/testlibng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# testlibng

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

## Running unit tests

Run `nx test testlibng` to execute the unit tests.
59 changes: 59 additions & 0 deletions packages/testlibng/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { FlatCompat } = require('@eslint/eslintrc');
const baseConfig = require('../../eslint.config.js');
const js = require('@eslint/js');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});

module.exports = [
...baseConfig,
...compat
.config({
extends: [
'plugin:@nx/angular',
'plugin:@angular-eslint/template/process-inline-templates',
],
})
.map((config) => ({
...config,
files: ['**/*.ts'],
rules: {
...config.rules,
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'lib',
style: 'camelCase',
},
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'lib',
style: 'kebab-case',
},
],
},
})),
...compat
.config({ extends: ['plugin:@nx/angular-template'] })
.map((config) => ({
...config,
files: ['**/*.html'],
rules: {
...config.rules,
},
})),
...compat.config({ parser: 'jsonc-eslint-parser' }).map((config) => ({
...config,
files: ['**/*.json'],
rules: {
...config.rules,
'@nx/dependency-checks': 'error',
},
})),
];
Loading

0 comments on commit 6e06d1c

Please sign in to comment.