From 96ea59636db8de18346b5f23dcd76623cd7d9ff8 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:06:01 +0900 Subject: [PATCH 1/7] chore: remove unneeded config --- tsconfig.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 7994505..2e8e447 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,8 +7,6 @@ "strict": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "allowImportingTsExtensions": true, "resolveJsonModule": true, "isolatedModules": true }, From 1a072efda7f569c7c7fc2cd2f40e18cf6eda0bc2 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:08:55 +0900 Subject: [PATCH 2/7] feat!: remove subcommands --- src/commands/clean.ts | 34 ---------------------------------- src/commands/list.ts | 24 ------------------------ src/index.ts | 4 +--- 3 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 src/commands/clean.ts delete mode 100644 src/commands/list.ts diff --git a/src/commands/clean.ts b/src/commands/clean.ts deleted file mode 100644 index 2ae8ee6..0000000 --- a/src/commands/clean.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { cancel, confirm, isCancel, log, outro } from '@clack/prompts'; -import { command } from 'cleye'; -import colors from 'picocolors'; - -import { cleanWorkspaces } from '../operations/clean-workspaces.js'; - -export default command( - { - name: 'clean', - - help: { - description: 'Clean all workspaces codew stored', - }, - }, - async () => { - try { - const confirmed = await confirm({ - message: `Are you sure to clean all workspaces?`, - initialValue: false, - }); - if (!confirmed || isCancel(confirmed)) { - cancel(`Cancelled`); - process.exit(0); - } - - await cleanWorkspaces(); - - outro(colors.cyan('✔ Successfully cleaned.')); - process.exit(0); - } catch (e) { - log.error(`${e}`); - } - }, -); diff --git a/src/commands/list.ts b/src/commands/list.ts deleted file mode 100644 index 40938d7..0000000 --- a/src/commands/list.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { command } from 'cleye'; -import colors from 'picocolors'; - -import { getWorkspaces } from '../operations/get-workspaces.js'; - -export default command( - { - name: 'list', - - help: { - description: 'List workspaces', - }, - }, - async () => { - const workspaces = await getWorkspaces(); - const msg = [ - `${colors.cyan('All workspaces')} (total: ${workspaces.length})`, - ...workspaces.map( - (w) => `${colors.white(w.codeWorkspacePath)} ${colors.dim(w.dirPath)}`, - ), - ].join('\n'); - console.log(msg); - }, -); diff --git a/src/index.ts b/src/index.ts index 9c83cbe..cbdc779 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,6 @@ import { log } from '@clack/prompts'; import { cli } from 'cleye'; import { description, version } from '../package.json'; -import clean from './commands/clean.js'; -import list from './commands/list.js'; import { checkDir } from './operations/check-dir.js'; import { createWorkspace } from './operations/create-workspace.js'; import { getWorkspace } from './operations/get-workspace.js'; @@ -27,7 +25,7 @@ cli( examples: ['codew .'], }, - commands: [list, clean], + commands: [], }, async (argv) => { const path = argv._.path; From 41962362f7df30ae717cfb658e2e07c0240c709f Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:20:13 +0900 Subject: [PATCH 3/7] chore: modify preset --- release.config.cjs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/release.config.cjs b/release.config.cjs index 41c72f9..4df8298 100644 --- a/release.config.cjs +++ b/release.config.cjs @@ -3,4 +3,18 @@ /** @type {import('semantic-release').Options} */ module.exports = { branches: ['main', 'next', { name: 'beta', prerelease: true }], + plugins: [ + [ + '@semantic-release/commit-analyzer', + { + preset: 'conventionalcommits', + }, + ], + [ + '@semantic-release/release-notes-generator', + { + preset: 'conventionalcommits', + }, + ], + ], }; From 7724afb187f8abe8c4602743347030e2bd825af7 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:23:06 +0900 Subject: [PATCH 4/7] chore: add preset package --- package.json | 1 + pnpm-lock.yaml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/package.json b/package.json index 6d142fc..78b9b6e 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@vitest/coverage-v8": "^0.34.3", "bumpp": "^9.2.0", "concurrently": "^8.2.1", + "conventional-changelog-conventionalcommits": "^7.0.1", "cross-env": "^7.0.3", "eslint": "^8.48.0", "eslint-plugin-simple-import-sort": "^10.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4088784..47f33d9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,6 +46,9 @@ devDependencies: concurrently: specifier: ^8.2.1 version: 8.2.1 + conventional-changelog-conventionalcommits: + specifier: ^7.0.1 + version: 7.0.1 cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -1554,6 +1557,13 @@ packages: compare-func: 2.0.0 dev: true + /conventional-changelog-conventionalcommits@7.0.1: + resolution: {integrity: sha512-VfFJxBmi+LYXeb4pIfZGbuaFCpWZh0qXbUAKP/s6B8tigV6R4D8j5PDlTtMMWawa7+DcNySVoF7kPWz0EMYuCQ==} + engines: {node: '>=16'} + dependencies: + compare-func: 2.0.0 + dev: true + /conventional-changelog-writer@6.0.1: resolution: {integrity: sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==} engines: {node: '>=14'} From d718bad81efd72d49521577149371802df0aa8f2 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:26:12 +0900 Subject: [PATCH 5/7] chore: modify plugins --- release.config.cjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release.config.cjs b/release.config.cjs index 4df8298..1cdd9cf 100644 --- a/release.config.cjs +++ b/release.config.cjs @@ -16,5 +16,7 @@ module.exports = { preset: 'conventionalcommits', }, ], + '@semantic-release/npm', + '@semantic-release/github', ], }; From 9193e0917120b81ad76e0708b21c8b42ed7bbec4 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:38:22 +0900 Subject: [PATCH 6/7] chore: use tag publish --- .github/old/{release.yml => release2.yml} | 12 ++++++++---- .github/{old => workflows}/publish.yml | 0 .github/workflows/release.yml | 12 ++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) rename .github/old/{release.yml => release2.yml} (62%) rename .github/{old => workflows}/publish.yml (100%) diff --git a/.github/old/release.yml b/.github/old/release2.yml similarity index 62% rename from .github/old/release.yml rename to .github/old/release2.yml index 8733da1..a78b92e 100644 --- a/.github/old/release.yml +++ b/.github/old/release2.yml @@ -2,14 +2,16 @@ name: Release on: push: - tags: - - 'v*' + branches: + - main + - beta jobs: release: runs-on: ubuntu-latest permissions: - contents: write + contents: write # to be able to publish a GitHub release + id-token: write # to enable use of OIDC for npm provenance steps: - uses: actions/checkout@v3 with: @@ -25,6 +27,8 @@ jobs: - name: install run: pnpm i - - run: npx changelogithub + - name: release + run: pnpm semantic-release env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/old/publish.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/old/publish.yml rename to .github/workflows/publish.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a78b92e..8733da1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,16 +2,14 @@ name: Release on: push: - branches: - - main - - beta + tags: + - 'v*' jobs: release: runs-on: ubuntu-latest permissions: - contents: write # to be able to publish a GitHub release - id-token: write # to enable use of OIDC for npm provenance + contents: write steps: - uses: actions/checkout@v3 with: @@ -27,8 +25,6 @@ jobs: - name: install run: pnpm i - - name: release - run: pnpm semantic-release + - run: npx changelogithub env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} From c9cec990bdfb5c18b95c52cf2638d858e2fa19a4 Mon Sep 17 00:00:00 2001 From: shuheikikuchi Date: Mon, 4 Sep 2023 17:42:05 +0900 Subject: [PATCH 7/7] fix extension --- test/operations/create-workspace.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/operations/create-workspace.test.ts b/test/operations/create-workspace.test.ts index 57a51a8..48ef126 100644 --- a/test/operations/create-workspace.test.ts +++ b/test/operations/create-workspace.test.ts @@ -4,7 +4,7 @@ import { basename, resolve } from 'node:path'; import { afterEach, beforeEach, expect, test, vi } from 'vitest'; -import { DbData } from '../../src/db.ts'; +import { DbData } from '../../src/db.js'; import { createWorkspace } from '../../src/operations/create-workspace.js'; const mocks = vi.hoisted(() => {