stovesdk.js 0.0.0-stage → 0.3.1
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/LICENSE +21 -0
- package/README.md +205 -2
- package/binding.gyp +73 -0
- package/index.d.ts +241 -0
- package/index.js +117 -0
- package/lib/sdk-dir.js +58 -0
- package/package.json +48 -4
- package/prebuilds/win32-x64/SHA256SUMS +1 -0
- package/prebuilds/win32-x64/stovesdk.node +0 -0
- package/src/stovesdk.cc +904 -0
- package/tools/check-tarball.js +60 -0
- package/tools/sdk-dir.js +36 -0
- package/tools/smoke.js +102 -0
- package/tools/syntax-check.sh +34 -0
package/lib/sdk-dir.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// Resolves where the user-supplied STOVE PC SDK lives and what binding.gyp expects to find there.
|
|
4
|
+
//
|
|
5
|
+
// STOVE_PCSDK_DIR explicit location (highest priority)
|
|
6
|
+
// <repo>/sdk default (gitignored except its README)
|
|
7
|
+
//
|
|
8
|
+
// Expected layout (the shape the SDK zips unpack to — one folder per module):
|
|
9
|
+
// <sdk>/BaseSDK/Deploy/Include/BaseSDK.h
|
|
10
|
+
// <sdk>/BaseSDK/Deploy/Lib/x64/Release/BaseSDK.lib
|
|
11
|
+
// <sdk>/BaseSDK/Deploy/Bin/x64/Release/BaseSDK.dll
|
|
12
|
+
// ... and the same for OwnershipSDK and GameSupportSDK.
|
|
13
|
+
// <sdk>/VERSION optional, one line: the SDK version string baked into getAddonInfo().
|
|
14
|
+
|
|
15
|
+
const fs = require('fs')
|
|
16
|
+
const path = require('path')
|
|
17
|
+
|
|
18
|
+
const SDK_MODULES = ['BaseSDK', 'OwnershipSDK', 'GameSupportSDK']
|
|
19
|
+
|
|
20
|
+
function defaultSdkDir() {
|
|
21
|
+
return path.join(__dirname, '..', 'sdk')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function resolveSdkDir(env = process.env) {
|
|
25
|
+
const fromEnv = env.STOVE_PCSDK_DIR
|
|
26
|
+
return fromEnv && fromEnv.trim() ? path.resolve(fromEnv.trim()) : defaultSdkDir()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function headerPath(sdkDir, mod) {
|
|
30
|
+
return path.join(sdkDir, mod, 'Deploy', 'Include', `${mod}.h`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function libPath(sdkDir, mod) {
|
|
34
|
+
return path.join(sdkDir, mod, 'Deploy', 'Lib', 'x64', 'Release', `${mod}.lib`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function dllPath(sdkDir, mod) {
|
|
38
|
+
return path.join(sdkDir, mod, 'Deploy', 'Bin', 'x64', 'Release', `${mod}.dll`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Returns the list of required files that are missing (empty = layout is complete).
|
|
42
|
+
function missingSdkFiles(sdkDir, exists = fs.existsSync) {
|
|
43
|
+
const required = []
|
|
44
|
+
for (const mod of SDK_MODULES) required.push(headerPath(sdkDir, mod), libPath(sdkDir, mod), dllPath(sdkDir, mod))
|
|
45
|
+
return required.filter(file => !exists(file))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Version string for getAddonInfo().sdkVersion: <sdk>/VERSION if present, else 'unknown'.
|
|
49
|
+
function readSdkVersion(sdkDir, readFile = fs.readFileSync) {
|
|
50
|
+
try {
|
|
51
|
+
const text = String(readFile(path.join(sdkDir, 'VERSION'), 'utf8')).trim()
|
|
52
|
+
return text || 'unknown'
|
|
53
|
+
} catch {
|
|
54
|
+
return 'unknown'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = { SDK_MODULES, defaultSdkDir, resolveSdkDir, headerPath, libPath, dllPath, missingSdkFiles, readSdkVersion }
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stovesdk.js",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Unofficial Node.js / Electron bindings for the STOVE PC SDK (N-API)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "firejune",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/firejune/stovesdk.js.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"stove",
|
|
13
|
+
"pcsdk",
|
|
14
|
+
"electron",
|
|
15
|
+
"napi",
|
|
16
|
+
"gamedev",
|
|
17
|
+
"achievements"
|
|
18
|
+
],
|
|
19
|
+
"main": "index.js",
|
|
20
|
+
"types": "index.d.ts",
|
|
21
|
+
"gypfile": false,
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"index.js",
|
|
27
|
+
"index.d.ts",
|
|
28
|
+
"lib/",
|
|
29
|
+
"src/",
|
|
30
|
+
"tools/",
|
|
31
|
+
"binding.gyp",
|
|
32
|
+
"prebuilds/",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"check-sdk": "node tools/sdk-dir.js check",
|
|
38
|
+
"build": "node-gyp rebuild --release --arch=x64",
|
|
39
|
+
"clean": "node-gyp clean",
|
|
40
|
+
"smoke": "node tools/smoke.js",
|
|
41
|
+
"test": "node --test \"test/**/*.test.js\"",
|
|
42
|
+
"typecheck": "tsc --noEmit -p test/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.20.5",
|
|
46
|
+
"node-addon-api": "8.9.2",
|
|
47
|
+
"node-gyp": "13.0.2",
|
|
48
|
+
"typescript": "5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f9ac8af314ddee58b85b57836ac7703acae28184691ce5401757aff36b906210 *./stovesdk.node
|
|
Binary file
|