Skip to content

Commit

Permalink
Bazı düzenlemeler yapıldı.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilaleren committed May 29, 2023
1 parent c0026e8 commit d58c494
Show file tree
Hide file tree
Showing 28 changed files with 611 additions and 566 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import EInvoice, {
getDateFormat, // Tarih formatını alma
EInvoiceCountry, // Ülkeler
EInvoiceApi, // e-Arşiv API servisi
EInvoiceError, // Genel hata sınıfı
EInvoiceTypeError, // Tür hata sınıfı
EInvoiceApiError, // API hata sınıfı
InvoiceType, // Fatura türü
EInvoiceApiErrorCode, // API hata kodları
Expand Down Expand Up @@ -116,17 +116,17 @@ API taraflı veya doğrulama sonucunda oluşacak hataları ayıklama.

```typescript
import EInvoice, {
EInvoiceError,
EInvoiceApiError,
EInvoiceTypeError,
EInvoiceApiErrorCode
} from 'e-fatura'

try {
await EInvoice.createDraftInvoice({})
// veya EInvoice.*()
} catch (e) {
if (e instanceof EInvoiceError) {
console.error('Doğrulama hatası meydana geldi:', e)
if (e instanceof EInvoiceTypeError) {
console.error('Tür hatası meydana geldi:', e)
} else if (e instanceof EInvoiceApiError) {
const response = e.getResponse()

Expand Down
10 changes: 5 additions & 5 deletions docs/SIGN_INVOICE_VIA_SMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ e-Arşiv üzerinden belirli bir faturayı imzalama.
```typescript
import EInvoice, {
BasicInvoice,
EInvoiceError,
EInvoiceApiError,
EInvoiceTypeError,
EInvoiceApiErrorCode
} from 'e-fatura'

Expand Down Expand Up @@ -34,20 +34,20 @@ try {
console.error('Sunucu hatası.')
break
case EInvoiceApiErrorCode.INVALID_RESPONSE:
console.error('Geçersiz sunucu cevabı')
console.error('Geçersiz sunucu cevabı.')
break
case EInvoiceApiErrorCode.NOT_VERIFIED_SMS_CODE:
console.error('SMS doğrulama kodu onaylanamadı.')
break
case EInvoiceApiErrorCode.INVALID_SMS_OPERATION_ID:
console.error('SMS gönderilemedi veya işlem kimliği geçersiz')
console.error('SMS gönderilemedi veya işlem kimliği geçersiz.')
break
case EInvoiceApiErrorCode.SAVED_PHONE_NUMBER_NOT_FOUND:
console.error('Kayıtlı telefon numarası bulunamadı.')
break
}
} else if (e instanceof EInvoiceError) {
console.error('Doğrulama hatası meydana geldi:', e)
} else if (e instanceof EInvoiceTypeError) {
console.error('Tür hatası meydana geldi:', e)
} else {
console.error('Bilinmeyen bir hata meydana geldi:', e)
}
Expand Down
18 changes: 14 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
const jestConfig = {
verbose: true,
/** @type {import('@jest/types').Config} */
const config = {
preset: 'ts-jest',
roots: ['./src'],
moduleFileExtensions: ['js', 'ts', 'tsx', 'json'],
rootDir: './src',
testRegex: '.*\\.test\\.ts(x)?$',
transform: {
'^.+\\.ts$': [
'ts-jest',
{
isolatedModules: true
}
]
},
testEnvironment: 'node'
}

module.exports = jestConfig
module.exports = config
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "e-fatura",
"version": "1.0.2",
"version": "1.0.3",
"description": "e-Arşiv üzerinden fatura oluşturur, faturaları listeler, fatura(ları) imzalar ve daha fazlasını yapar.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -17,13 +17,13 @@
],
"scripts": {
"prebuild": "rm -rf dist && yarn lint && yarn test",
"build": "NODE_ENV=production rollup -c --bundleConfigAsCjs",
"start:dev": "NODE_ENV=development rollup -c -w --bundleConfigAsCjs",
"build": "NODE_ENV=production rollup -c",
"start:dev": "NODE_ENV=development rollup -c",
"lint": "eslint \"./src/**/*.ts\" --quiet",
"lint:fix": "eslint \"./src/**/*.ts\" --fix",
"test": "jest",
"format": "prettier --write \"./src/**/*.ts\"",
"test:watch": "yarn test --watchAll",
"test": "jest --config jest.config.js --detectOpenHandles",
"test:watch": "yarn run test --watchAll",
"build:docker-image": "bash ./scripts/docker-image.sh build",
"run:docker-container": "bash ./scripts/docker-image.sh up"
},
Expand Down
12 changes: 6 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dts from 'rollup-plugin-dts'
import cleanup from 'rollup-plugin-cleanup'
import typescript from '@rollup/plugin-typescript'
import externals from 'rollup-plugin-node-externals'
const cleanup = require('rollup-plugin-cleanup')
const { default: dts } = require('rollup-plugin-dts')
const typescript = require('@rollup/plugin-typescript')
const externals = require('rollup-plugin-node-externals')

const prod = process.env.NODE_ENV === 'production'

Expand Down Expand Up @@ -36,7 +36,7 @@ const config = [
if (prod) {
config.push({
input: './src/index.ts',
plugins: [dts.default()],
plugins: [dts()],
output: {
file: './dist/index.d.ts',
format: 'es',
Expand All @@ -45,4 +45,4 @@ if (prod) {
})
}

export default config
module.exports = config
Loading

0 comments on commit d58c494

Please sign in to comment.