bare-build 0.1.0 → 0.2.0

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/CMakeLists.txt CHANGED
@@ -5,9 +5,7 @@ find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
5
5
 
6
6
  project(bare_build C)
7
7
 
8
- set(bare_version "1.24.3")
9
-
10
- fetch_package("github:holepunchto/bare@${bare_version}")
8
+ fetch_package("github:holepunchto/bare@1.24.3")
11
9
  fetch_package("github:holepunchto/libpath")
12
10
 
13
11
  add_executable(bare_build)
@@ -49,6 +47,10 @@ target_link_libraries(
49
47
  )
50
48
 
51
49
  if(WIN32)
50
+ file(READ "package.json" pkg)
51
+
52
+ string(JSON version GET "${pkg}" version)
53
+
52
54
  file(READ "lib/runtime.manifest" manifest)
53
55
 
54
56
  string(CONFIGURE "${manifest}" manifest)
@@ -70,4 +72,4 @@ endif()
70
72
 
71
73
  bare_target(target)
72
74
 
73
- install(TARGETS bare_build DESTINATION ${target})
75
+ install(TARGETS bare_build RUNTIME DESTINATION ${target})
package/README.md CHANGED
@@ -11,11 +11,13 @@ npm i [-g] bare-build
11
11
  ```js
12
12
  const build = require('bare-build')
13
13
 
14
- await build('/path/to/app.js', {
15
- target: ['darwin-arm64', 'darwinx64'],
14
+ for await (const resource of build('/path/to/app.js', {
15
+ target: ['darwin-arm64', 'darwin-x64'],
16
16
  icon: 'icon.icns',
17
17
  identifier: 'com.example.App'
18
- })
18
+ })) {
19
+ console.log(resource)
20
+ }
19
21
  ```
20
22
 
21
23
  ```console
@@ -28,7 +30,7 @@ bare-build \
28
30
 
29
31
  ## API
30
32
 
31
- #### `await build(entry[, options])`
33
+ #### `for await (const resource of build(entry[, options]))`
32
34
 
33
35
  Options include:
34
36
 
package/bin.js CHANGED
@@ -56,7 +56,7 @@ const cmd = command(
56
56
  if (version) return console.log(`v${pkg.version}`)
57
57
 
58
58
  try {
59
- await build(entry, {
59
+ for await (const _ of build(entry, {
60
60
  name,
61
61
  author,
62
62
  description,
@@ -76,7 +76,8 @@ const cmd = command(
76
76
  subjectName,
77
77
  thumbprint,
78
78
  key
79
- })
79
+ })) {
80
+ }
80
81
  } catch (err) {
81
82
  if (err) console.error(err)
82
83
  process.exitCode = 1
package/index.js CHANGED
@@ -5,11 +5,7 @@ const id = require('bare-bundle-id')
5
5
  const pack = require('bare-pack')
6
6
  const fs = require('bare-pack/fs')
7
7
 
8
- const apple = require('./lib/platform/apple')
9
- const linux = require('./lib/platform/linux')
10
- const windows = require('./lib/platform/windows')
11
-
12
- module.exports = async function build(entry, opts = {}) {
8
+ module.exports = async function* build(entry, opts = {}) {
13
9
  const { base = '.', target = [], hosts = target } = opts
14
10
 
15
11
  let pkg
@@ -45,15 +41,15 @@ module.exports = async function build(entry, opts = {}) {
45
41
  case 'ios-arm64':
46
42
  case 'ios-arm64-simulator':
47
43
  case 'ios-x64-simulator':
48
- platform = apple
44
+ platform = require('./lib/platform/apple')
49
45
  break
50
46
  case 'linux-arm64':
51
47
  case 'linux-x64':
52
- platform = linux
48
+ platform = require('./lib/platform/linux')
53
49
  break
54
50
  case 'win32-arm64':
55
51
  case 'win32-x64':
56
- platform = windows
52
+ platform = require('./lib/platform/windows')
57
53
  break
58
54
  default:
59
55
  throw new Error(`Unknown host '${host}'`)
@@ -70,6 +66,6 @@ module.exports = async function build(entry, opts = {}) {
70
66
  }
71
67
 
72
68
  for (const [platform, hosts] of groups) {
73
- await platform(base, pkg, bundle, { ...opts, hosts })
69
+ yield* platform(base, pkg, bundle, { ...opts, hosts })
74
70
  }
75
71
  }
package/lib/fs.js CHANGED
@@ -29,6 +29,14 @@ exports.cp = async function cp(src, dest) {
29
29
  }
30
30
  }
31
31
 
32
+ exports.chmod = async function chmod(name, mode) {
33
+ return new Promise((resolve, reject) => {
34
+ fs.chmod(name, mode, (err) => {
35
+ err ? reject(err) : resolve()
36
+ })
37
+ })
38
+ }
39
+
32
40
  exports.copyFile = async function copyFile(src, dest) {
33
41
  return new Promise((resolve, reject) => {
34
42
  fs.copyFile(src, dest, (err) => {
@@ -45,6 +53,14 @@ exports.writeFile = async function writeFile(name, data) {
45
53
  })
46
54
  }
47
55
 
56
+ exports.readFile = async function readFile(name) {
57
+ return new Promise((resolve) => {
58
+ fs.readFile(name, (err, data) => {
59
+ resolve(err ? null : data)
60
+ })
61
+ })
62
+ }
63
+
48
64
  exports.symlink = async function symlink(target, path) {
49
65
  await exports.rm(path)
50
66
 
@@ -1,15 +1,21 @@
1
1
  const path = require('path')
2
2
  const link = require('bare-link')
3
3
  const unpack = require('bare-unpack')
4
+ const { MachO } = require('bare-lief')
4
5
  const fs = require('../../fs')
5
- const run = require('../../run')
6
6
  const prebuilds = require('../../prebuilds')
7
7
  const sign = require('./sign')
8
8
  const toIdentifier = require('./to-identifier')
9
9
 
10
10
  // https://developer.apple.com/documentation/bundleresources/placing-content-in-a-bundle
11
- module.exports = async function createApp(base, pkg, bundle, hosts, out, opts = {}) {
12
- const { name = pkg.name, version = pkg.version, icon } = opts
11
+ module.exports = async function* createApp(base, pkg, bundle, hosts, out, opts = {}) {
12
+ const {
13
+ name = pkg.name,
14
+ version = pkg.version,
15
+ icon,
16
+ identity,
17
+ applicationIdentity = identity
18
+ } = opts
13
19
 
14
20
  const isMac = hosts.some((host) => host.startsWith('darwin'))
15
21
 
@@ -22,11 +28,9 @@ module.exports = async function createApp(base, pkg, bundle, hosts, out, opts =
22
28
  const resources = isMac ? path.join(main, 'Resources') : main
23
29
  await fs.makeDir(resources)
24
30
 
25
- const frameworks = path.join(main, 'Frameworks')
31
+ const assets = path.join(resources, 'app')
26
32
 
27
- for await (const resource of link(base, { hosts, out: frameworks })) {
28
- await sign(resource, opts)
29
- }
33
+ const frameworks = path.join(main, 'Frameworks')
30
34
 
31
35
  const executable = isMac ? path.join(main, 'MacOS', name) : path.join(main, name)
32
36
 
@@ -34,17 +38,30 @@ module.exports = async function createApp(base, pkg, bundle, hosts, out, opts =
34
38
  await fs.makeDir(path.join(main, 'MacOS'))
35
39
  }
36
40
 
37
- const assets = path.join(resources, 'app')
41
+ yield* link(base, { ...opts, hosts, identity: applicationIdentity, out: frameworks })
38
42
 
39
43
  const inputs = hosts.map((host) => prebuilds[host]())
40
44
 
41
- await run('lipo', ['-create', '-output', executable, ...inputs])
45
+ const binaries = []
42
46
 
47
+ for (const input of inputs) binaries.push(new MachO.FatBinary(await fs.readFile(input)))
48
+
49
+ const fat = MachO.FatBinary.merge(binaries)
50
+
51
+ fat.toDisk(executable)
52
+ await fs.chmod(executable, 0o755)
43
53
  await sign(executable, opts)
54
+ yield executable
55
+
56
+ const info = path.join(main, 'Info.plist')
57
+ await fs.writeFile(info, createPropertyList(isMac, name, version, opts))
58
+ yield info
44
59
 
45
- await fs.writeFile(path.join(main, 'Info.plist'), createPropertyList(isMac, name, version, opts))
60
+ const pkgInfo = path.join(main, 'PkgInfo')
61
+ await fs.writeFile(pkgInfo, 'APPL????')
62
+ yield pkgInfo
46
63
 
47
- await fs.writeFile(path.join(main, 'PkgInfo'), 'APPL????')
64
+ const unpacked = []
48
65
 
49
66
  bundle = await unpack(bundle, { files: false, assets: true }, async (key) => {
50
67
  const target = path.join(assets, key)
@@ -54,16 +71,25 @@ module.exports = async function createApp(base, pkg, bundle, hosts, out, opts =
54
71
 
55
72
  await sign(target, opts)
56
73
 
74
+ unpacked.push(target)
75
+
57
76
  return '/../app' + key
58
77
  })
59
78
 
60
- await fs.writeFile(path.join(resources, 'app.bundle'), bundle.toBuffer())
79
+ yield* unpacked
61
80
 
62
- await sign(path.join(resources, 'app.bundle'), opts)
81
+ const appBundle = path.join(resources, 'app.bundle')
82
+ await fs.writeFile(appBundle, bundle.toBuffer())
83
+ await sign(appBundle, opts)
84
+ yield appBundle
63
85
 
64
- await fs.cp(path.resolve(icon), path.join(resources, 'app' + path.extname(icon)))
86
+ const appIcon = path.join(resources, 'app' + path.extname(icon))
87
+ await fs.cp(path.resolve(icon), appIcon)
88
+ await sign(appIcon, opts)
89
+ yield appIcon
65
90
 
66
- await sign(path.join(resources, 'app' + path.extname(icon)), opts)
91
+ await sign(app, opts)
92
+ yield app
67
93
 
68
94
  return app
69
95
  }
@@ -78,6 +104,8 @@ function createPropertyList(isMac, name, version, opts = {}) {
78
104
  <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
79
105
  <plist version="1.0">
80
106
  <dict>
107
+ <key>CFBundleDisplayName</key>
108
+ <string>${name}</string>
81
109
  <key>CFBundleIdentifier</key>
82
110
  <string>${identifier}</string>
83
111
  <key>CFBundleVersion</key>
@@ -1,8 +1,9 @@
1
1
  const path = require('path')
2
+ const fs = require('../../fs')
2
3
  const run = require('../../run')
3
4
  const toIdentifier = require('./to-identifier')
4
5
 
5
- module.exports = async function createPackageComponent(pkg, root, id, opts = {}) {
6
+ module.exports = async function* createPackageComponent(pkg, root, id, opts = {}) {
6
7
  if (typeof id === 'object' && id !== null) {
7
8
  opts = id
8
9
  id = null
@@ -50,8 +51,7 @@ module.exports = async function createPackageComponent(pkg, root, id, opts = {})
50
51
 
51
52
  await run('pkgbuild', args, { cwd })
52
53
 
53
- return {
54
- identifier,
55
- name
56
- }
54
+ yield component
55
+
56
+ return component
57
57
  }
@@ -2,7 +2,7 @@ const path = require('path')
2
2
  const fs = require('../../fs')
3
3
  const run = require('../../run')
4
4
 
5
- module.exports = async function createPackage(pkg, root, components, out, opts = {}) {
5
+ module.exports = async function* createPackage(pkg, root, components, out, opts = {}) {
6
6
  const {
7
7
  name = pkg.name,
8
8
  version = pkg.version,
@@ -12,6 +12,8 @@ module.exports = async function createPackage(pkg, root, components, out, opts =
12
12
  keychain
13
13
  } = opts
14
14
 
15
+ await fs.makeDir(out)
16
+
15
17
  const cwd = path.resolve(root, '..')
16
18
 
17
19
  const distribution = path.join(cwd, 'distribution.xml')
@@ -32,6 +34,8 @@ module.exports = async function createPackage(pkg, root, components, out, opts =
32
34
 
33
35
  await run('productbuild', args, { cwd })
34
36
 
37
+ yield package
38
+
35
39
  return package
36
40
  }
37
41
 
@@ -42,8 +46,8 @@ function createDistribution(name, version, components) {
42
46
  <installer-gui-script minSpecVersion="1">
43
47
  <title>${name}</title>
44
48
  ${components.map(
45
- ({ identifier, name }) => `\
46
- <pkg-ref id="${identifier}">${name}</pkg-ref>
49
+ (component, i) => `\
50
+ <pkg-ref id="${i}">${component}</pkg-ref>
47
51
  `
48
52
  )}
49
53
  <choices-outline>
@@ -51,8 +55,8 @@ ${components.map(
51
55
  </choices-outline>
52
56
  <choice id="app" title="${name}">
53
57
  ${components.map(
54
- ({ identifier }) => `\
55
- <pkg-ref id="${identifier}"/>
58
+ (_, i) => `\
59
+ <pkg-ref id="${i}"/>
56
60
  `
57
61
  )}
58
62
  </choice>
@@ -21,5 +21,7 @@ module.exports = async function sign(resource, opts = {}) {
21
21
  args.push(resource)
22
22
 
23
23
  await run('codesign', args)
24
+ } else {
25
+ await run('codesign', ['--timestamp=none', '--force', '--sign', '-', resource])
24
26
  }
25
27
  }
@@ -4,7 +4,7 @@ const createApp = require('./apple/create-app')
4
4
  const createPackage = require('./apple/create-package')
5
5
  const createPackageComponent = require('./apple/create-package-component')
6
6
 
7
- module.exports = async function build(base, pkg, bundle, opts = {}) {
7
+ module.exports = async function* apple(base, pkg, bundle, opts = {}) {
8
8
  const { hosts = [], package = false, out = '.' } = opts
9
9
 
10
10
  const archs = new Map([
@@ -53,9 +53,9 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
53
53
 
54
54
  root = path.join(out, 'root')
55
55
 
56
- await createApp(base, pkg, bundle, hosts, path.join(root, 'Applications'), opts)
56
+ yield* createApp(base, pkg, bundle, hosts, path.join(root, 'Applications'), opts)
57
57
  } else {
58
- const app = await createApp(
58
+ const app = yield* createApp(
59
59
  base,
60
60
  pkg,
61
61
  bundle,
@@ -69,10 +69,10 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
69
69
  continue
70
70
  }
71
71
 
72
- const components = [await createPackageComponent(pkg, root, opts)]
72
+ const components = [yield* createPackageComponent(pkg, root, opts)]
73
73
 
74
74
  result.push(
75
- await createPackage(
75
+ yield* createPackage(
76
76
  pkg,
77
77
  root,
78
78
  components,
@@ -5,7 +5,7 @@ const fs = require('../../fs')
5
5
  const prebuilds = require('../../prebuilds')
6
6
 
7
7
  // https://docs.appimage.org/packaging-guide/manual.html#creating-an-appdir-manually
8
- module.exports = async function createAppDir(base, pkg, bundle, host, out, opts = {}) {
8
+ module.exports = async function* createAppDir(base, pkg, bundle, host, out, opts = {}) {
9
9
  const { name = pkg.name, icon } = opts
10
10
 
11
11
  const app = path.resolve(out, name + '.AppDir')
@@ -15,55 +15,68 @@ module.exports = async function createAppDir(base, pkg, bundle, host, out, opts
15
15
  const bin = path.join(usr, 'bin')
16
16
  await fs.makeDir(bin)
17
17
 
18
- const executable = path.join(bin, toIdentifier(name))
19
-
20
- await fs.copyFile(prebuilds[host](), executable)
21
-
22
- await fs.symlink(path.join('usr', 'bin', toIdentifier(name)), path.join(app, 'AppRun'))
23
-
24
18
  const share = path.join(usr, 'share')
25
19
 
26
20
  const applications = path.join(share, 'applications')
27
21
  await fs.makeDir(applications)
28
22
 
23
+ const icons = path.join(share, 'icons')
24
+ await fs.makeDir(icons)
25
+
29
26
  const data = path.join(share, toIdentifier(name))
30
27
  await fs.makeDir(data)
31
28
 
32
29
  const assets = path.join(data, 'app')
33
30
 
34
- for await (const _ of link(base, { hosts: [host], out: usr })) {
35
- continue
36
- }
37
-
38
- await fs.writeFile(path.join(applications, name + '.desktop'), createDesktopEntry(name))
31
+ await fs.symlink(path.join('usr', 'bin', toIdentifier(name)), path.join(app, 'AppRun'))
39
32
 
40
33
  await fs.symlink(
41
34
  path.join('usr', 'share', 'applications', name + '.desktop'),
42
35
  path.join(app, name + '.desktop')
43
36
  )
44
37
 
38
+ await fs.symlink(
39
+ path.join('usr', 'share', 'icons', name + path.extname(icon)),
40
+ path.join(app, name + path.extname(icon))
41
+ )
42
+
43
+ await fs.symlink(name + path.extname(icon), path.join(app, '.DirIcon'))
44
+
45
+ yield* link(base, { ...opts, hosts: [host], out: usr })
46
+
47
+ const executable = path.join(bin, toIdentifier(name))
48
+ await fs.copyFile(prebuilds[host](), executable)
49
+ await fs.chmod(executable, 0o755)
50
+ yield executable
51
+
52
+ const desktopEntry = path.join(applications, name + '.desktop')
53
+ await fs.writeFile(desktopEntry, createDesktopEntry(name))
54
+ yield desktopEntry
55
+
56
+ const unpacked = []
57
+
45
58
  bundle = await unpack(bundle, { files: false, assets: true }, async (key) => {
46
59
  const target = path.join(assets, key)
47
60
 
48
61
  await fs.makeDir(path.dirname(target))
49
62
  await fs.writeFile(target, bundle.read(key))
50
63
 
64
+ unpacked.push(target)
65
+
51
66
  return '/../app' + key
52
67
  })
53
68
 
54
- await fs.writeFile(path.join(data, 'app.bundle'), bundle.toBuffer())
69
+ yield* unpacked
55
70
 
56
- const icons = path.join(share, 'icons')
57
- await fs.makeDir(icons)
71
+ const appBundle = path.join(data, 'app.bundle')
72
+ await fs.writeFile(appBundle, bundle.toBuffer())
73
+ yield appBundle
58
74
 
59
- await fs.cp(path.resolve(icon), path.join(icons, name + path.extname(icon)))
60
-
61
- await fs.symlink(
62
- path.join('usr', 'share', 'icons', name + path.extname(icon)),
63
- path.join(app, name + path.extname(icon))
64
- )
75
+ const appIcon = path.join(icons, name + path.extname(icon))
76
+ await fs.cp(path.resolve(icon), appIcon)
77
+ yield appIcon
65
78
 
66
- await fs.symlink(name + path.extname(icon), path.join(app, '.DirIcon'))
79
+ yield app
67
80
 
68
81
  return app
69
82
  }
@@ -1,20 +1,16 @@
1
1
  const path = require('path')
2
- const run = require('../../run')
3
- const appimagetool = require('../../appimagetool')
4
2
 
5
3
  // https://docs.appimage.org/packaging-guide/manual.html#creating-an-appimage-from-the-appdir
6
- module.exports = async function createAppImage(pkg, appDir, out, opts = {}) {
4
+ module.exports = async function* createAppImage(pkg, appDir, out, opts = {}) {
5
+ const createAppImage = require('bare-app-image') // Optional
6
+
7
7
  const { name = pkg.name, sign = false, key } = opts
8
8
 
9
9
  const appImage = path.resolve(out, name + '.AppImage')
10
10
 
11
- const args = [appDir]
12
-
13
- if (sign) args.push('--sign', '--sign-key', key)
14
-
15
- args.push(appImage)
11
+ await createAppImage(appDir, appImage, { sign, key, compression: 'zstd' })
16
12
 
17
- await run(appimagetool, args)
13
+ yield appImage
18
14
 
19
15
  return appImage
20
16
  }
@@ -3,7 +3,7 @@ const fs = require('../fs')
3
3
  const createAppDir = require('./linux/create-app-dir')
4
4
  const createAppImage = require('./linux/create-app-image')
5
5
 
6
- module.exports = async function build(base, pkg, bundle, opts = {}) {
6
+ module.exports = exports = async function* linux(base, pkg, bundle, opts = {}) {
7
7
  const { hosts = [], package = false, out = '.' } = opts
8
8
 
9
9
  const archs = new Map()
@@ -37,9 +37,9 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
37
37
 
38
38
  temp.push(out)
39
39
 
40
- appDir = await createAppDir(base, pkg, bundle, host, out, opts)
40
+ appDir = yield* createAppDir(base, pkg, bundle, host, out, opts)
41
41
  } else {
42
- appDir = await createAppDir(
42
+ appDir = yield* createAppDir(
43
43
  base,
44
44
  pkg,
45
45
  bundle,
@@ -54,7 +54,7 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
54
54
  }
55
55
 
56
56
  result.push(
57
- await createAppImage(
57
+ yield* createAppImage(
58
58
  pkg,
59
59
  appDir,
60
60
  archs.size === 1 ? path.resolve(out) : path.resolve(out, arch),
@@ -68,3 +68,5 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
68
68
  for (const dir of temp) await fs.rm(dir)
69
69
  }
70
70
  }
71
+
72
+ exports.sign = async function sign() {}
@@ -5,7 +5,7 @@ const fs = require('../../fs')
5
5
  const prebuilds = require('../../prebuilds')
6
6
  const sign = require('./sign')
7
7
 
8
- module.exports = async function createMSIXContentDirectory(
8
+ module.exports = async function* createMSIXContentDirectory(
9
9
  base,
10
10
  pkg,
11
11
  bundle,
@@ -20,20 +20,22 @@ module.exports = async function createMSIXContentDirectory(
20
20
  const bin = path.join(app, 'App')
21
21
  await fs.makeDir(bin)
22
22
 
23
- const executable = path.join(bin, name + '.exe')
24
-
25
- await fs.copyFile(prebuilds[host](), executable)
26
-
27
- await sign(executable, opts)
28
-
29
23
  const resources = path.join(app, 'Resources')
30
24
  await fs.makeDir(resources)
31
25
 
26
+ const icons = path.join(app, 'Assets')
27
+ await fs.makeDir(icons)
28
+
32
29
  const assets = path.join(resources, 'app')
33
30
 
34
- for await (const resource of link(base, { hosts: [host], out: bin })) {
35
- await sign(resource, opts)
36
- }
31
+ yield* link(base, { ...opts, hosts: [host], out: bin })
32
+
33
+ const executable = path.join(bin, name + '.exe')
34
+ await fs.copyFile(prebuilds[host](), executable)
35
+ await sign(executable, opts)
36
+ yield executable
37
+
38
+ const unpacked = []
37
39
 
38
40
  bundle = await unpack(bundle, { files: false, assets: true }, async (key) => {
39
41
  const target = path.join(assets, key)
@@ -41,17 +43,24 @@ module.exports = async function createMSIXContentDirectory(
41
43
  await fs.makeDir(path.dirname(target))
42
44
  await fs.writeFile(target, bundle.read(key))
43
45
 
46
+ unpacked.push(target)
47
+
44
48
  return '/../app' + key
45
49
  })
46
50
 
47
- await fs.writeFile(path.join(resources, 'app.bundle'), bundle.toBuffer())
51
+ const appBundle = path.join(resources, 'app.bundle')
52
+ await fs.writeFile(appBundle, bundle.toBuffer())
53
+ yield appBundle
48
54
 
49
- await fs.writeFile(path.join(app, 'AppxManifest.xml'), createAppxManifest(pkg, host, opts))
55
+ const appManifest = path.join(app, 'AppxManifest.xml')
56
+ await fs.writeFile(appManifest, createAppxManifest(pkg, host, opts))
57
+ yield appManifest
50
58
 
51
- const icons = path.join(app, 'Assets')
52
- await fs.makeDir(icons)
59
+ const appIcon = path.join(icons, name + path.extname(icon))
60
+ await fs.cp(path.resolve(icon), appIcon)
61
+ yield appIcon
53
62
 
54
- await fs.cp(path.resolve(icon), path.join(icons, name + path.extname(icon)))
63
+ yield app
55
64
 
56
65
  return app
57
66
  }
@@ -1,17 +1,18 @@
1
1
  const path = require('path')
2
2
  const fs = require('../../fs')
3
+ const run = require('../../run')
3
4
  const sign = require('./sign')
4
5
 
5
- module.exports = async function createMSIX(pkg, contentDirectory, out, opts = {}) {
6
+ module.exports = async function* createMSIX(pkg, contentDirectory, out, opts = {}) {
6
7
  const { name = pkg.name } = opts
7
8
 
8
9
  const msix = path.resolve(out, name + '.msix')
9
-
10
10
  await fs.rm(msix)
11
11
 
12
12
  await run('makeappx', ['pack', '/d', contentDirectory, '/p', msix])
13
13
 
14
14
  await sign(msix, opts)
15
+ yield msix
15
16
 
16
17
  return msix
17
18
  }
@@ -3,7 +3,7 @@ const fs = require('../fs')
3
3
  const createMSIX = require('./windows/create-msix')
4
4
  const createMSIXContentDirectory = require('./windows/create-msix-content-directory')
5
5
 
6
- module.exports = async function build(base, pkg, bundle, opts = {}) {
6
+ module.exports = async function* windows(base, pkg, bundle, opts = {}) {
7
7
  const { hosts = [], package = false, out = '.' } = opts
8
8
 
9
9
  const archs = new Map()
@@ -37,9 +37,9 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
37
37
 
38
38
  temp.push(out)
39
39
 
40
- contentDirectory = await createMSIXContentDirectory(base, pkg, bundle, host, out, opts)
40
+ contentDirectory = yield* createMSIXContentDirectory(base, pkg, bundle, host, out, opts)
41
41
  } else {
42
- contentDirectory = await createMSIXContentDirectory(
42
+ contentDirectory = yield* createMSIXContentDirectory(
43
43
  base,
44
44
  pkg,
45
45
  bundle,
@@ -54,7 +54,7 @@ module.exports = async function build(base, pkg, bundle, opts = {}) {
54
54
  }
55
55
 
56
56
  result.push(
57
- await createMSIX(
57
+ yield* createMSIX(
58
58
  pkg,
59
59
  contentDirectory,
60
60
  archs.size === 1 ? path.resolve(out) : path.resolve(out, arch)
package/lib/prebuilds.js CHANGED
@@ -1,49 +1,37 @@
1
- const fs = require('fs')
2
-
3
1
  require.asset = require('require-asset')
4
2
 
5
3
  exports['darwin-x64'] = () => {
6
- return executable(require.asset('../prebuilds/darwin-x64/bare', __filename))
4
+ return require.asset('../prebuilds/darwin-x64/bare', __filename)
7
5
  }
8
6
 
9
7
  exports['darwin-arm64'] = () => {
10
- return executable(require.asset('../prebuilds/darwin-arm64/bare', __filename))
8
+ return require.asset('../prebuilds/darwin-arm64/bare', __filename)
11
9
  }
12
10
 
13
11
  exports['ios-arm64'] = () => {
14
- return executable(require.asset('../prebuilds/ios-arm64/bare', __filename))
12
+ return require.asset('../prebuilds/ios-arm64/bare', __filename)
15
13
  }
16
14
 
17
15
  exports['ios-arm64-simulator'] = () => {
18
- return executable(require.asset('../prebuilds/ios-arm64-simulator/bare', __filename))
16
+ return require.asset('../prebuilds/ios-arm64-simulator/bare', __filename)
19
17
  }
20
18
 
21
19
  exports['ios-x64-simulator'] = () => {
22
- return executable(require.asset('../prebuilds/ios-x64-simulator/bare', __filename))
20
+ return require.asset('../prebuilds/ios-x64-simulator/bare', __filename)
23
21
  }
24
22
 
25
23
  exports['linux-x64'] = () => {
26
- return executable(require.asset('../prebuilds/linux-x64/bare', __filename))
24
+ return require.asset('../prebuilds/linux-x64/bare', __filename)
27
25
  }
28
26
 
29
27
  exports['linux-arm64'] = () => {
30
- return executable(require.asset('../prebuilds/linux-arm64/bare', __filename))
28
+ return require.asset('../prebuilds/linux-arm64/bare', __filename)
31
29
  }
32
30
 
33
31
  exports['win32-x64'] = () => {
34
- return executable(require.asset('../prebuilds/win32-x64/bare.exe', __filename))
32
+ return require.asset('../prebuilds/win32-x64/bare.exe', __filename)
35
33
  }
36
34
 
37
35
  exports['win32-arm64'] = () => {
38
- return executable(require.asset('../prebuilds/win32-arm64/bare.exe', __filename))
39
- }
40
-
41
- function executable(file) {
42
- try {
43
- fs.accessSync(file, fs.constants.X_OK)
44
- } catch {
45
- fs.chmodSync(file, 0o755)
46
- }
47
-
48
- return file
36
+ return require.asset('../prebuilds/win32-arm64/bare.exe', __filename)
49
37
  }
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3
- <assemblyIdentity type="win32" name="to.holepunch.bare" version="${bare_version}.0" />
3
+ <assemblyIdentity type="win32" name="to.holepunch.bare" version="${version}.0" />
4
4
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
5
5
  <windowsSettings>
6
6
  <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
package/package.json CHANGED
@@ -1,18 +1,12 @@
1
1
  {
2
2
  "name": "bare-build",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Application builder for Bare",
5
5
  "exports": {
6
6
  "./package": "./package.json",
7
7
  ".": "./index.js"
8
8
  },
9
9
  "imports": {
10
- "#appimagetool": {
11
- "linux": {
12
- "arm64": "./prebuilds/linux-arm64/appimagetool.AppImage",
13
- "x64": "./prebuilds/linux-x64/appimagetool.AppImage"
14
- }
15
- },
16
10
  "child_process": {
17
11
  "bare": "bare-subprocess",
18
12
  "default": "child_process"
@@ -60,7 +54,8 @@
60
54
  "dependencies": {
61
55
  "bare-bundle-id": "^1.0.2",
62
56
  "bare-fs": "^4.5.1",
63
- "bare-link": "^2.0.0",
57
+ "bare-lief": "^0.0.2",
58
+ "bare-link": "^2.1.0",
64
59
  "bare-module-traverse": "^1.8.1",
65
60
  "bare-os": "^3.6.2",
66
61
  "bare-pack": "^1.5.1",
@@ -71,6 +66,9 @@
71
66
  "paparam": "^1.8.0",
72
67
  "require-asset": "^1.1.0"
73
68
  },
69
+ "optionalDependencies": {
70
+ "bare-app-image": "^0.0.0"
71
+ },
74
72
  "devDependencies": {
75
73
  "brittle": "^3.18.0",
76
74
  "cmake-bare": "^1.6.5",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- const fs = require('fs')
2
-
3
- require.asset = require('require-asset')
4
-
5
- try {
6
- const appimagetool = require.asset('#appimagetool', __filename)
7
-
8
- try {
9
- fs.accessSync(appimagetool, fs.constants.X_OK)
10
- } catch {
11
- fs.chmodSync(appimagetool, 0o755)
12
- }
13
-
14
- module.exports = appimagetool
15
- } catch {
16
- module.exports = null
17
- }
Binary file
Binary file