@directivegames/genesys.sdk 3.3.3 → 3.3.5

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.
@@ -69,16 +69,11 @@ function isInstalledPackage() {
69
69
  return false;
70
70
  }
71
71
  }
72
- // Get current package version
73
- function getCurrentVersion() {
74
- try {
75
- const packageJsonPath = path.join(getProjectRoot(), 'package.json');
76
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
77
- return packageJson.version;
78
- }
79
- catch {
80
- return 'unknown';
81
- }
72
+ // Get package.json
73
+ function getPackageJson() {
74
+ const packageJsonPath = path.join(getProjectRoot(), 'package.json');
75
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
76
+ return packageJson;
82
77
  }
83
78
  // Check for updates and prompt user
84
79
  async function checkForUpdates() {
@@ -87,11 +82,13 @@ async function checkForUpdates() {
87
82
  if (!isInstalledPackage())
88
83
  return;
89
84
  logger.log('Checking for updates...');
90
- const currentVersion = getCurrentVersion();
85
+ const packageJson = getPackageJson();
86
+ const currentVersion = packageJson.version;
87
+ const packageName = packageJson.name;
91
88
  if (currentVersion === 'unknown')
92
89
  return;
93
90
  // Fetch latest version from npm registry
94
- const response = await fetch('https://registry.npmjs.org/genesys.sdk/latest');
91
+ const response = await fetch(`https://registry.npmjs.org/${packageJson.name}/latest`);
95
92
  if (!response.ok)
96
93
  return;
97
94
  const data = await response.json();
@@ -106,9 +103,8 @@ async function checkForUpdates() {
106
103
  // Prompt user if they want to upgrade now
107
104
  const answer = await promptUser('Would you like to upgrade now? (Y/n): ');
108
105
  if (answer === '' || answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
109
- logger.log('\nUpgrading genesys.sdk...\n');
106
+ logger.log(`\nUpgrading ${packageName}...\n`);
110
107
  const { execSync } = await import('child_process');
111
- const packageName = '@directivegames/genesys.sdk';
112
108
  try {
113
109
  execSync(`pnpm remove -g ${packageName} && pnpm add -g ${packageName}`, {
114
110
  stdio: 'inherit'
@@ -160,7 +156,8 @@ async function main() {
160
156
  await checkForUpdates();
161
157
  const program = new Command();
162
158
  const handler = new ConsoleHandler();
163
- const currentVersion = getCurrentVersion();
159
+ const packageJson = getPackageJson();
160
+ const currentVersion = packageJson.version;
164
161
  program
165
162
  .name('genesys-sdk')
166
163
  .description('Genesys SDK CLI - Game Project Management Tool')
@@ -119,7 +119,6 @@ export function getProjectFolderAndFile(projectPath, logger) {
119
119
  const testProjectFile = `${folderName}${ENGINE.GAME_PROJECT_FILE_EXT}`;
120
120
  if (fs.existsSync(path.join(folder, testProjectFile))) {
121
121
  projectFile = testProjectFile;
122
- logger.log(`Using existing project file: ${projectFile}`);
123
122
  }
124
123
  // check for any existing project files in the folder, and use the latest one
125
124
  if (!projectFile) {
@@ -137,7 +136,6 @@ export function getProjectFolderAndFile(projectPath, logger) {
137
136
  }
138
137
  if (latestFile) {
139
138
  projectFile = latestFile;
140
- logger.log(`Using latest project file: ${projectFile}`);
141
139
  }
142
140
  else {
143
141
  logger.warn(`No project files found in folder: ${folder}`);
@@ -178,31 +178,31 @@ export async function newProject(parentPath, projectName, templateId, logger, ha
178
178
  const totalSteps = 5;
179
179
  // Step 1: Creating directories (0-5%)
180
180
  logger.log('Creating default scene and game code...');
181
- handler?.ui.showLoadingOverlay('Creating project 0%\nStep 1/5 Creating directories...');
181
+ handler?.ui.showLoadingOverlay('Creating project 0%\nStep 1/5 Creating directories...');
182
182
  await new Promise(resolve => setTimeout(resolve, 300));
183
- handler?.ui.showLoadingOverlay('Creating project 2%\nStep 1/5 Creating directories...');
183
+ handler?.ui.showLoadingOverlay('Creating project 2%\nStep 1/5 Creating directories...');
184
184
  await Promise.all([
185
185
  mkdirAsync(path.join(projectPath, `${ENGINE.ASSETS_FOLDER}/models`), { recursive: true }),
186
186
  mkdirAsync(path.join(projectPath, `${ENGINE.ASSETS_FOLDER}/textures`), { recursive: true }),
187
187
  mkdirAsync(path.join(projectPath, `${ENGINE.ASSETS_FOLDER}/sounds`), { recursive: true })
188
188
  ]);
189
189
  overallProgress = 5;
190
- handler?.ui.showLoadingOverlay('Creating project 5%\nStep 1/5 Directories created');
190
+ handler?.ui.showLoadingOverlay('Creating project 5%\nStep 1/5 Directories created');
191
191
  await new Promise(resolve => setTimeout(resolve, 300));
192
192
  // Step 2: Creating project files (5-10%)
193
193
  logger.log('Creating project files...');
194
- handler?.ui.showLoadingOverlay('Creating project 5%\nStep 2/5 Generating project files...');
194
+ handler?.ui.showLoadingOverlay('Creating project 5%\nStep 2/5 Generating project files...');
195
195
  await new Promise(resolve => setTimeout(resolve, 300));
196
196
  const packageJson = { ...projectFiles.packageJson }; // Create a copy to avoid mutation
197
197
  packageJson.name = projectName;
198
- handler?.ui.showLoadingOverlay('Creating project 7%\nStep 2/5 Generating project files...');
198
+ handler?.ui.showLoadingOverlay('Creating project 7%\nStep 2/5 Generating project files...');
199
199
  const [, , projectFileFullPath] = await Promise.all([
200
200
  writeFileAsync(path.join(projectPath, 'package.json'), JSON.stringify(packageJson, null, 2)),
201
201
  writeFileAsync(path.join(projectPath, `${projectName}.code-workspace`), JSON.stringify(projectFiles.codeWorkspace, null, 2)),
202
202
  createGenesysProjectFile(projectPath)
203
203
  ]);
204
204
  overallProgress = 8;
205
- handler?.ui.showLoadingOverlay('Creating project 8%\nStep 2/5 Copying template files...');
205
+ handler?.ui.showLoadingOverlay('Creating project 8%\nStep 2/5 Copying template files...');
206
206
  // Copy template files
207
207
  logger.log('Copying other project files...');
208
208
  const individualTemplatePath = path.join(templatePackagePath, template.path);
@@ -211,11 +211,11 @@ export async function newProject(parentPath, projectName, templateId, logger, ha
211
211
  copyAsync(individualTemplatePath, projectPath, { recursive: true })
212
212
  ]);
213
213
  overallProgress = 10;
214
- handler?.ui.showLoadingOverlay('Creating project 10%\nStep 2/5 Project files created');
214
+ handler?.ui.showLoadingOverlay('Creating project 10%\nStep 2/5 Project files created');
215
215
  await new Promise(resolve => setTimeout(resolve, 300));
216
216
  // Step 3: Installing dependencies (10-70%)
217
217
  logger.log('Running pnpm install...');
218
- handler?.ui.showLoadingOverlay('Creating project 10%\nStep 3/5 Installing dependencies...');
218
+ handler?.ui.showLoadingOverlay('Creating project 10%\nStep 3/5 Installing dependencies...');
219
219
  const installStartTime = Date.now();
220
220
  const estimatedInstallTime = 35; // seconds
221
221
  let installComplete = false;
@@ -228,7 +228,7 @@ export async function newProject(parentPath, projectName, templateId, logger, ha
228
228
  // Asymptotic progress: approaches 70% but never quite reaches it
229
229
  const installProgress = Math.min(0.95, elapsed / estimatedInstallTime);
230
230
  overallProgress = 10 + Math.floor(installProgress * 60);
231
- handler?.ui.showLoadingOverlay(`Creating project ${overallProgress}%\nStep 3/5 Installing dependencies...`);
231
+ handler?.ui.showLoadingOverlay(`Creating project ${overallProgress}%\nStep 3/5 Installing dependencies...`);
232
232
  }, 1000);
233
233
  await runCommandAsync('pnpm install', projectPath, logger, (progressMsg) => {
234
234
  // Detect completion - pnpm uses different output format
@@ -242,11 +242,11 @@ export async function newProject(parentPath, projectName, templateId, logger, ha
242
242
  installComplete = true;
243
243
  clearInterval(installInterval);
244
244
  overallProgress = 70;
245
- handler?.ui.showLoadingOverlay(`Creating project 70%\nStep 3/5 Installed ${packageCount} packages ✅`);
245
+ handler?.ui.showLoadingOverlay(`Creating project 70%\nStep 3/5 Installed ${packageCount} packages`);
246
246
  await new Promise(resolve => setTimeout(resolve, 500));
247
247
  // Step 4: Building project (70-90%)
248
248
  logger.log('Running pnpm build...');
249
- handler?.ui.showLoadingOverlay('Creating project 70%\nStep 4/5 Building project...');
249
+ handler?.ui.showLoadingOverlay('Creating project 70%\nStep 4/5 Building project...');
250
250
  const buildStartTime = Date.now();
251
251
  const estimatedBuildTime = 10; // seconds
252
252
  let buildComplete = false;
@@ -258,22 +258,22 @@ export async function newProject(parentPath, projectName, templateId, logger, ha
258
258
  // Asymptotic progress: approaches 90% but never quite reaches it
259
259
  const buildProgress = Math.min(0.95, elapsed / estimatedBuildTime);
260
260
  overallProgress = 70 + Math.floor(buildProgress * 20);
261
- handler?.ui.showLoadingOverlay(`Creating project ${overallProgress}%\nStep 4/5 Building project...`);
261
+ handler?.ui.showLoadingOverlay(`Creating project ${overallProgress}%\nStep 4/5 Building project...`);
262
262
  }, 1000);
263
263
  await runCommandAsync('pnpm build', projectPath, logger);
264
264
  buildComplete = true;
265
265
  clearInterval(buildInterval);
266
266
  overallProgress = 90;
267
- handler?.ui.showLoadingOverlay('Creating project 90%\nStep 4/5 Build complete');
267
+ handler?.ui.showLoadingOverlay('Creating project 90%\nStep 4/5 Build complete');
268
268
  await new Promise(resolve => setTimeout(resolve, 500));
269
269
  // Step 5: Finalizing (90-100%)
270
- handler?.ui.showLoadingOverlay('Creating project 95%\nStep 5/5 Finalizing...');
270
+ handler?.ui.showLoadingOverlay('Creating project 95%\nStep 5/5 Finalizing...');
271
271
  // open the project in the file explorer
272
272
  handler?.os.openPath(projectPath);
273
273
  await new Promise(resolve => setTimeout(resolve, 500));
274
274
  overallProgress = 100;
275
275
  logger.log('Project created successfully');
276
- handler?.ui.showLoadingOverlay('Creating project 100%\n✅ Project created successfully!');
276
+ handler?.ui.showLoadingOverlay('Creating project 100%\nProject created successfully!');
277
277
  await new Promise(resolve => setTimeout(resolve, 1000));
278
278
  return {
279
279
  success: true,
@@ -1,5 +1,5 @@
1
1
  import { app, Menu } from 'electron';
2
- import { buildProject, checkUpdates, openAppLog, showAbout, showInExplorer } from './actions.js';
2
+ import { checkUpdates, openAppLog, showAbout, showInExplorer } from './actions.js';
3
3
  export function buildAppMenu(mainWindow) {
4
4
  const isMac = process.platform === 'darwin';
5
5
  if (isMac) {
@@ -38,12 +38,6 @@ function buildMacMenu(mainWindow) {
38
38
  {
39
39
  label: 'Project',
40
40
  submenu: [
41
- {
42
- label: 'Build Project',
43
- accelerator: 'Cmd+B',
44
- click: () => buildProject(true)
45
- },
46
- { type: 'separator' },
47
41
  {
48
42
  label: 'Show in Finder',
49
43
  accelerator: 'Cmd+E',
@@ -115,12 +109,6 @@ function buildWindowsMenu(mainWindow) {
115
109
  {
116
110
  label: 'Project',
117
111
  submenu: [
118
- {
119
- label: 'Build Project',
120
- accelerator: 'Ctrl+B',
121
- click: () => buildProject(true)
122
- },
123
- { type: 'separator' },
124
112
  {
125
113
  label: 'Show in Explorer',
126
114
  accelerator: 'Ctrl+E',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directivegames/genesys.sdk",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "description": "Genesys SDK - A development toolkit for game development",
5
5
  "author": "Directive Games",
6
6
  "main": "index.js",