@weave-apps/sdk 0.1.1 → 0.1.3
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 +0 -18
- package/bin/init.js +46 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,24 +11,6 @@ Official SDK for building third-party applications for the Weave Platform.
|
|
|
11
11
|
- ✅ **DOM API** - Secure parent page DOM manipulation
|
|
12
12
|
- ✅ **Shadow DOM Isolation** - Scoped styles and encapsulation
|
|
13
13
|
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
Install directly from GitHub:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install github:your-org/weave-app-sdk
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Or add to your `package.json`:
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
{
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@weave/app-sdk": "github:your-org/weave-app-sdk"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
14
|
## Quick Start
|
|
33
15
|
|
|
34
16
|
### 1. Initialize a New App
|
package/bin/init.js
CHANGED
|
@@ -8,11 +8,55 @@
|
|
|
8
8
|
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
-
const
|
|
11
|
+
const sdkPackageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
12
|
+
|
|
13
|
+
// Read SDK version from its package.json
|
|
14
|
+
const sdkPackageJson = JSON.parse(fs.readFileSync(sdkPackageJsonPath, 'utf8'));
|
|
15
|
+
|
|
16
|
+
let sdkVersion;
|
|
17
|
+
if (fs.existsSync(sdkPackageJsonPath)) {
|
|
18
|
+
try {
|
|
19
|
+
const sdkPackageJson = JSON.parse(fs.readFileSync(sdkPackageJsonPath, 'utf8'));
|
|
20
|
+
sdkVersion = `^${sdkPackageJson.version}`;
|
|
21
|
+
} catch (err) {
|
|
22
|
+
console.warn('⚠️ Warning: Could not read SDK version from package.json, using fallback');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
12
25
|
|
|
13
26
|
const args = process.argv.slice(2);
|
|
14
27
|
const appName = args[0];
|
|
15
28
|
|
|
29
|
+
// Help command
|
|
30
|
+
if (appName === '--help') {
|
|
31
|
+
console.log(`
|
|
32
|
+
|
|
33
|
+
🚀 Weave Apps SDK Help
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
weave-init <app-name> Create a new Weave app
|
|
37
|
+
weave-init --help Show this help message
|
|
38
|
+
|
|
39
|
+
Examples:
|
|
40
|
+
weave-init my-app
|
|
41
|
+
weave-init my-custom-app
|
|
42
|
+
weave-init dashboard
|
|
43
|
+
|
|
44
|
+
Requirements:
|
|
45
|
+
• App name must be in kebab-case (lowercase with hyphens)
|
|
46
|
+
• App name must start with a letter
|
|
47
|
+
• Directory with that name must not already exist
|
|
48
|
+
|
|
49
|
+
After initialization:
|
|
50
|
+
cd <app-name>
|
|
51
|
+
npm install
|
|
52
|
+
npm run build
|
|
53
|
+
|
|
54
|
+
Learn more:
|
|
55
|
+
https://www.npmjs.com/package/@weave-apps/sdk
|
|
56
|
+
`);
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
|
|
16
60
|
if (!appName) {
|
|
17
61
|
console.error('❌ Error: App name is required');
|
|
18
62
|
console.log('Usage: npx weave-init <app-name>');
|
|
@@ -50,7 +94,7 @@ const packageJson = {
|
|
|
50
94
|
clean: 'rm -rf dist'
|
|
51
95
|
},
|
|
52
96
|
devDependencies: {
|
|
53
|
-
'@weave/
|
|
97
|
+
'@weave-apps/sdk': sdkVersion
|
|
54
98
|
}
|
|
55
99
|
};
|
|
56
100
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave-apps/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "SDK for building Weave Micro Apps",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"bin": {
|
|
11
11
|
"weave-init": "./bin/init.js",
|
|
12
|
+
"@weave-apps/sdk": "./bin/init.js",
|
|
12
13
|
"weave-build": "./bin/build.js",
|
|
13
14
|
"weave-compile": "./bin/compile.js"
|
|
14
15
|
},
|