Skip to content

Commit

Permalink
feat: Update to NX v20.0.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE: NX is updated to v20.0.0
  • Loading branch information
TriPSs committed Oct 11, 2024
1 parent 6b8b92e commit 78dad2e
Show file tree
Hide file tree
Showing 31 changed files with 51 additions and 52 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus/src/executors/browser/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function* runExecutor(
) {
const projectRoot = path.join(
context.root,
context.workspace.projects[context.projectName ?? ''].root
context.projectsConfigurations.projects[context.projectName ?? ''].root
)

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/executors/dev-server/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async function* runExecutor(
) {
const projectRoot = path.join(
context.root,
context.workspace.projects[context.projectName ?? ''].root
context.projectsConfigurations.projects[context.projectName ?? ''].root
)
const port = options.port.toString()

Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-cloud-run/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function deployExecutor(
options: ExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const buildTarget = options.buildTarget || `${context.projectName}:build`
const outputDirectory = getOutputDirectoryFromBuildTarget(context, buildTarget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function createExecutor(
options: ExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

return Promise.resolve(
execCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function deleteExecutor(
options: ExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

return Promise.resolve(
execCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function updateExecutor(
options: Options,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

return Promise.resolve(
execCommand(
Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-functions/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NestFactory } from '@nestjs/core'
import { ExpressAdapter } from '@nestjs/platform-express'
import { FsTree } from 'nx/src/generators/tree'
import { getProjects } from 'nx/src/generators/utils/project-configuration'
import { workspaceRoot } from 'nx/src/utils/app-root'
import { workspaceRoot } from 'nx/src/utils/workspace-root'

import type { HttpFunction } from '@google-cloud/functions-framework'
import type { DeployExecutorSchema } from '@nx-extend/gcp-functions/src/executors/deploy/deploy.impl'
Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-functions/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function deployExecutor(
throw new Error('"triggerValue" is not accepted when trigger is "http"!')
}

const { targets } = context.workspace.projects[context.projectName]
const { targets } = context.projectsConfigurations.projects[context.projectName]

const validSecrets = getValidSecrets(secrets)

Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-functions/src/utils/generate-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const generatePackageJson = (
omitOptionalDependencies = true,
generateLockFile?: boolean
) => {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const packageJson = createPackageJson(
context.projectName,
Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-secrets/src/executors/decrypt/decrypt.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function decyrptExecutor(
options: SharedOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

if (isEncryptionKeySet()) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-secrets/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function deployExecutor(
options: DeploySchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

if (isEncryptionKeySet()) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/gcp-secrets/src/executors/encrypt/encrypt.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function encryptExecutor(
options: SharedOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

if (isEncryptionKeySet()) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/github-pages/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function deployExecutor(
throw new Error('No "GH_PAGES_ACCESS_TOKEN" is set!')
}

const { targets } = context.workspace.projects[context.projectName]
const { targets } = context.projectsConfigurations.projects[context.projectName]

if (!targets?.build?.options?.outputPath) {
throw new Error('No build target configured!')
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/executors/codegen/codegen.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function codegenExecutor(
options: CodegenOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const { url, loadStorage } = options

Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/src/executors/test/test.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function testExecutor(
options: TestOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const { url, headed, debug, ui } = options

Expand Down
2 changes: 1 addition & 1 deletion packages/pulumi/src/executors/config/config.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function configExecutor(
throw new Error('pulumi is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
Expand Down
2 changes: 1 addition & 1 deletion packages/pulumi/src/executors/import/import.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async function creatExecutor(
throw new Error('pulumi is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
Expand Down
2 changes: 1 addition & 1 deletion packages/pulumi/src/executors/preview/preview.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function creatExecutor(
throw new Error('pulumi is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
Expand Down
2 changes: 1 addition & 1 deletion packages/pulumi/src/executors/refresh/refresh.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function createExecutor(
throw new Error('pulumi is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
Expand Down
2 changes: 1 addition & 1 deletion packages/pulumi/src/executors/up/up.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async function createExecutor(
throw new Error('pulumi is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]

execSync(buildCommand([
'pulumi up --suppress-progress',
Expand Down
2 changes: 1 addition & 1 deletion packages/react-email/src/executors/export/export.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function exportExecutor(
options: ServeExecutorOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot, root } = context.workspace.projects[context.projectName]
const { sourceRoot, root } = context.projectsConfigurations.projects[context.projectName]

if (!options.outputPath) {
throw new Error('No "outputPath" defined in options!')
Expand Down
2 changes: 1 addition & 1 deletion packages/react-email/src/executors/serve/serve.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function serveExecutor(
options: ServeExecutorOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { sourceRoot, root } = context.workspace.projects[context.projectName]
const { sourceRoot, root } = context.projectsConfigurations.projects[context.projectName]

return execPackageManagerCommand(buildCommand([
'react-email dev',
Expand Down
2 changes: 1 addition & 1 deletion packages/shadcn-ui/src/executors/add/add.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function addExecutor(
options: ExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

return execPackageManagerCommand(
buildCommand([
Expand Down
41 changes: 20 additions & 21 deletions packages/shadcn-ui/src/generators/init/init.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,38 @@ function getLibRoot(host: Tree, fileName: string) {
}

export default async function (tree: Tree, options: ShadecnUiSchema) {
const uiLibOptions = await determineProjectNameAndRootOptions(tree, {
name: options.uiName,
projectType: 'library',
directory: getLibRoot(tree, options.uiName)
})

await libraryGenerator(tree, {
name: options.uiName,
skipFormat: true,
style: 'css',
linter: Linter.EsLint
linter: Linter.EsLint,
directory: uiLibOptions.projectRoot
})

const uiLibOptions = await determineProjectNameAndRootOptions(tree, {
callingGenerator: '@nx-extend/shadcn-ui:init',
name: options.uiName,
projectType: 'library'
const utilsLibOptions = await determineProjectNameAndRootOptions(tree, {
name: options.utilsName,
projectType: 'library',
directory: getLibRoot(tree, options.utilsName)
})

const uiRoot = getLibRoot(tree, uiLibOptions.projectRoot)
addTsConfigPath(tree, `${uiLibOptions.importPath}/*`, [`${uiRoot}/src/*`])
cleanupLib(tree, uiRoot)

await libraryGenerator(tree, {
name: options.utilsName,
skipFormat: true,
style: 'css',
linter: Linter.EsLint
})

const utilsLibOptions = await determineProjectNameAndRootOptions(tree, {
callingGenerator: '@nx-extend/shadcn-ui:init',
name: options.utilsName,
projectType: 'library'
linter: Linter.EsLint,
directory: utilsLibOptions.projectRoot
})

const utilRoot = getLibRoot(tree, utilsLibOptions.projectRoot)
addTsConfigPath(tree, `${utilsLibOptions.importPath}/*`, [`${utilRoot}/src/*`])
cleanupLib(tree, utilRoot)
addTsConfigPath(tree, `${uiLibOptions.importPath}/*`, [`${uiLibOptions.projectRoot}/src/*`])
addTsConfigPath(tree, `${utilsLibOptions.importPath}/*`, [`${utilsLibOptions.projectRoot}/src/*`])
cleanupLib(tree, uiLibOptions.projectRoot)
cleanupLib(tree, utilsLibOptions.projectRoot)

addFilesToUtilsLib(tree, `${getLibRoot(tree, options.utilsName)}/src`)

Expand All @@ -80,8 +79,8 @@ export default async function (tree: Tree, options: ShadecnUiSchema) {
'style': 'default',
'rsc': false,
'tailwind': {
'config': join(utilRoot, 'tailwind.config.js'),
'css': join(utilRoot, 'global.css'),
'config': join(utilsLibOptions.projectRoot, 'tailwind.config.js'),
'css': join(utilsLibOptions.projectRoot, 'global.css'),
'baseColor': 'neutral',
'cssVariables': true
},
Expand Down
2 changes: 1 addition & 1 deletion packages/strapi/src/executors/build/build.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function buildExecutor(
options: BuildExecutorSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

if (!options.outputPath) {
throw new Error('No "outputPath" defined in options!')
Expand Down
2 changes: 1 addition & 1 deletion packages/strapi/src/executors/serve/serve.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function serveExecutor(
options: ServeExecutorOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const {
build = true,
Expand Down
2 changes: 1 addition & 1 deletion packages/strapi/src/utils/create-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function createPackageJson(
context: ExecutorContext,
generateLockFile: boolean
) {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

let existingDeps = {}
// User can define its own root (Same CMS multiple apps)
Expand Down
2 changes: 1 addition & 1 deletion packages/terraform/src/utils/create-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function createExecutor(command: string) {
throw new Error('Terraform is not installed!')
}

const { sourceRoot } = context.workspace.projects[context.projectName]
const { sourceRoot } = context.projectsConfigurations.projects[context.projectName]
const {
backendConfig = [],
planFile,
Expand Down
4 changes: 2 additions & 2 deletions packages/translations/src/executors/extract/extract.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function extractExecutor(
options: ExtractSchema,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { root } = context.workspace.projects[context.projectName]
const { root } = context.projectsConfigurations.projects[context.projectName]

const {
outputDirectory = options.output,
Expand Down Expand Up @@ -117,7 +117,7 @@ export const getLibsRoot = async (
return
}

const libMetadata = context.workspace.projects[connectedLib.target]
const libMetadata = context.projectsConfigurations.projects[connectedLib.target]
targetsDone.push(connectedLib.target)

if (!roots.includes(libMetadata.sourceRoot)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/translations/src/utils/get-project-root.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExecutorContext } from '@nx/devkit'

export const getProjectRoot = (context: ExecutorContext): string => {
return context.workspace.projects[context.projectName].root
return context.projectsConfigurations.projects[context.projectName].root
}
2 changes: 1 addition & 1 deletion packages/vercel/src/executors/deploy/deploy.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function deployExecutor(
options: DeployOptions,
context: ExecutorContext
): Promise<{ success: boolean }> {
const { targets } = context.workspace.projects[context.projectName]
const { targets } = context.projectsConfigurations.projects[context.projectName]

let outputDirectory = ''

Expand Down

0 comments on commit 78dad2e

Please sign in to comment.