@ludeo/cli 1.2.0 → 1.2.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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludeo/cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Ludeo CLI - Upload game builds and manage content on the Ludeo platform",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -9,7 +9,12 @@
9
9
  "scripts": {
10
10
  "build": "make build-all",
11
11
  "postinstall": "node scripts/postinstall.js",
12
- "prepublishOnly": "npm run build"
12
+ "prepublishOnly": "npm run build",
13
+ "release": "node scripts/release.js",
14
+ "release:patch": "node scripts/release.js patch",
15
+ "release:minor": "node scripts/release.js minor",
16
+ "release:major": "node scripts/release.js major",
17
+ "windows-release": "make windows-release"
13
18
  },
14
19
  "keywords": [
15
20
  "ludeo",
@@ -0,0 +1,227 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process');
6
+
7
+ // Colors for console output
8
+ const colors = {
9
+ reset: '\x1b[0m',
10
+ bright: '\x1b[1m',
11
+ red: '\x1b[31m',
12
+ green: '\x1b[32m',
13
+ yellow: '\x1b[33m',
14
+ blue: '\x1b[34m',
15
+ magenta: '\x1b[35m',
16
+ cyan: '\x1b[36m'
17
+ };
18
+
19
+ function log(message, color = 'reset') {
20
+ console.log(`${colors[color]}${message}${colors.reset}`);
21
+ }
22
+
23
+ function exec(command, options = {}) {
24
+ try {
25
+ return execSync(command, {
26
+ stdio: 'inherit',
27
+ encoding: 'utf8',
28
+ ...options
29
+ });
30
+ } catch (error) {
31
+ log(`❌ Command failed: ${command}`, 'red');
32
+ log(`Error: ${error.message}`, 'red');
33
+ process.exit(1);
34
+ }
35
+ }
36
+
37
+ function getCurrentVersion() {
38
+ const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
39
+ return packageJson.version;
40
+ }
41
+
42
+ function updateVersion(type) {
43
+ log(`📦 Updating version (${type})...`, 'blue');
44
+
45
+ // Update package.json version
46
+ exec(`npm version ${type} --no-git-tag-version`);
47
+
48
+ const newVersion = getCurrentVersion();
49
+ log(`✅ Version updated to: ${newVersion}`, 'green');
50
+ return newVersion;
51
+ }
52
+
53
+ function buildAll() {
54
+ log('🔨 Building for all platforms...', 'blue');
55
+ exec('make build-all');
56
+ log('✅ Build completed', 'green');
57
+ }
58
+
59
+ function publishNPM() {
60
+ log('📤 Publishing to NPM...', 'blue');
61
+ exec('make npm-publish');
62
+ log('✅ Published to NPM successfully', 'green');
63
+ }
64
+
65
+ function createWindowsRelease(version) {
66
+ log('🪟 Creating Windows release...', 'blue');
67
+
68
+ const releaseDir = `windows-releases/v${version}`;
69
+
70
+ // Create release directory
71
+ exec(`mkdir -p ${releaseDir}`);
72
+
73
+ // Copy Windows binaries
74
+ exec(`cp build/ludeo-windows-amd64.exe ${releaseDir}/`);
75
+ exec(`cp build/ludeo-windows-arm64.exe ${releaseDir}/`);
76
+
77
+ // Update version in documentation files
78
+ updateWindowsDocumentation(version, releaseDir);
79
+
80
+ log(`✅ Windows release created: ${releaseDir}`, 'green');
81
+ return releaseDir;
82
+ }
83
+
84
+ function updateWindowsDocumentation(version, releaseDir) {
85
+ const files = [
86
+ 'README.md',
87
+ 'INSTALL.txt',
88
+ 'install.bat',
89
+ 'install.ps1',
90
+ 'PACKAGE_CONTENTS.txt'
91
+ ];
92
+
93
+ // Copy template files from previous version or create new ones
94
+ const templateDir = 'windows-releases/template';
95
+
96
+ files.forEach(file => {
97
+ const templatePath = path.join(templateDir, file);
98
+ const targetPath = path.join(releaseDir, file);
99
+
100
+ if (fs.existsSync(templatePath)) {
101
+ let content = fs.readFileSync(templatePath, 'utf8');
102
+ // Replace version placeholders
103
+ content = content.replace(/v1\.2\.0/g, `v${version}`);
104
+ content = content.replace(/1\.2\.0/g, version);
105
+ fs.writeFileSync(targetPath, content);
106
+ } else {
107
+ // Create basic files if templates don't exist
108
+ createBasicWindowsFiles(version, releaseDir, file);
109
+ }
110
+ });
111
+ }
112
+
113
+ function createBasicWindowsFiles(version, releaseDir, filename) {
114
+ const content = getBasicFileContent(filename, version);
115
+ fs.writeFileSync(path.join(releaseDir, filename), content);
116
+ }
117
+
118
+ function getBasicFileContent(filename, version) {
119
+ switch (filename) {
120
+ case 'README.md':
121
+ return `# Ludeo CLI v${version} - Windows Release
122
+
123
+ ## Installation
124
+ 1. Download the appropriate executable for your system
125
+ 2. Add to PATH environment variable
126
+ 3. Run: ludeo --version
127
+
128
+ ## Support
129
+ - Email: support@ludeo.com
130
+ - Documentation: https://docs.ludeo.com/cli
131
+ `;
132
+ case 'INSTALL.txt':
133
+ return `LUDEO CLI v${version} - WINDOWS INSTALLATION
134
+
135
+ 1. Choose the right executable:
136
+ - ludeo-windows-amd64.exe (Intel/AMD)
137
+ - ludeo-windows-arm64.exe (ARM)
138
+
139
+ 2. Rename to "ludeo.exe"
140
+
141
+ 3. Add to PATH:
142
+ - Copy to C:\\ludeo-cli\\
143
+ - Add C:\\ludeo-cli\\ to PATH
144
+
145
+ 4. Test: ludeo --version
146
+ `;
147
+ default:
148
+ return `# Ludeo CLI v${version} - ${filename}`;
149
+ }
150
+ }
151
+
152
+ function createGitTag(version) {
153
+ log('🏷️ Creating git tag...', 'blue');
154
+ exec(`git add .`);
155
+ exec(`git commit -m "Release v${version}"`);
156
+ exec(`git tag v${version}`);
157
+ log(`✅ Git tag created: v${version}`, 'green');
158
+ }
159
+
160
+ function pushToGit() {
161
+ log('📤 Pushing to git...', 'blue');
162
+ exec('git push origin main');
163
+ exec('git push --tags');
164
+ log('✅ Pushed to git successfully', 'green');
165
+ }
166
+
167
+ function createZipRelease(releaseDir) {
168
+ log('📦 Creating zip release...', 'blue');
169
+ const zipName = `ludeo-cli-windows-v${getCurrentVersion()}.zip`;
170
+ exec(`cd windows-releases && zip -r ${zipName} v${getCurrentVersion()}/`);
171
+ log(`✅ Zip created: windows-releases/${zipName}`, 'green');
172
+ return zipName;
173
+ }
174
+
175
+ function main() {
176
+ const args = process.argv.slice(2);
177
+ const releaseType = args[0] || 'patch'; // patch, minor, major
178
+
179
+ if (!['patch', 'minor', 'major'].includes(releaseType)) {
180
+ log('❌ Invalid release type. Use: patch, minor, or major', 'red');
181
+ process.exit(1);
182
+ }
183
+
184
+ log('🚀 Starting Ludeo CLI Release Process', 'cyan');
185
+ log('=====================================', 'cyan');
186
+
187
+ try {
188
+ // 1. Update version
189
+ const newVersion = updateVersion(releaseType);
190
+
191
+ // 2. Build all platforms
192
+ buildAll();
193
+
194
+ // 3. Publish to NPM
195
+ publishNPM();
196
+
197
+ // 4. Create Windows release
198
+ const releaseDir = createWindowsRelease(newVersion);
199
+
200
+ // 5. Create git tag and push
201
+ createGitTag(newVersion);
202
+ pushToGit();
203
+
204
+ // 6. Create zip for easy distribution
205
+ const zipName = createZipRelease(releaseDir);
206
+
207
+ log('', 'reset');
208
+ log('🎉 Release completed successfully!', 'green');
209
+ log('================================', 'green');
210
+ log(`📦 NPM Package: @ludeo/cli@${newVersion}`, 'cyan');
211
+ log(`🪟 Windows Release: ${releaseDir}`, 'cyan');
212
+ log(`📁 Zip File: windows-releases/${zipName}`, 'cyan');
213
+ log(`🏷️ Git Tag: v${newVersion}`, 'cyan');
214
+ log('', 'reset');
215
+ log('Next steps:', 'yellow');
216
+ log('1. Test the NPM package: npm install -g @ludeo/cli@latest', 'white');
217
+ log('2. Distribute the Windows zip to developers', 'white');
218
+ log('3. Update any external documentation', 'white');
219
+
220
+ } catch (error) {
221
+ log(`❌ Release failed: ${error.message}`, 'red');
222
+ process.exit(1);
223
+ }
224
+ }
225
+
226
+ // Run the script
227
+ main();