diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..b15f9b0 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,38 @@ +module.exports = { + parser: '@typescript-eslint/parser', + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:prettier/recommended', + ], + plugins: ['prettier'], + env: { + node: true, + browser: true, + worker: true, + es2022: true, + }, + rules: { + 'prettier/prettier': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { ignoreRestSiblings: true, argsIgnorePattern: '^_' }, + ], + }, + overrides: [ + { + files: ['*d.ts'], + rules: { + 'no-undef': 'off', + }, + }, + { + files: ['*js'], + globals: { + webcm: 'writable', + }, + }, + ], +} + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e6a7bab --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: 'Build Test' + +on: + push: + branches: + - '**' + +jobs: + build-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v2 + - name: Running Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + # Actual Tests + - run: npm i + - run: npm run lint --if-present + - run: npm run typecheck --if-present + - run: npm run bundle --if-present + - run: npm run test --if-present diff --git a/package.json b/package.json index ab5df82..2a519c3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "bundle": "node esbuild.js", "build": "npm run lint && npm run typecheck && npm run bundle", "typecheck": "tsc --project tsconfig.build.json --noEmit", - "test": "vitest run --globals", + "test": "vitest run --globals --passWithNoTests", "test:dev": "vitest --globals", "release": "npm run build && npm version patch && npm publish" }, diff --git a/src/index.ts b/src/index.ts index f2b74a6..97a4a83 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ const sendEvent = async ( settings: ComponentSettings ) => { const tiktokEndpoint = - 'https://business-api.tiktok.com/open_api/v1.2/pixel/track/' + 'https://business-api.tiktok.com/open_api/v1.3/pixel/track/' const requestBody = { pixel_code: payload.properties.pixelCode || settings.pixelCode,