Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"description": "Bundle javascript and copy assets."
},
"bundle": {
"description": "Bundle javascript code only.",
"description": "Bundle javascript code only and optionally publish.",
"options": {
"dev": {
"default": "false",
Expand Down Expand Up @@ -157,6 +157,18 @@
},
"disableHermes": {
"default": false
},
"name": {
"hasValue": true,
"description": "Version name for publishing"
},
"description": {
"hasValue": true,
"description": "Version description for publishing"
},
"metaInfo": {
"hasValue": true,
"description": "Meta information for publishing"
}
}
},
Expand Down
32 changes: 29 additions & 3 deletions src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { tempDir } from './utils/constants';
import { checkLockFiles } from './utils/check-lockfile';
import { addGitIgnore } from './utils/add-gitignore';
import { commands as versionCommands } from './versions';

type Diff = (oldSource?: Buffer, newSource?: Buffer) => Buffer;

Expand Down Expand Up @@ -527,16 +528,16 @@
return new Promise((resolve, reject) => {
zipFile.openReadStream(entry, (err, stream) => {
stream.pipe({
write(chunk: Buffer) {

Check failure on line 531 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '(chunk: Buffer<ArrayBufferLike>) => void' is not assignable to type '{ (buffer: string | Uint8Array<ArrayBufferLike>, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean; (str: string, encoding?: BufferEncoding | undefined, cb?: ((err?: Error | ... 1 more ... | undefined) => void) | undefined): boolean; (buffer: string | Uint8Array<...>, cb?: ((err?: Error | ... 1 m...'.
buffers.push(chunk);
},
end() {

Check failure on line 534 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '() => void' is not assignable to type '{ (cb?: (() => void) | undefined): WritableStream; (data: string | Uint8Array<ArrayBufferLike>, cb?: (() => void) | undefined): WritableStream; (str: string, encoding?: BufferEncoding | undefined, cb?: (() => void) | undefined): WritableStream; (cb?: (() => void) | undefined): WritableStream; (data: string | Uint8Ar...'.
resolve(Buffer.concat(buffers));
},
prependListener() {},

Check failure on line 537 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '<K>() => void' is not assignable to type '{ <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; }'.
on() {},

Check failure on line 538 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '<K>() => void' is not assignable to type '{ <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; }'.
once() {},

Check failure on line 539 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '<K>() => void' is not assignable to type '{ <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; <K>(eventName: string | symbol, listener: (...args: any[]) => void): WritableStream; }'.
emit() {},

Check failure on line 540 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Type '<K>() => void' is not assignable to type '{ <K>(eventName: string | symbol, ...args: AnyRest): boolean; <K>(eventName: string | symbol, ...args: AnyRest): boolean; }'.
});
});
});
Expand All @@ -555,8 +556,8 @@

let originSource: Buffer | undefined;

await enumZipEntries(origin, (entry, zipFile) => {

Check failure on line 559 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Argument of type '(entry: Entry, zipFile: ZipFile) => Promise<any> | undefined' is not assignable to parameter of type '(entry: Entry, zipFile: ZipFile, nestedPath?: string | undefined) => Promise<any>'.
originEntries[entry.fileName] = entry;

Check failure on line 560 in src/bundle.ts

View workflow job for this annotation

GitHub Actions / lint (20.x)

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
if (!/\/$/.test(entry.fileName)) {
// isFile
originMap[entry.crc32] = entry.fileName;
Expand Down Expand Up @@ -916,6 +917,9 @@
expo,
rncli,
disableHermes,
name,
description,
metaInfo,
} = translateOptions({
...options,
tempDir,
Expand Down Expand Up @@ -956,14 +960,17 @@

await pack(path.resolve(intermediaDir), realOutput);

const v = await question(t('uploadBundlePrompt'));
if (v.toLowerCase() === 'y') {
const versionName = await this.publish({
if (name) {
const versionName = await versionCommands.publish({
args: [realOutput],
options: {
platform,
name,
description,
metaInfo,
},
});

if (isSentry) {
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
await uploadSourcemapForSentry(
Expand All @@ -973,6 +980,25 @@
versionName,
);
}
} else if (!options['no-interactive']) {
const v = await question(t('uploadBundlePrompt'));
if (v.toLowerCase() === 'y') {
const versionName = await versionCommands.publish({
args: [realOutput],
options: {
platform,
},
});
if (isSentry) {
await copyDebugidForSentry(bundleName, intermediaDir, sourcemapOutput);
await uploadSourcemapForSentry(
bundleName,
intermediaDir,
sourcemapOutput,
versionName,
);
}
}
}
},

Expand Down
Loading