From 165bf1b85863a1887d2c1cd4d743099dbf55dc9a Mon Sep 17 00:00:00 2001 From: Bram Borggreve Date: Thu, 10 Aug 2023 16:44:54 +0100 Subject: [PATCH] fix: make sure tools package has a package.json --- libs/tools/package.json | 19 +++++++++++++++++++ .../api-feature-generator.spec.ts.snap | 4 ++-- .../lib/api/api-update-core-feature-module.ts | 2 +- ...me__-__adminFileName__.service.ts.template | 2 +- .../api-__modelFileName__.service.ts.template | 2 +- .../tools/src/lib/api/generate-api-feature.ts | 2 +- libs/tools/src/lib/utils/add-export.ts | 2 +- libs/tools/src/lib/utils/get-source-file.ts | 2 +- .../tools/src/lib/utils/update-source-file.ts | 2 +- .../tools/src/lib/web/generate-web-feature.ts | 2 +- 10 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 libs/tools/package.json diff --git a/libs/tools/package.json b/libs/tools/package.json new file mode 100644 index 0000000..3eb735d --- /dev/null +++ b/libs/tools/package.json @@ -0,0 +1,19 @@ +{ + "name": "@pubkey-stack/tools", + "version": "0.0.1", + "dependencies": { + "@mrleebo/prisma-ast": "^0.7.0", + "@nx/devkit": "16.6.0", + "@nx/nest": "16.6.0", + "@nx/react": "16.6.0", + "@nx/linter": "16.6.0", + "dotenv": "^10.0.0", + "pg": "^8.11.2", + "tslib": "^2.3.0", + "ts-morph": "^19.0.0" + }, + "type": "commonjs", + "main": "./src/index.js", + "typings": "./src/index.d.ts", + "generators": "./generators.json" +} diff --git a/libs/tools/src/generators/api-feature/__snapshots__/api-feature-generator.spec.ts.snap b/libs/tools/src/generators/api-feature/__snapshots__/api-feature-generator.spec.ts.snap index 848810b..3b695a8 100644 --- a/libs/tools/src/generators/api-feature/__snapshots__/api-feature-generator.spec.ts.snap +++ b/libs/tools/src/generators/api-feature/__snapshots__/api-feature-generator.spec.ts.snap @@ -12,7 +12,7 @@ export * from './lib/dto/admin-update-test.input'; exports[`api-feature generator should generate the feature libraries 2`] = ` "import { Injectable } from '@nestjs/common'; -import { ApiCoreService } from '@pubkey-stack/api/core/data-access'; +import { ApiCoreService } from '@<%= npmScope %>/api/core/data-access'; import { AdminCreateTestInput } from './dto/admin-create-test.input'; import { AdminFindManyTestInput } from './dto/admin-find-many-test.input'; import { AdminUpdateTestInput } from './dto/admin-update-test.input'; @@ -80,7 +80,7 @@ export class ApiTestDataAccessModule {} exports[`api-feature generator should generate the feature libraries 4`] = ` "import { Injectable } from '@nestjs/common'; -import { ApiCoreService } from '@pubkey-stack/api/core/data-access'; +import { ApiCoreService } from '@<%= npmScope %>/api/core/data-access'; import { ApiTestAdminService } from './api-test-admin.service'; @Injectable() diff --git a/libs/tools/src/lib/api/api-update-core-feature-module.ts b/libs/tools/src/lib/api/api-update-core-feature-module.ts index b7d1dbf..e224aef 100644 --- a/libs/tools/src/lib/api/api-update-core-feature-module.ts +++ b/libs/tools/src/lib/api/api-update-core-feature-module.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { addNamedImport } from '../utils/add-named-import' import { updateSourceFile } from '../utils/update-source-file' diff --git a/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__-__adminFileName__.service.ts.template b/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__-__adminFileName__.service.ts.template index 4e2bf47..c052ea5 100644 --- a/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__-__adminFileName__.service.ts.template +++ b/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__-__adminFileName__.service.ts.template @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common' -import { ApiCoreService } from '@pubkey-stack/api/core/data-access' +import { ApiCoreService } from '@<%= npmScope %>/api/core/data-access' import { <%= admin.className %>Create<%= model.className %>Input } from './dto/<%= admin.fileName %>-create-<%= model.fileName %>.input' import { <%= admin.className %>FindMany<%= model.className %>Input } from './dto/<%= admin.fileName %>-find-many-<%= model.fileName %>.input' import { <%= admin.className %>Update<%= model.className %>Input } from './dto/<%= admin.fileName %>-update-<%= model.fileName %>.input' diff --git a/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__.service.ts.template b/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__.service.ts.template index cfaf1c3..86c2157 100644 --- a/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__.service.ts.template +++ b/libs/tools/src/lib/api/files/data-access/lib/api-__modelFileName__.service.ts.template @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common' -import { ApiCoreService } from '@pubkey-stack/api/core/data-access' +import { ApiCoreService } from '@<%= npmScope %>/api/core/data-access' import { Api<%= model.className %><%= admin.className %>Service } from './api-<%= model.fileName %>-<%= admin.fileName %>.service' @Injectable() diff --git a/libs/tools/src/lib/api/generate-api-feature.ts b/libs/tools/src/lib/api/generate-api-feature.ts index 15739cd..6cd88dc 100644 --- a/libs/tools/src/lib/api/generate-api-feature.ts +++ b/libs/tools/src/lib/api/generate-api-feature.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { NormalizedApiFeatureSchema } from '../../generators/api-feature/api-feature-schema' import { generateApiLib } from './generate-api-lib' import { generateSdkFile } from './generate-sdk-file' diff --git a/libs/tools/src/lib/utils/add-export.ts b/libs/tools/src/lib/utils/add-export.ts index aa6fc7f..d981fe9 100644 --- a/libs/tools/src/lib/utils/add-export.ts +++ b/libs/tools/src/lib/utils/add-export.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { updateSourceFile } from './update-source-file' export function addExport(tree: Tree, path: string, exportPath: string) { diff --git a/libs/tools/src/lib/utils/get-source-file.ts b/libs/tools/src/lib/utils/get-source-file.ts index 2f60ea4..980afb3 100644 --- a/libs/tools/src/lib/utils/get-source-file.ts +++ b/libs/tools/src/lib/utils/get-source-file.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { Project, SourceFile } from 'ts-morph' export function getSourceFile(tree: Tree, path: string): SourceFile { diff --git a/libs/tools/src/lib/utils/update-source-file.ts b/libs/tools/src/lib/utils/update-source-file.ts index 0f20d4f..0de072d 100644 --- a/libs/tools/src/lib/utils/update-source-file.ts +++ b/libs/tools/src/lib/utils/update-source-file.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { SourceFile } from 'ts-morph' import { getSourceFile } from './get-source-file' diff --git a/libs/tools/src/lib/web/generate-web-feature.ts b/libs/tools/src/lib/web/generate-web-feature.ts index 642b23f..ebdd837 100644 --- a/libs/tools/src/lib/web/generate-web-feature.ts +++ b/libs/tools/src/lib/web/generate-web-feature.ts @@ -1,4 +1,4 @@ -import { Tree } from '@nrwl/devkit' +import { Tree } from '@nx/devkit' import { NormalizedWebFeatureSchema } from '../../generators/web-feature/web-feature-schema' import { generateWebLib } from './generate-web-lib'