pear-build 1.2.0 → 1.3.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/README.md +16 -6
- package/index.js +23 -37
- package/package.json +37 -7
package/README.md
CHANGED
|
@@ -26,17 +26,27 @@ pear-build \
|
|
|
26
26
|
--target=./my-build
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
Each `*-app` flag can be passed more than once to place several artifacts under the same architecture. Every artifact must be named after `productName` (or `name`), or after one of the `bin` names when `bin` is an object:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pear-build \
|
|
33
|
+
--package=./my-app/package.json \
|
|
34
|
+
--darwin-arm64-app ./my-app/MyApp-darwin-arm64/MyApp.app \
|
|
35
|
+
--darwin-arm64-app ./my-app/MyApp-darwin-arm64/my-app \
|
|
36
|
+
--target=./my-build
|
|
37
|
+
```
|
|
38
|
+
|
|
29
39
|
## Example
|
|
30
40
|
|
|
31
41
|
```bash
|
|
32
42
|
node bin.js \
|
|
33
43
|
--package ./test/fixtures/hello-pear-electron/package.json \
|
|
34
|
-
--darwin-arm64-app ./test/fixtures/hello-pear-electron/
|
|
35
|
-
--darwin-x64-app ./test/fixtures/hello-pear-electron/
|
|
36
|
-
--linux-arm64-app ./test/fixtures/hello-pear-electron/
|
|
37
|
-
--linux-x64-app ./test/fixtures/hello-pear-electron/
|
|
38
|
-
--win32-x64-app ./test/fixtures/hello-pear-electron/
|
|
39
|
-
--win32-arm64-app ./test/fixtures/hello-pear-electron/
|
|
44
|
+
--darwin-arm64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-darwin-arm64/HelloPear.app \
|
|
45
|
+
--darwin-x64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-darwin-x64/HelloPear.app \
|
|
46
|
+
--linux-arm64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-linux-arm64/HelloPear.AppImage \
|
|
47
|
+
--linux-x64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-linux-x64/HelloPear.AppImage \
|
|
48
|
+
--win32-x64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-win32-x64/HelloPear.msix \
|
|
49
|
+
--win32-arm64-app ./test/fixtures/hello-pear-electron/by-arch/HelloPear-win32-arm64/HelloPear.msix \
|
|
40
50
|
--ios-arm64 ./test/fixtures/hello-pear-react-native/ota/ios/HelloPear \
|
|
41
51
|
--ios-arm64-simulator ./test/fixtures/hello-pear-react-native/ota/ios/HelloPear \
|
|
42
52
|
--ios-x64-simulator ./test/fixtures/hello-pear-react-native/ota/ios/HelloPear \
|
package/index.js
CHANGED
|
@@ -23,28 +23,25 @@ class Build extends EventEmitter {
|
|
|
23
23
|
const config = configPath && (await getParsedJSON('pear.json', configPath))
|
|
24
24
|
|
|
25
25
|
const { target = path.resolve(pkg.name + '-' + pkg.version) } = opts
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const androidArm64 = opts.androidArm64
|
|
46
|
-
? ['android-arm64', path.resolve(opts.androidArm64)]
|
|
47
|
-
: null
|
|
26
|
+
const archs = {
|
|
27
|
+
'darwin-arm64': opts.darwinArm64App,
|
|
28
|
+
'darwin-x64': opts.darwinX64App,
|
|
29
|
+
'linux-arm64': opts.linuxArm64App,
|
|
30
|
+
'linux-x64': opts.linuxX64App,
|
|
31
|
+
'win32-x64': opts.win32X64App,
|
|
32
|
+
'win32-arm64': opts.win32Arm64App,
|
|
33
|
+
'ios-arm64': opts.iosArm64,
|
|
34
|
+
'ios-arm64-simulator': opts.iosArm64Simulator,
|
|
35
|
+
'ios-x64-simulator': opts.iosX64Simulator,
|
|
36
|
+
'android-arm64': opts.androidArm64
|
|
37
|
+
}
|
|
38
|
+
const apps = []
|
|
39
|
+
for (const [arch, app] of Object.entries(archs)) {
|
|
40
|
+
if (!app) continue
|
|
41
|
+
for (const each of Array.isArray(app) ? app : [app]) {
|
|
42
|
+
if (each) apps.push([arch, path.resolve(each)])
|
|
43
|
+
}
|
|
44
|
+
}
|
|
48
45
|
|
|
49
46
|
const byArch = path.join(target, 'by-arch')
|
|
50
47
|
|
|
@@ -62,20 +59,9 @@ class Build extends EventEmitter {
|
|
|
62
59
|
)
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
const apps = [
|
|
66
|
-
darwinArm64App,
|
|
67
|
-
darwinX64App,
|
|
68
|
-
linuxArm64App,
|
|
69
|
-
linuxX64App,
|
|
70
|
-
win32X64App,
|
|
71
|
-
win32Arm64App,
|
|
72
|
-
iosArm64,
|
|
73
|
-
iosArm64Sim,
|
|
74
|
-
iosx64Sim,
|
|
75
|
-
androidArm64
|
|
76
|
-
].filter(Boolean)
|
|
77
|
-
|
|
78
62
|
const appName = pkg.productName ?? pkg.name
|
|
63
|
+
const binNames = pkg.bin && typeof pkg.bin === 'object' ? Object.keys(pkg.bin) : []
|
|
64
|
+
const appNames = [...new Set([appName, ...binNames])]
|
|
79
65
|
|
|
80
66
|
const noop = () => {}
|
|
81
67
|
const promises = []
|
|
@@ -83,9 +69,9 @@ class Build extends EventEmitter {
|
|
|
83
69
|
if (!fs.existsSync(app)) {
|
|
84
70
|
throw new Error(`${app} does not exists`)
|
|
85
71
|
}
|
|
86
|
-
if (path.basename(app, path.extname(app))
|
|
72
|
+
if (appNames.includes(path.basename(app, path.extname(app))) === false) {
|
|
87
73
|
throw ERR_INVALID_APP_NAME(
|
|
88
|
-
`expected
|
|
74
|
+
`expected ${appNames.join(' or ')} but got ${path.basename(app)} for ${arch}`,
|
|
89
75
|
{ arch, app }
|
|
90
76
|
)
|
|
91
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pear-build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -18,12 +18,42 @@
|
|
|
18
18
|
"flag --package [path]": "Path to project package.json",
|
|
19
19
|
"flag --target [path]": "Target build dir",
|
|
20
20
|
"flag --config [path]": "Path to project pear.json (mandatory for mobile)",
|
|
21
|
-
"flag --darwin-arm64-app [path]":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
"flag --darwin-arm64-app [path]": [
|
|
22
|
+
"Path to Mac ARM64 app",
|
|
23
|
+
{
|
|
24
|
+
"multiple": true
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"flag --darwin-x64-app [path]": [
|
|
28
|
+
"Path to Mac x64 app",
|
|
29
|
+
{
|
|
30
|
+
"multiple": true
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"flag --linux-arm64-app [path]": [
|
|
34
|
+
"Path to Linux ARM64 app",
|
|
35
|
+
{
|
|
36
|
+
"multiple": true
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"flag --linux-x64-app [path]": [
|
|
40
|
+
"Path to Linux x64 app",
|
|
41
|
+
{
|
|
42
|
+
"multiple": true
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"flag --win32-x64-app [path]": [
|
|
46
|
+
"Path to Windows x64 app",
|
|
47
|
+
{
|
|
48
|
+
"multiple": true
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"flag --win32-arm64-app [path]": [
|
|
52
|
+
"Path to Windows ARM64 app",
|
|
53
|
+
{
|
|
54
|
+
"multiple": true
|
|
55
|
+
}
|
|
56
|
+
],
|
|
27
57
|
"flag --ios-arm64 [path]": "Path to iOS ARM64 folder (ota bundle and assets)",
|
|
28
58
|
"flag --ios-arm64-simulator [path]": "Path to iOS ARM64-Simulator folder (ota bundle and asset)",
|
|
29
59
|
"flag --ios-x64-simulator [path]": "Path to iOS x64-Simulator folder (ota bundle and assets)",
|