@weave-apps/sdk 0.1.0 → 0.1.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.
- package/README.md +0 -18
- package/bin/init.js +32 -12
- 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
|
@@ -2,13 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Weave App Initializer
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Creates a new Weave app project with TypeScript setup
|
|
7
7
|
*/
|
|
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];
|
|
@@ -50,7 +63,7 @@ const packageJson = {
|
|
|
50
63
|
clean: 'rm -rf dist'
|
|
51
64
|
},
|
|
52
65
|
devDependencies: {
|
|
53
|
-
'@weave/
|
|
66
|
+
'@weave-apps/sdk': sdkVersion
|
|
54
67
|
}
|
|
55
68
|
};
|
|
56
69
|
|
|
@@ -62,15 +75,22 @@ fs.writeFileSync(
|
|
|
62
75
|
// Create minimal tsconfig.json that extends SDK's config
|
|
63
76
|
// This is needed for IDE support (IntelliSense, type checking, etc.)
|
|
64
77
|
const tsConfig = {
|
|
65
|
-
extends: '@weave/
|
|
66
|
-
compilerOptions: {
|
|
67
|
-
baseUrl: '.',
|
|
68
|
-
paths: {
|
|
69
|
-
'@weave/
|
|
78
|
+
'extends': '@weave-apps/sdk/tsconfig.app.json',
|
|
79
|
+
'compilerOptions': {
|
|
80
|
+
'baseUrl': '.',
|
|
81
|
+
'paths': {
|
|
82
|
+
'@weave-apps/sdk': [
|
|
83
|
+
'node_modules/@weave-apps/sdk/dist'
|
|
84
|
+
]
|
|
70
85
|
}
|
|
71
86
|
},
|
|
72
|
-
include: [
|
|
73
|
-
|
|
87
|
+
'include': [
|
|
88
|
+
'src/**/*'
|
|
89
|
+
],
|
|
90
|
+
'exclude': [
|
|
91
|
+
'node_modules',
|
|
92
|
+
'dist'
|
|
93
|
+
]
|
|
74
94
|
};
|
|
75
95
|
|
|
76
96
|
fs.writeFileSync(
|
|
@@ -236,14 +256,14 @@ console.log(' npm install');
|
|
|
236
256
|
console.log(' npm run build\n');
|
|
237
257
|
|
|
238
258
|
// Helper functions
|
|
239
|
-
function toPascalCase(str) {
|
|
259
|
+
function toPascalCase (str) {
|
|
240
260
|
return str
|
|
241
261
|
.split('-')
|
|
242
262
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
243
263
|
.join('');
|
|
244
264
|
}
|
|
245
265
|
|
|
246
|
-
function toTitleCase(str) {
|
|
266
|
+
function toTitleCase (str) {
|
|
247
267
|
return str
|
|
248
268
|
.split('-')
|
|
249
269
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weave-apps/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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
|
},
|