-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b62b45
Showing
67 changed files
with
13,486 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** @type {import('eslint').ESLint.ConfigData} */ | ||
module.exports = { | ||
env: { | ||
node: true, | ||
es2021: true, | ||
jest: true, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
overrides: [], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
}, | ||
plugins: ["@typescript-eslint", "prettier"], | ||
rules: { | ||
"prettier/prettier": "error", | ||
}, | ||
ignorePatterns: ["build", "node_modules", ".husky", ".yarn"], | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/test.yml | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
cache: "yarn" | ||
- name: Install | ||
run: yarn install --immutable | ||
- name: Build | ||
run: yarn build | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: yarn semantic-release |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.x, 18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "yarn" | ||
- name: Install | ||
run: yarn install --immutable | ||
- name: Lint | ||
run: yarn lint:check | ||
- name: Test | ||
run: yarn test |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules | ||
build | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit "$1" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"target": "es2021", | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true | ||
}, | ||
"transform": { | ||
"decoratorMetadata": true, | ||
"legacyDecorator": true | ||
}, | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
} | ||
}, | ||
"module": { | ||
"type": "commonjs", | ||
"strict": true | ||
}, | ||
"sourceMaps": true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "test", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeExecutable": "yarn", | ||
"runtimeArgs": ["test", "--verbose", "--watch", "--onlyChanged"], | ||
"sourceMaps": true, | ||
"pauseForSourceMap": true, | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "test:file", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeExecutable": "yarn", | ||
"runtimeArgs": [ | ||
"test", | ||
"${relativeFile}", | ||
"--verbose", | ||
"--watchAll", | ||
"--runInBand" | ||
], | ||
"sourceMaps": true, | ||
"pauseForSourceMap": true, | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yarnPath: .yarn/releases/yarn-3.4.1.cjs | ||
nodeLinker: node-modules |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# NestJS Chargebee |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
module.exports = { | ||
transform: { | ||
"^.+\\.(t|j)s?$": ["@swc/jest", { sourceMaps: "inline" }], | ||
}, | ||
extensionsToTreatAsEsm: [".ts"], | ||
moduleNameMapper: { | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
modulePathIgnorePatterns: ["<rootDir>/build/"], | ||
testMatch: ["<rootDir>/src/**/*.test.ts"], | ||
testEnvironment: "node", | ||
collectCoverage: false, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"name": "nestjs-chargebee", | ||
"version": "0.1.0", | ||
"exports": { | ||
".": { | ||
"types": "./build/types/main.d.ts", | ||
"import": "./build/esm/main.js", | ||
"default": "./build/cjs/main.js" | ||
} | ||
}, | ||
"main": "build/cjs/main.js", | ||
"types": "build/types/main.d.ts", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/voiceflow/nestjs-chargebee.git" | ||
}, | ||
"scripts": { | ||
"postinstall": "husky install", | ||
"prepack": "pinst --disable", | ||
"postpack": "pinst --enable", | ||
"build": "yarn run-p build:cjs build:esm build:types", | ||
"prebuild:cjs": "yarn rimraf build/cjs", | ||
"build:cjs": "yarn prebuild:cjs && yarn swc src -d build/cjs --config module.type=commonjs && yarn postbuild:cjs", | ||
"postbuild:cjs": "touch build/cjs/package.json && echo '{ \"type\": \"commonjs\" }' > build/cjs/package.json", | ||
"prebuild:esm": "yarn rimraf build/esm", | ||
"build:esm": "yarn prebuild:esm && yarn swc src -d build/esm --config module.type=es6 && yarn postbuild:esm", | ||
"postbuild:esm": "touch build/esm/package.json && echo '{ \"type\": \"module\" }' > build/esm/package.json", | ||
"build:types": "yarn tsc -p tsconfig.build.json", | ||
"test": "yarn jest --passWithNoTests", | ||
"lint": "yarn eslint --fix src", | ||
"lint:check": "yarn eslint src" | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"lint-staged": { | ||
"*.{ts,js}": "yarn eslint --fix", | ||
"*.{md,json,yml}": "yarn prettier --write" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main" | ||
] | ||
}, | ||
"dependencies": { | ||
"chargebee-typescript": "2.23.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.6.7", | ||
"@commitlint/config-conventional": "^17.6.7", | ||
"@nestjs/common": "^10.1.3", | ||
"@nestjs/core": "^10.1.3", | ||
"@nestjs/testing": "^10.1.3", | ||
"@swc/cli": "^0.1.62", | ||
"@swc/core": "^1.3.72", | ||
"@swc/jest": "^0.2.27", | ||
"@types/jest": "^29.5.3", | ||
"@types/q": "^1.5.5", | ||
"@types/supertest": "^2.0.12", | ||
"@typescript-eslint/eslint-plugin": "^6.2.1", | ||
"@typescript-eslint/parser": "^6.2.1", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.9.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.6.2", | ||
"lint-staged": "^13.2.3", | ||
"npm-run-all": "^4.1.5", | ||
"pinst": "^3.0.0", | ||
"prettier": "^3.0.0", | ||
"reflect-metadata": "^0.1.13", | ||
"rimraf": "^5.0.1", | ||
"rxjs": "^7.8.1", | ||
"semantic-release": "^21.0.7", | ||
"supertest": "^6.3.3", | ||
"ts-node": "^10.9.1", | ||
"tsc-alias": "^1.8.7", | ||
"typescript": "^5.1.6" | ||
}, | ||
"peerDependencies": { | ||
"@nestjs/common": "^9 || ^10", | ||
"rxjs": "^7" | ||
}, | ||
"packageManager": "yarn@3.4.1" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Inject, Injectable, Optional } from "@nestjs/common"; | ||
import { ChargeBee } from "chargebee-typescript"; | ||
|
||
import { ChargebeeModuleOptions } from "./chargebee.interface"; | ||
import { CHARGEBEE_MODULE_OPTIONS_TOKEN } from "./chargebee.module-definition"; | ||
|
||
@Injectable() | ||
export class ChargebeeClientService { | ||
constructor( | ||
@Inject(CHARGEBEE_MODULE_OPTIONS_TOKEN) | ||
options: ChargebeeModuleOptions, | ||
@Optional() | ||
private _client = new ChargeBee(), | ||
) { | ||
this._client.configure({ | ||
site: options.site, | ||
api_key: options.apiKey, | ||
}); | ||
} | ||
|
||
public get client(): ChargeBee { | ||
return this._client; | ||
} | ||
} |
Oops, something went wrong.