Skip to content

Commit

Permalink
Merge pull request #43 from restorecommerce/feature/scaffold-modules-…
Browse files Browse the repository at this point in the history
…orders-products-invoices-and-fulfillments

Feature/scaffold modules orders products invoices and fulfillments
  • Loading branch information
yosvelquintero authored Mar 28, 2024
2 parents cc08625 + 23b6d70 commit 01d4bbb
Show file tree
Hide file tree
Showing 76 changed files with 1,234 additions and 34 deletions.
50 changes: 50 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,59 @@
"type:types"
]
},
{
"sourceTag": "scope:account",
"onlyDependOnLibsWithTags": ["scope:account", "scope:shared"]
},
{
"sourceTag": "scope:authn",
"onlyDependOnLibsWithTags": ["scope:authn", "scope:shared"]
},
{
"sourceTag": "scope:fulfillment",
"onlyDependOnLibsWithTags": [
"scope:fulfillment",
"scope:shared"
]
},
{
"sourceTag": "scope:home",
"onlyDependOnLibsWithTags": ["scope:home", "scope:shared"]
},
{
"sourceTag": "scope:invoice",
"onlyDependOnLibsWithTags": ["scope:invoice", "scope:shared"]
},
{
"sourceTag": "scope:main",
"onlyDependOnLibsWithTags": [
"scope:main",
"scope:account",
"scope:authn",
"scope:fulfillment",
"scope:home",
"scope:invoice",
"scope:management",
"scope:order",
"scope:product",
"scope:shared"
]
},
{
"sourceTag": "scope:management",
"onlyDependOnLibsWithTags": ["scope:management", "scope:shared"]
},
{
"sourceTag": "scope:order",
"onlyDependOnLibsWithTags": ["scope:order", "scope:shared"]
},
{
"sourceTag": "scope:product",
"onlyDependOnLibsWithTags": ["scope:product", "scope:shared"]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": ["scope:shared"]
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@angular/platform-browser-dynamic": "16.1.5",
"@angular/router": "16.1.5",
"@apollo/client": "^3.7.15",
"@mdi/font": "^7.2.96",
"@mdi/font": "^7.4.47",
"@ngrx/component-store": "16.1.0",
"@ngrx/effects": "16.1.0",
"@ngrx/entity": "16.1.0",
Expand Down
24 changes: 24 additions & 0 deletions packages/core/config/src/lib/constants/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@ export const ROUTER: Readonly<IRouterConstant> = {
},
},
},
order: {
path: 'orders',
link: '/orders',
title: 'Orders',
getLink: () => ['', 'orders'],
},
product: {
path: 'products',
link: '/products',
title: 'Products',
getLink: () => ['', 'products'],
},
invoice: {
path: 'invoices',
link: '/invoices',
title: 'Invoices',
getLink: () => ['', 'invoices'],
},
fulfillment: {
path: 'fulfillments',
link: '/fulfillments',
title: 'Fulfillments',
getLink: () => ['', 'fulfillments'],
},
layout: {
path: 'layout',
link: '/layout',
Expand Down
4 changes: 2 additions & 2 deletions packages/core/state/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"error",
{
"type": "attribute",
"prefix": "lib",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "lib",
"prefix": "app",
"style": "kebab-case"
}
]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/state/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "core-state",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/core/state/src",
"prefix": "lib",
"prefix": "app",
"tags": ["type:state", "scope:shared"],
"projectType": "library",
"targets": {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/types/src/lib/interfaces/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface IRouterConstant {
preferences: IRouterItem;
};
};
order: IRouterItem;
product: IRouterItem;
invoice: IRouterItem;
fulfillment: IRouterItem;
layout: IRouterItem;
overflow: IRouterItem;
management: {
Expand Down
36 changes: 36 additions & 0 deletions packages/modules/fulfillment/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
},
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
]
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions packages/modules/fulfillment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# modules-fulfillment

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

## Running unit tests

Run `nx test modules-fulfillment` to execute the unit tests.
22 changes: 22 additions & 0 deletions packages/modules/fulfillment/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'modules-fulfillment',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/packages/modules/fulfillment',
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/modules/fulfillment/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/modules/fulfillment",
"lib": {
"entryFile": "src/index.ts"
}
}
12 changes: 12 additions & 0 deletions packages/modules/fulfillment/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@console-modules/fulfillment",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^16.1.0",
"@angular/core": "^16.1.0"
},
"dependencies": {
"tslib": "^2.3.0"
},
"sideEffects": false
}
50 changes: 50 additions & 0 deletions packages/modules/fulfillment/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "modules-fulfillment",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/modules/fulfillment/src",
"prefix": "app",
"tags": ["type:feature", "scope:fulfillment"],
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/angular:ng-packagr-lite",
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
"options": {
"project": "packages/modules/fulfillment/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "packages/modules/fulfillment/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "packages/modules/fulfillment/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/modules/fulfillment/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/modules/fulfillment/**/*.ts",
"packages/modules/fulfillment/**/*.html"
]
}
}
}
}
2 changes: 2 additions & 0 deletions packages/modules/fulfillment/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/modules-fulfillment.module';
export * from './lib/lib.routes';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'app-module-fulfillment-index',
template: `
<div>
<p>Fulfillment content</p>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FulfillmentComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'app-module-fulfillment-template',
template: `
<rc-page-layout>
<router-outlet />
</rc-page-layout>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FulfillmentTemplateComponent {}
21 changes: 21 additions & 0 deletions packages/modules/fulfillment/src/lib/lib.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Route } from '@angular/router';

import { ROUTER } from '@console-core/config';

import { FulfillmentComponent } from './components/fulfillment/fulfillment.component';
import { FulfillmentTemplateComponent } from './components/template/fulfillment-template.component';

export const modulesFulfillmentRoutes: Route[] = [
{
path: '',
component: FulfillmentTemplateComponent,
title: ROUTER.pages.main.children.fulfillment.title,
children: [
{
path: '',
pathMatch: 'full',
component: FulfillmentComponent,
},
],
},
];
17 changes: 17 additions & 0 deletions packages/modules/fulfillment/src/lib/modules-fulfillment.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { ModulesSharedModule } from '@console-modules/shared';

import { FulfillmentComponent } from './components/fulfillment/fulfillment.component';
import { FulfillmentTemplateComponent } from './components/template/fulfillment-template.component';
import { modulesFulfillmentRoutes } from './lib.routes';

@NgModule({
declarations: [FulfillmentTemplateComponent, FulfillmentComponent],
imports: [
ModulesSharedModule,
RouterModule.forChild(modulesFulfillmentRoutes),
],
})
export class ModulesFulfillmentModule {}
8 changes: 8 additions & 0 deletions packages/modules/fulfillment/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';
Loading

0 comments on commit 01d4bbb

Please sign in to comment.