react-native-update-cli 2.1.3 → 2.2.1
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/lib/bundle.js +23 -49
- package/package.json +1 -1
- package/src/bundle.ts +35 -46
package/lib/bundle.js
CHANGED
|
@@ -102,10 +102,10 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
102
102
|
const reactNativeBundleArgs = [];
|
|
103
103
|
const envArgs = process.env.PUSHY_ENV_ARGS;
|
|
104
104
|
if (envArgs) {
|
|
105
|
-
|
|
105
|
+
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
|
|
106
106
|
}
|
|
107
107
|
_fsextra.emptyDirSync(outputFolder);
|
|
108
|
-
let cliPath;
|
|
108
|
+
let cliPath = '';
|
|
109
109
|
let usingExpo = false;
|
|
110
110
|
const getExpoCli = ()=>{
|
|
111
111
|
try {
|
|
@@ -123,7 +123,7 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
123
123
|
if ((0, _compareversions.satisfies)(expoCliVersion, '>= 0.10.17')) {
|
|
124
124
|
usingExpo = true;
|
|
125
125
|
} else {
|
|
126
|
-
cliPath =
|
|
126
|
+
cliPath = '';
|
|
127
127
|
}
|
|
128
128
|
} catch (e) {}
|
|
129
129
|
};
|
|
@@ -183,52 +183,20 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
183
183
|
} else if (cli.taro) {
|
|
184
184
|
bundleCommand = 'build';
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
'--entry-file',
|
|
193
|
-
entryFile
|
|
194
|
-
]);
|
|
195
|
-
if (sourcemapOutput) {
|
|
196
|
-
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
197
|
-
}
|
|
198
|
-
if (config) {
|
|
199
|
-
reactNativeBundleArgs.push('--config', config);
|
|
200
|
-
}
|
|
186
|
+
reactNativeBundleArgs.push(cliPath, bundleCommand, '--assets-dest', outputFolder, '--bundle-output', _path.default.join(outputFolder, platform === 'harmony' ? 'bundle.harmony.js' : bundleName));
|
|
187
|
+
if (platform !== 'harmony') {
|
|
188
|
+
reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
|
|
189
|
+
}
|
|
190
|
+
if (cli.taro) {
|
|
191
|
+
reactNativeBundleArgs.push('--type', 'rn');
|
|
201
192
|
} else {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
'--platform',
|
|
210
|
-
platform,
|
|
211
|
-
'--reset-cache'
|
|
212
|
-
]);
|
|
213
|
-
if (cli.taro) {
|
|
214
|
-
reactNativeBundleArgs.push(...[
|
|
215
|
-
'--type',
|
|
216
|
-
'rn'
|
|
217
|
-
]);
|
|
218
|
-
} else {
|
|
219
|
-
reactNativeBundleArgs.push(...[
|
|
220
|
-
'--dev',
|
|
221
|
-
dev,
|
|
222
|
-
'--entry-file',
|
|
223
|
-
entryFile
|
|
224
|
-
]);
|
|
225
|
-
}
|
|
226
|
-
if (sourcemapOutput) {
|
|
227
|
-
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
228
|
-
}
|
|
229
|
-
if (config) {
|
|
230
|
-
reactNativeBundleArgs.push('--config', config);
|
|
231
|
-
}
|
|
193
|
+
reactNativeBundleArgs.push('--dev', dev, '--entry-file', entryFile);
|
|
194
|
+
}
|
|
195
|
+
if (sourcemapOutput) {
|
|
196
|
+
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
197
|
+
}
|
|
198
|
+
if (config) {
|
|
199
|
+
reactNativeBundleArgs.push('--config', config);
|
|
232
200
|
}
|
|
233
201
|
const reactNativeBundleProcess = (0, _child_process.spawn)('node', reactNativeBundleArgs);
|
|
234
202
|
console.log(`Running bundle command: node ${reactNativeBundleArgs.join(' ')}`);
|
|
@@ -544,6 +512,7 @@ async function diffFromPPK(origin, next, output) {
|
|
|
544
512
|
throw new Error('Bundle file not found! Please use default bundle file name and path.');
|
|
545
513
|
}
|
|
546
514
|
const copies = {};
|
|
515
|
+
const copiesv2 = {};
|
|
547
516
|
const zipfile = new _yazl.ZipFile();
|
|
548
517
|
const writePromise = new Promise((resolve, reject)=>{
|
|
549
518
|
zipfile.outputStream.on('error', (err)=>{
|
|
@@ -601,6 +570,7 @@ async function diffFromPPK(origin, next, output) {
|
|
|
601
570
|
addEntry(base);
|
|
602
571
|
}
|
|
603
572
|
copies[entry.fileName] = originMap[entry.crc32];
|
|
573
|
+
copiesv2[entry.crc32] = entry.fileName;
|
|
604
574
|
return;
|
|
605
575
|
}
|
|
606
576
|
// New file.
|
|
@@ -631,6 +601,7 @@ async function diffFromPPK(origin, next, output) {
|
|
|
631
601
|
//console.log({copies, deletes});
|
|
632
602
|
zipfile.addBuffer(Buffer.from(JSON.stringify({
|
|
633
603
|
copies,
|
|
604
|
+
copiesv2,
|
|
634
605
|
deletes
|
|
635
606
|
})), '__diff.json');
|
|
636
607
|
zipfile.end();
|
|
@@ -661,6 +632,7 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
|
|
|
661
632
|
throw new Error('Bundle file not found! Please use default bundle file name and path.');
|
|
662
633
|
}
|
|
663
634
|
const copies = {};
|
|
635
|
+
const copiesv2 = {};
|
|
664
636
|
const zipfile = new _yazl.ZipFile();
|
|
665
637
|
const writePromise = new Promise((resolve, reject)=>{
|
|
666
638
|
zipfile.outputStream.on('error', (err)=>{
|
|
@@ -697,6 +669,7 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
|
|
|
697
669
|
// If moved from other place
|
|
698
670
|
if (originMap[entry.crc32]) {
|
|
699
671
|
copies[entry.fileName] = originMap[entry.crc32];
|
|
672
|
+
copiesv2[entry.crc32] = entry.fileName;
|
|
700
673
|
return;
|
|
701
674
|
}
|
|
702
675
|
return new Promise((resolve, reject)=>{
|
|
@@ -714,7 +687,8 @@ async function diffFromPackage(origin, next, output, originBundleName, transform
|
|
|
714
687
|
}
|
|
715
688
|
});
|
|
716
689
|
zipfile.addBuffer(Buffer.from(JSON.stringify({
|
|
717
|
-
copies
|
|
690
|
+
copies,
|
|
691
|
+
copiesv2
|
|
718
692
|
})), '__diff.json');
|
|
719
693
|
zipfile.end();
|
|
720
694
|
await writePromise;
|
package/package.json
CHANGED
package/src/bundle.ts
CHANGED
|
@@ -75,15 +75,12 @@ async function runReactNativeBundleCommand({
|
|
|
75
75
|
const envArgs = process.env.PUSHY_ENV_ARGS;
|
|
76
76
|
|
|
77
77
|
if (envArgs) {
|
|
78
|
-
|
|
79
|
-
reactNativeBundleArgs,
|
|
80
|
-
envArgs.trim().split(/\s+/),
|
|
81
|
-
);
|
|
78
|
+
reactNativeBundleArgs.push(...envArgs.trim().split(/\s+/));
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
fs.emptyDirSync(outputFolder);
|
|
85
82
|
|
|
86
|
-
let cliPath
|
|
83
|
+
let cliPath = '';
|
|
87
84
|
let usingExpo = false;
|
|
88
85
|
|
|
89
86
|
const getExpoCli = () => {
|
|
@@ -104,7 +101,7 @@ async function runReactNativeBundleCommand({
|
|
|
104
101
|
if (satisfies(expoCliVersion, '>= 0.10.17')) {
|
|
105
102
|
usingExpo = true;
|
|
106
103
|
} else {
|
|
107
|
-
cliPath =
|
|
104
|
+
cliPath = '';
|
|
108
105
|
}
|
|
109
106
|
} catch (e) {}
|
|
110
107
|
};
|
|
@@ -166,49 +163,34 @@ async function runReactNativeBundleCommand({
|
|
|
166
163
|
bundleCommand = 'build';
|
|
167
164
|
}
|
|
168
165
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
166
|
+
reactNativeBundleArgs.push(
|
|
167
|
+
cliPath,
|
|
168
|
+
bundleCommand,
|
|
169
|
+
'--assets-dest',
|
|
170
|
+
outputFolder,
|
|
171
|
+
'--bundle-output',
|
|
172
|
+
path.join(
|
|
173
|
+
outputFolder,
|
|
174
|
+
platform === 'harmony' ? 'bundle.harmony.js' : bundleName,
|
|
175
|
+
),
|
|
176
|
+
);
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
if (platform !== 'harmony') {
|
|
179
|
+
reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
|
|
180
|
+
}
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
182
|
+
if (cli.taro) {
|
|
183
|
+
reactNativeBundleArgs.push('--type', 'rn');
|
|
186
184
|
} else {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
bundleCommand,
|
|
190
|
-
'--assets-dest',
|
|
191
|
-
outputFolder,
|
|
192
|
-
'--bundle-output',
|
|
193
|
-
path.join(outputFolder, bundleName),
|
|
194
|
-
'--platform',
|
|
195
|
-
platform,
|
|
196
|
-
'--reset-cache',
|
|
197
|
-
]);
|
|
198
|
-
|
|
199
|
-
if (cli.taro) {
|
|
200
|
-
reactNativeBundleArgs.push(...['--type', 'rn']);
|
|
201
|
-
} else {
|
|
202
|
-
reactNativeBundleArgs.push(...['--dev', dev, '--entry-file', entryFile]);
|
|
203
|
-
}
|
|
185
|
+
reactNativeBundleArgs.push('--dev', dev, '--entry-file', entryFile);
|
|
186
|
+
}
|
|
204
187
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
188
|
+
if (sourcemapOutput) {
|
|
189
|
+
reactNativeBundleArgs.push('--sourcemap-output', sourcemapOutput);
|
|
190
|
+
}
|
|
208
191
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
192
|
+
if (config) {
|
|
193
|
+
reactNativeBundleArgs.push('--config', config);
|
|
212
194
|
}
|
|
213
195
|
|
|
214
196
|
const reactNativeBundleProcess = spawn('node', reactNativeBundleArgs);
|
|
@@ -597,6 +579,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
597
579
|
}
|
|
598
580
|
|
|
599
581
|
const copies = {};
|
|
582
|
+
const copiesv2 = {};
|
|
600
583
|
|
|
601
584
|
const zipfile = new YazlZipFile();
|
|
602
585
|
|
|
@@ -668,6 +651,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
668
651
|
addEntry(base);
|
|
669
652
|
}
|
|
670
653
|
copies[entry.fileName] = originMap[entry.crc32];
|
|
654
|
+
copiesv2[entry.crc32] = entry.fileName;
|
|
671
655
|
return;
|
|
672
656
|
}
|
|
673
657
|
|
|
@@ -700,7 +684,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
|
|
|
700
684
|
|
|
701
685
|
//console.log({copies, deletes});
|
|
702
686
|
zipfile.addBuffer(
|
|
703
|
-
Buffer.from(JSON.stringify({ copies, deletes })),
|
|
687
|
+
Buffer.from(JSON.stringify({ copies, copiesv2, deletes })),
|
|
704
688
|
'__diff.json',
|
|
705
689
|
);
|
|
706
690
|
zipfile.end();
|
|
@@ -747,6 +731,7 @@ async function diffFromPackage(
|
|
|
747
731
|
}
|
|
748
732
|
|
|
749
733
|
const copies = {};
|
|
734
|
+
const copiesv2 = {};
|
|
750
735
|
|
|
751
736
|
const zipfile = new YazlZipFile();
|
|
752
737
|
|
|
@@ -792,6 +777,7 @@ async function diffFromPackage(
|
|
|
792
777
|
// If moved from other place
|
|
793
778
|
if (originMap[entry.crc32]) {
|
|
794
779
|
copies[entry.fileName] = originMap[entry.crc32];
|
|
780
|
+
copiesv2[entry.crc32] = entry.fileName;
|
|
795
781
|
return;
|
|
796
782
|
}
|
|
797
783
|
|
|
@@ -810,7 +796,10 @@ async function diffFromPackage(
|
|
|
810
796
|
}
|
|
811
797
|
});
|
|
812
798
|
|
|
813
|
-
zipfile.addBuffer(
|
|
799
|
+
zipfile.addBuffer(
|
|
800
|
+
Buffer.from(JSON.stringify({ copies, copiesv2 })),
|
|
801
|
+
'__diff.json',
|
|
802
|
+
);
|
|
814
803
|
zipfile.end();
|
|
815
804
|
await writePromise;
|
|
816
805
|
}
|