mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Fix Posthog by correctly copying .env in the build process (#4049)
This commit is contained in:
parent
f37e6f6fce
commit
ed24f65b30
7 changed files with 58 additions and 32 deletions
5
.changeset/thirty-cases-fail.md
Normal file
5
.changeset/thirty-cases-fail.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"roo-cline": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix Posthog by correctly copying .env in the build process
|
||||||
25
.github/workflows/marketplace-publish.yml
vendored
25
.github/workflows/marketplace-publish.yml
vendored
|
|
@ -45,15 +45,22 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
current_package_version=$(node -p "require('./src/package.json').version")
|
current_package_version=$(node -p "require('./src/package.json').version")
|
||||||
pnpm build
|
pnpm build
|
||||||
package=$(unzip -l bin/roo-cline-${current_package_version}.vsix)
|
|
||||||
echo "$package" | grep -q "extension/package.json" || exit 1
|
# Save VSIX contents to a temporary file to avoid broken pipe issues.
|
||||||
echo "$package" | grep -q "extension/package.nls.json" || exit 1
|
unzip -l bin/roo-cline-${current_package_version}.vsix > /tmp/roo-code-vsix-contents.txt
|
||||||
echo "$package" | grep -q "extension/dist/extension.js" || exit 1
|
|
||||||
echo "$package" | grep -q "extension/webview-ui/audio/celebration.wav" || exit 1
|
# Check for required files.
|
||||||
echo "$package" | grep -q "extension/webview-ui/build/assets/index.js" || exit 1
|
grep -q "extension/package.json" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
echo "$package" | grep -q "extension/assets/codicons/codicon.ttf" || exit 1
|
grep -q "extension/package.nls.json" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
echo "$package" | grep -q "extension/assets/vscode-material-icons/icons/3d.svg" || exit 1
|
grep -q "extension/dist/extension.js" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
echo "$package" | grep -q ".env" || exit 1
|
grep -q "extension/webview-ui/audio/celebration.wav" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
|
grep -q "extension/webview-ui/build/assets/index.js" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
|
grep -q "extension/assets/codicons/codicon.ttf" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
|
grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
|
grep -q ".env" /tmp/roo-code-vsix-contents.txt || exit 1
|
||||||
|
|
||||||
|
# Clean up temporary file.
|
||||||
|
rm /tmp/roo-code-vsix-contents.txt
|
||||||
- name: Create and Push Git Tag
|
- name: Create and Push Git Tag
|
||||||
run: |
|
run: |
|
||||||
current_package_version=$(node -p "require('./src/package.json').version")
|
current_package_version=$(node -p "require('./src/package.json').version")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
dist
|
|
||||||
build
|
|
||||||
out
|
|
||||||
.next
|
|
||||||
.venv
|
|
||||||
pnpm-lock.yaml
|
|
||||||
|
|
@ -3,5 +3,6 @@
|
||||||
"useTabs": true,
|
"useTabs": true,
|
||||||
"printWidth": 120,
|
"printWidth": 120,
|
||||||
"semi": false,
|
"semi": false,
|
||||||
"bracketSameLine": true
|
"bracketSameLine": true,
|
||||||
|
"ignore": ["node_modules", "dist", "build", "out", ".next", ".venv", "pnpm-lock.yaml"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ async function main() {
|
||||||
["../README.md", "README.md"],
|
["../README.md", "README.md"],
|
||||||
["../CHANGELOG.md", "CHANGELOG.md"],
|
["../CHANGELOG.md", "CHANGELOG.md"],
|
||||||
["../LICENSE", "LICENSE"],
|
["../LICENSE", "LICENSE"],
|
||||||
|
["../.env", ".env", { optional: true }],
|
||||||
[".vscodeignore", ".vscodeignore"],
|
[".vscodeignore", ".vscodeignore"],
|
||||||
["assets", "assets"],
|
["assets", "assets"],
|
||||||
["integrations", "integrations"],
|
["integrations", "integrations"],
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ function rmDir(dirPath: string, maxRetries: number = 3): void {
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const isLastAttempt = attempt === maxRetries
|
const isLastAttempt = attempt === maxRetries
|
||||||
const isEnotemptyError = error instanceof Error && "code" in error && (error.code === 'ENOTEMPTY' || error.code === 'EBUSY')
|
|
||||||
|
const isEnotemptyError =
|
||||||
|
error instanceof Error && "code" in error && (error.code === "ENOTEMPTY" || error.code === "EBUSY")
|
||||||
|
|
||||||
if (isLastAttempt || !isEnotemptyError) {
|
if (isLastAttempt || !isEnotemptyError) {
|
||||||
throw error // Re-throw if it's the last attempt or not a locking error.
|
throw error // Re-throw if it's the last attempt or not a locking error.
|
||||||
|
|
@ -41,13 +43,21 @@ function rmDir(dirPath: string, maxRetries: number = 3): void {
|
||||||
|
|
||||||
// Synchronous sleep for simplicity in build scripts.
|
// Synchronous sleep for simplicity in build scripts.
|
||||||
const start = Date.now()
|
const start = Date.now()
|
||||||
while (Date.now() - start < delay) { /* Busy wait */ }
|
|
||||||
|
while (Date.now() - start < delay) {
|
||||||
|
/* Busy wait */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function copyPaths(copyPaths: [string, string][], srcDir: string, dstDir: string) {
|
type CopyPathOptions = {
|
||||||
copyPaths.forEach(([srcRelPath, dstRelPath]) => {
|
optional?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export function copyPaths(copyPaths: [string, string, CopyPathOptions?][], srcDir: string, dstDir: string) {
|
||||||
|
copyPaths.forEach(([srcRelPath, dstRelPath, options = {}]) => {
|
||||||
|
try {
|
||||||
const stats = fs.lstatSync(path.join(srcDir, srcRelPath))
|
const stats = fs.lstatSync(path.join(srcDir, srcRelPath))
|
||||||
|
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
|
|
@ -63,6 +73,13 @@ export function copyPaths(copyPaths: [string, string][], srcDir: string, dstDir:
|
||||||
fs.copyFileSync(path.join(srcDir, srcRelPath), path.join(dstDir, dstRelPath))
|
fs.copyFileSync(path.join(srcDir, srcRelPath), path.join(dstDir, dstRelPath))
|
||||||
console.log(`[copyPaths] Copied ${srcRelPath} to ${dstRelPath}`)
|
console.log(`[copyPaths] Copied ${srcRelPath} to ${dstRelPath}`)
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (options.optional) {
|
||||||
|
console.warn(`[copyPaths] Optional file not found: ${srcRelPath}`)
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ async function main() {
|
||||||
["../README.md", "README.md"],
|
["../README.md", "README.md"],
|
||||||
["../CHANGELOG.md", "CHANGELOG.md"],
|
["../CHANGELOG.md", "CHANGELOG.md"],
|
||||||
["../LICENSE", "LICENSE"],
|
["../LICENSE", "LICENSE"],
|
||||||
|
["../.env", ".env", { optional: true }],
|
||||||
["node_modules/vscode-material-icons/generated", "assets/vscode-material-icons"],
|
["node_modules/vscode-material-icons/generated", "assets/vscode-material-icons"],
|
||||||
["../webview-ui/audio", "webview-ui/audio"],
|
["../webview-ui/audio", "webview-ui/audio"],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue