From b8239f5eb98f620eda4988d4a2e49ef13db5d075 Mon Sep 17 00:00:00 2001 From: "masayuki.O" Date: Tue, 21 Oct 2025 01:36:54 +0900 Subject: [PATCH 1/5] chore(ci): add reusable CI workflow (org v1) --- .github/workflows/github_actions.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/github_actions.yml diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml new file mode 100644 index 0000000..8b14a00 --- /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 + with: + node-version: ${{ matrix.node-version }} + working-directory: '.' + run-lint: true + run-test: true + run-build: true From 67ffe9427747d223e3f18e1e154b6dfbd935e14b Mon Sep 17 00:00:00 2001 From: "masayuki.O" Date: Tue, 21 Oct 2025 02:59:11 +0900 Subject: [PATCH 2/5] test: add smoke test and minimal ESLint config --- eslint.config.mjs | 19 +++++++++++++++++++ tests/smoke.test.js | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 eslint.config.mjs create mode 100644 tests/smoke.test.js diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..1cd843d --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,19 @@ +import js from "@eslint/js"; +import globals from "globals"; + +export default [ + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 2023, + sourceType: "module", + globals: globals.node, + }, + rules: { + // 必要最低限。将来プロジェクトポリシーに合わせて強化 + "no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], + "no-console": "off", + }, + ignores: ["dist/**", "lib/**", "node_modules/**"], + }, +]; diff --git a/tests/smoke.test.js b/tests/smoke.test.js new file mode 100644 index 0000000..9676910 --- /dev/null +++ b/tests/smoke.test.js @@ -0,0 +1,10 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; + +// 最小のスモークテスト +// CLIが存在し、基本的なモジュールが読み込めることを確認 + +test('package loads', async () => { + const pkg = await import('../lib/index.js').catch(() => null); + assert.ok(pkg !== null, 'lib/index.js should be importable'); +}); From ec87782d8be35e024b5b670e5fc1aa2e22f67b2d Mon Sep 17 00:00:00 2001 From: "masayuki.O" Date: Tue, 21 Oct 2025 03:04:30 +0900 Subject: [PATCH 3/5] chore(ci): add minimal ESLint config and smoke test --- eslint.config.mjs | 21 ++++++++++----------- tests/smoke.test.js | 15 +++++++++------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 1cd843d..2a30ac5 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,19 +1,18 @@ -import js from "@eslint/js"; -import globals from "globals"; +import js from '@eslint/js'; +import pluginSecurity from 'eslint-plugin-security'; +import globals from 'globals'; export default [ js.configs.recommended, + pluginSecurity.configs.recommended, { languageOptions: { - ecmaVersion: 2023, - sourceType: "module", - globals: globals.node, + ecmaVersion: 'latest', + sourceType: 'module', + globals: { ...globals.node } }, rules: { - // 必要最低限。将来プロジェクトポリシーに合わせて強化 - "no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], - "no-console": "off", - }, - ignores: ["dist/**", "lib/**", "node_modules/**"], - }, + 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }] + } + } ]; diff --git a/tests/smoke.test.js b/tests/smoke.test.js index 9676910..4872197 100644 --- a/tests/smoke.test.js +++ b/tests/smoke.test.js @@ -1,10 +1,13 @@ -import assert from 'node:assert/strict'; 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'; -// 最小のスモークテスト -// CLIが存在し、基本的なモジュールが読み込めることを確認 +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); -test('package loads', async () => { - const pkg = await import('../lib/index.js').catch(() => null); - assert.ok(pkg !== null, 'lib/index.js should be importable'); +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'); }); From 4b8c705c6280c5d9660f53f256e6c73fc475af13 Mon Sep 17 00:00:00 2001 From: Masayuki Otawara Date: Tue, 21 Oct 2025 08:49:18 +0900 Subject: [PATCH 4/5] fix(eslint): treat tests as ESM; update flat config (#3) * fix(eslint): treat tests as ESM; update flat config * chore(eslint): remove legacy eslint.config.js to use flat mjs * ci: temporarily disable test for node:test; fix jest --ci later --- .github/workflows/github_actions.yml | 2 +- eslint.config.js | 34 ------------------------- eslint.config.mjs | 5 ++-- tests/{smoke.test.js => smoke.test.mjs} | 0 4 files changed, 3 insertions(+), 38 deletions(-) delete mode 100644 eslint.config.js rename tests/{smoke.test.js => smoke.test.mjs} (100%) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 8b14a00..7510a55 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -33,5 +33,5 @@ jobs: node-version: ${{ matrix.node-version }} working-directory: '.' run-lint: true - run-test: true + run-test: false 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 index 2a30ac5..c5a62e4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -6,13 +6,12 @@ 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: '^_' }] - } + rules: { 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }] } } ]; diff --git a/tests/smoke.test.js b/tests/smoke.test.mjs similarity index 100% rename from tests/smoke.test.js rename to tests/smoke.test.mjs From 0dbdc8474122ba7fdc94dbbaf8c6bc8cfb80a070 Mon Sep 17 00:00:00 2001 From: "masayuki.O" Date: Tue, 21 Oct 2025 10:12:23 +0900 Subject: [PATCH 5/5] ci: use reusable v1.1 and enable tests --- .github/workflows/github_actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 7510a55..a7377ec 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -28,10 +28,10 @@ jobs: fail-fast: false matrix: node-version: [18, 20] - uses: cursorvers/cursor-macbookpro2019-workflows/.github/workflows/node-ci-reusable.yml@v1 + 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: false + run-test: true run-build: true