pear-build 0.1.1 → 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.
- package/index.js +5 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -48,36 +48,20 @@ module.exports = async function build(dir, opts = {}) {
|
|
|
48
48
|
const noop = () => {}
|
|
49
49
|
const promises = []
|
|
50
50
|
for (const [arch, app] of apps) {
|
|
51
|
-
const
|
|
52
|
-
const appName = isMobile ? (pkg.productName ?? pkg.name) : path.basename(app)
|
|
53
|
-
if (typeof appName !== 'string') {
|
|
54
|
-
throw new Error('package.json productName or name is a required field string')
|
|
55
|
-
}
|
|
51
|
+
const appName = path.basename(app)
|
|
56
52
|
const archApp = path.join(byArch, arch, 'app')
|
|
57
53
|
await fs.promises.mkdir(archApp, { recursive: true })
|
|
58
54
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const appDir = path.join(archApp, appName)
|
|
63
|
-
await fs.promises.mkdir(appDir, { recursive: true })
|
|
64
|
-
src = new Localdrive(app)
|
|
65
|
-
dst = new Localdrive(appDir)
|
|
66
|
-
mirror = src.mirror(dst)
|
|
67
|
-
} else {
|
|
68
|
-
src = new Localdrive(path.dirname(app))
|
|
69
|
-
dst = new Localdrive(archApp)
|
|
70
|
-
mirror = src.mirror(dst, { prefix: '/' + path.basename(app) })
|
|
71
|
-
}
|
|
55
|
+
const src = new Localdrive(path.dirname(app))
|
|
56
|
+
const dst = new Localdrive(archApp)
|
|
57
|
+
const mirror = src.mirror(dst, { prefix: '/' + appName })
|
|
72
58
|
|
|
73
59
|
await src.ready()
|
|
74
60
|
await dst.ready()
|
|
75
61
|
console.log(app, 'mirroring to', archApp)
|
|
76
62
|
const promise = mirror.done()
|
|
77
63
|
promises.push(promise)
|
|
78
|
-
promise.then(() =>
|
|
79
|
-
console.log(app, 'mirrored to', archApp)
|
|
80
|
-
}, noop)
|
|
64
|
+
promise.then(() => console.log(app, 'mirrored to', archApp), noop)
|
|
81
65
|
await src.close()
|
|
82
66
|
await dst.close()
|
|
83
67
|
}
|