mirror of
https://github.com/nestjs/docs.nestjs.com.git
synced 2026-02-21 20:31:32 +00:00
chore(deps): upgrade to eslint v9
This commit is contained in:
193
.eslintrc.js
193
.eslintrc.js
@@ -1,193 +0,0 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "tsconfig.json",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@angular-eslint/eslint-plugin",
|
||||
"@typescript-eslint",
|
||||
"@typescript-eslint/tslint"
|
||||
],
|
||||
"extends": [
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
],
|
||||
"rules": {
|
||||
"@angular-eslint/component-class-suffix": "error",
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": "app",
|
||||
"style": "kebab-case"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/directive-class-suffix": "error",
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "app",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/no-host-metadata-property": "error",
|
||||
"@angular-eslint/no-input-rename": "error",
|
||||
"@angular-eslint/no-inputs-metadata-property": "error",
|
||||
"@angular-eslint/no-output-rename": "error",
|
||||
"@angular-eslint/no-outputs-metadata-property": "error",
|
||||
"@angular-eslint/use-lifecycle-interface": "error",
|
||||
"@angular-eslint/use-pipe-transform-interface": "error",
|
||||
"@typescript-eslint/consistent-type-definitions": "error",
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"off",
|
||||
{
|
||||
"accessibility": "explicit"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/indent": "error",
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"error",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": true
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/member-ordering": "off",
|
||||
"@typescript-eslint/naming-convention": "error",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-inferrable-types": [
|
||||
"error",
|
||||
{
|
||||
"ignoreParameters": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-shadow": [
|
||||
"error",
|
||||
{
|
||||
"hoist": "all"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-unused-expressions": "off",
|
||||
"@typescript-eslint/prefer-function-type": "error",
|
||||
"@typescript-eslint/quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"@typescript-eslint/semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unified-signatures": "error",
|
||||
"arrow-body-style": "error",
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs"
|
||||
],
|
||||
"constructor-super": "error",
|
||||
"curly": "error",
|
||||
"dot-notation": "off",
|
||||
"eol-last": "off",
|
||||
"eqeqeq": [
|
||||
"error",
|
||||
"smart"
|
||||
],
|
||||
"guard-for-in": "error",
|
||||
"id-blacklist": "off",
|
||||
"id-match": "off",
|
||||
"indent": "error",
|
||||
"max-len": [
|
||||
"error",
|
||||
{
|
||||
"code": 140
|
||||
}
|
||||
],
|
||||
"no-bitwise": "error",
|
||||
"no-caller": "error",
|
||||
"no-console": [
|
||||
"error",
|
||||
{
|
||||
"allow": [
|
||||
"log",
|
||||
"warn",
|
||||
"dir",
|
||||
"timeLog",
|
||||
"assert",
|
||||
"clear",
|
||||
"count",
|
||||
"countReset",
|
||||
"group",
|
||||
"groupEnd",
|
||||
"table",
|
||||
"dirxml",
|
||||
"error",
|
||||
"groupCollapsed",
|
||||
"Console",
|
||||
"profile",
|
||||
"profileEnd",
|
||||
"timeStamp",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-debugger": "error",
|
||||
"no-empty": "off",
|
||||
"no-empty-function": "off",
|
||||
"no-eval": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-shadow": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-labels": "error",
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"quotes": "error",
|
||||
"radix": "error",
|
||||
"semi": "error",
|
||||
"spaced-comment": [
|
||||
"error",
|
||||
"always",
|
||||
{
|
||||
"markers": [
|
||||
"/"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid-typeof": "error",
|
||||
"@typescript-eslint/tslint/config": [
|
||||
"error",
|
||||
{
|
||||
"rules": {
|
||||
"import-spacing": true,
|
||||
"invoke-injectable": true,
|
||||
"no-access-missing-member": true,
|
||||
"templates-use-public": true,
|
||||
"whitespace": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx --no-install commitlint --edit $1
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx --no-install lint-staged
|
||||
61
eslint.config.js
Normal file
61
eslint.config.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// @ts-check
|
||||
const eslint = require('@eslint/js');
|
||||
const tseslint = require('typescript-eslint');
|
||||
const angular = require('angular-eslint');
|
||||
|
||||
module.exports = tseslint.config(
|
||||
{
|
||||
// Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc)
|
||||
files: ['**/*.ts'],
|
||||
extends: [
|
||||
// Apply the recommended core rules
|
||||
eslint.configs.recommended,
|
||||
// Apply the recommended TypeScript rules
|
||||
...tseslint.configs.recommended,
|
||||
// Optionally apply stylistic rules from typescript-eslint that improve code consistency
|
||||
...tseslint.configs.stylistic,
|
||||
// Apply the recommended Angular rules
|
||||
...angular.configs.tsRecommended,
|
||||
],
|
||||
// Set the custom processor which will allow us to have our inline Component templates extracted
|
||||
// and treated as if they are HTML files (and therefore have the .html config below applied to them)
|
||||
processor: angular.processInlineTemplates,
|
||||
// Override specific rules for TypeScript files (these will take priority over the extended configs above)
|
||||
rules: {
|
||||
'@angular-eslint/directive-selector': [
|
||||
'error',
|
||||
{
|
||||
type: 'attribute',
|
||||
prefix: 'app',
|
||||
style: 'camelCase',
|
||||
},
|
||||
],
|
||||
'@angular-eslint/component-selector': [
|
||||
'error',
|
||||
{
|
||||
type: 'element',
|
||||
prefix: 'app',
|
||||
style: 'kebab-case',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
// Everything in this config object targets our HTML files (external templates,
|
||||
// and inline templates as long as we have the `processor` set on our TypeScript config above)
|
||||
files: ['**/*.html'],
|
||||
extends: [
|
||||
// Apply the recommended Angular template rules
|
||||
...angular.configs.templateRecommended,
|
||||
// Apply the Angular template rules which focus on accessibility of our apps
|
||||
...angular.configs.templateAccessibility,
|
||||
],
|
||||
rules: {},
|
||||
},
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
},
|
||||
},
|
||||
);
|
||||
995
package-lock.json
generated
995
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@
|
||||
"e2e": "ng e2e",
|
||||
"docs": "npm run docs-only",
|
||||
"docs-only": "ts-node -P tools/tsconfig.json tools/dgeni-cli.ts tools/transforms/nestjs-package/index",
|
||||
"prepare": "husky install"
|
||||
"prepare": "husky"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{ts,json}": []
|
||||
@@ -46,12 +46,13 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "18.2.9",
|
||||
"@angular-eslint/eslint-plugin": "16.0.3",
|
||||
"@angular-eslint/eslint-plugin": "18.3.1",
|
||||
"@angular/cli": "18.2.9",
|
||||
"@angular/compiler-cli": "18.2.8",
|
||||
"@angular/language-service": "18.2.8",
|
||||
"@commitlint/cli": "19.5.0",
|
||||
"@commitlint/config-angular": "19.5.0",
|
||||
"@eslint/js": "^9.12.0",
|
||||
"@types/jasmine": "5.1.4",
|
||||
"@types/jasminewd2": "2.0.10",
|
||||
"@types/lodash": "4.14.195",
|
||||
@@ -59,10 +60,12 @@
|
||||
"@types/node": "20.3.1",
|
||||
"@types/prismjs": "1.26.0",
|
||||
"@types/rimraf": "4.0.5",
|
||||
"angular-eslint": "^18.3.1",
|
||||
"chokidar": "4.0.1",
|
||||
"concurrently": "9.0.1",
|
||||
"dgeni": "0.4.14",
|
||||
"dgeni-packages": "0.30.0",
|
||||
"eslint": "^9.12.0",
|
||||
"husky": "9.1.6",
|
||||
"jasmine-core": "5.0.1",
|
||||
"jasmine-spec-reporter": "7.0.0",
|
||||
@@ -77,6 +80,7 @@
|
||||
"rimraf": "6.0.1",
|
||||
"ts-node": "10.9.1",
|
||||
"typescript": "5.4.5",
|
||||
"typescript-eslint": "^8.10.0",
|
||||
"uuid": "10.0.0",
|
||||
"yargs": "17.7.2"
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export class HomepageComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
this.scrollSubscription = fromEvent(window, 'scroll')
|
||||
.pipe(debounceTime(this.scrollDebounceTime))
|
||||
.subscribe((_) => {
|
||||
.subscribe(() => {
|
||||
this.checkViewportBoundaries();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ export class MenuComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.router.events
|
||||
.pipe(filter((ev) => ev instanceof NavigationEnd))
|
||||
.subscribe((event) => this.toggleCategory());
|
||||
.subscribe(() => this.toggleCategory());
|
||||
|
||||
this.toggleCategory();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-libraries',
|
||||
templateUrl: './libraries.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CliLibrariesComponent extends BasePageComponent {}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-overview',
|
||||
templateUrl: './overview.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CliOverviewComponent extends BasePageComponent {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'devtools-ci-cd',
|
||||
selector: 'app-devtools-ci-cd',
|
||||
templateUrl: './ci-cd.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'devtools-overview',
|
||||
selector: 'app-devtools-overview',
|
||||
templateUrl: './overview.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { BasePageComponent } from '../../page/page.component';
|
||||
|
||||
@Component({
|
||||
selector: 'keep-alive-connections',
|
||||
selector: 'app-keep-alive-connections',
|
||||
templateUrl: './keep-alive-connections.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
|
||||
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tabs',
|
||||
templateUrl: './tabs.component.html',
|
||||
styleUrls: ['./tabs.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class TabsComponent {
|
||||
public isJsActive = false;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
ElementRef,
|
||||
Inject,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
@@ -54,7 +52,7 @@ export class TocComponent implements OnInit, OnDestroy, OnChanges {
|
||||
ngOnInit() {
|
||||
this.scrollSubscription = fromEvent(window, 'scroll')
|
||||
.pipe(debounceTime(this.scrollDebounceTime))
|
||||
.subscribe((_) => {
|
||||
.subscribe(() => {
|
||||
this.findCurrentHeading();
|
||||
this.checkViewportBoundaries();
|
||||
});
|
||||
@@ -70,6 +68,7 @@ export class TocComponent implements OnInit, OnDestroy, OnChanges {
|
||||
|
||||
ngOnDestroy() {
|
||||
this.scrollSubscription && this.scrollSubscription.unsubscribe();
|
||||
|
||||
this.timerSubscription && this.timerSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
CanActivateFn,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import { ActivatedRouteSnapshot, CanActivateFn } from '@angular/router';
|
||||
|
||||
export const RedirectGuard: CanActivateFn = (
|
||||
route: ActivatedRouteSnapshot,
|
||||
state: RouterStateSnapshot,
|
||||
) => {
|
||||
export const RedirectGuard: CanActivateFn = (route: ActivatedRouteSnapshot) => {
|
||||
window.location.href = route.data['externalUrl'];
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'zone.js/dist/fake-async-test';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
@@ -17,12 +17,13 @@ declare const __karma__: any;
|
||||
declare const require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
__karma__.loaded = function () {};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
platformBrowserDynamicTesting(),
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
|
||||
2
src/typings.d.ts
vendored
2
src/typings.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
declare let module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
import { Dgeni } from 'dgeni';
|
||||
import { resolve } from 'path';
|
||||
|
||||
const argv = require('yargs').argv;
|
||||
const packagePaths = argv._;
|
||||
|
||||
const packages = packagePaths.map(packagePath => {
|
||||
const packages = packagePaths.map((packagePath) => {
|
||||
if (packagePath.indexOf('.') === 0) {
|
||||
packagePath = resolve(packagePath);
|
||||
}
|
||||
@@ -13,10 +14,10 @@ const packages = packagePaths.map(packagePath => {
|
||||
|
||||
new Dgeni(packages)
|
||||
.generate()
|
||||
.then(docs => {
|
||||
.then((docs) => {
|
||||
console.log(`${docs.length} docs generated.`);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -3,19 +3,19 @@ import { Processor, DocCollection } from 'dgeni';
|
||||
/**
|
||||
* Extracts the title of a content file.
|
||||
* This processor assumes that the first line of the
|
||||
* content includes the title.
|
||||
* content includes the title.
|
||||
*/
|
||||
export class ExtractContentTitleProcessor implements Processor {
|
||||
$runAfter = ['renderDocsProcessor'];
|
||||
$runBefore = ['convertToJsonProcessor'];
|
||||
$process(docs: DocCollection) {
|
||||
docs.forEach(doc => {
|
||||
docs.forEach((doc) => {
|
||||
if (doc.docType === 'content') {
|
||||
try {
|
||||
const firstLine: string = doc.content.split('\n')[0];
|
||||
const title = firstLine.replace(/#/g, '').trim();
|
||||
doc.title = title;
|
||||
} catch (ex) {
|
||||
} catch {
|
||||
// We do not care if the title does not exist here
|
||||
// convertToJson will complain later in case the title
|
||||
// does not exist
|
||||
|
||||
@@ -10,8 +10,8 @@ export function nestjsMarkedNunjucksTag(renderNestJSMarkdown: RenderNestJSMarkdo
|
||||
parse: function(parser: any, nodes: any) {
|
||||
parser.advanceAfterBlockEnd();
|
||||
|
||||
var content = parser.parseUntilBlocks('endmarked');
|
||||
var tag = new nodes.CallExtension(this, 'process', null, [content]);
|
||||
const content = parser.parseUntilBlocks('endmarked');
|
||||
const tag = new nodes.CallExtension(this, 'process', null, [content]);
|
||||
parser.advanceAfterBlockEnd();
|
||||
|
||||
return tag;
|
||||
|
||||
@@ -25,6 +25,5 @@ export function renderNestJSMarkdown() {
|
||||
applyHeadingRenderer(renderer);
|
||||
applyBlockQuoteRenderer(renderer);
|
||||
|
||||
// @ts-ignore
|
||||
return (content: string) => marked(content, { renderer });
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ export function applyCodeRenderer(renderer: Renderer) {
|
||||
if (filenameIndex >= 0) {
|
||||
const output = replaceFilename(
|
||||
(text, directiveRef) =>
|
||||
// @ts-ignore
|
||||
renderer.code(text, language, isEscaped, directiveRef, true),
|
||||
code,
|
||||
filenameKey,
|
||||
|
||||
@@ -15,7 +15,7 @@ export class ConvertToJsonProcessor implements Processor {
|
||||
const docTypes = this.docTypes;
|
||||
docs.forEach((doc: any) => {
|
||||
if (docTypes.includes(doc.docType)) {
|
||||
let contents = doc.renderedContent || '';
|
||||
const contents = doc.renderedContent || '';
|
||||
|
||||
let title = doc.title;
|
||||
|
||||
|
||||
@@ -1,53 +1,50 @@
|
||||
import { Package } from 'dgeni';
|
||||
|
||||
import { CONTENTS_PATH } from '../config';
|
||||
import nestjsBasePackage, {
|
||||
ConvertToJsonProcessor
|
||||
} from '../nestjs-base-package';
|
||||
import nestjsBasePackage from '../nestjs-base-package';
|
||||
import contentPackage, { contentFileReader } from '../content-package';
|
||||
|
||||
export default new Package('nestjs-content', [
|
||||
nestjsBasePackage,
|
||||
contentPackage
|
||||
contentPackage,
|
||||
])
|
||||
.config((readFilesProcessor: any) => {
|
||||
readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/**/*.md',
|
||||
fileReader: contentFileReader.name
|
||||
fileReader: contentFileReader.name,
|
||||
},
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/navigation.json',
|
||||
fileReader: 'jsonFileReader'
|
||||
fileReader: 'jsonFileReader',
|
||||
},
|
||||
{
|
||||
basePath: CONTENTS_PATH,
|
||||
include: CONTENTS_PATH + '/discover/who-uses.json',
|
||||
fileReader: 'jsonFileReader'
|
||||
}
|
||||
fileReader: 'jsonFileReader',
|
||||
},
|
||||
]);
|
||||
})
|
||||
|
||||
.config((computePathsProcessor: any) => {
|
||||
// Replace any path templates inherited from other packages
|
||||
// (we want full and transparent control)
|
||||
computePathsProcessor.pathTemplates = computePathsProcessor.pathTemplates.concat(
|
||||
[
|
||||
computePathsProcessor.pathTemplates =
|
||||
computePathsProcessor.pathTemplates.concat([
|
||||
{
|
||||
docTypes: ['content', 'who-uses'],
|
||||
getPath: doc => `${doc.id.replace(/\/index$/, '')}`,
|
||||
outputPathTemplate: '${path}.json'
|
||||
getPath: (doc) => `${doc.id.replace(/\/index$/, '')}`,
|
||||
outputPathTemplate: '${path}.json',
|
||||
},
|
||||
{
|
||||
docTypes: ['who-uses-json'],
|
||||
pathTemplate: '${id}',
|
||||
outputPathTemplate: '../${id}.json'
|
||||
}
|
||||
]
|
||||
);
|
||||
})
|
||||
// .config((convertToJsonProcessor: ConvertToJsonProcessor) => {
|
||||
// convertToJsonProcessor.docTypes.push('content');
|
||||
// });
|
||||
outputPathTemplate: '../${id}.json',
|
||||
},
|
||||
]);
|
||||
});
|
||||
// .config((convertToJsonProcessor: ConvertToJsonProcessor) => {
|
||||
// convertToJsonProcessor.docTypes.push('content');
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user