puter-cli 1.5.7 → 1.6.0

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.
@@ -29,5 +29,5 @@ jobs:
29
29
  uses: codecov/codecov-action@v5
30
30
  with:
31
31
  token: ${{ secrets.CODECOV_TOKEN }}
32
- slug: bitsnaps/puter-cli
32
+ slug: HeyPuter/puter-cli
33
33
 
package/CHANGELOG.md CHANGED
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v1.6.0](https://github.com/HeyPuter/puter-cli/compare/v1.5.7...v1.6.0)
8
+
9
+ - feat: improve init command [`2bd51ee`](https://github.com/HeyPuter/puter-cli/commit/2bd51ee01d0636b7979a9f55d3c746287c3b512a)
10
+ - chore: improve error message [`46fb3b0`](https://github.com/HeyPuter/puter-cli/commit/46fb3b063c1c74d0006138cd400b6ad207e784d9)
11
+ - chore: update package repo [`f6960ed`](https://github.com/HeyPuter/puter-cli/commit/f6960ed6f8e6fb793a6b8340476ab22778b44c14)
12
+
7
13
  #### [v1.5.7](https://github.com/HeyPuter/puter-cli/compare/v1.5.6...v1.5.7)
8
14
 
15
+ > 16 February 2025
16
+
9
17
  - chore: clean unused [`8477dc2`](https://github.com/HeyPuter/puter-cli/commit/8477dc294773c99270a83dc22ae602abe92621cf)
10
18
 
11
19
  #### [v1.5.6](https://github.com/HeyPuter/puter-cli/compare/v1.5.5...v1.5.6)
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Puter-CLI
2
2
 
3
3
  <p align="center">
4
- <img alt="test" src="https://github.com/bitsnaps/puter-cli/actions/workflows/npm-build.yml/badge.svg">
5
- <a href="https://codecov.io/github/bitsnaps/puter-cli" >
6
- <img src="https://codecov.io/github/bitsnaps/puter-cli/graph/badge.svg?token=TFPCdwdFxF"/>
4
+ <img alt="test" src="https://github.com/HeyPuter/puter-cli/actions/workflows/npm-build.yml/badge.svg">
5
+ <a href="https://codecov.io/github/HeyPuter/puter-cli" >
6
+ <img src="https://codecov.io/github/HeyPuter/puter-cli/graph/badge.svg?token=TFPCdwdFxF"/>
7
7
  </a>
8
- <img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/bitsnaps/puter-cli">
8
+ <img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/HeyPuter/puter-cli">
9
9
  <a href="https://opensource.org/licenses/MIT" >
10
10
  <img alt="License" src="https://img.shields.io/badge/License-MIT-yellow.svg">
11
11
  </a>
@@ -266,7 +266,7 @@ If you want to customize this tool you can follow these steps:
266
266
  ### Steps
267
267
  1. Clone the repository:
268
268
  ```bash
269
- git clone https://github.com/bitsnaps/puter-cli.git
269
+ git clone https://github.com/HeyPuter/puter-cli.git
270
270
  cd puter-cli
271
271
  ```
272
272
  2. Install dependencies:
@@ -339,7 +339,7 @@ This project was previously licensed under the "NoHarm" license to explicitly pr
339
339
 
340
340
  ## Support
341
341
 
342
- For issues or questions, please open an issue on [GitHub](https://github.com/bitsnaps/puter-cli/issues) or contact [puter's team](mailto:hey@puter.com) if you found an issue related to Puter's APIs.
342
+ For issues or questions, please open an issue on [GitHub](https://github.com/HeyPuter/puter-cli/issues) or contact [puter's team](mailto:hey@puter.com) if you found an issue related to Puter's APIs.
343
343
 
344
344
  ---
345
345
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puter-cli",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "description": "Command line interface for Puter cloud platform",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -48,10 +48,10 @@
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "git+https://github.com/bitsnaps/puter-cli.git"
51
+ "url": "git+https://github.com/HeyPuter/puter-cli.git"
52
52
  },
53
53
  "bugs": {
54
- "url": "https://github.com/bitsnaps/puter-cli/issues"
54
+ "url": "https://github.com/HeyPuter/puter-cli/issues"
55
55
  },
56
- "homepage": "https://github.com/bitsnaps/puter-cli"
56
+ "homepage": "https://github.com/HeyPuter/puter-cli"
57
57
  }
@@ -1195,16 +1195,26 @@ async function resolveLocalDirectory(localPath) {
1195
1195
  * @param {string[]} args - Command-line arguments (e.g., [localDir, remoteDir]).
1196
1196
  */
1197
1197
  export async function syncDirectory(args = []) {
1198
+ const usageMessage = 'Usage: update <local_directory> <remote_directory> [--delete]';
1198
1199
  if (args.length < 2) {
1199
- console.log(chalk.red('Usage: update <local_directory> <remote_directory> [--delete]'));
1200
+ console.log(chalk.red(usageMessage));
1200
1201
  return;
1201
1202
  }
1202
1203
 
1203
- const localDir = await resolveLocalDirectory(args[0]);
1204
- const remoteDir = resolvePath(getCurrentDirectory(), args[1]);
1205
- const deleteFlag = args.includes('--delete'); // Whether to delete extra files
1204
+ let localDir = '';
1205
+ let remoteDir = '';
1206
+ let deleteFlag = '';
1207
+ try {
1208
+ localDir = await resolveLocalDirectory(args[0]);
1209
+ remoteDir = resolvePath(getCurrentDirectory(), args[1]);
1210
+ deleteFlag = args.includes('--delete'); // Whether to delete extra files
1211
+ } catch (error) {
1212
+ console.error(chalk.red(error.message));
1213
+ console.log(chalk.green(usageMessage));
1214
+ return;
1215
+ }
1206
1216
 
1207
- console.log(chalk.green(`Syncing local directory "${localDir}" with remote directory "${remoteDir}"...\n`));
1217
+ console.log(chalk.green(`Syncing local directory ${chalk.cyan(localDir)}" with remote directory ${chalk.cyan(remoteDir)}"...\n`));
1208
1218
 
1209
1219
  try {
1210
1220
  // Step 1: Validate local directory
@@ -26,8 +26,10 @@ export async function init() {
26
26
  }
27
27
  ]);
28
28
 
29
- let jsFiles = [];
29
+ let jsFiles = ['puter-sdk'];
30
+ let jsDevFiles = [];
30
31
  let cssFiles = [];
32
+ let jsExtraLibraries = [];
31
33
  let extraFiles = [];
32
34
  let bundlerAnswers = null;
33
35
  let frameworkAnswers = null;
@@ -73,14 +75,14 @@ export async function init() {
73
75
  content: `<template><h1>${answers.name}</h1></template>`
74
76
  });
75
77
  break;
76
- case FULLSTACK_FRAMEWORKS[2]:
78
+ case FULLSTACK_FRAMEWORKS[2]:
77
79
  jsFiles.push('svelte@latest', 'sveltekit@latest');
78
80
  extraFiles.push({
79
81
  path: 'src/app.vue',
80
82
  content: `<template><h1>${answers.name}</h1></template>`
81
83
  });
82
84
  break;
83
- case FULLSTACK_FRAMEWORKS[3]:
85
+ case FULLSTACK_FRAMEWORKS[3]:
84
86
  jsFiles.push('astro@latest', 'astro@latest');
85
87
  extraFiles.push({
86
88
  path: 'src/pages/index.astro',
@@ -117,6 +119,7 @@ export async function init() {
117
119
  break;
118
120
  case JS_LIBRARIES[1]:
119
121
  jsFiles.push('vue@latest');
122
+ jsDevFiles.push('@vitejs/plugin-vue');
120
123
  const vueLibs = await inquirer.prompt([
121
124
  {
122
125
  type: 'checkbox',
@@ -126,10 +129,30 @@ export async function init() {
126
129
  }
127
130
  ]);
128
131
  jsFiles.push(...vueLibs.vueLibraries);
129
- extraFiles.push({
132
+ extraFiles.push(
133
+ {
130
134
  path: 'src/App.vue',
131
135
  content: `<template><h1>${answers.name}</h1></template>`
132
- });
136
+ },
137
+ {
138
+ path: 'vite.config.js',
139
+ content: `import { defineConfig } from 'vite';
140
+ import vue from '@vitejs/plugin-vue';
141
+
142
+ export default defineConfig({
143
+ plugins: [vue()]
144
+ })
145
+ `},
146
+ {
147
+ path: 'main.js',
148
+ content: `import { createApp } from 'vue'
149
+ import './style.css';
150
+ import App from './App.vue';
151
+
152
+ const app = createApp(App);
153
+ app.mount('#app');
154
+ `},
155
+ );
133
156
  break;
134
157
  case JS_LIBRARIES[2]:
135
158
  jsFiles.push('@angular/core@latest');
@@ -196,15 +219,16 @@ export async function init() {
196
219
  case CSS_LIBRARIES[2]:
197
220
  cssFiles.push('https://cdn.tailwindcss.com');
198
221
  break;
199
- }
222
+ }
200
223
  }
201
224
 
225
+
202
226
  const spinner = ora('Creating Puter app...').start();
203
227
 
204
228
  try {
205
229
  const useBundler = answers.useBundler === 'Yes';
206
230
  // Create basic app structure
207
- await createAppStructure(answers.name, useBundler, bundlerAnswers, frameworkAnswers, jsFiles, cssFiles, extraFiles);
231
+ await createAppStructure(answers.name, useBundler, bundlerAnswers, frameworkAnswers, jsFiles, jsDevFiles, cssFiles, extraFiles);
208
232
  spinner.succeed(chalk.green('Successfully created Puter app!'));
209
233
 
210
234
  console.log('\nNext steps:');
@@ -221,7 +245,7 @@ export async function init() {
221
245
  }
222
246
  }
223
247
 
224
- async function createAppStructure(name, useBundler, bundlerAnswers, frameworkAnswers, jsFiles, cssFiles, extraFiles) {
248
+ async function createAppStructure(name, useBundler, bundlerAnswers, frameworkAnswers, jsFiles, jsDevFiles, cssFiles, extraFiles) {
225
249
  // Create project directory
226
250
  await fs.mkdir(name, { recursive: true });
227
251
 
@@ -262,17 +286,23 @@ console.log('Puter app initialized!');`,
262
286
  const packageJson = {
263
287
  name: name,
264
288
  version: '1.0.0',
289
+ type: 'module',
265
290
  scripts,
266
291
  dependencies: {},
267
292
  devDependencies: {}
268
293
  };
269
294
 
295
+
270
296
  jsFiles.forEach(lib => {
271
297
  if (!lib.startsWith('http')) {
272
298
  packageJson.dependencies[lib.split('@')[0].toString().toLowerCase()] = lib.split('@')[1] || 'latest';
273
299
  }
274
300
  });
275
301
 
302
+ jsDevFiles.forEach(lib => {
303
+ packageJson.devDependencies[lib] = 'latest';
304
+ });
305
+
276
306
  packageJson.devDependencies[bundler] = 'latest';
277
307
 
278
308
  await fs.writeFile(path.join(name, 'package.json'), JSON.stringify(packageJson, null, 2));