From f2906b6c17bc7d6cdeecb9c5d8c626e10592f660 Mon Sep 17 00:00:00 2001 From: Tyagi-Sunny Date: Thu, 27 Jun 2024 22:01:39 +0530 Subject: [PATCH] fix(templates): modify cli to add docs while scaffolding application modify cli to add docs while scaffolding application gh-0 --- .../src/plugins/sourceloop-extension.ts | 2 +- patches/@sourceloop+cli+7.2.2.patch | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 patches/@sourceloop+cli+7.2.2.patch diff --git a/packages/backend/src/plugins/sourceloop-extension.ts b/packages/backend/src/plugins/sourceloop-extension.ts index e746528..1f5ca7e 100644 --- a/packages/backend/src/plugins/sourceloop-extension.ts +++ b/packages/backend/src/plugins/sourceloop-extension.ts @@ -20,7 +20,7 @@ export function createExtensionAction() { }, }, }, - async handler(ctx: any) { + async handler(ctx: any) { // NOSONAR const extensions = ctx.input.extensions; const cwd=ctx.workspacePath; diff --git a/patches/@sourceloop+cli+7.2.2.patch b/patches/@sourceloop+cli+7.2.2.patch new file mode 100644 index 0000000..ad83788 --- /dev/null +++ b/patches/@sourceloop+cli+7.2.2.patch @@ -0,0 +1,24 @@ +diff --git a/node_modules/@sourceloop/cli/lib/generators/scaffold/index.js b/node_modules/@sourceloop/cli/lib/generators/scaffold/index.js +index a2f1db9..2a370df 100644 +--- a/node_modules/@sourceloop/cli/lib/generators/scaffold/index.js ++++ b/node_modules/@sourceloop/cli/lib/generators/scaffold/index.js +@@ -29,10 +29,19 @@ class ScaffoldGenerator extends base_generator_1.BaseGenerator { + path: require.resolve('../backstage-integration'), + }, this.options); + } ++ ++ await this._addDocs(); + } + async install() { + await this.spawnCommand('npm', ['i']); + } ++ async _addDocs() { ++ const sourcePath = `${this.destinationRoot()}/README.md`; ++ const destinationPath = `${this.destinationRoot()}/docs/README.md`; ++ /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ ++ //@ts-ignore ++ await this.fs.copyTplAsync(sourcePath, destinationPath); ++ } + _setRoot() { + if (this.options.cwd) { + this.destinationRoot(this.options.cwd);