create-dwy 0.13.5 → 0.13.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # create-dwy
2
2
 
3
+ ## 0.13.7
4
+
5
+ ### Patch Changes
6
+
7
+ - `dwy` 同步模板前会先检查本地缓存仓库 `origin` 是否仍指向当前 CLI 目标仓库 `https://github.com/danweiyuancircle/dwy-ai-experience.git`;若不一致,则删除 `/Users/chances/.dwy/cache/dwy` 后重新 clone,避免旧 Gitee 缓存继续被 pull。
8
+
9
+ ## 0.13.6
10
+
11
+ ### Patch Changes
12
+
13
+ - 调整 CLI 发布工作流,GitHub Actions 在 npm 发布完成后自动创建对应的 GitHub Release,版本展示统一为 `create-dwy@x.y.z`。
14
+
3
15
  ## 0.13.5
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dwy",
3
- "version": "0.13.5",
3
+ "version": "0.13.7",
4
4
  "description": "项目脚手架与 Claude Code 配置同步工具",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,10 @@
21
21
  "fastapi",
22
22
  "vue"
23
23
  ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/danweiyuancircle/dwy-ai-experience.git"
27
+ },
24
28
  "license": "MIT",
25
29
  "author": "dwydev",
26
30
  "dependencies": {
package/src/utils.js CHANGED
@@ -9,16 +9,33 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
9
9
 
10
10
  export const PACKAGE_ROOT = path.resolve(__dirname, '..')
11
11
  export const CACHE_DIR = path.join(process.env.HOME, '.dwy', 'cache')
12
- export const DWY_REPO_URL = 'https://github.com/danweiyuancircle/dwy-shared.git'
12
+ export const DWY_REPO_URL = 'https://github.com/danweiyuancircle/dwy-ai-experience.git'
13
+
14
+ export async function needsRepoReclone(git, repoUrl) {
15
+ const remotes = await git.getRemotes(true)
16
+ const origin = remotes.find(remote => remote.name === 'origin')
17
+ if (!origin) return true
18
+
19
+ const fetchUrl = origin.refs?.fetch
20
+ const pushUrl = origin.refs?.push
21
+ return fetchUrl !== repoUrl || pushUrl !== repoUrl
22
+ }
13
23
 
14
24
  export async function ensureRepoCache() {
15
25
  await fs.ensureDir(CACHE_DIR)
16
26
  const repoDir = path.join(CACHE_DIR, 'dwy')
17
27
 
18
28
  if (await fs.pathExists(path.join(repoDir, '.git'))) {
19
- console.log(chalk.gray('Pulling latest templates...'))
20
29
  const git = simpleGit(repoDir)
21
- await git.pull()
30
+ if (await needsRepoReclone(git, DWY_REPO_URL)) {
31
+ console.log(chalk.gray('Cached templates point to another repo, recreating cache...'))
32
+ await fs.remove(repoDir)
33
+ console.log(chalk.gray('Cloning template repo...'))
34
+ await simpleGit().clone(DWY_REPO_URL, repoDir)
35
+ } else {
36
+ console.log(chalk.gray('Pulling latest templates...'))
37
+ await git.pull()
38
+ }
22
39
  } else {
23
40
  console.log(chalk.gray('Cloning template repo...'))
24
41
  await simpleGit().clone(DWY_REPO_URL, repoDir)