@better-update/cli 0.5.0 → 0.6.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/LICENSE.md +73 -0
- package/dist/index.mjs +126 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/LICENSE.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to **Distribution License** and make changes or new works based on the software according to **Changes and New Works License**.
|
|
12
|
+
|
|
13
|
+
## Distribution License
|
|
14
|
+
|
|
15
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by **Changes and New Works License**.
|
|
16
|
+
|
|
17
|
+
## Notices
|
|
18
|
+
|
|
19
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
20
|
+
|
|
21
|
+
> Required Notice: Copyright Công Trần
|
|
22
|
+
|
|
23
|
+
## Changes and New Works License
|
|
24
|
+
|
|
25
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
26
|
+
|
|
27
|
+
## Patent License
|
|
28
|
+
|
|
29
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
30
|
+
|
|
31
|
+
## Noncommercial Purposes
|
|
32
|
+
|
|
33
|
+
Any noncommercial purpose is a permitted purpose.
|
|
34
|
+
|
|
35
|
+
## Personal Uses
|
|
36
|
+
|
|
37
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
38
|
+
|
|
39
|
+
## Noncommercial Organizations
|
|
40
|
+
|
|
41
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
42
|
+
|
|
43
|
+
## Fair Use
|
|
44
|
+
|
|
45
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
46
|
+
|
|
47
|
+
## No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
50
|
+
|
|
51
|
+
## Patent Defense
|
|
52
|
+
|
|
53
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
54
|
+
|
|
55
|
+
## Violations
|
|
56
|
+
|
|
57
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
58
|
+
|
|
59
|
+
## No Liability
|
|
60
|
+
|
|
61
|
+
**_As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim._**
|
|
62
|
+
|
|
63
|
+
## Definitions
|
|
64
|
+
|
|
65
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
66
|
+
|
|
67
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
68
|
+
|
|
69
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
70
|
+
|
|
71
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
72
|
+
|
|
73
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
package/dist/index.mjs
CHANGED
|
@@ -3124,15 +3124,15 @@ const runBuildWorkflow = (options) => Effect.scoped(Effect.gen(function* () {
|
|
|
3124
3124
|
|
|
3125
3125
|
//#endregion
|
|
3126
3126
|
//#region src/commands/build/index.ts
|
|
3127
|
-
const platform$
|
|
3128
|
-
const profile = Options.text("profile").pipe(Options.withDefault("production"));
|
|
3129
|
-
const message$
|
|
3127
|
+
const platform$7 = Options.choice("platform", ["ios", "android"]);
|
|
3128
|
+
const profile$1 = Options.text("profile").pipe(Options.withDefault("production"));
|
|
3129
|
+
const message$3 = Options.text("message").pipe(Options.optional);
|
|
3130
3130
|
const noUpload = Options.boolean("no-upload");
|
|
3131
3131
|
const rawOutput = Options.boolean("raw-output");
|
|
3132
3132
|
const buildCommand = Command.make("build", {
|
|
3133
|
-
platform: platform$
|
|
3134
|
-
profile,
|
|
3135
|
-
message: message$
|
|
3133
|
+
platform: platform$7,
|
|
3134
|
+
profile: profile$1,
|
|
3135
|
+
message: message$3,
|
|
3136
3136
|
noUpload,
|
|
3137
3137
|
rawOutput
|
|
3138
3138
|
}, (opts) => runBuildWorkflow({
|
|
@@ -3246,10 +3246,10 @@ const installLinkCommand = Command.make("install-link", { id: id$6 }, (opts) =>
|
|
|
3246
3246
|
|
|
3247
3247
|
//#endregion
|
|
3248
3248
|
//#region src/commands/builds/list.ts
|
|
3249
|
-
const platform$
|
|
3249
|
+
const platform$6 = Options.choice("platform", ["ios", "android"]).pipe(Options.optional);
|
|
3250
3250
|
const limit$1 = Options.integer("limit").pipe(Options.withDefault(10));
|
|
3251
3251
|
const listCommand$5 = Command.make("list", {
|
|
3252
|
-
platform: platform$
|
|
3252
|
+
platform: platform$6,
|
|
3253
3253
|
limit: limit$1
|
|
3254
3254
|
}, (opts) => Effect.gen(function* () {
|
|
3255
3255
|
const projectId = yield* readProjectId;
|
|
@@ -3281,6 +3281,122 @@ const listCommand$5 = Command.make("list", {
|
|
|
3281
3281
|
]));
|
|
3282
3282
|
}).pipe(handleBuildsCommandErrors));
|
|
3283
3283
|
|
|
3284
|
+
//#endregion
|
|
3285
|
+
//#region src/application/upload-workflow.ts
|
|
3286
|
+
const resolveIosTarget = (profile, appMeta) => Effect.gen(function* () {
|
|
3287
|
+
if (!profile.ios) return yield* new BuildProfileError({ message: `Profile "${profile.name}" has no ios section.` });
|
|
3288
|
+
if (!appMeta.bundleId) return yield* new BuildProfileError({ message: "Missing expo.ios.bundleIdentifier in app.json." });
|
|
3289
|
+
return {
|
|
3290
|
+
target: {
|
|
3291
|
+
platform: "ios",
|
|
3292
|
+
distribution: profile.ios.distribution,
|
|
3293
|
+
artifactFormat: "ipa"
|
|
3294
|
+
},
|
|
3295
|
+
bundleId: appMeta.bundleId
|
|
3296
|
+
};
|
|
3297
|
+
});
|
|
3298
|
+
const resolveAndroidTarget = (profile, appMeta, projectRoot) => Effect.gen(function* () {
|
|
3299
|
+
if (!profile.android) return yield* new BuildProfileError({ message: `Profile "${profile.name}" has no android section.` });
|
|
3300
|
+
if (!appMeta.androidPackage) return yield* new BuildProfileError({ message: "Missing expo.android.package in app.json." });
|
|
3301
|
+
const gradleConfig = yield* readGradleConfig(`${projectRoot}/android`);
|
|
3302
|
+
yield* warnOnGradleMismatch(gradleConfig, appMeta.androidPackage);
|
|
3303
|
+
const bundleId = gradleConfig?.applicationId ?? appMeta.androidPackage;
|
|
3304
|
+
return {
|
|
3305
|
+
target: profile.android.format === "aab" ? {
|
|
3306
|
+
platform: "android",
|
|
3307
|
+
distribution: "play-store",
|
|
3308
|
+
artifactFormat: "aab"
|
|
3309
|
+
} : {
|
|
3310
|
+
platform: "android",
|
|
3311
|
+
distribution: "direct",
|
|
3312
|
+
artifactFormat: "apk"
|
|
3313
|
+
},
|
|
3314
|
+
bundleId
|
|
3315
|
+
};
|
|
3316
|
+
});
|
|
3317
|
+
const runUploadWorkflow = (options) => Effect.gen(function* () {
|
|
3318
|
+
const api = yield* apiClient;
|
|
3319
|
+
const projectRoot = yield* (yield* CliRuntime).cwd;
|
|
3320
|
+
if (!(yield* (yield* FileSystem.FileSystem).exists(options.artifactPath).pipe(Effect.orElseSucceed(() => false)))) yield* new ArtifactNotFoundError({ message: `Artifact not found at ${options.artifactPath}.` });
|
|
3321
|
+
const appJson = yield* readAppJson;
|
|
3322
|
+
const projectId = yield* readProjectId;
|
|
3323
|
+
const profile = yield* readBuildProfile(appJson, options.profileName);
|
|
3324
|
+
const expoConfig = yield* readExpoConfig(projectRoot, yield* pullEnvVars(api, {
|
|
3325
|
+
projectId,
|
|
3326
|
+
environment: profile.environment
|
|
3327
|
+
}));
|
|
3328
|
+
const appMeta = expoConfig ? yield* readAppMetaFromConfig(expoConfig, options.platform).pipe(Effect.tap(() => Console.log("Resolved app config via @expo/config")), Effect.catchAll(() => readAppMeta(appJson, options.platform))) : yield* readAppMeta(appJson, options.platform);
|
|
3329
|
+
const runtimeVersion = yield* resolveRuntimeVersion({
|
|
3330
|
+
raw: appMeta.rawRuntimeVersion,
|
|
3331
|
+
appVersion: appMeta.appVersion,
|
|
3332
|
+
projectRoot
|
|
3333
|
+
});
|
|
3334
|
+
const { target, bundleId } = options.platform === "ios" ? yield* resolveIosTarget(profile, appMeta) : yield* resolveAndroidTarget(profile, appMeta, projectRoot);
|
|
3335
|
+
yield* Console.log(`Hashing ${options.artifactPath}...`);
|
|
3336
|
+
const { sha256, byteSize } = yield* sha256File(options.artifactPath);
|
|
3337
|
+
const rawGitContext = yield* readGitContext(projectRoot);
|
|
3338
|
+
const gitContext = {
|
|
3339
|
+
...rawGitContext.ref === void 0 ? {} : { ref: rawGitContext.ref },
|
|
3340
|
+
...rawGitContext.commit === void 0 ? {} : { commit: rawGitContext.commit },
|
|
3341
|
+
dirty: rawGitContext.dirty
|
|
3342
|
+
};
|
|
3343
|
+
const result = yield* reserveAndUpload(api, {
|
|
3344
|
+
target,
|
|
3345
|
+
projectId,
|
|
3346
|
+
profileName: profile.name,
|
|
3347
|
+
runtimeVersion,
|
|
3348
|
+
...appMeta.appVersion === void 0 ? {} : { appVersion: appMeta.appVersion },
|
|
3349
|
+
...appMeta.buildNumber === void 0 ? {} : { buildNumber: appMeta.buildNumber },
|
|
3350
|
+
bundleId,
|
|
3351
|
+
gitContext,
|
|
3352
|
+
...options.message === void 0 ? {} : { message: options.message },
|
|
3353
|
+
artifactPath: options.artifactPath,
|
|
3354
|
+
sha256,
|
|
3355
|
+
byteSize
|
|
3356
|
+
});
|
|
3357
|
+
yield* Console.log("");
|
|
3358
|
+
yield* printKeyValue([
|
|
3359
|
+
["Build ID", result.id],
|
|
3360
|
+
["Status", result.status],
|
|
3361
|
+
["Platform", options.platform],
|
|
3362
|
+
["Profile", profile.name],
|
|
3363
|
+
["Runtime version", runtimeVersion],
|
|
3364
|
+
["Artifact", options.artifactPath],
|
|
3365
|
+
["SHA-256", sha256],
|
|
3366
|
+
["Bytes", String(byteSize)]
|
|
3367
|
+
]);
|
|
3368
|
+
});
|
|
3369
|
+
|
|
3370
|
+
//#endregion
|
|
3371
|
+
//#region src/commands/builds/upload.ts
|
|
3372
|
+
const artifactPath = Args.text({ name: "artifact-path" });
|
|
3373
|
+
const platform$5 = Options.choice("platform", ["ios", "android"]);
|
|
3374
|
+
const profile = Options.text("profile").pipe(Options.withDefault("production"));
|
|
3375
|
+
const message$2 = Options.text("message").pipe(Options.optional);
|
|
3376
|
+
const uploadCommand$1 = Command.make("upload", {
|
|
3377
|
+
artifactPath,
|
|
3378
|
+
platform: platform$5,
|
|
3379
|
+
profile,
|
|
3380
|
+
message: message$2
|
|
3381
|
+
}, (opts) => runUploadWorkflow({
|
|
3382
|
+
artifactPath: opts.artifactPath,
|
|
3383
|
+
platform: opts.platform,
|
|
3384
|
+
profileName: opts.profile,
|
|
3385
|
+
message: Option.getOrUndefined(opts.message)
|
|
3386
|
+
}).pipe(Effect.catchTags({
|
|
3387
|
+
AuthRequiredError: (err) => exitWith(3, err.message),
|
|
3388
|
+
ProjectNotLinkedError: (err) => exitWith(4, err.message),
|
|
3389
|
+
BuildProfileError: (err) => exitWith(2, err.message),
|
|
3390
|
+
RuntimeVersionError: (err) => exitWith(2, err.message),
|
|
3391
|
+
ArtifactNotFoundError: (err) => exitWith(6, err.message),
|
|
3392
|
+
BuildFailedError: (err) => exitWith(6, err.message),
|
|
3393
|
+
ReserveError: (err) => exitWith(7, err.message),
|
|
3394
|
+
UploadFailedError: (err) => exitWith(7, err.message),
|
|
3395
|
+
PresignedUrlExpiredError: (err) => exitWith(7, err.message),
|
|
3396
|
+
CompleteError: (err) => exitWith(7, err.message),
|
|
3397
|
+
EnvExportError: (err) => exitWith(7, err.message)
|
|
3398
|
+
})));
|
|
3399
|
+
|
|
3284
3400
|
//#endregion
|
|
3285
3401
|
//#region src/commands/builds/index.ts
|
|
3286
3402
|
const buildsCommand = Command.make("builds", {}, () => Console.log("Manage builds. Run with --help for subcommands.")).pipe(Command.withSubcommands([
|
|
@@ -3288,7 +3404,8 @@ const buildsCommand = Command.make("builds", {}, () => Console.log("Manage build
|
|
|
3288
3404
|
getCommand$2,
|
|
3289
3405
|
deleteCommand$5,
|
|
3290
3406
|
installLinkCommand,
|
|
3291
|
-
compatibilityMatrixCommand
|
|
3407
|
+
compatibilityMatrixCommand,
|
|
3408
|
+
uploadCommand$1
|
|
3292
3409
|
]));
|
|
3293
3410
|
|
|
3294
3411
|
//#endregion
|