Skip to content

Commit 01c75e4

Browse files
committed
Merge branch 'create-solana-dapp-(solana-foundation#211)' of https://github.com/Dargon789/create-solana-dapp into create-solana-dapp-(solana-foundation#211)
2 parents b2a4448 + 30a93c3 commit 01c75e4

File tree

2 files changed

+42
-74
lines changed

2 files changed

+42
-74
lines changed

package.json

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-solana-dapp",
3-
"version": "4.6.0",
3+
"version": "4.8.2",
44
"description": "The fastest way to create Solana apps",
55
"repository": {
66
"name": "solana-foundation/create-solana-dapp",
@@ -39,43 +39,52 @@
3939
"dev": "vitest dev",
4040
"docker:build": "docker build -t create-solana-dapp:latest .",
4141
"docker:run": "docker run --rm --name create-solana-dapp -v \"${PWD}/dist:/workspace/dist\" -it create-solana-dapp:latest",
42-
"lint": "eslint . && prettier -c .",
43-
"lint:fix": "automd && eslint . --fix && prettier -w .",
42+
"lint": "eslint .",
43+
"lint:fix": "automd && eslint . --fix",
4444
"prepublishOnly": "pnpm pkg delete devDependencies",
45-
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-canary} --access public --no-git-checks",
45+
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-latest} --access public --no-git-checks",
4646
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
4747
"test": "pnpm lint && pnpm test:types && vitest run --coverage",
4848
"test:types": "tsc --noEmit --skipLibCheck"
4949
},
5050
"devDependencies": {
51-
"@changesets/changelog-github": "^0.5.0",
52-
"@changesets/cli": "^2.27.10",
51+
"@changesets/changelog-github": "^0.5.1",
52+
"@changesets/cli": "^2.29.7",
5353
"@types/mock-fs": "^4.13.4",
54-
"@types/node": "^22.13.1",
55-
"@types/semver": "^7.5.8",
54+
"@types/node": "^24.3.1",
55+
"@types/semver": "^7.7.1",
5656
"@types/update-notifier": "^6.0.8",
57-
"@vitest/coverage-v8": "^3.0.5",
58-
"automd": "^0.3.12",
59-
"eslint": "^9.20.0",
60-
"eslint-config-unjs": "^0.4.2",
61-
"memfs": "^4.17.2",
57+
"@vitest/coverage-v8": "^3.2.4",
58+
"automd": "^0.4.0",
59+
"eslint": "^9.35.0",
60+
"eslint-config-prettier": "^10.1.8",
61+
"eslint-config-unjs": "^0.5.0",
62+
"eslint-plugin-prettier": "^5.5.4",
63+
"eslint-plugin-sort": "^4.0.0",
64+
"lefthook": "^1.12.4",
65+
"memfs": "^4.39.0",
6266
"mock-fs": "^5.5.0",
63-
"prettier": "^3.4.2",
64-
"typescript": "^5.6.0",
65-
"unbuild": "^3.3.1",
66-
"vitest": "^3.0.5"
67+
"pkg-pr-new": "^0.0.59",
68+
"prettier": "^3.6.2",
69+
"typescript": "^5.9.2",
70+
"unbuild": "^3.6.1",
71+
"vitest": "^3.2.4"
72+
},
73+
"packageManager": "[email protected]",
74+
"pnpm": {
75+
"onlyBuiltDependencies": [
76+
"lefthook"
77+
]
6778
},
68-
"packageManager": "[email protected]",
6979
"dependencies": {
70-
"@beeman/repokit": "0.0.0-canary-20250801172233",
71-
"@clack/prompts": "^0.11.0",
72-
"commander": "^13.1.0",
73-
"giget": "^1.2.4",
74-
"is-in-ci": "^1.0.0",
75-
"picocolors": "^1.1.1",
76-
"semver": "^7.7.1",
77-
"update-notifier": "^7.3.1",
78-
"zod": "^3.24.1"
80+
"@clack/prompts": "0.7.0",
81+
"commander": "14.0.0",
82+
"giget": "2.0.0",
83+
"is-in-ci": "2.0.0",
84+
"picocolors": "1.1.1",
85+
"semver": "7.7.2",
86+
"update-notifier": "7.3.1",
87+
"zod": "4.1.5"
7988
},
8089
"contributors": [
8190
{

src/utils/search-and-replace.ts

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readdir, readFile, rename, writeFile } from 'node:fs/promises'
22
import { join } from 'node:path'
33

4-
const EXCLUDED_DIRECTORIES = new Set(['dist', 'coverage', 'node_modules', '.git', '.github', 'tmp'])
4+
const EXCLUDED_DIRECTORIES = new Set(['dist', 'coverage', 'node_modules', '.git', 'tmp'])
55

66
export async function searchAndReplace(
77
rootFolder: string,
@@ -14,13 +14,6 @@ export async function searchAndReplace(
1414
throw new Error('fromStrings and toStrings arrays must have the same length')
1515
}
1616

17-
if (isVerbose) {
18-
console.log(`searchAndReplace: ${rootFolder} Searching for ${fromStrings.join(', ')}`, {
19-
rootFolder,
20-
fromStrings,
21-
toStrings,
22-
})
23-
}
2417
async function processFile(filePath: string): Promise<void> {
2518
try {
2619
const content = await readFile(filePath, 'utf8')
@@ -88,14 +81,8 @@ export async function searchAndReplace(
8881
}
8982

9083
async function renamePaths(directoryPath: string): Promise<void> {
91-
if (isVerbose) {
92-
console.log(`searchAndReplace [renamePaths]: START Renaming paths in ${directoryPath}`)
93-
}
9484
try {
9585
const entries = await readdir(directoryPath, { withFileTypes: true })
96-
if (isVerbose) {
97-
console.log(`searchAndReplace [renamePaths]: Renaming paths in ${directoryPath}`, { entries })
98-
}
9986

10087
for (const entry of entries) {
10188
if (EXCLUDED_DIRECTORIES.has(entry.name)) {
@@ -105,36 +92,17 @@ export async function searchAndReplace(
10592
continue
10693
}
10794

108-
if (isVerbose) {
109-
console.log(`searchAndReplace [renamePaths] => Renaming ${entry.name} to ${entry.name}`)
110-
}
11195
const oldPath = join(directoryPath, entry.name)
112-
let newPath = oldPath
96+
let newName = entry.name
11397

11498
for (const [i, fromString] of fromStrings.entries()) {
115-
if (directoryPath.endsWith(toStrings[i])) {
116-
if (isVerbose) {
117-
console.log(`searchAndReplace [renamePaths] => [${i}] Skipping ${fromString} with ${toStrings[i]}`)
118-
}
119-
continue
120-
}
121-
if (isVerbose) {
122-
console.log(`searchAndReplace [renamePaths] => [${i}] Replacing ${fromString} with ${toStrings[i]}`)
123-
}
124-
newPath = newPath.replace(new RegExp(fromString, 'g'), toStrings[i])
125-
if (isVerbose) {
126-
console.log(`searchAndReplace [renamePaths] => [${i}] Renamed ${oldPath} -> ${newPath}`)
127-
}
99+
newName = newName.replace(new RegExp(fromString, 'g'), toStrings[i])
128100
}
129101

102+
const newPath = join(directoryPath, newName)
103+
130104
if (oldPath !== newPath) {
131-
if (isVerbose) {
132-
console.log(`searchAndReplace [renamePaths] => Renaming ${oldPath} to ${newPath}`)
133-
}
134105
if (!isDryRun) {
135-
if (isVerbose) {
136-
console.log(`searchAndReplace [renamePaths] => Renaming ${oldPath} to ${newPath}`)
137-
}
138106
await rename(oldPath, newPath)
139107
}
140108
if (isVerbose) {
@@ -143,25 +111,16 @@ export async function searchAndReplace(
143111
}
144112

145113
if (entry.isDirectory()) {
146-
await renamePaths(newPath)
114+
await renamePaths(entry.isDirectory() ? newPath : oldPath)
147115
}
148116
}
149-
if (isVerbose) {
150-
console.log(`searchAndReplace [renamePaths]: END Renaming paths in ${directoryPath}`)
151-
}
152117
} catch (error) {
153118
console.error(`Error renaming paths in ${directoryPath}:`, error)
154119
}
155120
}
156121

157122
try {
158-
if (isVerbose) {
159-
console.log(`searchAndReplace: Processing directory ${rootFolder}`)
160-
}
161123
await processDirectory(rootFolder)
162-
if (isVerbose) {
163-
console.log(`searchAndReplace: Renaming paths in ${rootFolder}`)
164-
}
165124
await renamePaths(rootFolder)
166125
if (isVerbose) {
167126
console.log(isDryRun ? 'Dry run completed' : 'Search and replace completed')

0 commit comments

Comments
 (0)