Skip to content

Commit

Permalink
Format for lint and keep apps-engine version to 1.44
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert committed Sep 26, 2024
1 parent d40def4 commit b4dc27c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
26 changes: 16 additions & 10 deletions src/misc/variousUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,34 @@ import { IAppCategory } from './interfaces';

export class VariousUtils {
public static slugify = function _slugify(text: string): string {
return text.toString().toLowerCase().replace(/^\s+|\s+$/g, '')
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of textte
return text
.toString()
.toLowerCase()
.replace(/^\s+|\s+$/g, '')
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of textte
};

public static getTsDefVersion = function _getTsDefVersion(): string {
const devLocation = 'node_modules/@rocket.chat/apps-engine/package.json';
const devLocation =
'node_modules/@rocket.chat/apps-engine/package.json';

if (fs.existsSync(devLocation)) {
const info = JSON.parse(fs.readFileSync(devLocation, 'utf8'));
return '^' + info.version as string;
return ('^' + info.version) as string;
}

return '^1.45.0';
return '^1.44.0';
};

// tslint:disable:promise-function-async
public static async fetchCategories(): Promise<Array<IAppCategory>> {
const cats = await fetch('https://marketplace.rocket.chat/v1/categories').then((res) => res.json());
const cats = await fetch(
'https://marketplace.rocket.chat/v1/categories',
).then((res) => res.json());

const categories: Array<IAppCategory> = cats.map((c: any) => {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/templates/app/packageJsonTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export const packageJsonTemplate = (): string => {
return `{
"devDependencies": {
"@rocket.chat/apps-engine": "^1.45.0",
"@rocket.chat/apps-engine": "^1.44.0",
"@types/node": "14.14.6",
"tslint": "^5.10.0",
"typescript": "^5.6.2"
},
"dependencies": {
"@rocket.chat/icons": "^0.38.0",
"@rocket.chat/ui-kit": "^0.36.1"
"@rocket.chat/ui-kit": "^0.36.1"
}
}`;
};

0 comments on commit b4dc27c

Please sign in to comment.