#12

Rename README.md to README.md

Openzskbotwants to merge intofrom

No description provided.

Activity

6
vercel[bot]1mo ago

@zskbot is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

zskbot1mo ago

Được, làm cả 2 thay đổi rồi mới phát hành bản đầu tiên. Tuy nhiên có một điểm quan trọng:

  • package.json hiện đang là 0.2.0
  • src/index.ts đang hiển thị 0.1.0
  • Vì vậy, bản phát hành đầu tiên theo metadata hiện tại nên là autoship@0.2.0, không phải 0.1.0, trừ khi bạn muốn đổi lại version một cách có chủ ý.

1. Tạo branch trên fork của bạn

Repo bạn gửi là repo upstream vercel-labs/autoship; bạn không có quyền tạo branch trực tiếp ở đó. Hãy fork repo trước, sau đó chạy:

git clone https://github.com/zskbot/autoship.git
cd autoship

git remote add upstream https://github.com/vercel-labs/autoship.git
git checkout -b fix/first-release-preparation

Nếu fork của bạn có tên khác, thay URL tương ứng.

2. Sửa cả hai lỗi

Sửa version CLI

Trong src/index.ts:

 program
   .name('autoship')
   .description('CLI tool to automate changeset-based releases')
-  .version('0.1.0');
+  .version('0.2.0');

Tạo thư mục .changeset trước khi ghi file

Trong src/git.ts:

   async generateChangeset(options: ReleaseOptions, packageName: string): Promise<string> {
     const changesetDir = path.join(this.workDir, '.changeset');

+    if (!fs.existsSync(changesetDir)) {
+      fs.mkdirSync(changesetDir, { recursive: true });
+    }
+
     // Generate a unique changeset name
     const changesetId = `release-${randomBytes(4).toString('hex')}`;

Thêm test

Trong src/git.test.ts, thêm test trong block describe('generateChangeset'):

it('should create .changeset directory before writing file', async () => {
  vi.mocked(fs.existsSync).mockReturnValue(false);
  vi.mocked(fs.mkdirSync).mockImplementation(() => undefined);
  vi.mocked(fs.writeFileSync).mockImplementation(() => {});

  await gitOps.generateChangeset(
    { type: 'patch', message: 'Fixed issue' },
    'my-package'
  );

  expect(fs.mkdirSync).toHaveBeenCalledWith(
    '/mock/tmp/autoship/test-repo-abcd1234/.changeset',
    { recursive: true }
  );
});

Chạy kiểm tra:

pnpm install
pnpm test
pnpm build

Commit:

git add src/index.ts src/git.ts src/git.test.ts
git commit -m "fix: prepare autoship for first release"
git push origin fix/first-release-preparation

Sau đó mở PR từ fork vào vercel-labs/autoship.

3. Chuẩn bị phát hành autoship@0.2.0

Repo này dùng Changesets, nhưng ở commit bạn gửi chưa thấy cấu hình .changeset hoàn chỉnh. Để phát hành đúng quy trình, cần kiểm tra hoặc bổ sung:

  • .changeset/config.json
  • workflow GitHub Actions cho Changesets
  • cấu hình npm publish
  • NPM_TOKEN hoặc trusted publishing
  • repository, files và publishConfig trong package.json

Một changeset tối thiểu có thể tạo thủ công:

mkdir -p .changeset
cat > .changeset/first-autoship-release.md <<'EOF'
---
"autoship": minor
---

Prepare the first public autoship release with improved CLI version reporting and reliable changeset file creation.
EOF

Tuy nhiên, nếu package.json đang là 0.2.0 và bạn muốn phát hành đúng phiên bản đó, hãy kiểm tra xem package đã có version 0.2.0 hay chưa:

npm view autoship version

Nếu npm đã có 0.2.0, bạn không thể publish lại cùng version. Khi đó cần tăng lên version mới, chẳng hạn:

pnpm version patch

hoặc:

pnpm version minor

4. Kiểm tra package trước khi publish

pnpm build
npm pack --dry-run

Kiểm tra xem package có chứa các file cần thiết:

npm pack
tar -tf autoship-*.tgz

Đăng nhập npm:

npm login
npm whoami

Để publish bản public:

npm publish --access public

Nếu package hiện tại đã được publish và bạn muốn phát hành bản tiếp theo:

pnpm version patch
pnpm build
npm publish

5. Quy trình an toàn tôi khuyên dùng

# Kiểm tra trạng thái hiện tại
git status

# Chạy test/build
pnpm test
pnpm build

# Kiểm tra package
npm pack --dry-run

# Kiểm tra version trên npm
npm view autoship version

# Chỉ publish nếu version local chưa tồn tại trên npm
npm publish --access public

PR title và body đề xuất

PR title:

fix: prepare autoship for first release

PR body:

## Summary

- Sync the CLI version with the package version.
- Create the `.changeset` directory before writing generated changesets.
- Add a regression test for repositories without an existing `.changeset` directory.

## Validation

- [x] `pnpm test`
- [x] `pnpm build`
- [x] `npm pack --dry-run`

## Release

This prepares the repository for the first release of the current package version.

Lưu ý cuối: nếu mục tiêu của bạn là phát hành bản đầu tiên trên npm, hãy kiểm tra npm view autoship version trước. Tên autoship có thể đã tồn tại trên npm; nếu đã tồn tại, bạn cần dùng version tiếp theo hoặc đổi tên package, ví dụ @zskbot/autoship.

zskbot1mo ago

Debug this error

404 DEPLOYMENT_NOT_FOUND

Request ID: hkg1::pcbkh-1789830222304-9bc38f7aceb5 URL: https://wwwvelclawcom.vercel.app/ User agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Mobile Safari/537.36 Docs for this error code: https://vercel.com/docs/errors/deployment_not_found

zskbot1mo ago

hkg1::6hgqv-1789830277048-d5026e3892a9

zskbot1mo ago

Debug this error

404 DEPLOYMENT_NOT_FOUND

Request ID: hkg1::8hn6c-1789830336195-f2e77dc9a7c5 URL: https://wwwvelclawcom.vercel.app/ User agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Mobile Safari/537.36 Docs for this error code: https://vercel.com/docs/errors/deployment_not_found