diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml new file mode 100644 index 0000000..a7377ec --- /dev/null +++ b/.github/workflows/github_actions.yml @@ -0,0 +1,37 @@ +name: github_actions + +on: + push: + branches: [ main, master ] + paths-ignore: + - '**/*.md' + - 'docs/**' + - '.github/ISSUE_TEMPLATE/**' + pull_request: + types: [opened, synchronize, reopened] + paths-ignore: + - '**/*.md' + - 'docs/**' + - '.github/ISSUE_TEMPLATE/**' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + node-ci: + strategy: + fail-fast: false + matrix: + node-version: [18, 20] + uses: cursorvers/cursor-macbookpro2019-workflows/.github/workflows/node-ci-reusable.yml@v1.1 + with: + node-version: ${{ matrix.node-version }} + working-directory: '.' + run-lint: true + run-test: true + run-build: true diff --git a/eslint.config.js b/eslint.config.js deleted file mode 100644 index f52d2ef..0000000 --- a/eslint.config.js +++ /dev/null @@ -1,34 +0,0 @@ -const js = require('@eslint/js'); -const globals = require('globals'); -const securityPlugin = require('eslint-plugin-security'); - -module.exports = [ - { - ignores: ['node_modules/**', 'coverage/**'], - }, - { - files: ['**/*.js'], - languageOptions: { - ecmaVersion: 2022, - sourceType: 'script', - globals: { - ...globals.node, - }, - }, - plugins: { - security: securityPlugin, - }, - rules: { - ...js.configs.recommended.rules, - ...securityPlugin.configs.recommended.rules, - 'no-console': 'off', - 'security/detect-object-injection': 'off', - }, - }, - { - files: ['test/**/*.js'], - rules: { - 'security/detect-non-literal-fs-filename': 'off', - }, - }, -]; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..c5a62e4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,17 @@ +import js from '@eslint/js'; +import pluginSecurity from 'eslint-plugin-security'; +import globals from 'globals'; + +export default [ + js.configs.recommended, + pluginSecurity.configs.recommended, + { + files: ['**/*.js', '**/*.mjs', 'tests/**/*.mjs'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { ...globals.node } + }, + rules: { 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }] } + } +]; diff --git a/tests/smoke.test.mjs b/tests/smoke.test.mjs new file mode 100644 index 0000000..4872197 --- /dev/null +++ b/tests/smoke.test.mjs @@ -0,0 +1,13 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import { dirname } from 'node:path'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +test('package.json exists and has name', () => { + const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url))); + assert.equal(typeof pkg.name, 'string'); +});