Skip to content
Merged
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
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
packages: write
strategy:
matrix:
node-version: [16.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package to npmjs
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'

- run: |
echo "@internxt:registry=https://npm.pkg.github.com/" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc

- run: yarn
- run: yarn run build

# Change the registry to npmjs (to publish)
- run: |
echo "registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc

- run: npm publish --scope=@internxt --access public
9 changes: 5 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: Publish package in github package registry
on:
release:
types: [created]
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '22.x'
registry-url: 'https://npm.pkg.github.com'
- run: yarn
env:
Expand Down
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint && yarn format && yarn test
13 changes: 13 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import eslintConfigInternxt from '@internxt/eslint-config-internxt';

export default [
{
ignores: ['dist', 'build'],
},
...eslintConfigInternxt,
{
rules: {
"@typescript-eslint/no-explicit-any": "warn",
}
}
];
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/lib",
"version": "1.2.0",
"version": "1.3.0",
"description": "Common logic shared between different projects of Internxt ",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand All @@ -13,7 +13,7 @@
"build": "tsc",
"lint": "eslint src/**/*.ts",
"format": "prettier src/**/*.ts",
"prepare": "husky install"
"prepare": "husky"
},
"repository": {
"type": "git",
Expand All @@ -26,14 +26,15 @@
},
"homepage": "https://github.com/internxt/lib#readme",
"devDependencies": {
"@internxt/eslint-config-internxt": "^1.0.3",
"@internxt/prettier-config": "^1.0.1",
"@types/jest": "^27.0.1",
"eslint": "^7.32.0",
"husky": "^7.0.1",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"ts-jest": "^27.0.5",
"typescript": "^4.3.5"
"@internxt/eslint-config-internxt": "2.0.0",
"@internxt/prettier-config": "1.0.2",
"@types/jest": "30.0.0",
"@types/node": "24.0.4",
"eslint": "9.29.0",
"husky": "9.1.7",
"jest": "30.0.3",
"prettier": "3.6.1",
"ts-jest": "29.4.0",
"typescript": "5.8.3"
}
}
9 changes: 5 additions & 4 deletions src/items/renameIfNeeded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
* if it doesn't exist already.
*/
export default function renameIfNeeded(
items: { name: string; type: string }[],
items: { name: string; type?: string }[],
filename: string,
type: string,
type?: string,
): [boolean, number, string] {
const FILENAME_INCREMENT_REGEX = /( \([0-9]+\))$/i;
const INCREMENT_INDEX_REGEX = /\(([^)]+)\)/;

const cleanFilename = filename.replace(FILENAME_INCREMENT_REGEX, '');

const infoFilenames: { name: string; cleanName: string; type: string; incrementIndex: number }[] = items
const infoFilenames: { name: string; cleanName: string; type?: string; incrementIndex: number }[] = items
.map((item) => {
const cleanName = item.name.replace(FILENAME_INCREMENT_REGEX, '');
const incrementString = item.name.match(FILENAME_INCREMENT_REGEX)?.pop()?.match(INCREMENT_INDEX_REGEX)?.pop();
Expand All @@ -35,7 +35,8 @@ export default function renameIfNeeded(
incrementIndex,
};
})
.filter((item) => item.cleanName === cleanFilename && item.type === type)
.filter((item) => item.cleanName.toLowerCase() === cleanFilename.toLowerCase()
&& (item.type?.toLowerCase() ?? '') === (type?.toLowerCase() ?? ''))
.sort((a, b) => b.incrementIndex - a.incrementIndex);

const filenameExists = !!infoFilenames.length;
Expand Down
3 changes: 1 addition & 2 deletions src/request/extractMessageFromError.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
type AxiosError = any;
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
/* eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */
type AxiosResponse<T> = any;
type ErrorMessage = string;

Expand Down
Loading