pear-build 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.
Files changed (2) hide show
  1. package/index.js +11 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,7 +28,10 @@ module.exports = async function build(dir, opts = {}) {
28
28
 
29
29
  await fs.promises.mkdir(byArch, { recursive: true })
30
30
 
31
- fs.writeFileSync(path.join(target, 'package.json'), fs.readFileSync(pkgPath))
31
+ await fs.promises.writeFile(
32
+ path.join(target, 'package.json'),
33
+ await fs.promises.readFile(pkgPath)
34
+ )
32
35
 
33
36
  const apps = [
34
37
  darwinArm64App,
@@ -45,24 +48,20 @@ module.exports = async function build(dir, opts = {}) {
45
48
  const noop = () => {}
46
49
  const promises = []
47
50
  for (const [arch, app] of apps) {
48
- const isMobile = arch.startsWith('ios') || arch.startsWith('android')
49
- const appName = isMobile ? (pkg.productName ?? pkg.name) : path.basename(app)
50
- if (typeof appName !== 'string') {
51
- throw new Error('package.json productName or name is a required field string')
52
- }
53
- const archApp = path.join(byArch, arch, 'app', appName)
51
+ const appName = path.basename(app)
52
+ const archApp = path.join(byArch, arch, 'app')
54
53
  await fs.promises.mkdir(archApp, { recursive: true })
55
- const src = new Localdrive(app)
54
+
55
+ const src = new Localdrive(path.dirname(app))
56
56
  const dst = new Localdrive(archApp)
57
+ const mirror = src.mirror(dst, { prefix: '/' + appName })
58
+
57
59
  await src.ready()
58
60
  await dst.ready()
59
- const mirror = src.mirror(dst)
60
61
  console.log(app, 'mirroring to', archApp)
61
62
  const promise = mirror.done()
62
63
  promises.push(promise)
63
- promise.then(() => {
64
- console.log(app, 'mirrored to', archApp)
65
- }, noop)
64
+ promise.then(() => console.log(app, 'mirrored to', archApp), noop)
66
65
  await src.close()
67
66
  await dst.close()
68
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-build",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "main": "index.js",
5
5
  "type": "commonjs",
6
6
  "bin": "bin.js",