Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
- run: npm install
- run: npm run bootstrap
- run: npm run lint
Expand All @@ -24,10 +24,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm run bootstrap
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
6 changes: 5 additions & 1 deletion packages/angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "projects/tx-native-angular-sdk/tsconfig.spec.json",
"karmaConfig": "projects/tx-native-angular-sdk/karma.conf.js",
"codeCoverage": true
"codeCoverage": true,
"watch": false
}
},
"lint": {
Expand All @@ -53,5 +54,8 @@
"@angular-eslint/schematics:library": {
"setParserOptionsProject": true
}
},
"cli": {
"analytics": false
}
}
59 changes: 31 additions & 28 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,39 @@
"test": "ng test"
},
"private": true,
"engines": {
"node": ">=18.19.0"
},
"dependencies": {
"@angular/animations": "~16.2.7",
"@angular/common": "~16.2.7",
"@angular/compiler": "~16.2.7",
"@angular/core": "~16.2.7",
"@angular/forms": "~16.2.7",
"@angular/platform-browser": "^16.2.7",
"@angular/platform-browser-dynamic": "^16.2.7",
"@angular/router": "~16.2.7",
"@angular/animations": "~19.2.19",
"@angular/common": "~19.2.19",
"@angular/compiler": "~19.2.19",
"@angular/core": "~19.2.19",
"@angular/forms": "~19.2.19",
"@angular/platform-browser": "~19.2.19",
"@angular/platform-browser-dynamic": "~19.2.19",
"@angular/router": "~19.2.19",
"@transifex/native": "^7.1.5",
"rxjs": "~6.6.0",
"rxjs": "~7.8.0",
"tslib": "^2.6.2",
"zone.js": "^0.13.3"
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/architect": "^0.1602.4",
"@angular-devkit/build-angular": "^16.2.4",
"@angular-eslint/builder": "^16.2.0",
"@angular-eslint/eslint-plugin": "^16.2.0",
"@angular-eslint/eslint-plugin-template": "^16.2.0",
"@angular-eslint/schematics": "16.2.0",
"@angular-eslint/template-parser": "^16.2.0",
"@angular/cli": "^16.2.4",
"@angular/compiler-cli": "^16.2.7",
"@types/jasmine": "~4.0.0",
"@types/node": "^16.18.70",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@angular-devkit/architect": "0.1902.19",
"@angular-devkit/build-angular": "~19.2.19",
"@angular-eslint/builder": "~19.2.0",
"@angular-eslint/eslint-plugin": "~19.2.0",
"@angular-eslint/eslint-plugin-template": "~19.2.0",
"@angular-eslint/schematics": "~19.2.0",
"@angular-eslint/template-parser": "~19.2.0",
"@angular/cli": "~19.2.0",
"@angular/compiler-cli": "~19.2.19",
"@types/jasmine": "~5.1.0",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.56.0",
"eslint-config-airbnb-typescript": "^16.2.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
Expand All @@ -69,15 +72,15 @@
"eslint-plugin-rxjs-angular": "^2.0.1",
"eslint-plugin-tsdoc": "^0.2.17",
"eslint-plugin-unicorn": "^46.0.1",
"jasmine-core": "~4.3.0",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "^7.0.0",
"karma": "~6.4.1",
"karma-chrome-launcher": "~3.1.1",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"ng-packagr": "^16.2.3",
"ts-node": "~8.3.0",
"typescript": "~4.9.5"
"ng-packagr": "~19.2.0",
"ts-node": "~10.9.0",
"typescript": "~5.5.0"
}
}
11 changes: 6 additions & 5 deletions packages/angular/projects/tx-native-angular-sdk/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (config) {
jasmine: {
failSpecWithNoExpectations: true,
},
clearContext: false
clearContext: true, // Suppresses "full page reload" false positive in Chrome 128+
},
jasmineHtmlReporter: {
suppressAll: true
Expand All @@ -30,7 +30,7 @@ module.exports = function (config) {
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
reporters: ['progress', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand All @@ -44,10 +44,11 @@ module.exports = function (config) {
},
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
flags: ['--no-sandbox', '--headless=old'],
},
},
singleRun: true, // Moved this property outside the customLaunchers object
restartOnFileChange: true, // Moved this property outside the customLaunchers object
singleRun: true,
restartOnFileChange: false,
browserDisconnectTolerance: 2,
});
};
4 changes: 2 additions & 2 deletions packages/angular/projects/tx-native-angular-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"repository": "git://github.com/transifex/transifex-javascript.git",
"license": "Apache-2.0",
"peerDependencies": {
"@angular/common": "^16.0.0",
"@angular/core": " ^16.0.0",
"@angular/common": "^19.0.0",
"@angular/core": "^19.0.0",
"@transifex/native": "^7.0.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { Component, Input, OnChanges, OnDestroy, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Observable, Subscription } from 'rxjs';

import { TXInstanceComponent } from './instance.component';
import { ITranslateParams } from './interfaces';
import { SafeHtmlPipe } from './safe-html.pipe';
import { TranslationService } from './translation.service';

/**
* A translation component
**/
@Component({
standalone: true,
selector: 'T',
imports: [CommonModule, SafeHtmlPipe],
template: `
<ng-container *ngIf="!translateParams.sanitize">{{ translatedStr }}</ng-container>
<span *ngIf="translateParams.sanitize" [innerHTML]="translatedStr | safeHtml"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ITXInstanceConfiguration} from "./interfaces";
*/

export const T = (str: string, params?: Record<string, unknown>,
instanceConfig?: ITXInstanceConfiguration) => (target: any, key: string) => {
instanceConfig?: ITXInstanceConfiguration) => (target: object, key: string) => {
const injector = Injector.create(
{
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { LoadTranslationsDirective } from './load-translations.directive';


@NgModule({
declarations: [
imports: [
CommonModule,
TComponent,
UTComponent,
LanguagePickerComponent,
Expand All @@ -21,7 +22,6 @@ import { LoadTranslationsDirective } from './load-translations.directive';
TXInstanceComponent,
LoadTranslationsDirective,
],
imports: [CommonModule],
exports: [
TComponent,
UTComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';

import { TXInstanceComponent } from './instance.component';
import { SafeHtmlPipe } from './safe-html.pipe';
import { TComponent } from './T.component';
import { TranslationService } from './translation.service';

@Component({
standalone: true,
selector: 'UT',
imports: [CommonModule, SafeHtmlPipe],
template: `
<div *ngIf="!translateParams._inline" [innerHTML]="translatedStr | safeHtml"></div>
<span *ngIf="translateParams._inline" [innerHTML]="translatedStr | safeHtml"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TranslationService } from './translation.service';
import {TxNative} from "@transifex/native";

@Component({
standalone: true,
selector: 'tx-instance',
template: `
<ng-content></ng-content>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Observable, Subscription } from 'rxjs';

import { TXInstanceComponent } from './instance.component';
Expand All @@ -9,7 +10,9 @@ import { TranslationService } from './translation.service';
* A language picker component with the available languages already populated
*/
@Component({
standalone: true,
selector: 'tx-language-picker',
imports: [CommonModule],
template: `
<select [class]="className" (change)="onChange($event)" class="tx-language-picker">
<option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TranslationService } from './translation.service';
/**
* Directive for fetching translations in batches
*/
@Directive({ selector: '[txLoadTranslations]' })
@Directive({ standalone: true, selector: '[txLoadTranslations]' })
export class LoadTranslationsDirective implements OnChanges, OnDestroy {
@Input('txLoadTranslations') tags = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core';
/**
* A pipe for sanitizing safely HTML
*/
@Pipe({ name: 'safeHtml' })
@Pipe({ standalone: true, name: 'safeHtml' })
export class SafeHtmlPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TranslationService } from './translation.service';

@Injectable()
@Pipe({
standalone: true,
name: 'translate',
pure: false, // required to update the translation
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('TComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TComponent, SafeHtmlPipe, TXInstanceComponent],
imports: [TComponent, SafeHtmlPipe, TXInstanceComponent],
providers: [TXInstanceComponent],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('UTComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [UTComponent, SafeHtmlPipe, TXInstanceComponent],
imports: [UTComponent, SafeHtmlPipe, TXInstanceComponent],
providers: [TXInstanceComponent],
}).compileComponents();
service = TestBed.inject(TranslationService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('TXInstanceComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TXInstanceComponent],
imports: [TXInstanceComponent],
providers: [TXInstanceComponent],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('LanguagePickerComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [LanguagePickerComponent, TXInstanceComponent],
imports: [LanguagePickerComponent, TXInstanceComponent],
providers: [TXInstanceComponent],
}).compileComponents();
service = TestBed.inject(TranslationService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { LoadTranslationsDirective, TranslationService } from '../public-api';

describe('LoadTranslationsDirective', () => {
@Component({
standalone: true,
imports: [LoadTranslationsDirective],
template: ` <div [txLoadTranslations]="'tag1'"></div> `,
})
class TestComponent {}
Expand All @@ -19,7 +21,7 @@ describe('LoadTranslationsDirective', () => {

beforeEach(() => {
fixture = TestBed.configureTestingModule({
declarations: [LoadTranslationsDirective, TestComponent],
imports: [TestComponent],
providers: [],
}).createComponent(TestComponent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('TranslatePipe', () => {

beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [TXInstanceComponent],
imports: [TXInstanceComponent],
providers: [
TranslationService,
TXInstanceComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [ "node" ],
"typeRoots": [ "../node_modules/@types" ],
"types": [],
"lib": [
"dom",
"es2020"
Expand Down