@axpo/cli 1.0.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.
- package/README.md +91 -0
- package/bin/axpo.js +127 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +2586 -0
- package/dist/index.js.map +1 -0
- package/dist/postinstall.js +4 -0
- package/package.json +68 -0
- package/templates/javascript/ChangeLog.md +16 -0
- package/templates/javascript/axpo.config.js +36 -0
- package/templates/javascript/icon.png +0 -0
- package/templates/javascript/package.json +23 -0
- package/templates/javascript/plugin.json +23 -0
- package/templates/javascript/readme.md +50 -0
- package/templates/javascript/src/main.js +16 -0
- package/templates/typescript/ChangeLog.md +16 -0
- package/templates/typescript/axpo.config.ts +36 -0
- package/templates/typescript/icon.png +0 -0
- package/templates/typescript/package.json +24 -0
- package/templates/typescript/plugin.json +23 -0
- package/templates/typescript/readme.md +50 -0
- package/templates/typescript/src/main.ts +16 -0
- package/templates/typescript/tsconfig.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://github.com/MatrixCoder0101/axpo">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://iili.io/q0y2Jne.png">
|
|
5
|
+
<img alt="Axpo logo" src="https://iili.io/q0y2Jne.png" height="128">
|
|
6
|
+
</picture>
|
|
7
|
+
</a>
|
|
8
|
+
<h1>@axpo/cli</h1>
|
|
9
|
+
|
|
10
|
+
<p>CLI & build tool for <a href="https://acode.app">Acode</a> plugin development.</p>
|
|
11
|
+
|
|
12
|
+
<p>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@axpo/cli">
|
|
14
|
+
<img src="https://img.shields.io/npm/v/@axpo/cli?style=flat-square&logo=npm&color=CB3837" alt="npm version" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@axpo/cli">
|
|
17
|
+
<img src="https://img.shields.io/npm/dm/@axpo/cli?style=flat-square&logo=npm&color=CB3837" alt="monthly downloads" />
|
|
18
|
+
</a>
|
|
19
|
+
<img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="typescript" />
|
|
20
|
+
<img src="https://img.shields.io/badge/platform-Android-3DDC84?style=flat-square&logo=android&logoColor=white" alt="platform" />
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
> CLI and build tooling for Acode plugin development. Part of the [Axpo](https://github.com/MatrixCoder0101/axpo) ecosystem.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Create your first plugin
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @axpo/cli init
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Commands
|
|
37
|
+
|
|
38
|
+
### Inside a plugin project
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm run dev # Start dev server with hot reload
|
|
42
|
+
npm run build # Build + zip for production
|
|
43
|
+
npm run clean # Clean build output
|
|
44
|
+
npm run publish # Publish to Acode registry
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Axpo CLI
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
axpo init [name] # Create a new plugin project
|
|
51
|
+
axpo dev # Start development server
|
|
52
|
+
axpo build # Build plugin (creates zip by default)
|
|
53
|
+
axpo build --no-zip # Build only, skip zip
|
|
54
|
+
axpo zip # Create zip from existing build
|
|
55
|
+
axpo publish # Publish plugin to Acode registry
|
|
56
|
+
axpo logout # Clear saved Acode credentials
|
|
57
|
+
axpo clean # Remove build folder and zip files
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**`axpo init` options**
|
|
61
|
+
|
|
62
|
+
| Flag | Description |
|
|
63
|
+
|------|-------------|
|
|
64
|
+
| `[name]` | Project folder name |
|
|
65
|
+
| `.` | Initialize in current directory |
|
|
66
|
+
| `-y, --yes` | Skip prompts, use defaults |
|
|
67
|
+
|
|
68
|
+
**`axpo build` options**
|
|
69
|
+
|
|
70
|
+
| Flag | Description |
|
|
71
|
+
|------|-------------|
|
|
72
|
+
| `--no-zip` | Skip zip creation |
|
|
73
|
+
| `-o, --output <file>` | Custom zip filename |
|
|
74
|
+
|
|
75
|
+
**`axpo publish` options**
|
|
76
|
+
|
|
77
|
+
| Flag | Description |
|
|
78
|
+
|------|-------------|
|
|
79
|
+
| `-z, --zip <file>` | Zip file to publish (default: `Plugin.zip`) |
|
|
80
|
+
| `-f, --force` | Skip confirmation prompt |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Links
|
|
86
|
+
|
|
87
|
+
- **Core SDK:** [@axpo/core](https://www.npmjs.com/package/@axpo/core)
|
|
88
|
+
- **GitHub:** [github.com/MatrixCoder0101/axpo](https://github.com/MatrixCoder0101/axpo)
|
|
89
|
+
- **Acode Docs:** [docs.acode.app](https://docs.acode.app)
|
|
90
|
+
|
|
91
|
+
<center>Made with ❤️ by Goutam Kumar</center>
|
package/bin/axpo.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import color from 'picocolors';
|
|
4
|
+
import { build, dev, createZip, clean, publish, logout, init } from '../dist/index.js';
|
|
5
|
+
|
|
6
|
+
const program = new Command();
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.name('axpo')
|
|
10
|
+
.description('💓 Modern Framework for Acode plugin development')
|
|
11
|
+
.version('1.0.0');
|
|
12
|
+
|
|
13
|
+
//Init command
|
|
14
|
+
program
|
|
15
|
+
.command('init [name]')
|
|
16
|
+
.description('Create a new Acode plugin project')
|
|
17
|
+
.option('-y, --yes', 'Skip prompts and use defaults')
|
|
18
|
+
.action(async (name, options) => {
|
|
19
|
+
// Check if name is "."
|
|
20
|
+
const isCurrent = name === '.';
|
|
21
|
+
await init({
|
|
22
|
+
name: isCurrent ? undefined : name,
|
|
23
|
+
current: isCurrent,
|
|
24
|
+
...options
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Dev command
|
|
29
|
+
program
|
|
30
|
+
.command('dev')
|
|
31
|
+
.description('Start development server with hot reload')
|
|
32
|
+
.action(async () => {
|
|
33
|
+
try {
|
|
34
|
+
await dev();
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Build command
|
|
42
|
+
program
|
|
43
|
+
.command('build')
|
|
44
|
+
.description('Build plugin for production')
|
|
45
|
+
.option('--no-zip', 'Skip zip creation after build') // ✅ --no-zip flag
|
|
46
|
+
.option('-o, --output <filename>', 'Zip output filename (default: Plugin.zip)')
|
|
47
|
+
.option('-w, --watch', 'Watch for changes')
|
|
48
|
+
.action(async (options) => {
|
|
49
|
+
try {
|
|
50
|
+
if (options.watch) {
|
|
51
|
+
await dev();
|
|
52
|
+
} else {
|
|
53
|
+
await build({
|
|
54
|
+
zip: options.zip, // ✅ --no-zip se automatically false ho jayega
|
|
55
|
+
zipFilename: options.output
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Zip command
|
|
65
|
+
program
|
|
66
|
+
.command('zip')
|
|
67
|
+
.description('Create zip (requires build first)')
|
|
68
|
+
.option('-o, --output <filename>', 'Zip output filename (default: Plugin.zip)')
|
|
69
|
+
.action(async (options) => {
|
|
70
|
+
try {
|
|
71
|
+
await createZip(options.output);
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Publish command
|
|
79
|
+
program
|
|
80
|
+
.command('publish')
|
|
81
|
+
.description('Publish plugin to Acode registry')
|
|
82
|
+
.option('-z, --zip <filename>', 'Zip filename to publish (default: Plugin.zip)')
|
|
83
|
+
.option('-f, --force', 'Skip confirmation prompts')
|
|
84
|
+
.action(async (options) => {
|
|
85
|
+
try {
|
|
86
|
+
await publish({
|
|
87
|
+
zipFilename: options.zip,
|
|
88
|
+
force: options.force
|
|
89
|
+
});
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Logout command
|
|
97
|
+
program
|
|
98
|
+
.command('logout')
|
|
99
|
+
.description('Clear saved Acode credentials')
|
|
100
|
+
.action(async () => {
|
|
101
|
+
try {
|
|
102
|
+
await logout();
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Clean command
|
|
110
|
+
program
|
|
111
|
+
.command('clean')
|
|
112
|
+
.description('Clean build artifacts (build/, zip files)')
|
|
113
|
+
.action(async () => {
|
|
114
|
+
try {
|
|
115
|
+
await clean();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error(color.red('\n✗ Error:'), error.message);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Show help if no command
|
|
123
|
+
if (!process.argv.slice(2).length) {
|
|
124
|
+
program.outputHelp();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
program.parse();
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AxpoConfig, PluginJson } from '@axpo/sdk';
|
|
2
|
+
|
|
3
|
+
interface DeviceInfo {
|
|
4
|
+
packageName: string;
|
|
5
|
+
version: string;
|
|
6
|
+
versionCode: number;
|
|
7
|
+
buildType: string;
|
|
8
|
+
debug: boolean;
|
|
9
|
+
flavor: string;
|
|
10
|
+
installDate: string;
|
|
11
|
+
isPaid: boolean;
|
|
12
|
+
androidVersion: string;
|
|
13
|
+
deviceModel: string;
|
|
14
|
+
chromeVersion: string;
|
|
15
|
+
deviceVendor: string;
|
|
16
|
+
screenWidth: number;
|
|
17
|
+
screenHeight: number;
|
|
18
|
+
viewportWidth: number;
|
|
19
|
+
viewportHeight: number;
|
|
20
|
+
pixelRatio: number;
|
|
21
|
+
sys: string;
|
|
22
|
+
cpuCores: number;
|
|
23
|
+
ram: number;
|
|
24
|
+
os: string;
|
|
25
|
+
browser: string;
|
|
26
|
+
userAgent: string;
|
|
27
|
+
}
|
|
28
|
+
interface SessionWarnings {
|
|
29
|
+
minVersionCodeWarning: boolean;
|
|
30
|
+
apiWarnings: Set<string>;
|
|
31
|
+
}
|
|
32
|
+
interface APIWarning {
|
|
33
|
+
api: string;
|
|
34
|
+
requiredVersion: number;
|
|
35
|
+
file: string;
|
|
36
|
+
line: number;
|
|
37
|
+
severity: 'error' | 'warn' | 'info';
|
|
38
|
+
}
|
|
39
|
+
interface APIUsageAnalysis {
|
|
40
|
+
apis: Set<string>;
|
|
41
|
+
warnings: APIWarning[];
|
|
42
|
+
hasErrors: boolean;
|
|
43
|
+
hasWarnings: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface BuildCommandOptions {
|
|
46
|
+
zip?: boolean;
|
|
47
|
+
zipFilename?: string;
|
|
48
|
+
}
|
|
49
|
+
interface PublishCommandOptions {
|
|
50
|
+
token?: string;
|
|
51
|
+
registry?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface PublishOptions {
|
|
55
|
+
zipFilename?: string;
|
|
56
|
+
force?: boolean;
|
|
57
|
+
token?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function publish(options?: PublishOptions): Promise<void>;
|
|
60
|
+
declare function logout(): Promise<void>;
|
|
61
|
+
|
|
62
|
+
declare function build(options?: BuildCommandOptions): Promise<boolean>;
|
|
63
|
+
declare function dev(): Promise<void>;
|
|
64
|
+
declare function createZip(commandZipFilename?: string): Promise<void>;
|
|
65
|
+
declare function clean(): Promise<void>;
|
|
66
|
+
|
|
67
|
+
declare function loadPluginJson(): PluginJson;
|
|
68
|
+
declare function loadConfig(configPath?: string): Promise<AxpoConfig>;
|
|
69
|
+
declare function validateConfig(config: AxpoConfig, pluginJson: PluginJson): void;
|
|
70
|
+
declare function getOutDir(config: AxpoConfig): string;
|
|
71
|
+
|
|
72
|
+
interface VersionCheckResult {
|
|
73
|
+
isOutdated: boolean;
|
|
74
|
+
currentVersion: string;
|
|
75
|
+
latestVersion?: string;
|
|
76
|
+
}
|
|
77
|
+
declare function checkAxpoVersion(): Promise<VersionCheckResult | null>;
|
|
78
|
+
declare function displayVersionWarning(result: VersionCheckResult): void;
|
|
79
|
+
|
|
80
|
+
interface InitOptions {
|
|
81
|
+
name?: string;
|
|
82
|
+
yes?: boolean;
|
|
83
|
+
current?: boolean;
|
|
84
|
+
}
|
|
85
|
+
declare function init(options?: InitOptions): Promise<void>;
|
|
86
|
+
|
|
87
|
+
export { type APIUsageAnalysis, type APIWarning, type BuildCommandOptions, type DeviceInfo, type PublishCommandOptions, type SessionWarnings, build, checkAxpoVersion, clean, createZip, dev, displayVersionWarning, getOutDir, init, loadConfig, loadPluginJson, logout, publish, validateConfig };
|