From 4ebc04c2232fcda5abdbaecb4fdf3048cf143114 Mon Sep 17 00:00:00 2001 From: Dominik Pieper Date: Mon, 23 Oct 2023 15:10:23 +0200 Subject: [PATCH] chore(nxext): rename core to common --- packages/common/README.md | 11 ++++++++++ packages/{core => common}/eslint.config.js | 0 packages/{core => common}/jest.config.ts | 4 ++-- packages/{core => common}/package.json | 2 +- packages/{core => common}/project.json | 20 +++++++++---------- packages/{core => common}/src/index.ts | 0 .../src/lib/utils/add-plugin-to-nx-json.ts | 0 .../src/lib/utils/ast-utils.ts | 0 .../src/lib/utils/map-lint-pattern.ts | 0 packages/{core => common}/tsconfig.json | 0 packages/{core => common}/tsconfig.lib.json | 0 packages/{core => common}/tsconfig.spec.json | 0 packages/core/README.md | 11 ---------- packages/nuxt/package.json | 2 +- .../generators/application/lib/add-linting.ts | 2 +- packages/nuxt/src/generators/init/init.ts | 2 +- packages/stencil/package.json | 2 +- .../add-outputtarget/add-angular/generator.ts | 2 +- .../add-outputtarget/add-react/generator.ts | 2 +- .../add-outputtarget/add-svelte/generator.ts | 2 +- .../lib/calculate-stencil-source-options.ts | 2 +- .../src/stencil-core-utils/lib/plugins.ts | 2 +- .../stencil-core-utils/lib/style-plugins.ts | 2 +- packages/vue/package.json | 2 +- .../generators/application/lib/add-linting.ts | 2 +- .../component/lib/add-exports-to-barrel.ts | 2 +- packages/vue/src/generators/init/init.ts | 2 +- tsconfig.base.json | 4 ++-- 28 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 packages/common/README.md rename packages/{core => common}/eslint.config.js (100%) rename packages/{core => common}/jest.config.ts (73%) rename packages/{core => common}/package.json (94%) rename packages/{core => common}/project.json (61%) rename packages/{core => common}/src/index.ts (100%) rename packages/{core => common}/src/lib/utils/add-plugin-to-nx-json.ts (100%) rename packages/{core => common}/src/lib/utils/ast-utils.ts (100%) rename packages/{core => common}/src/lib/utils/map-lint-pattern.ts (100%) rename packages/{core => common}/tsconfig.json (100%) rename packages/{core => common}/tsconfig.lib.json (100%) rename packages/{core => common}/tsconfig.spec.json (100%) delete mode 100644 packages/core/README.md diff --git a/packages/common/README.md b/packages/common/README.md new file mode 100644 index 000000000..1573ff98a --- /dev/null +++ b/packages/common/README.md @@ -0,0 +1,11 @@ +# common + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build common` to build the library. + +## Running unit tests + +Run `nx test common` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/core/eslint.config.js b/packages/common/eslint.config.js similarity index 100% rename from packages/core/eslint.config.js rename to packages/common/eslint.config.js diff --git a/packages/core/jest.config.ts b/packages/common/jest.config.ts similarity index 73% rename from packages/core/jest.config.ts rename to packages/common/jest.config.ts index f8cf7f609..e1de8f054 100644 --- a/packages/core/jest.config.ts +++ b/packages/common/jest.config.ts @@ -1,11 +1,11 @@ /* eslint-disable */ export default { - displayName: 'core', + displayName: '@nxext/common', preset: '../../jest.preset.js', testEnvironment: 'node', transform: { '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/packages/core', + coverageDirectory: '../../coverage/packages/common', }; diff --git a/packages/core/package.json b/packages/common/package.json similarity index 94% rename from packages/core/package.json rename to packages/common/package.json index 72556d1db..6a409a520 100644 --- a/packages/core/package.json +++ b/packages/common/package.json @@ -1,5 +1,5 @@ { - "name": "@nxext/core", + "name": "@nxext/common", "version": "17.0.0", "description": "Core utilities for nxext Nx plugins", "author": { diff --git a/packages/core/project.json b/packages/common/project.json similarity index 61% rename from packages/core/project.json rename to packages/common/project.json index 5602dc80b..0e188ec46 100644 --- a/packages/core/project.json +++ b/packages/common/project.json @@ -1,18 +1,18 @@ { - "name": "core", + "name": "common", "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "packages/core/src", + "sourceRoot": "packages/common/src", "projectType": "library", "targets": { "build": { "executor": "@nx/js:tsc", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/packages/core", - "tsConfig": "packages/core/tsconfig.lib.json", - "packageJson": "packages/core/package.json", - "main": "packages/core/src/index.ts", - "assets": ["packages/core/*.md"] + "outputPath": "dist/packages/common", + "tsConfig": "packages/common/tsconfig.lib.json", + "packageJson": "packages/common/package.json", + "main": "packages/common/src/index.ts", + "assets": ["packages/common/*.md"] } }, "lint": { @@ -20,8 +20,8 @@ "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ - "packages/core/**/*.ts", - "packages/core/package.json" + "packages/common/**/*.ts", + "packages/common/package.json" ] } }, @@ -29,7 +29,7 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "packages/core/jest.config.ts", + "jestConfig": "packages/common/jest.config.ts", "passWithNoTests": true }, "configurations": { diff --git a/packages/core/src/index.ts b/packages/common/src/index.ts similarity index 100% rename from packages/core/src/index.ts rename to packages/common/src/index.ts diff --git a/packages/core/src/lib/utils/add-plugin-to-nx-json.ts b/packages/common/src/lib/utils/add-plugin-to-nx-json.ts similarity index 100% rename from packages/core/src/lib/utils/add-plugin-to-nx-json.ts rename to packages/common/src/lib/utils/add-plugin-to-nx-json.ts diff --git a/packages/core/src/lib/utils/ast-utils.ts b/packages/common/src/lib/utils/ast-utils.ts similarity index 100% rename from packages/core/src/lib/utils/ast-utils.ts rename to packages/common/src/lib/utils/ast-utils.ts diff --git a/packages/core/src/lib/utils/map-lint-pattern.ts b/packages/common/src/lib/utils/map-lint-pattern.ts similarity index 100% rename from packages/core/src/lib/utils/map-lint-pattern.ts rename to packages/common/src/lib/utils/map-lint-pattern.ts diff --git a/packages/core/tsconfig.json b/packages/common/tsconfig.json similarity index 100% rename from packages/core/tsconfig.json rename to packages/common/tsconfig.json diff --git a/packages/core/tsconfig.lib.json b/packages/common/tsconfig.lib.json similarity index 100% rename from packages/core/tsconfig.lib.json rename to packages/common/tsconfig.lib.json diff --git a/packages/core/tsconfig.spec.json b/packages/common/tsconfig.spec.json similarity index 100% rename from packages/core/tsconfig.spec.json rename to packages/common/tsconfig.spec.json diff --git a/packages/core/README.md b/packages/core/README.md deleted file mode 100644 index 0b50a3b3e..000000000 --- a/packages/core/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# core - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build core` to build the library. - -## Running unit tests - -Run `nx test core` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index eaa516268..0258c29ce 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -32,7 +32,7 @@ "@nx/workspace": "17.0.1", "@nuxt/kit": "3.6.5", "nuxi": "3.6.5", - "@nxext/core": "^17.0.0" + "@nxext/common": "*" }, "peerDependencies": { "@nx/js": "17.0.1", diff --git a/packages/nuxt/src/generators/application/lib/add-linting.ts b/packages/nuxt/src/generators/application/lib/add-linting.ts index 5540f7396..74abd8081 100644 --- a/packages/nuxt/src/generators/application/lib/add-linting.ts +++ b/packages/nuxt/src/generators/application/lib/add-linting.ts @@ -13,7 +13,7 @@ import { ensurePackage, NX_VERSION, } from '@nx/devkit'; -import { mapLintPattern } from '@nxext/core'; +import { mapLintPattern } from '@nxext/common'; export async function addLinting(host: Tree, options: NormalizedSchema) { const tasks: GeneratorCallback[] = []; diff --git a/packages/nuxt/src/generators/init/init.ts b/packages/nuxt/src/generators/init/init.ts index c93c92e0a..e330b5dbd 100644 --- a/packages/nuxt/src/generators/init/init.ts +++ b/packages/nuxt/src/generators/init/init.ts @@ -19,7 +19,7 @@ import { } from '../utils/versions'; import { InitSchema } from './schema'; import { initGenerator as jsInitGenerator } from '@nx/js'; -import { addPluginToNxJson } from '@nxext/core'; +import { addPluginToNxJson } from '@nxext/common'; function updateDependencies(host: Tree) { const dependencies: Record = { diff --git a/packages/stencil/package.json b/packages/stencil/package.json index a11b1ae56..cc8b255c3 100644 --- a/packages/stencil/package.json +++ b/packages/stencil/package.json @@ -35,7 +35,7 @@ "@nx/workspace": "17.0.1", "@nx/angular": "17.0.1", "nx": "17.0.1", - "@nxext/core": "^17.0.0" + "@nxext/common": "*" }, "peerDependencies": { "@nxext/svelte": "^16.7.0", diff --git a/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts index b1ee42865..1bf01d0d1 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-angular/generator.ts @@ -23,7 +23,7 @@ import { addExportToModule, } from '../../../utils/angular-ast-utils'; import { getProjectTsImportPath } from '../../storybook-configuration/generator'; -import { addAfterLastImport, addImport } from '@nxext/core'; +import { addAfterLastImport, addImport } from '@nxext/common'; import { addGlobal } from '@nx/js'; async function prepareAngularLibrary( diff --git a/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts index 0e9267ee8..423cc259e 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-react/generator.ts @@ -16,7 +16,7 @@ import { STENCIL_OUTPUTTARGET_VERSION } from '../../../utils/versions'; import { addToGitignore } from '../../../utils/utillities'; import * as ts from 'typescript'; import { getDistDir, getRelativePath } from '../../../utils/fileutils'; -import { addImport } from '@nxext/core'; +import { addImport } from '@nxext/common'; import { addOutputTarget } from '../../../stencil-core-utils'; import { calculateStencilSourceOptions } from '../lib/calculate-stencil-source-options'; diff --git a/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts b/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts index c465cf23e..f22140330 100644 --- a/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts +++ b/packages/stencil/src/generators/add-outputtarget/add-svelte/generator.ts @@ -16,7 +16,7 @@ import { import { addToGitignore } from '../../../utils/utillities'; import * as ts from 'typescript'; import { getDistDir, getRelativePath } from '../../../utils/fileutils'; -import { addImport } from '@nxext/core'; +import { addImport } from '@nxext/common'; import { addOutputTarget } from '../../../stencil-core-utils'; import { calculateStencilSourceOptions } from '../lib/calculate-stencil-source-options'; diff --git a/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts b/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts index cbff8daef..4e51dd7b5 100644 --- a/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts +++ b/packages/stencil/src/generators/add-outputtarget/lib/calculate-stencil-source-options.ts @@ -1,7 +1,7 @@ import { readProjectConfiguration, Tree } from '@nx/devkit'; import { getNpmScope } from '@nx/js/src/utils/package-json/get-npm-scope'; import * as ts from 'typescript'; -import { readTsSourceFile } from '@nxext/core'; +import { readTsSourceFile } from '@nxext/common'; export function calculateStencilSourceOptions(host: Tree, projectName: string) { const stencilProjectConfig = readProjectConfiguration(host, projectName); diff --git a/packages/stencil/src/stencil-core-utils/lib/plugins.ts b/packages/stencil/src/stencil-core-utils/lib/plugins.ts index 9bb7c2d57..40b72dccc 100644 --- a/packages/stencil/src/stencil-core-utils/lib/plugins.ts +++ b/packages/stencil/src/stencil-core-utils/lib/plugins.ts @@ -1,5 +1,5 @@ import * as ts from 'typescript'; -import { readTsSourceFile } from '@nxext/core'; +import { readTsSourceFile } from '@nxext/common'; import { applyChangesToString, ChangeType, diff --git a/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts b/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts index 4992c36fa..714c68f85 100644 --- a/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts +++ b/packages/stencil/src/stencil-core-utils/lib/style-plugins.ts @@ -1,7 +1,7 @@ import * as ts from 'typescript'; import { addToPlugins } from './plugins'; import { applyChangesToString, StringChange, Tree } from '@nx/devkit'; -import { readTsSourceFile, addImport } from '@nxext/core'; +import { readTsSourceFile, addImport } from '@nxext/common'; export enum SupportedStyles { css = 'css', diff --git a/packages/vue/package.json b/packages/vue/package.json index c15fdc0f2..a5d8742e3 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -28,7 +28,7 @@ "tslib": "^2.3.0", "typescript": "5.1.6", "nx": "17.0.1", - "@nxext/core": "^17.0.0" + "@nxext/common": "*" }, "peerDependencies": { "@nx/js": "17.0.1", diff --git a/packages/vue/src/generators/application/lib/add-linting.ts b/packages/vue/src/generators/application/lib/add-linting.ts index f4aa04553..f5c5b734f 100644 --- a/packages/vue/src/generators/application/lib/add-linting.ts +++ b/packages/vue/src/generators/application/lib/add-linting.ts @@ -10,7 +10,7 @@ import { ensurePackage, NX_VERSION, } from '@nx/devkit'; -import { mapLintPattern } from '@nxext/core'; +import { mapLintPattern } from '@nxext/common'; export async function addLinting(host: Tree, options: NormalizedSchema) { const tasks: GeneratorCallback[] = []; diff --git a/packages/vue/src/generators/component/lib/add-exports-to-barrel.ts b/packages/vue/src/generators/component/lib/add-exports-to-barrel.ts index 8506fe325..9e69b7ede 100644 --- a/packages/vue/src/generators/component/lib/add-exports-to-barrel.ts +++ b/packages/vue/src/generators/component/lib/add-exports-to-barrel.ts @@ -5,7 +5,7 @@ import { joinPathFragments, } from '@nx/devkit'; import { NormalizedSchema } from '../schema'; -import { addImport } from '@nxext/core'; +import { addImport } from '@nxext/common'; import * as ts from 'typescript'; export function addExportsToBarrel(host: Tree, options: NormalizedSchema) { diff --git a/packages/vue/src/generators/init/init.ts b/packages/vue/src/generators/init/init.ts index 71545f105..07c84cc14 100644 --- a/packages/vue/src/generators/init/init.ts +++ b/packages/vue/src/generators/init/init.ts @@ -17,7 +17,7 @@ import { vueVersion, } from '../utils/versions'; import { InitSchema } from './schema'; -import { addPluginToNxJson } from '@nxext/core'; +import { addPluginToNxJson } from '@nxext/common'; function updateDependencies(host: Tree, schema: InitSchema) { let dependencies: Record = { diff --git a/tsconfig.base.json b/tsconfig.base.json index 0ca8e2ed0..3af910101 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,7 +20,6 @@ "@nxext/angular-swc": ["packages/angular/swc/src/index.ts"], "@nxext/angular-vite": ["packages/angular/vite/src/index.ts"], "@nxext/capacitor": ["packages/capacitor/src/index.ts"], - "@nxext/core": ["packages/core/src/index.ts"], "@nxext/e2e-utils": ["e2e/utils/index.ts"], "@nxext/ionic-angular": ["packages/ionic-angular/src/index.ts"], "@nxext/ionic-react": ["packages/ionic-react/src/index.ts"], @@ -30,7 +29,8 @@ "@nxext/svelte": ["packages/svelte/src/index.ts"], "@nxext/vite": ["packages/vite/src/index.ts"], "@nxext/vitest": ["packages/vitest/src/index.ts"], - "@nxext/vue": ["packages/vue/src/index.ts"] + "@nxext/vue": ["packages/vue/src/index.ts"], + "@nxext/common": ["packages/common/src/index.ts"] } }, "exclude": ["node_modules", "tmp"]