Upgrading NX and start fixing styles

This commit is contained in:
Vito Albano
2023-11-14 01:10:57 +00:00
committed by VitoAlbano
parent 63a3b071cd
commit 1d66ed4b92
50 changed files with 1429 additions and 232 deletions

View File

@@ -1,16 +1,13 @@
const rootMain = require('../../../.storybook/main');
module.exports = {
...rootMain,
core: { ...rootMain.core, builder: 'webpack5' },
stories: [
...rootMain.stories,
'../**/*.stories.@(js|jsx|ts|tsx)'
],
staticDirs: [
...rootMain.staticDirs,
{ from: __dirname + '/../src/lib/i18n', to: 'assets/adf-core/i18n' },
{ from: __dirname + '/../src/lib/assets/images', to: 'assets/images' }
],
addons: [...rootMain.addons ]
...rootMain,
core: { ...rootMain.core, builder: 'webpack5' },
stories: [...rootMain.stories, '../**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: [
...rootMain.staticDirs,
{ from: __dirname + '/../src/lib/i18n', to: 'assets/adf-core/i18n' },
{ from: __dirname + '/../src/lib/assets/images', to: 'assets/images' }
],
addons: ['@storybook/addon-essentials', ...rootMain.addons]
};

150
lib/core/project.json Normal file
View File

@@ -0,0 +1,150 @@
{
"name": "core",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "lib/core",
"prefix": "adf",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/core/tsconfig.lib.json",
"project": "lib/core/ng-package.json"
},
"dependsOn": ["^build", "license"],
"configurations": {
"production": {
"project": "lib/core/ng-package.json",
"tsConfig": "lib/core/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "lib/core/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"executor": "@angular-devkit/build-angular:karma",
"options": {
"main": "lib/core/test.ts",
"tsConfig": "lib/core/tsconfig.spec.json",
"karmaConfig": "lib/core/karma.conf.js",
"sourceMap": true,
"codeCoverage": true,
"stylePreprocessorOptions": {
"includePaths": ["lib", "lib/core/src/lib"]
},
"styles": ["demo-shell/src/styles.scss"]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"lib/core/**/*.ts",
"lib/core/**/*.html",
"lib/core/api/**/*.ts",
"lib/core/api/**/*.html",
"lib/core/auth/**/*.ts",
"lib/core/auth/**/*.html",
"lib/core/shell/**/*.ts",
"lib/core/shell/**/*.html",
"lib/core/breadcrumbs/**/*.ts",
"lib/core/breadcrumbs/**/*.html"
]
}
},
"storybook": {
"executor": "@storybook/angular:start-storybook",
"options": {
"port": 4400,
"browserTarget": "core:storybook",
"configDir": "lib/core/.storybook",
"compodoc": false,
"styles": [
"demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css",
"node_modules/pdfjs-dist/web/pdf_viewer.css"
],
"stylePreprocessorOptions": {
"includePaths": ["lib", "lib/core/src/lib"]
}
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"build-storybook": {
"executor": "@storybook/angular:build-storybook",
"options": {
"browserTarget": "core:build-storybook",
"configDir": "lib/core/.storybook",
"outputDir": "dist/storybook/core",
"compodoc": false,
"styles": [
"demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css",
"node_modules/pdfjs-dist/web/pdf_viewer.css"
],
"stylePreprocessorOptions": {
"includePaths": ["lib", "lib/core/src/lib"]
}
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"stylelint": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx stylelint lib/core/**/*.scss --config stylelint-config.json"
}
]
}
},
"license": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx license-checker --production --failOn 'GPL;GPL-2.0' > licenses.txt"
}
]
}
},
"pretheme": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "npx webpack -- --config ./lib/config/webpack.style.js --progress --profile --bail"
}
]
}
},
"npm-publish": {
"executor": "nx:run-commands",
"dependsOn": ["build"],
"options": {
"cwd": "dist/libs/core",
"commands": [
{
"command": "npm publish --tag {args.tag}",
"forwardAllArgs": true
}
],
"stylePreprocessorOptions": {
"includePaths": ["lib", "lib/core/src/lib"]
}
}
}
}
}

View File

@@ -79,11 +79,8 @@
<mat-form-field *ngIf="isEditable"
class="adf-property-field adf-textitem-chip-list-input"
[ngClass]="{ 'adf-property-read-only': !isEditable }"
[floatLabel]="'never'"
>
<input
matInput
[ngClass]="{ 'adf-property-read-only': !isEditable }">
<input matInput
class="adf-property-value"
[ngClass]="{
'adf-property-value-editable': editable,
@@ -107,8 +104,7 @@
[ngClass]="{ 'adf-property-read-only': !isEditable }"
[attr.data-automation-id]="'card-textitem-toggle-' + property.key"
(click)="clicked()">
<mat-form-field class="adf-property-field adf-card-textitem-field"
[floatLabel]="'never'">
<mat-form-field class="adf-property-field adf-card-textitem-field">
<mat-label *ngIf="showProperty || isEditable" [attr.data-automation-id]="'card-textitem-label-' + property.key" class="adf-property-label">
{{ property.label | translate }}
</mat-label>

View File

@@ -15,6 +15,4 @@ $alfresco-typography: mat.define-typography-config(
$caption: mat.define-typography-level(12px, 20px, 400),
$button: mat.define-typography-level(14px, 14px, 500),
// Line-height must be unit-less fraction of the font-size.
$in/* TODO(mdc-migration): No longer supported. Use `body-1` instead. put: mat.define-typography-level(16px, 1.25, 400)
);
*/

View File

@@ -18,22 +18,9 @@
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(), {
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
});

View File

@@ -12,7 +12,9 @@
"@alfresco/adf-core/api": ["../api/src/index.ts"],
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
}
},
"target": "ES2022",
"useDefineForClassFields": false
},
"exclude": ["./test.ts", "**/*.spec.ts", "**/*.test.ts"],
"include": ["**/*.ts"]

View File

@@ -1,7 +1,9 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
"declarationMap": false,
"target": "ES2022",
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"compilationMode": "partial"

View File

@@ -1,7 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc"
"outDir": "../../dist/out-tsc",
"target": "ES2022",
"useDefineForClassFields": false
},
"files": ["./test.ts"],
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]