mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-02 00:07:23 +08:00
feat!: upgrade to Angular 19.2.14 with modern testing infrastructure
BREAKING CHANGE: Minimum Angular version requirement updated to 19.2.14 - Angular Core: 19.0.5 → 19.2.14 (latest Angular 19 LTS) - Zone.js: 0.15.0 → 0.15.1 (latest compatibility) - TypeScript: 5.6.3 (latest supported by Angular 19) Testing Infrastructure Modernization: - Jest: 27.5.1 → 29.7.0 (major upgrade for better performance) - ts-jest: 27.1.5 → 29.3.4 (TypeScript 5.6+ compatibility) - @types/jest: 27.5.2 → 29.5.14 (latest type definitions) - jest-environment-jsdom: Added 29.7.0 (required for Jest 29) - RxJS: 7.8.1 → 7.8.2 (latest patch version) Package Generator Improvements: - Fixed package.json generator to use correct author from main package.json - Updated RxJS peer dependency to ^7.8.0 (modern version range) - Updated core version dependency to use current package version dynamically - Ensured consistency across all generated plugin package.json files This update brings the project to the latest Angular 19 LTS with enhanced testing capabilities, improved build performance, and modernized dependency management. All builds and tests passing successfully.
This commit is contained in:
@@ -22,16 +22,16 @@ export const PLUGINS_ROOT = join(ROOT, 'src/@awesome-cordova-plugins/plugins/');
|
||||
export const PLUGIN_PATHS = readdirSync(PLUGINS_ROOT).map((d) => join(PLUGINS_ROOT, d, 'index.ts'));
|
||||
|
||||
export function getDecorator(node: Node, index = 0): Decorator {
|
||||
if (node.decorators && node.decorators[index]) {
|
||||
return node.decorators[index];
|
||||
const decorators = (node as any).decorators;
|
||||
if (decorators && decorators[index]) {
|
||||
return decorators[index];
|
||||
}
|
||||
}
|
||||
|
||||
export function hasDecorator(decoratorName: string, node: Node): boolean {
|
||||
const decorators = (node as any).decorators;
|
||||
return (
|
||||
node.decorators &&
|
||||
node.decorators.length &&
|
||||
node.decorators.findIndex((d) => getDecoratorName(d) === decoratorName) > -1
|
||||
decorators && decorators.length && decorators.findIndex((d: any) => getDecoratorName(d) === decoratorName) > -1
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,11 @@ export function getProgram(rootNames: string[] = createSourceFiles()) {
|
||||
options.basePath = ROOT;
|
||||
options.moduleResolution = ModuleResolutionKind.NodeJs;
|
||||
options.module = ModuleKind.ES2015;
|
||||
options.target = ScriptTarget.ES5;
|
||||
options.lib = ['dom', 'es2017'];
|
||||
options.target = ScriptTarget.ES2020;
|
||||
options.lib = ['dom', 'es2020'];
|
||||
options.inlineSourceMap = true;
|
||||
options.importHelpers = true;
|
||||
options.inlineSources = true;
|
||||
options.enableIvy = true;
|
||||
options.compilationMode = 'partial';
|
||||
|
||||
delete options.baseUrl;
|
||||
|
||||
@@ -17,7 +17,7 @@ export function transformMembers(cls: ClassDeclaration) {
|
||||
propertyIndices.push(index);
|
||||
return member;
|
||||
case SyntaxKind.Constructor:
|
||||
return factory.createConstructorDeclaration(undefined, undefined, member.parameters, member.body);
|
||||
return factory.createConstructorDeclaration(undefined, member.parameters, member.body);
|
||||
default:
|
||||
return member; // in case anything gets here by accident...
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ export function transformMethod(method: MethodDeclaration) {
|
||||
|
||||
try {
|
||||
return factory.createMethodDeclaration(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
method.name,
|
||||
|
||||
@@ -25,7 +25,6 @@ function transformClass(cls: any, ngcBuild?: boolean) {
|
||||
for (const prop in pluginDecoratorArgs) {
|
||||
pluginStatics.push(
|
||||
factory.createPropertyDeclaration(
|
||||
undefined,
|
||||
[factory.createToken(SyntaxKind.StaticKeyword)],
|
||||
factory.createIdentifier(prop),
|
||||
undefined,
|
||||
@@ -36,11 +35,15 @@ function transformClass(cls: any, ngcBuild?: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
cls = factory.createClassDeclaration(
|
||||
const decorators =
|
||||
ngcBuild && cls.decorators && cls.decorators.length
|
||||
? cls.decorators.filter((d) => getDecoratorName(d) === 'Injectable')
|
||||
: undefined, // remove Plugin and Injectable decorators
|
||||
[factory.createToken(SyntaxKind.ExportKeyword)],
|
||||
? cls.decorators.filter((d: any) => getDecoratorName(d) === 'Injectable')
|
||||
: undefined;
|
||||
|
||||
const modifiers = [factory.createToken(SyntaxKind.ExportKeyword)];
|
||||
|
||||
cls = factory.createClassDeclaration(
|
||||
[...(decorators || []), ...modifiers], // combined decorators and modifiers
|
||||
cls.name,
|
||||
cls.typeParameters,
|
||||
cls.heritageClauses,
|
||||
@@ -58,7 +61,7 @@ function transformClasses(file: SourceFile, ctx: TransformationContext, ngcBuild
|
||||
(node) => {
|
||||
if (
|
||||
node.kind !== SyntaxKind.ClassDeclaration ||
|
||||
(node.modifiers && node.modifiers.find((v) => v.kind === SyntaxKind.DeclareKeyword))
|
||||
((node as any).modifiers && (node as any).modifiers.find((v: any) => v.kind === SyntaxKind.DeclareKeyword))
|
||||
) {
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ export function transformProperty(members: any[], index: number) {
|
||||
}
|
||||
|
||||
const getter = factory.createGetAccessorDeclaration(
|
||||
undefined,
|
||||
undefined,
|
||||
property.name,
|
||||
undefined,
|
||||
@@ -39,10 +38,9 @@ export function transformProperty(members: any[], index: number) {
|
||||
);
|
||||
|
||||
const setter = factory.createSetAccessorDeclaration(
|
||||
undefined,
|
||||
undefined,
|
||||
property.name,
|
||||
[factory.createParameterDeclaration(undefined, undefined, undefined, 'value', undefined, property.type)],
|
||||
[factory.createParameterDeclaration(undefined, undefined, 'value', undefined, property.type)],
|
||||
factory.createBlock([
|
||||
factory.createExpressionStatement(
|
||||
factory.createCallExpression(factory.createIdentifier(type + 'PropertySet'), undefined, [
|
||||
|
||||
Reference in New Issue
Block a user