This file contains hidden or 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
| import { FFService } from './feature-flag.service'; | |
| import { TranslocoTranspilerFunction } from '@ngneat/transloco'; | |
| class FeatureFlagResolver implements TranslocoTranspilerFunction { | |
| constructor(private featureFlagService: FFService) {} | |
| transpile(...args: string[]): any { | |
| const [flagName, trueValue, falseValue] = args; | |
| return this.featureFlagService.hasFF(flagName) ? trueValue : falseValue; |
This file contains hidden or 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
| import { FunctionalTranspiler, TRANSLOCO_TRANSPILER } from '@ngneat/transloco'; | |
| @NgModule({ | |
| ... | |
| providers: [{ | |
| provide: TRANSLOCO_TRANSPILER, | |
| useClass: FunctionalTranspiler | |
| }] | |
| }) | |
| export class TranslocoRootModule {} |
This file contains hidden or 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
| const chalk = require('chalk'); | |
| const {exec} = require('./exec'); | |
| /* The flag commit hash 🚩 */ | |
| const stgUniqCommit = "s76o527m89e9h72619a827s9h038c029o8de"; | |
| const currentBranch = exec('git rev-parse --abbrev-ref HEAD'); | |
| /* Get all the branch names that have a commit with this hash */ | |
| const branchesWithStaging = exec(`git branch --contains ${stgUniqCommit}`); | |
| if (branchesWithStaging.includes(currentBranch)) { | |
| console.log(chalk.bgRed.black.bold(`Your branch contains commits from 'staging' branch.`)); |
This file contains hidden or 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
| const {exec} = require('./exec'); | |
| /* Update local branch from origin master */ | |
| exec('git pull origin master'); |
This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const chalk = require('chalk'); | |
| const {exec} = require('./exec'); | |
| /* Branch Naming Convention */ | |
| ... | |
| /* Check Forbidden Tokens */ | |
| const FILES_REGEX = {ts: /\.ts$/, spec: /\.spec\.ts$/}; |
This file contains hidden or 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
| const chalk = require('chalk'); | |
| const {exec} = require('./exec'); | |
| const branchName = exec('git rev-parse --abbrev-ref HEAD', {trim: true}); | |
| // check if this branch already exists in the remote | |
| const isInRemote = exec(`git show-branch remotes/origin/${branchName}`, {toString: false}).code === 0; | |
| if (!isInRemote) { | |
| const validBranchPrefix = 'feature|fix|hotfix|chore|tests|automation'; | |
| const validBranchesRegex = new RegExp(`^(${validBranchPrefix})\/[\\w.-]+$`); |
This file contains hidden or 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
| const shell = require('shelljs'); | |
| function exec(cmd, options) { | |
| const defaultOptions = {silent: true}; | |
| let output = shell.exec(cmd, {...defaultOptions, ...(options || {})}); | |
| if (options && options.toString !== false) { | |
| output = output.toString(); | |
| output = options.trim ? output.trim() : output; | |
| } |
This file contains hidden or 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
| <ng-container *transloco="let t"> | |
| {{ t('profile.title') }} | |
| {{ t('title') }} | |
| </ng-container> |
This file contains hidden or 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
| <ng-container *transloco="let t"> | |
| {{ t('userProfile.title') }} | |
| {{ t('title') }} | |
| </ng-container> |
This file contains hidden or 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
| const routes: Routes = [ | |
| { | |
| path: '', | |
| component: UserProfileComponent | |
| } | |
| ]; | |
| @NgModule({ | |
| declarations: [UserProfileComponent], | |
| providers: [{provide: TRANSLOCO_SCOPE, useValue: 'user-profile'}], |