refactor: recreate angular module template

pull/4457/head
mehmet-erim 5 years ago
parent a78702de40
commit e7f33bc56c

@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

@ -11,8 +11,8 @@
/node_modules
# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
/.idea
@ -45,4 +45,4 @@ testem.log
.DS_Store
Thumbs.db
yarn.lock*
yarn.lock

@ -1,5 +0,0 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}

@ -1 +1,27 @@
# MyProjectName
# MyProjectName
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.9.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

@ -3,28 +3,68 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"myProjectName": {
"my-project-name": {
"projectType": "library",
"root": "projects/my-project-name",
"sourceRoot": "projects/my-project-name/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/my-project-name/tsconfig.lib.json",
"project": "projects/my-project-name/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/my-project-name/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/my-project-name/src/test.ts",
"tsConfig": "projects/my-project-name/tsconfig.spec.json",
"karmaConfig": "projects/my-project-name/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/my-project-name/tsconfig.lib.json",
"projects/my-project-name/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
}
}
}
},
"dev-app": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"root": "projects/dev-app",
"sourceRoot": "projects/dev-app/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/myProjectName",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"outputPath": "dist/dev-app",
"index": "projects/dev-app/src/index.html",
"main": "projects/dev-app/src/main.ts",
"polyfills": "projects/dev-app/src/polyfills.ts",
"tsConfig": "projects/dev-app/tsconfig.app.json",
"aot": true,
"extractCss": true,
"assets": ["src/favicon.ico", "src/assets"],
"assets": [
"projects/dev-app/src/favicon.ico",
"projects/dev-app/src/assets"
],
"styles": [
{
"input": "node_modules/@abp/ng.theme.shared/styles/bootstrap-rtl.min.css",
@ -61,16 +101,17 @@
"inject": true,
"bundleName": "ngx-datatable-material"
},
"src/styles.scss"
"projects/dev-app/src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"tsConfig": "projects/dev-app/tsconfig.prod.json",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"replace": "projects/dev-app/src/environments/environment.ts",
"with": "projects/dev-app/src/environments/environment.prod.ts"
}
],
"optimization": true,
@ -89,7 +130,8 @@
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
@ -98,149 +140,63 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "myProjectName:build"
"browserTarget": "dev-app:build"
},
"configurations": {
"production": {
"browserTarget": "myProjectName:build:production"
"browserTarget": "dev-app:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "myProjectName:build"
"browserTarget": "dev-app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
{
"input": "node_modules/bootstrap/dist/css/bootstrap.min.css",
"inject": true,
"bundleName": "bootstrap.min"
},
"src/styles.scss",
{
"input": "node_modules/@fortawesome/fontawesome-free/css/all.min.css",
"inject": false,
"bundleName": "fontawesome-all.min"
},
{
"input": "node_modules/@fortawesome/fontawesome-free/css/v4-shims.min.css",
"inject": false,
"bundleName": "fontawesome-v4-shims.min"
}
"main": "projects/dev-app/src/test.ts",
"polyfills": "projects/dev-app/src/polyfills.ts",
"tsConfig": "projects/dev-app/tsconfig.spec.json",
"karmaConfig": "projects/dev-app/karma.conf.js",
"assets": [
"projects/dev-app/src/favicon.ico",
"projects/dev-app/src/assets"
],
"styles": ["projects/dev-app/src/styles.scss"],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"tsConfig": [
"projects/dev-app/tsconfig.app.json",
"projects/dev-app/tsconfig.spec.json",
"projects/dev-app/e2e/tsconfig.json"
],
"exclude": ["**/node_modules/**"]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "myProjectName:serve"
"protractorConfig": "projects/dev-app/e2e/protractor.conf.js",
"devServerTarget": "dev-app:serve"
},
"configurations": {
"production": {
"devServerTarget": "myProjectName:serve:production"
"devServerTarget": "dev-app:serve:production"
}
}
}
}
},
"my-project-name": {
"projectType": "library",
"root": "projects/my-project-name",
"sourceRoot": "projects/my-project-name/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/my-project-name/tsconfig.lib.json",
"project": "projects/my-project-name/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/my-project-name/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/my-project-name/src/test.ts",
"tsConfig": "projects/my-project-name/tsconfig.spec.json",
"karmaConfig": "projects/my-project-name/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/my-project-name/tsconfig.lib.json",
"projects/my-project-name/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
}
}
}
},
"my-project-name-config": {
"projectType": "library",
"root": "projects/my-project-name-config",
"sourceRoot": "projects/my-project-name-config/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/my-project-name-config/tsconfig.lib.json",
"project": "projects/my-project-name-config/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/my-project-name-config/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/my-project-name-config/src/test.ts",
"tsConfig": "projects/my-project-name-config/tsconfig.spec.json",
"karmaConfig": "projects/my-project-name-config/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/my-project-name-config/tsconfig.lib.json",
"projects/my-project-name-config/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"defaultProject": "myProjectName",
"cli": {
"analytics": false
}
},
"defaultProject": "dev-app"
}

@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}

@ -1,57 +1,51 @@
{
"name": "MyProjectName",
"name": "my-project-name",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start:hmr": "ng serve --open",
"build": "ng build",
"start": "ng serve dev-app --open",
"build": "ng build my-project-name --prod",
"build:app": "ng build dev-app --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@abp/ng.account": "~2.9.0",
"@abp/ng.identity": "~2.9.0",
"@abp/ng.setting-management": "~2.9.0",
"@abp/ng.tenant-management": "~2.9.0",
"@abp/ng.theme.basic": "~2.9.0",
"@angular/animations": "~9.1.2",
"@angular/common": "~9.1.2",
"@angular/compiler": "~9.1.2",
"@angular/core": "~9.1.2",
"@angular/forms": "~9.1.2",
"@angular/platform-browser": "~9.1.2",
"@angular/platform-browser-dynamic": "~9.1.2",
"@angular/router": "~9.1.2",
"rxjs": "~6.5.5",
"@angular/animations": "~9.1.11",
"@angular/common": "~9.1.11",
"@angular/compiler": "~9.1.11",
"@angular/core": "~9.1.11",
"@angular/forms": "~9.1.11",
"@angular/platform-browser": "~9.1.11",
"@angular/platform-browser-dynamic": "~9.1.11",
"@angular/router": "~9.1.11",
"@abp/ng.theme.shared": "~2.9.1",
"@swimlane/ngx-datatable": "^17.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.1",
"@angular-devkit/build-ng-packagr": "~0.901.1",
"@angular/cli": "~9.1.1",
"@angular/compiler-cli": "~9.1.2",
"@angular/language-service": "~9.1.2",
"@ngxs/logger-plugin": "^3.5.1",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@angular-devkit/build-angular": "~0.901.9",
"@angular-devkit/build-ng-packagr": "~0.901.9",
"@angular/cli": "~9.1.9",
"@angular/compiler-cli": "~9.1.11",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.4.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"ng-packagr": "^9.0.0",
"ngxs-schematic": "^1.1.9",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
}
}

@ -13,7 +13,7 @@ exports.config = {
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',

@ -10,7 +10,7 @@ describe('workspace-project App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to myProjectName!');
expect(page.getTitleText()).toEqual('dev-app app is running!');
});
afterEach(async () => {

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl) as Promise<unknown>;
}
getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}

@ -1,7 +1,7 @@
{
"extends": "../tsconfig.json",
"extends": "../../../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"outDir": "../../../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

@ -16,7 +16,7 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/myProjectName'),
dir: require('path').join(__dirname, '../../coverage/dev-app'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},

@ -0,0 +1,57 @@
import { ABP, DynamicLayoutComponent } from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
component: DynamicLayoutComponent,
children: [
{
path: '',
pathMatch: 'full',
loadChildren: () =>
import('./home/home.module').then((m) => m.HomeModule),
},
{
path: 'account',
loadChildren: () =>
import('@abp/ng.account').then((m) =>
m.AccountModule.forLazy({ redirectUrl: '/' })
),
},
{
path: 'identity',
loadChildren: () =>
import('@abp/ng.identity').then((m) => m.IdentityModule.forLazy()),
},
{
path: 'tenant-management',
loadChildren: () =>
import('@abp/ng.tenant-management').then((m) =>
m.TenantManagementModule.forLazy()
),
},
{
path: 'setting-management',
loadChildren: () =>
import('@abp/ng.setting-management').then((m) =>
m.SettingManagementModule.forLazy()
),
},
{
path: 'my-project-name',
loadChildren: () =>
import('@my-company-name/my-project-name').then((m) =>
m.MyProjectNameModule.forLazy()
),
},
],
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}

@ -1,44 +1,41 @@
import { AccountConfigModule } from '@abp/ng.account.config';
import { AccountConfigModule } from '@abp/ng.account/config';
import { CoreModule } from '@abp/ng.core';
import { IdentityConfigModule } from '@abp/ng.identity.config';
import { SettingManagementConfigModule } from '@abp/ng.setting-management.config';
import { TenantManagementConfigModule } from '@abp/ng.tenant-management.config';
import { IdentityConfigModule } from '@abp/ng.identity/config';
import { SettingManagementConfigModule } from '@abp/ng.setting-management/config';
import { TenantManagementConfigModule } from '@abp/ng.tenant-management/config';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin';
import { MyProjectNameConfigModule } from '@my-company-name/my-project-name/config';
import { NgxsModule } from '@ngxs/store';
import { OAuthModule } from 'angular-oauth2-oidc';
import { MyProjectNameConfigModule } from '../../projects/my-project-name-config/src/public-api';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { APP_ROUTE_PROVIDER } from './route.provider';
import { SharedModule } from './shared/shared.module';
const LOGGERS = [NgxsLoggerPluginModule.forRoot({ disabled: false })];
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
ThemeSharedModule.forRoot(),
CoreModule.forRoot({
environment,
sendNullsAsQueryParam: false,
skipGetAppConfiguration: false,
}),
OAuthModule.forRoot(),
NgxsModule.forRoot([]),
AccountConfigModule.forRoot({ redirectUrl: '/' }),
IdentityConfigModule,
TenantManagementConfigModule,
SettingManagementConfigModule,
MyProjectNameConfigModule,
ThemeSharedModule.forRoot(),
AccountConfigModule.forRoot(),
IdentityConfigModule.forRoot(),
MyProjectNameConfigModule.forRoot(),
TenantManagementConfigModule.forRoot(),
SettingManagementConfigModule.forRoot(),
NgxsModule.forRoot(),
SharedModule,
...(environment.production ? [] : LOGGERS),
],
providers: [APP_ROUTE_PROVIDER],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}

@ -1,12 +1,10 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home.component';
import { ApplicationLayoutComponent } from '@abp/ng.theme.basic';
const routes: Routes = [
{
path: '',
component: ApplicationLayoutComponent,
children: [{ path: '', component: HomeComponent }],
},
];

@ -0,0 +1,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
})
export class HomeComponent {}

@ -0,0 +1,25 @@
import { RoutesService, eLayoutType } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';
export const APP_ROUTE_PROVIDER = [
{
provide: APP_INITIALIZER,
useFactory: configureRoutes,
deps: [RoutesService],
multi: true,
},
];
function configureRoutes(routes: RoutesService) {
return () => {
routes.add([
{
path: '/',
name: 'Home',
iconClass: 'fas fa-home',
order: 1,
layout: eLayoutType.application,
},
]);
};
}

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DevApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>

@ -8,6 +8,5 @@ if (environment.production) {
enableProdMode();
}
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

@ -0,0 +1 @@
/* You can add global styles to this file, and also import other style files */

@ -1,6 +1,5 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
@ -8,7 +7,12 @@ import {
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(

@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}

@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.prod.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"types": []
},
"files": ["src/main.ts", "src/polyfills.ts"],
"include": ["src/**/*.d.ts"]
}

@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"

@ -4,13 +4,13 @@
"directive-selector": [
true,
"attribute",
"lib",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"app",
"kebab-case"
]
}

@ -1,32 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/my-project-name-config'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -1,7 +0,0 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/my-project-name-config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -1,7 +0,0 @@
{
"name": "my-project-name.config",
"version": "0.0.1",
"peerDependencies": {
"@abp/ng.core": "~2.9.0"
}
}

@ -1,9 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'my-project-name-settings',
template: `
<h3>MyProjectName Settings</h3>
`,
})
export class MyProjectNameSettingsComponent {}

@ -1,12 +0,0 @@
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { MyProjectNameConfigService } from './services/my-project-name-config.service';
import { noop } from '@abp/ng.core';
import { MyProjectNameSettingsComponent } from './components/my-project-name-settings.component';
@NgModule({
declarations: [MyProjectNameSettingsComponent],
providers: [{ provide: APP_INITIALIZER, deps: [MyProjectNameConfigService], multi: true, useFactory: noop }],
exports: [MyProjectNameSettingsComponent],
entryComponents: [MyProjectNameSettingsComponent],
})
export class MyProjectNameConfigModule {}

@ -1,25 +0,0 @@
import { Injectable } from '@angular/core';
import { eLayoutType, addAbpRoutes, ABP } from '@abp/ng.core';
import { addSettingTab } from '@abp/ng.theme.shared';
import { MyProjectNameSettingsComponent } from '../components/my-project-name-settings.component';
@Injectable({
providedIn: 'root',
})
export class MyProjectNameConfigService {
constructor() {
addAbpRoutes({
name: 'MyProjectName',
path: 'my-project-name',
layout: eLayoutType.application,
order: 2,
} as ABP.FullRoute);
const route = addSettingTab({
component: MyProjectNameSettingsComponent,
name: 'MyProjectName Settings',
order: 1,
requiredPolicy: '',
});
}
}

@ -1,3 +0,0 @@
export * from './lib/components/my-project-name-settings.component';
export * from './lib/services/my-project-name-config.service';
export * from './lib/my-project-name-config.module';

@ -1,25 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

@ -1,6 +0,0 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

@ -1,17 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -1 +1,24 @@
# MyProjectName
# MyProjectName
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.11.
## Code scaffolding
Run `ng generate component component-name --project my-project-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-project-name`.
> Note: Don't forget to add `--project my-project-name` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build my-project-name` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build my-project-name`, go to the dist folder `cd dist/my-project-name` and run `npm publish`.
## Running unit tests
Run `ng test my-project-name` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

@ -0,0 +1,7 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/my-project-name/config",
"lib": {
"entryFile": "src/public-api.ts"
}
}

@ -0,0 +1,3 @@
export const enum eMyProjectNameRouteNames {
MyProjectName = 'MyProjectName',
}

@ -0,0 +1,12 @@
import { ModuleWithProviders, NgModule } from '@angular/core';
import { MY_PROJECT_NAME_ROUTE_PROVIDERS } from './providers/route.provider';
@NgModule()
export class MyProjectNameConfigModule {
static forRoot(): ModuleWithProviders<MyProjectNameConfigModule> {
return {
ngModule: MyProjectNameConfigModule,
providers: [MY_PROJECT_NAME_ROUTE_PROVIDERS],
};
}
}

@ -0,0 +1,28 @@
import { eLayoutType, RoutesService } from '@abp/ng.core';
import { eThemeSharedRouteNames } from '@abp/ng.theme.shared';
import { APP_INITIALIZER } from '@angular/core';
import { eMyProjectNameRouteNames } from '../enums/route-names';
export const MY_PROJECT_NAME_ROUTE_PROVIDERS = [
{
provide: APP_INITIALIZER,
useFactory: configureRoutes,
deps: [RoutesService],
multi: true,
},
];
export function configureRoutes(routes: RoutesService) {
return () => {
routes.add([
{
path: '/my-project-name',
name: eMyProjectNameRouteNames.MyProjectName,
parentName: eThemeSharedRouteNames.Administration,
iconClass: 'fas fa-book',
layout: eLayoutType.application,
order: 3,
},
]);
};
}

@ -0,0 +1,3 @@
export * from './enums';
export * from './my-project-name-config.module';
export * from './providers';

@ -3,6 +3,5 @@
"dest": "../../dist/my-project-name",
"lib": {
"entryFile": "src/public-api.ts"
},
"whitelistedNonPeerDependencies": ["@abp/ng.theme.shared", "my-project-name.config"]
}
}
}

@ -1,8 +1,13 @@
{
"name": "my-project-name",
"version": "0.0.1",
"peerDependencies": {
"@angular/common": "^9.1.11",
"@angular/core": "^9.1.11",
"@abp/ng.core": ">=3.0.0",
"@abp/ng.theme.shared": ">=3.0.0"
},
"dependencies": {
"@abp/ng.theme.shared": "~2.9.0",
"my-project-name.config": "^0.0.1"
"tslib": "^1.10.0"
}
}

@ -7,13 +7,14 @@ import { Component, OnInit } from '@angular/core';
my-project-name works!
</p>
`,
styles: []
styles: [
]
})
export class MyProjectNameComponent implements OnInit {
constructor() { }
ngOnInit() {
ngOnInit(): void {
}
}

@ -1,31 +1,14 @@
import {
AuthGuard,
DynamicLayoutComponent,
PermissionGuard,
ReplaceableComponents,
ReplaceableRouteContainerComponent,
} from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DynamicLayoutComponent } from '@abp/ng.core';
import { Routes, RouterModule } from '@angular/router';
import { MyProjectNameComponent } from './components/my-project-name.component';
const routes: Routes = [
{
path: '',
component: DynamicLayoutComponent,
canActivate: [AuthGuard, PermissionGuard],
children: [
{
path: '',
component: ReplaceableRouteContainerComponent,
data: {
requiredPolicy: '',
replaceableComponent: {
defaultComponent: MyProjectNameComponent,
key: 'MyProjectName.MyProjectNameComponent',
} as ReplaceableComponents.RouteData<MyProjectNameComponent>,
},
},
{ path: '', pathMatch: 'full', component: MyProjectNameComponent },
],
},
];

@ -8,8 +8,9 @@ describe('MyProjectNameComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyProjectNameComponent],
}).compileComponents();
declarations: [ MyProjectNameComponent ]
})
.compileComponents();
}));
beforeEach(() => {

@ -1,12 +1,23 @@
import { NgModule } from '@angular/core';
import { NgModule, NgModuleFactory, ModuleWithProviders } from '@angular/core';
import { CoreModule, LazyModuleFactory } from '@abp/ng.core';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { MyProjectNameComponent } from './components/my-project-name.component';
import { MyProjectNameRoutingModule } from './my-project-name-routing.module';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { CoreModule } from '@abp/ng.core';
@NgModule({
declarations: [MyProjectNameComponent],
imports: [CoreModule, ThemeSharedModule, MyProjectNameRoutingModule],
exports: [MyProjectNameComponent],
})
export class MyProjectNameModule {}
export class MyProjectNameModule {
static forChild(): ModuleWithProviders<MyProjectNameModule> {
return {
ngModule: MyProjectNameModule,
providers: [],
};
}
static forLazy(): NgModuleFactory<MyProjectNameModule> {
return new LazyModuleFactory(MyProjectNameModule.forChild());
}
}

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MyProjectNameService } from './my-project-name.service';
describe('MyProjectNameService', () => {
let service: MyProjectNameService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MyProjectNameService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class MyProjectNameService {
constructor() { }
}

@ -1,2 +1,7 @@
/*
* Public API Surface of my-project-name
*/
export * from './lib/components/my-project-name.component';
export * from './lib/services/my-project-name.service';
export * from './lib/my-project-name.module';

@ -8,7 +8,12 @@ import {
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(

@ -1,25 +1,17 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.prod.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
"exclude": ["src/test.ts", "**/*.spec.ts"]
}

@ -3,4 +3,4 @@
"angularCompilerOptions": {
"enableIvy": false
}
}
}

@ -1,51 +0,0 @@
import { ABP } from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
data: {
routes: {
name: 'Home',
order: 1,
} as ABP.Route,
},
},
{
path: 'account',
loadChildren: () =>
import('./lazy-libs/account-wrapper.module').then(m => m.AccountWrapperModule),
},
{
path: 'identity',
loadChildren: () =>
import('./lazy-libs/identity-wrapper.module').then(m => m.IdentityWrapperModule),
},
{
path: 'tenant-management',
loadChildren: () =>
import('./lazy-libs/tenant-management-wrapper.module').then(
m => m.TenantManagementWrapperModule,
),
},
{
path: 'setting-management',
loadChildren: () =>
import('./lazy-libs/setting-management-wrapper.module').then(
m => m.SettingManagementWrapperModule,
),
},
{
path: 'my-project-name',
loadChildren: () =>
import('./lazy-libs/my-project-name-wrapper.module').then(m => m.MyProjectNameWrapperModule),
},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}

@ -1,6 +0,0 @@
<div id="AbpContentToolbar"></div>
<div class="row">
<a routerLink="/account/login" [state]="{ redirectUrl: '/' }" role="button">
{{ '::Login' | abpLocalization }}</a
>
</div>

@ -1,14 +0,0 @@
import { Component } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
})
export class HomeComponent {
get hasLoggedIn(): boolean {
return this.oAuthService.hasValidAccessToken();
}
constructor(private oAuthService: OAuthService) {}
}

@ -1,7 +0,0 @@
import { NgModule } from '@angular/core';
import { AccountModule } from '@abp/ng.account';
@NgModule({
imports: [AccountModule],
})
export class AccountWrapperModule {}

@ -1,7 +0,0 @@
import { NgModule } from '@angular/core';
import { IdentityModule } from '@abp/ng.identity';
@NgModule({
imports: [IdentityModule],
})
export class IdentityWrapperModule {}

@ -1,7 +0,0 @@
import { NgModule } from '@angular/core';
import { MyProjectNameModule } from '../../../projects/my-project-name/src/public-api';
@NgModule({
imports: [MyProjectNameModule],
})
export class MyProjectNameWrapperModule {}

@ -1,7 +0,0 @@
import { NgModule } from '@angular/core';
import { SettingManagementModule } from '@abp/ng.setting-management';
@NgModule({
imports: [SettingManagementModule],
})
export class SettingManagementWrapperModule {}

@ -1,7 +0,0 @@
import { NgModule } from '@angular/core';
import { TenantManagementModule } from '@abp/ng.tenant-management';
@NgModule({
imports: [TenantManagementModule],
})
export class TenantManagementWrapperModule {}

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>MyProjectName</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body class="bg-light">
<app-root>
<div class="donut centered"></div>
</app-root>
</body>
</html>

@ -1,27 +0,0 @@
/* You can add global styles to this file, and also import other style files */
@keyframes donut-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.donut {
display: inline-block;
border: 4px solid rgba(0, 0, 0, 0.1);
border-left-color: #7983ff;
border-radius: 50%;
width: 30px;
height: 30px;
animation: donut-spin 1.2s linear infinite;
&.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
}

@ -1,20 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -1,12 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": ["node"]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": ["src/**/*.d.ts"]
}

@ -1,37 +1,13 @@
{
"compileOnSave": false,
"extends": "./tsconfig.prod.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"my-project-name": [
"dist/my-project-name"
"@my-company-name/my-project-name": [
"projects/my-project-name/src/public-api.ts"
],
"my-project-name/*": [
"dist/my-project-name/*"
],
"my-project-name-config": [
"dist/my-project-name-config"
],
"my-project-name-config/*": [
"dist/my-project-name-config/*"
"@my-company-name/my-project-name/config": [
"projects/my-project-name/config/src/public-api.ts"
]
}
}
}
}

@ -0,0 +1,20 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"lib": ["es2018", "dom"]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}

@ -1,37 +1,37 @@
{
"extends": "tslint:recommended",
"rulesDirectory": [
"codelyzer"
],
"rules": {
"align": {
"options": [
"parameters",
"statements"
]
},
"array-type": false,
"arrow-parens": false,
"arrow-return-shorthand": true,
"curly": true,
"deprecation": {
"severity": "warn"
"severity": "warning"
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"eofline": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"import-spacing": true,
"indent": {
"options": [
"spaces"
]
},
"max-classes-per-file": false,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
@ -43,7 +43,6 @@
]
}
],
"no-consecutive-blank-lines": false,
"no-console": [
true,
"debug",
@ -60,19 +59,67 @@
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-use-before-declare": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"trailing-comma": false,
"semicolon": {
"options": [
"always"
]
},
"space-before-function-paren": {
"options": {
"anonymous": "never",
"asyncArrow": "always",
"constructor": "never",
"method": "never",
"named": "never"
}
},
"typedef-whitespace": {
"options": [
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
]
},
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-pascal-case"
]
},
"whitespace": {
"options": [
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type",
"check-typecast"
]
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
@ -85,8 +132,5 @@
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true
},
"rulesDirectory": [
"codelyzer"
]
}
}
}

Loading…
Cancel
Save