promptlineapp 1.9.0 → 1.9.1
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/bin/cli.js +25 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2876,8 +2876,31 @@ async function getProject(gitUrl, destName) {
|
|
|
2876
2876
|
if (fs.existsSync(viteConfigPath)) {
|
|
2877
2877
|
let viteContent = fs.readFileSync(viteConfigPath, 'utf8');
|
|
2878
2878
|
if (!viteContent.includes('/api/promptline')) {
|
|
2879
|
-
//
|
|
2880
|
-
|
|
2879
|
+
// Check if there's already a proxy section in server block
|
|
2880
|
+
const hasExistingProxy = /server:\s*\{[^}]*proxy:\s*\{/.test(viteContent);
|
|
2881
|
+
|
|
2882
|
+
if (hasExistingProxy) {
|
|
2883
|
+
// Merge into existing proxy block
|
|
2884
|
+
const proxyEntries = `
|
|
2885
|
+
// PromptLine API Proxy (added by npx promptlineapp get)
|
|
2886
|
+
'/api/promptline-local': {
|
|
2887
|
+
target: 'https://app.local.promptlineops.com',
|
|
2888
|
+
changeOrigin: true,
|
|
2889
|
+
rewrite: (path) => path.replace(/^\\/api\\/promptline-local/, '/api/v1/live'),
|
|
2890
|
+
secure: true
|
|
2891
|
+
},
|
|
2892
|
+
'/api/promptline': {
|
|
2893
|
+
target: 'https://app.promptlineops.com',
|
|
2894
|
+
changeOrigin: true,
|
|
2895
|
+
rewrite: (path) => path.replace(/^\\/api\\/promptline/, '/api/v1/live'),
|
|
2896
|
+
secure: true
|
|
2897
|
+
},`;
|
|
2898
|
+
viteContent = viteContent.replace(
|
|
2899
|
+
/(proxy:\s*\{)/,
|
|
2900
|
+
'$1' + proxyEntries
|
|
2901
|
+
);
|
|
2902
|
+
} else if (viteContent.includes('server:')) {
|
|
2903
|
+
// Add proxy config to server section
|
|
2881
2904
|
viteContent = viteContent.replace(
|
|
2882
2905
|
/server:\s*\{/,
|
|
2883
2906
|
'server: {' + devTemplates.viteProxyConfig
|