generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: angular 19 support
- Loading branch information
Showing
19 changed files
with
1,979 additions
and
2,611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { getJestProjects } from '@nx/jest'; | ||
import { getJestProjectsAsync } from '@nx/jest'; | ||
|
||
export default { | ||
projects: getJestProjects(), | ||
}; | ||
export default async () => ({ | ||
projects: await getJestProjectsAsync(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,68 @@ | ||
import { ExecutorContext } from "nx/src/config/misc-interfaces"; | ||
import { flushChanges, FsTree, printChanges } from "nx/src/generators/tree"; | ||
import { workspaceRoot } from "nx/src/utils/app-root"; | ||
import { formatFiles, readProjectConfiguration } from "@nx/devkit"; | ||
import { fsCommit, NxFsImplementation } from "@ui5/webcomponents-transformer-fs-commit"; | ||
import { FileSystemInterface, transformer, TransformerConfig } from "@ui5/webcomponents-transformer"; | ||
import { | ||
ExecutorContext, | ||
readProjectConfiguration, | ||
logger, | ||
workspaceRoot, | ||
formatFiles, | ||
} from '@nx/devkit'; | ||
import { FsTree, flushChanges, printChanges } from 'nx/src/generators/tree'; | ||
import { fsCommit, NxFsImplementation } from '@ui5/webcomponents-transformer-fs-commit'; | ||
import { FileSystemInterface, transformer, TransformerConfig } from '@ui5/webcomponents-transformer'; | ||
|
||
type TransformerNxConfig<T> = Omit<TransformerConfig<T>, 'persist'>; | ||
|
||
export type Ui5NxTransformerConfig<T = unknown> = | ||
TransformerNxConfig<T> | ||
| ((fs: FileSystemInterface) => TransformerNxConfig<T>); | ||
TransformerNxConfig<T> | | ||
((fs: FileSystemInterface) => TransformerNxConfig<T>); | ||
|
||
const executeTransformation = async (options: { | ||
transformerConfig: Ui5NxTransformerConfig; | ||
basePath: string, | ||
fsAdapter: FileSystemInterface | ||
basePath: string; | ||
fsAdapter: FileSystemInterface; | ||
}) => { | ||
await transformer({ | ||
persist: fsCommit(options.fsAdapter, options.basePath), | ||
...(typeof options.transformerConfig === 'function' ? options.transformerConfig(options.fsAdapter) : options.transformerConfig) | ||
...(typeof options.transformerConfig === 'function' ? options.transformerConfig(options.fsAdapter) : options.transformerConfig), | ||
}); | ||
}; | ||
|
||
/** | ||
* The executor which is calling the wrapper in Nx environment | ||
* The executor which is calling the wrapper in Nx environment. | ||
* @param schema | ||
* @param executorContext | ||
*/ | ||
export default async function ( | ||
schema: { configFile?: string, configFiles?: string[] }, | ||
schema: { configFile?: string; configFiles?: string[] }, | ||
executorContext: ExecutorContext | ||
): Promise<{ success: boolean }> { | ||
if (!schema.configFile && !schema.configFiles) { | ||
throw new Error('No config file specified'); | ||
throw new Error('No config file specified.'); | ||
} | ||
|
||
const host = new FsTree(workspaceRoot, executorContext.isVerbose); | ||
const configFiles = schema.configFile ? [schema.configFile] : schema.configFiles; | ||
const projectConfiguration = readProjectConfiguration(host, executorContext.projectName); | ||
const outputs = executorContext.target.outputs; | ||
const fsAdapter = new NxFsImplementation(host); | ||
|
||
outputs.forEach(output => { | ||
host.delete(output.replace('{projectRoot}', projectConfiguration.root).replace('{workspaceRoot}', workspaceRoot)) | ||
// Process the output paths | ||
(executorContext.target.outputs || []).forEach((output) => { | ||
host.delete(output.replace('{projectRoot}', projectConfiguration.root).replace('{workspaceRoot}', workspaceRoot)); | ||
}); | ||
|
||
// Execute transformation | ||
for (const configFile of configFiles) { | ||
await executeTransformation({ | ||
transformerConfig: await import(configFile).then((module) => module.default), | ||
basePath: projectConfiguration.sourceRoot, | ||
fsAdapter | ||
fsAdapter, | ||
}); | ||
} | ||
|
||
const changes = host.listChanges(); | ||
printChanges(changes); | ||
flushChanges(workspaceRoot, changes); | ||
flushChanges(host.root, changes); // Pass the base path (host.root) | ||
|
||
await formatFiles(host); | ||
|
||
return {success: true}; | ||
return { success: true }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.