@kmamal/sdl 0.5.0 → 0.5.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.0",
2
+ "version": "0.5.2",
3
3
  "name": "@kmamal/sdl",
4
4
  "description": "SDL2 bindings for Node.js",
5
5
  "keywords": [
@@ -36,7 +36,11 @@
36
36
  "install-deps-mac": "./scripts/install-deps-mac.sh"
37
37
  },
38
38
  "dependencies": {
39
- "@kmamal/build-sdl": "~2.24.1-5",
40
39
  "tar": "^6.1.11"
40
+ },
41
+ "sdl": {
42
+ "owner": "kmamal",
43
+ "repo": "build-sdl",
44
+ "version": "2.24.1"
41
45
  }
42
46
  }
package/scripts/build.mjs CHANGED
@@ -11,13 +11,13 @@ await Promise.all([
11
11
  await Fs.promises.rm(dir, { recursive: true }).catch(() => {})
12
12
  }))
13
13
 
14
- console.log("load @kmamal/build-sdl")
14
+ console.log("download @kmamal/build-sdl to", C.dir.sdl)
15
15
  process.chdir(C.dir.root)
16
- const { default: sdlPath } = await import('@kmamal/build-sdl')
16
+ await import('./download-sdl.mjs')
17
17
 
18
18
  console.log("build in", C.dir.build)
19
- process.env.SDL_INC = Path.join(sdlPath, 'include')
20
- process.env.SDL_LIB = Path.join(sdlPath, 'lib')
19
+ process.env.SDL_INC = Path.join(C.dir.sdl, 'include')
20
+ process.env.SDL_LIB = Path.join(C.dir.sdl, 'lib')
21
21
 
22
22
  let archFlag = ''
23
23
  if (process.env.CROSS_COMPILE_ARCH) {
package/scripts/clean.mjs CHANGED
@@ -4,6 +4,7 @@ import C from './util/common.js'
4
4
 
5
5
  const dirs = [
6
6
  Path.join(C.dir.root, 'node_modules'),
7
+ C.dir.sdl,
7
8
  C.dir.build,
8
9
  C.dir.dist,
9
10
  C.dir.publish,
@@ -0,0 +1,17 @@
1
+ import Fs from 'node:fs'
2
+ import { once } from 'node:events'
3
+ import C from './util/common.js'
4
+ import { fetch } from './util/fetch.js'
5
+ import Tar from 'tar'
6
+
7
+ const url = `https://github.com/${C.sdl.owner}/${C.sdl.repo}/releases/download/v${C.sdl.version}/${C.sdl.assetName}`
8
+
9
+ console.log("fetch", url)
10
+ const response = await fetch(url)
11
+
12
+ console.log("unpack to", C.dir.sdl)
13
+ await Fs.promises.rm(C.dir.sdl, { recursive: true }).catch(() => {})
14
+ await Fs.promises.mkdir(C.dir.sdl, { recursive: true })
15
+ const tar = Tar.extract({ gzip: true, C: C.dir.sdl })
16
+ response.stream().pipe(tar)
17
+ await once(tar, 'finish')
@@ -3,6 +3,7 @@ const Path = require('node:path')
3
3
 
4
4
  const dir = {}
5
5
  dir.root = Path.resolve(__dirname, '../..')
6
+ dir.sdl = Path.join(dir.root, 'sdl')
6
7
  dir.build = Path.join(dir.root, 'build')
7
8
  dir.dist = Path.join(dir.root, 'dist')
8
9
  dir.publish = Path.join(dir.root, 'publish')
@@ -16,6 +17,9 @@ const { platform, arch } = process
16
17
  const targetArch = process.env.CROSS_COMPILE_ARCH || arch
17
18
  const assetName = `sdl.node-v${version}-${platform}-${targetArch}.tar.gz`
18
19
 
20
+ const sdl = pkg.sdl
21
+ sdl.assetName = `SDL-v${sdl.version}-${platform}-${targetArch}.tar.gz`
22
+
19
23
  module.exports = {
20
24
  dir,
21
25
  version,
@@ -25,4 +29,5 @@ module.exports = {
25
29
  arch,
26
30
  targetArch,
27
31
  assetName,
32
+ sdl,
28
33
  }