-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.js
More file actions
262 lines (245 loc) · 8.03 KB
/
init.js
File metadata and controls
262 lines (245 loc) · 8.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
const fs = require('fs');
const path = require('path');
const root = __dirname;
const dirs = [
'packages/core/src',
'packages/web/src',
'packages/react-native/src',
'packages/react-native/ios',
'packages/react-native/android',
'packages/flutter/lib',
'packages/smart-contracts/src',
'packages/testing/src',
'examples/web-demo/src',
'examples/react-native-demo/src',
'examples/flutter-demo/lib',
'docs'
];
dirs.forEach(d => fs.mkdirSync(path.join(root, d), { recursive: true }));
const files = {
'pnpm-workspace.yaml': `packages:
- 'packages/*'
- 'examples/*'
`,
'turbo.json': JSON.stringify({
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": []
},
"dev": {
"cache": false,
"persistent": true
}
}
}, null, 2),
'package.json': JSON.stringify({
"name": "signet-sdk-monorepo",
"private": true,
"scripts": {
"build": "turbo run build",
"test": "turbo run test",
"dev": "turbo run dev"
},
"devDependencies": {
"turbo": "^2.0.0",
"typescript": "^5.4.0",
"eslint": "^9.0.0",
"prettier": "^3.2.0",
"@changesets/cli": "^2.27.0"
},
"engines": {
"node": ">=20.0.0",
"pnpm": ">=9.0.0"
}
}, null, 2),
'tsconfig.json': JSON.stringify({
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true
}
}, null, 2),
// Core
'packages/core/package.json': JSON.stringify({
"name": "@signet-sdk/core",
"version": "0.1.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"test": "vitest run"
},
"dependencies": {
"@stellar/stellar-sdk": "^12.0.0",
"@noble/curves": "^1.4.0",
"@noble/hashes": "^1.4.0",
"cbor-x": "^1.5.0",
"buffer": "^6.0.3"
},
"devDependencies": {
"tsup": "^8.0.0",
"vitest": "^1.0.0",
"typescript": "^5.4.0"
}
}, null, 2),
'packages/core/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'packages/core/src/index.ts': 'export const coreVersion = "0.1.0";\\nexport const ping = () => "pong";\\n',
// Web
'packages/web/package.json': JSON.stringify({
"name": "@signet-sdk/web",
"version": "0.1.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"test": "vitest run"
},
"dependencies": {
"@signet-sdk/core": "workspace:*",
"idb": "^8.0.0"
},
"devDependencies": {
"tsup": "^8.0.0",
"vitest": "^1.0.0",
"@vitest/browser": "^1.0.0",
"typescript": "^5.4.0"
}
}, null, 2),
'packages/web/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'packages/web/src/index.ts': 'import { coreVersion } from "@signet-sdk/core";\\nexport const webVersion = "0.1.0";\\nexport const initWeb = () => console.log("Init Web Core:", coreVersion);\\n',
// React Native
'packages/react-native/package.json': JSON.stringify({
"name": "@signet-sdk/react-native",
"version": "0.1.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts",
"test": "vitest run"
},
"dependencies": {
"@signet-sdk/core": "workspace:*"
},
"peerDependencies": {
"react-native": ">=0.73.0",
"expo-modules-core": ">=1.11.0"
},
"peerDependenciesMeta": {
"expo-modules-core": {
"optional": true
}
},
"devDependencies": {
"tsup": "^8.0.0",
"vitest": "^1.0.0",
"typescript": "^5.4.0",
"@react-native-community/cli": "^12.0.0"
}
}, null, 2),
'packages/react-native/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'packages/react-native/src/index.ts': 'import { coreVersion } from "@signet-sdk/core";\\nexport const rnVersion = "0.1.0";\\nexport const initRN = () => console.log("Init RN Core:", coreVersion);\\n',
// Flutter
'packages/flutter/pubspec.yaml': `name: signet_flutter\\ndescription: Flutter platform integration for Signet SDK.\\nversion: 0.1.0\\n\\nenvironment:\\n sdk: ">=3.0.0 <4.0.0"\\n\\ndependencies:\\n flutter:\\n sdk: flutter\\n stellar_flutter_sdk: ^1.7.0\\n pointycastle: ^3.7.0\\n cbor: ^6.3.0\\n flutter_secure_storage: ^9.0.0\\n crypto: ^3.0.3\\n convert: ^3.1.1\\n\\ndev_dependencies:\\n flutter_test:\\n sdk: flutter\\n mockito: ^5.4.4\\n build_runner: ^2.4.8\\n`,
'packages/flutter/lib/signet_flutter.dart': 'class SignetFlutter {\\n static String ping() => "pong";\\n}\\n',
// Smart Contracts
'packages/smart-contracts/Cargo.toml': `[package]\\nname = "signet-contracts"\\nversion = "0.1.0"\\nedition = "2021"\\n\\n[workspace]\\nmembers = ["."]\\n\\n[dependencies]\\nsoroban-sdk = "21.0.0"\\nsoroban-auth = "21.0.0"\\n`,
'packages/smart-contracts/src/lib.rs': '#![no_std]\\nuse soroban_sdk::{contract, contractimpl, Env};\\n\\n#[contract]\\npub struct SignetContract;\\n\\n#[contractimpl]\\nimpl SignetContract {\\n pub fn check_auth(_env: Env) {}\\n}\\n',
// Testing
'packages/testing/package.json': JSON.stringify({
"name": "@signet-sdk/testing",
"version": "0.1.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup src/index.ts --format cjs,esm --dts"
},
"dependencies": {
"@signet-sdk/core": "workspace:*",
"@noble/curves": "^1.4.0",
"@stellar/stellar-sdk": "^12.0.0"
},
"devDependencies": {
"tsup": "^8.0.0",
"typescript": "^5.4.0",
"vitest": "^1.0.0"
}
}, null, 2),
'packages/testing/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'packages/testing/src/index.ts': 'export const testingVersion = "0.1.0";\\n',
// Demos
'examples/web-demo/package.json': JSON.stringify({
"name": "web-demo",
"private": true,
"version": "0.1.0",
"dependencies": {
"@signet-sdk/web": "workspace:*"
}
}, null, 2),
'examples/web-demo/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'examples/web-demo/src/index.ts': 'console.log("Web Demo");\\n',
'examples/react-native-demo/package.json': JSON.stringify({
"name": "react-native-demo",
"private": true,
"version": "0.1.0",
"dependencies": {
"@signet-sdk/react-native": "workspace:*"
}
}, null, 2),
'examples/react-native-demo/tsconfig.json': JSON.stringify({
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}, null, 2),
'examples/react-native-demo/src/index.ts': 'console.log("React Native Demo");\\n',
'examples/flutter-demo/pubspec.yaml': `name: flutter_demo\\ndescription: Flutter Demo for Signet SDK.\\nversion: 0.1.0\\nenvironment:\\n sdk: ">=3.0.0 <4.0.0"\\ndependencies:\\n flutter:\\n sdk: flutter\\n signet_flutter:\\n path: ../../packages/flutter\\n`,
'examples/flutter-demo/lib/main.dart': 'void main() { print("Flutter Demo"); }\\n',
// Docs
'docs/README.md': '# Signet SDK Documentation\\n',
};
for (const [filepath, content] of Object.entries(files)) {
fs.writeFileSync(path.join(root, filepath), content);
}
console.log('Project setup complete.');