@mexty/cli 1.0.1 → 1.0.2

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.
Files changed (41) hide show
  1. package/README.md +5 -5
  2. package/package.json +4 -2
  3. package/src/commands/sync.ts +2 -2
  4. package/src/index.ts +83 -83
  5. package/src/utils/api.ts +241 -239
  6. package/dist/commands/create.d.ts +0 -7
  7. package/dist/commands/create.d.ts.map +0 -1
  8. package/dist/commands/create.js +0 -80
  9. package/dist/commands/create.js.map +0 -1
  10. package/dist/commands/delete.d.ts +0 -2
  11. package/dist/commands/delete.d.ts.map +0 -1
  12. package/dist/commands/delete.js +0 -54
  13. package/dist/commands/delete.js.map +0 -1
  14. package/dist/commands/fork.d.ts +0 -2
  15. package/dist/commands/fork.d.ts.map +0 -1
  16. package/dist/commands/fork.js +0 -52
  17. package/dist/commands/fork.js.map +0 -1
  18. package/dist/commands/login.d.ts +0 -2
  19. package/dist/commands/login.d.ts.map +0 -1
  20. package/dist/commands/login.js +0 -12
  21. package/dist/commands/login.js.map +0 -1
  22. package/dist/commands/publish.d.ts +0 -2
  23. package/dist/commands/publish.d.ts.map +0 -1
  24. package/dist/commands/publish.js +0 -139
  25. package/dist/commands/publish.js.map +0 -1
  26. package/dist/commands/sync.d.ts +0 -2
  27. package/dist/commands/sync.d.ts.map +0 -1
  28. package/dist/commands/sync.js +0 -140
  29. package/dist/commands/sync.js.map +0 -1
  30. package/dist/index.d.ts +0 -3
  31. package/dist/index.d.ts.map +0 -1
  32. package/dist/index.js +0 -60
  33. package/dist/index.js.map +0 -1
  34. package/dist/utils/api.d.ts +0 -55
  35. package/dist/utils/api.d.ts.map +0 -1
  36. package/dist/utils/api.js +0 -68
  37. package/dist/utils/api.js.map +0 -1
  38. package/dist/utils/git.d.ts +0 -41
  39. package/dist/utils/git.d.ts.map +0 -1
  40. package/dist/utils/git.js +0 -171
  41. package/dist/utils/git.js.map +0 -1
package/README.md CHANGED
@@ -30,7 +30,7 @@ npm install -g mexty
30
30
 
31
31
  - Node.js 16+ installed
32
32
  - Git installed and configured
33
- - MEXT server running (default: http://localhost:3001)
33
+ - MEXT server running (default: https://api.v2.mext.app)
34
34
  - GitHub access for repository operations
35
35
 
36
36
  ## Commands
@@ -193,7 +193,7 @@ After publishing or syncing, you can use components with full type safety:
193
193
 
194
194
  ```tsx
195
195
  // Full TypeScript support with IntelliSense
196
- import { MyAmazingBlock } from 'mextblock';
196
+ import { MyAmazingBlock } from '@mexty/block';
197
197
 
198
198
  // Props are fully typed - you get autocompletion and error checking
199
199
  <MyAmazingBlock
@@ -252,7 +252,7 @@ mexty publish # Automatically parses props and syncs registry locally
252
252
  mexty sync
253
253
 
254
254
  # Then use in your React app with full TypeScript support
255
- import { TeamComponent } from 'mextblock';
255
+ import { TeamComponent } from '@mexty/block';
256
256
 
257
257
  <TeamComponent
258
258
  props={{
@@ -307,7 +307,7 @@ Gets converted to JSON schema automatically for runtime validation and type gene
307
307
  For advanced use cases, you can create strongly typed components:
308
308
 
309
309
  ```tsx
310
- import { createTypedBlock } from 'mextblock';
310
+ import { createTypedBlock } from '@mexty/block';
311
311
 
312
312
  interface GameProps {
313
313
  level: number;
@@ -333,7 +333,7 @@ const TypedGame = createTypedBlock<GameProps>('VirtualGame', {
333
333
 
334
334
  The CLI uses the following default settings:
335
335
 
336
- - **Server URL**: http://localhost:3001
336
+ - **Server URL**: https://api.v2.mext.app
337
337
  - **Timeout**: 30 seconds for API requests
338
338
  - **Props Parsing**: Automatic on publish/push
339
339
  - **Type Generation**: Automatic on sync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mexty/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "MEXT CLI for managing blocks and repositories",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -12,9 +12,11 @@
12
12
  "start": "node dist/index.js"
13
13
  },
14
14
  "dependencies": {
15
- "commander": "^11.1.0",
15
+ "@types/inquirer": "^9.0.8",
16
16
  "axios": "^1.6.0",
17
17
  "chalk": "^4.1.2",
18
+ "commander": "^11.1.0",
19
+ "inquirer": "^12.6.3",
18
20
  "simple-git": "^3.20.0"
19
21
  },
20
22
  "devDependencies": {
@@ -30,7 +30,7 @@ export async function syncCommand(): Promise<void> {
30
30
 
31
31
  // Fetch registry from server
32
32
  console.log(chalk.yellow('📡 Fetching registry from server...'));
33
- const response = await fetch('http://localhost:3001/api/blocks/registry');
33
+ const response = await fetch('https://api.v2.mext.app/api/blocks/registry');
34
34
 
35
35
  if (!response.ok) {
36
36
  throw new Error(`Server responded with ${response.status}: ${response.statusText}`);
@@ -114,7 +114,7 @@ function findMextBlockPath(): string | null {
114
114
  if (fs.existsSync(path.join(possiblePath, 'package.json'))) {
115
115
  try {
116
116
  const packageJson = JSON.parse(fs.readFileSync(path.join(possiblePath, 'package.json'), 'utf8'));
117
- if (packageJson.name === '@mexty/block' || packageJson.name === 'mextblock') {
117
+ if (packageJson.name === '@mexty/block' || packageJson.name === '@mexty/block') {
118
118
  return possiblePath;
119
119
  }
120
120
  } catch (error) {
package/src/index.ts CHANGED
@@ -1,84 +1,84 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from 'commander';
4
- import chalk from 'chalk';
5
- import { loginCommand } from './commands/login';
6
- import { createCommand } from './commands/create';
7
- import { forkCommand } from './commands/fork';
8
- import { deleteCommand } from './commands/delete';
9
- import { publishCommand } from './commands/publish';
10
- import { syncCommand } from './commands/sync';
11
- import { apiClient } from './utils/api';
12
-
13
- const program = new Command();
14
-
15
- // CLI Configuration
16
- program
17
- .name('mexty')
18
- .description('MEXT CLI for managing React microfrontend blocks and components')
19
- .version('1.0.0');
20
-
21
- // Add commands
22
- program
23
- .command('login')
24
- .description('Authenticate with MEXT')
25
- .action(loginCommand);
26
-
27
- program
28
- .command('logout')
29
- .description('Logout from MEXT')
30
- .action(async () => {
31
- try {
32
- if (!apiClient.isAuthenticated()) {
33
- console.log(chalk.yellow('⚠️ You are not logged in'));
34
- return;
35
- }
36
-
37
- await apiClient.logout();
38
- console.log(chalk.green('✅ Logged out successfully'));
39
- } catch (error: any) {
40
- console.error(chalk.red(`❌ Logout failed: ${error.message}`));
41
- }
42
- });
43
-
44
- program
45
- .command('create <name>')
46
- .description('Create a new React microfrontend block')
47
- .option('-d, --description <description>', 'Block description')
48
- .option('-t, --type <type>', 'Block type', 'custom')
49
- .action(createCommand);
50
-
51
- program
52
- .command('fork <blockId>')
53
- .description('Fork an existing block and clone its repository')
54
- .action(forkCommand);
55
-
56
- program
57
- .command('delete <blockId>')
58
- .description('Delete a block (requires ownership)')
59
- .action(deleteCommand);
60
-
61
- program
62
- .command('publish')
63
- .description('Publish current block with automatic bundling')
64
- .action(publishCommand);
65
-
66
- program
67
- .command('sync')
68
- .description('Sync block registry and update typed exports')
69
- .action(syncCommand);
70
-
71
- // Error handling
72
- program.on('command:*', () => {
73
- console.error(chalk.red(`Invalid command: ${program.args.join(' ')}`));
74
- console.log(chalk.yellow('See --help for a list of available commands.'));
75
- process.exit(1);
76
- });
77
-
78
- // Parse arguments
79
- program.parse(process.argv);
80
-
81
- // Show help if no command provided
82
- if (!process.argv.slice(2).length) {
83
- program.outputHelp();
1
+ #!/usr/bin/env node
2
+
3
+ import { Command } from 'commander';
4
+ import chalk from 'chalk';
5
+ import { loginCommand } from './commands/login';
6
+ import { createCommand } from './commands/create';
7
+ import { forkCommand } from './commands/fork';
8
+ import { deleteCommand } from './commands/delete';
9
+ import { publishCommand } from './commands/publish';
10
+ import { syncCommand } from './commands/sync';
11
+ import { apiClient } from './utils/api';
12
+
13
+ const program = new Command();
14
+
15
+ // CLI Configuration
16
+ program
17
+ .name('mexty')
18
+ .description('MEXT CLI for managing React microfrontend blocks and components')
19
+ .version('1.0.0');
20
+
21
+ // Add commands
22
+ program
23
+ .command('login')
24
+ .description('Authenticate with MEXT')
25
+ .action(loginCommand);
26
+
27
+ program
28
+ .command('logout')
29
+ .description('Logout from MEXT')
30
+ .action(async () => {
31
+ try {
32
+ if (!apiClient.isAuthenticated()) {
33
+ console.log(chalk.yellow('⚠️ You are not logged in'));
34
+ return;
35
+ }
36
+
37
+ await apiClient.logout();
38
+ console.log(chalk.green('✅ Logged out successfully'));
39
+ } catch (error: any) {
40
+ console.error(chalk.red(`❌ Logout failed: ${error.message}`));
41
+ }
42
+ });
43
+
44
+ program
45
+ .command('create <name>')
46
+ .description('Create a new React microfrontend block')
47
+ .option('-d, --description <description>', 'Block description')
48
+ .option('-t, --type <type>', 'Block type', 'custom')
49
+ .action(createCommand);
50
+
51
+ program
52
+ .command('fork <blockId>')
53
+ .description('Fork an existing block and clone its repository')
54
+ .action(forkCommand);
55
+
56
+ program
57
+ .command('delete <blockId>')
58
+ .description('Delete a block (requires ownership)')
59
+ .action(deleteCommand);
60
+
61
+ program
62
+ .command('publish')
63
+ .description('Publish current block with automatic bundling')
64
+ .action(publishCommand);
65
+
66
+ program
67
+ .command('sync')
68
+ .description('Sync block registry and update typed exports')
69
+ .action(syncCommand);
70
+
71
+ // Error handling
72
+ program.on('command:*', () => {
73
+ console.error(chalk.red(`Invalid command: ${program.args.join(' ')}`));
74
+ console.log(chalk.yellow('See --help for a list of available commands.'));
75
+ process.exit(1);
76
+ });
77
+
78
+ // Parse arguments
79
+ program.parse(process.argv);
80
+
81
+ // Show help if no command provided
82
+ if (!process.argv.slice(2).length) {
83
+ program.outputHelp();
84
84
  }