Skip to content

Commit 9842003

Browse files
authored
Fixes to nested flows and flyde-nodes.json + website journey fixes (#252)
1 parent 6dd1062 commit 9842003

29 files changed

Lines changed: 886 additions & 181 deletions

File tree

core/src/configurable-nodes/configurable-node-utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export function extractInputsFromValue(
3636
let val: ConfigurableValue = _val as any;
3737

3838
if (!isConfigurableValue(val)) {
39-
console.warn(
40-
`Value ${key} isn't a valid ConfigurableValue, converting to dynamic`
41-
);
39+
// console.warn(
40+
// `Value ${key} isn't a valid ConfigurableValue, converting to dynamic`
41+
// );
4242
val = configurableValue("dynamic", `{{${key}}}`);
4343
}
4444

core/src/configurable-nodes/configurable-nodes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ export function processConfigurableNode(node: CodeNode, secrets: Record<string,
489489

490490
let configValue = config[key];
491491
if (!isConfigurableValue(configValue)) {
492-
console.warn(
493-
`Config value ${key} isn't a valid ConfigurableValue, converting to dynamic`
494-
);
492+
// console.warn(
493+
// `Config value ${key} isn't a valid ConfigurableValue, converting to dynamic`
494+
// );
495495
configValue = configurableValue("dynamic", configValue);
496496
}
497497

create-flyde-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"scripts": {
1414
"build": "tsc",
1515
"dev": "tsc --watch",
16+
"start": "node dist/index.js",
1617
"prepublishOnly": "npm run build"
1718
},
1819
"dependencies": {

create-flyde-app/src/index.ts

Lines changed: 159 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ async function main() {
3737
const userId = generateAnonymousId();
3838
const systemInfo = getSystemInfo();
3939

40-
console.log(chalk.blue('🚀 Welcome to Flyde!'));
41-
console.log(chalk.gray('Creating your visual flow project...\n'));
40+
console.log();
41+
console.log(chalk.cyan.bold(' 🚀 Welcome to Flyde!'));
42+
console.log(chalk.dim(' Create visual flow-based programs with TypeScript'));
43+
console.log();
4244

4345
// Get project name from args or prompt
4446
let projectName = process.argv[2];
@@ -47,33 +49,72 @@ async function main() {
4749
const response = await prompts({
4850
type: 'text',
4951
name: 'projectName',
50-
message: 'Project name:',
52+
message: 'Project name',
5153
initial: 'my-flyde-project'
5254
});
5355

5456
if (!response.projectName) {
55-
console.log(chalk.red('❌ Project creation cancelled.'));
57+
console.log(chalk.yellow('\n⚠ Project creation cancelled'));
5658
process.exit(0);
5759
}
5860

5961
projectName = response.projectName;
6062
}
6163

64+
// Report project name selected
65+
reportEvent(userId, 'create-project:name-selected', {
66+
...systemInfo,
67+
fromArgs: !!process.argv[2]
68+
});
69+
70+
// IDE selection
71+
const ideResponse = await prompts({
72+
type: 'select',
73+
name: 'ide',
74+
message: 'Which editor are you using?',
75+
choices: [
76+
{ title: 'VS Code', value: 'vscode' },
77+
{ title: 'Cursor', value: 'cursor' },
78+
{ title: 'Windsurf', value: 'windsurf' },
79+
{ title: 'Other', value: 'other' }
80+
],
81+
initial: 0
82+
});
83+
84+
if (!ideResponse.ide) {
85+
console.log(chalk.yellow('\n⚠ Project creation cancelled'));
86+
process.exit(0);
87+
}
88+
89+
const ide = ideResponse.ide;
90+
91+
// Report IDE selected
92+
reportEvent(userId, 'create-project:ide-selected', {
93+
...systemInfo,
94+
ide
95+
});
96+
6297
const projectPath = path.resolve(process.cwd(), projectName);
6398

6499
// Check if directory exists
65100
if (fs.existsSync(projectPath)) {
66-
console.log(chalk.red(`❌ Directory "${projectName}" already exists.`));
101+
console.log(chalk.yellow(`\n⚠ Directory "${projectName}" already exists`));
67102
process.exit(1);
68103
}
69104

70105
try {
71106
// Create project directory
72-
console.log(chalk.blue('📁 Creating project directory...'));
107+
console.log(chalk.dim('\n📁 Creating project directory...'));
73108
fs.ensureDirSync(projectPath);
109+
110+
// Report directory created
111+
reportEvent(userId, 'create-project:directory-created', {
112+
...systemInfo,
113+
ide
114+
});
74115

75116
// Copy template files
76-
console.log(chalk.blue('📋 Setting up project files...'));
117+
console.log(chalk.dim('📋 Setting up project files...'));
77118
const templatePath = path.join(__dirname, '..', 'templates', 'default');
78119
fs.copySync(templatePath, projectPath);
79120

@@ -84,40 +125,127 @@ async function main() {
84125
fs.writeJsonSync(packageJsonPath, packageJson, { spaces: 2 });
85126

86127
// Install dependencies
87-
console.log(chalk.blue('📦 Installing dependencies...'));
128+
console.log(chalk.dim('📦 Installing dependencies...'));
129+
const installStart = Date.now();
88130
execSync('npm install', { cwd: projectPath, stdio: 'inherit' });
131+
132+
// Report dependencies installed
133+
reportEvent(userId, 'create-project:dependencies-installed', {
134+
...systemInfo,
135+
ide,
136+
installDuration: Date.now() - installStart
137+
});
89138

90-
// Install VS Code extension
91-
console.log(chalk.blue('🔧 Installing VS Code extension...'));
92-
try {
93-
execSync('code --install-extension flyde.flyde-vscode', { stdio: 'pipe' });
94-
console.log(chalk.green('✅ VS Code extension installed!'));
95-
} catch (error) {
96-
console.log(chalk.yellow('⚠️ Could not install VS Code extension automatically.'));
97-
console.log(chalk.gray(' Please install it manually from the VS Code marketplace.'));
139+
// Install IDE extension based on selection
140+
if (ide !== 'other') {
141+
console.log(chalk.dim('\n🔧 Installing Flyde extension...'));
142+
143+
const commands = {
144+
vscode: 'code',
145+
cursor: 'cursor',
146+
windsurf: 'windsurf'
147+
};
148+
149+
const command = commands[ide as keyof typeof commands];
150+
151+
try {
152+
// Check if IDE command is available
153+
execSync(`${command} --version`, { stdio: 'pipe' });
154+
155+
try {
156+
execSync(`${command} --install-extension flyde.flyde-vscode`, { stdio: 'pipe' });
157+
console.log(chalk.green('✅ Flyde extension installed'));
158+
159+
// Report extension installed
160+
reportEvent(userId, 'create-project:extension-installed', {
161+
...systemInfo,
162+
ide,
163+
success: true
164+
});
165+
} catch (error) {
166+
console.log(chalk.yellow(`\n⚠ Could not install extension automatically`));
167+
168+
// Report extension installation failed
169+
reportEvent(userId, 'create-project:extension-installed', {
170+
...systemInfo,
171+
ide,
172+
success: false,
173+
reason: 'install-failed'
174+
});
175+
if (ide === 'vscode') {
176+
console.log(chalk.dim(' Install from: https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode'));
177+
} else {
178+
console.log(chalk.dim(' Install from: https://open-vsx.org/extension/flyde/flyde-vscode'));
179+
}
180+
}
181+
} catch (error) {
182+
console.log(chalk.yellow(`\n⚠ ${command} command not found`));
183+
184+
// Report IDE not found
185+
reportEvent(userId, 'create-project:extension-installed', {
186+
...systemInfo,
187+
ide,
188+
success: false,
189+
reason: 'ide-not-found'
190+
});
191+
192+
if (ide === 'vscode') {
193+
console.log(chalk.dim(' Install VS Code first, then install the extension from:'));
194+
console.log(chalk.dim(' https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode'));
195+
} else {
196+
console.log(chalk.dim(` Install ${ide} first, then install the extension from:`))
197+
console.log(chalk.dim(' https://open-vsx.org/extension/flyde/flyde-vscode'));
198+
}
199+
}
200+
} else {
201+
console.log(chalk.yellow('\n⚠ Please install the Flyde extension manually'));
202+
console.log(chalk.dim(' VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode'));
203+
console.log(chalk.dim(' Open VSX: https://open-vsx.org/extension/flyde/flyde-vscode'));
98204
}
99205

100206
// Success message
101-
console.log(chalk.green('\n🎉 Project created successfully!'));
102-
console.log(chalk.gray('\nNext steps:'));
103-
console.log(chalk.gray(` cd ${projectName}`));
104-
console.log(chalk.gray(' code .'));
105-
console.log(chalk.gray(' Open hello-world.flyde to get started\n'));
106-
107-
// Open VS Code automatically
108-
try {
109-
console.log(chalk.blue('🚀 Opening VS Code...'));
110-
execSync(`code "${projectPath}" "${projectPath}/hello-world.flyde"`, { stdio: 'pipe' });
111-
} catch (error) {
112-
console.log(chalk.yellow('⚠️ Could not open VS Code automatically.'));
113-
console.log(chalk.gray(` Please run: cd ${projectName} && code .`));
207+
console.log(chalk.green.bold('\n✨ Project created successfully!'));
208+
console.log(chalk.dim('\nNext steps:'));
209+
console.log(chalk.white(` cd ${projectName}`));
210+
211+
if (ide !== 'other') {
212+
const commands = {
213+
vscode: 'code',
214+
cursor: 'cursor',
215+
windsurf: 'windsurf'
216+
};
217+
console.log(chalk.white(` ${commands[ide as keyof typeof commands]} .`));
218+
}
219+
220+
console.log(chalk.white(' Open hello-world.flyde to start building'));
221+
console.log();
222+
223+
// Open IDE automatically
224+
if (ide !== 'other') {
225+
const commands = {
226+
vscode: 'code',
227+
cursor: 'cursor',
228+
windsurf: 'windsurf'
229+
};
230+
231+
const command = commands[ide as keyof typeof commands];
232+
233+
try {
234+
console.log(chalk.dim(`🚀 Opening ${ide}...`));
235+
execSync(`${command} "${projectPath}" "${projectPath}/hello-world.flyde"`, { stdio: 'pipe' });
236+
} catch (error) {
237+
// Silently fail - user can open manually
238+
}
114239
}
115240

116241
// Report success
117-
reportEvent(userId, 'create-project:success', systemInfo);
242+
reportEvent(userId, 'create-project:success', {
243+
...systemInfo,
244+
ide
245+
});
118246

119247
} catch (error) {
120-
console.error(chalk.red('❌ Error creating project:'), error);
248+
console.error(chalk.red('\n❌ Error creating project:'), error);
121249

122250
// Report error
123251
reportEvent(userId, 'create-project:error', {

create-flyde-app/templates/default/index.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

create-flyde-app/templates/default/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "my-flyde-project",
33
"version": "1.0.0",
44
"description": "A Flyde visual programming project",
5-
"main": "index.js",
5+
"main": "index.ts",
66
"scripts": {
7-
"start": "node index.js",
7+
"start": "tsx index.ts",
88
"dev": "tsx watch index.ts"
99
},
1010
"dependencies": {

main.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
{
1919
"path": "vscode"
2020
},
21+
{
22+
"path": "create-flyde-app"
23+
}
2124
],
2225
"settings": {
2326
"search.useGlobalIgnoreFiles": true,
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { CodeNode } from "@flyde/core";
21
export { Supabase } from "./supabase.flyde";
32
export { OpenAI } from "./openai.flyde";
43
export { OpenAIResponsesAPI } from "./openai-responses.flyde";

nodes/src/ThirdParty/server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
export * from "./";
2-
export { PostgreSQL } from "./postgres.flyde";
1+
export * from "./browser";
2+
export { PostgreSQL } from "./postgres.flyde";
3+
export { GoogleSheets } from "./googlesheets.flyde";

nodes/src/all-browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export * from "./State";
1010
export * from "./Timing";
1111
export * from "./Values/index";
1212
export * from "./Note/Note.flyde";
13-
export * from "./ThirdParty";
13+
export * from "./ThirdParty/browser";

0 commit comments

Comments
 (0)