@git.zone/cli 9.0.1 → 9.2.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/assets/templates/asset_binary_installer/install.sh +236 -25
- package/assets/templates/asset_binary_postinstall/bin/wrapper.js +64 -15
- package/assets/templates/asset_binary_postinstall/scripts/install-binary.js +68 -30
- package/assets/templates/asset_binary_release_gitea/.gitea/workflows/release.yml +24 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.managedassets.d.ts +35 -0
- package/dist_ts/helpers.managedassets.js +105 -3
- package/dist_ts/mod_config/index.js +27 -2
- package/dist_ts/mod_format/formatters/assets.formatter.js +28 -10
- package/dist_ts/mod_release/helpers.tsdockerprotocol.d.ts +3 -3
- package/package.json +3 -3
- package/readme.md +11 -6
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.managedassets.ts +149 -2
- package/ts/mod_config/index.ts +25 -0
- package/ts/mod_format/formatters/assets.formatter.ts +31 -6
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
assertManagedAssetsCurrent,
|
|
11
11
|
managedAssetKinds,
|
|
12
12
|
readBinaryBuild,
|
|
13
|
+
readBinaryExtras,
|
|
13
14
|
type IBinaryBuild,
|
|
15
|
+
type IBinaryExtras,
|
|
14
16
|
} from '../../helpers.managedassets.js';
|
|
15
17
|
|
|
16
18
|
interface IAssetFileMapping {
|
|
@@ -290,9 +292,23 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
290
292
|
: { outDir: '', targets: [] };
|
|
291
293
|
const binaryTargets = binaryBuild.targets;
|
|
292
294
|
const binaryConfig = isPlainObject(assetsConfig.binary) ? assetsConfig.binary : {};
|
|
293
|
-
const
|
|
295
|
+
const installFileName = binaryConfig.installFileName || cliName;
|
|
296
|
+
const installerAssetName = plugins.path.basename(
|
|
297
|
+
(isPlainObject(assetsConfig.installer) && assetsConfig.installer.file) || 'install.sh',
|
|
298
|
+
);
|
|
299
|
+
const extras: IBinaryExtras =
|
|
300
|
+
assetsConfig.kind === 'binaryCli'
|
|
301
|
+
? await readBinaryExtras(assetsConfig, {
|
|
302
|
+
projectDir: paths.cwd,
|
|
303
|
+
binaryBuild,
|
|
304
|
+
installerAssetName,
|
|
305
|
+
installFileName,
|
|
306
|
+
packNpmArtifact: isPlainObject(assetsConfig.releaseWorkflow) && assetsConfig.releaseWorkflow.packNpmArtifact === true,
|
|
307
|
+
})
|
|
308
|
+
: { assets: [], installed: [] };
|
|
309
|
+
const installerConfig = this.normalizeInstallerConfig(assetsConfig, cliName, repository, extras);
|
|
294
310
|
const npmWrapperConfig = this.normalizeNpmWrapperConfig(assetsConfig, cliName);
|
|
295
|
-
const releaseWorkflowConfig = this.normalizeReleaseWorkflowConfig(assetsConfig, binaryBuild, installerConfig);
|
|
311
|
+
const releaseWorkflowConfig = this.normalizeReleaseWorkflowConfig(assetsConfig, binaryBuild, installerConfig, extras);
|
|
296
312
|
|
|
297
313
|
return {
|
|
298
314
|
module: moduleConfig,
|
|
@@ -308,7 +324,7 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
308
324
|
binary: {
|
|
309
325
|
...binaryConfig,
|
|
310
326
|
outDir: binaryBuild.outDir,
|
|
311
|
-
installFileName
|
|
327
|
+
installFileName,
|
|
312
328
|
targets: binaryTargets,
|
|
313
329
|
supportedPlatformText: binaryTargets.map((target) => target.label).join(', '),
|
|
314
330
|
hasTargets: binaryTargets.length > 0,
|
|
@@ -323,6 +339,7 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
323
339
|
assetsConfig: Record<string, any>,
|
|
324
340
|
cliName: string,
|
|
325
341
|
repository: Record<string, any>,
|
|
342
|
+
extrasArg: IBinaryExtras,
|
|
326
343
|
): Record<string, any> {
|
|
327
344
|
const installer = isPlainObject(assetsConfig.installer) ? assetsConfig.installer : {};
|
|
328
345
|
const modes = isPlainObject(installer.modes) ? installer.modes : {};
|
|
@@ -330,7 +347,9 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
330
347
|
const service = isPlainObject(installer.service) ? installer.service : {};
|
|
331
348
|
const file = installer.file || 'install.sh';
|
|
332
349
|
const releaseAssetName = plugins.path.basename(file);
|
|
333
|
-
|
|
350
|
+
// Release assets are readable without an account on every Gitea; `rawBranch` is an explicit opt-in for hosts
|
|
351
|
+
// that serve raw files anonymously (code.foss.global serves raw/src to signed-in users only).
|
|
352
|
+
const distribution = installer.distribution || 'releaseAsset';
|
|
334
353
|
const versionSelection = uniqueStringArray(installer.versionSelection, ['latest', 'version']);
|
|
335
354
|
const detectNames = uniqueStringArray(service.detectNames, service.name ? [service.name] : [cliName]);
|
|
336
355
|
const removeLegacyUnits = uniqueStringArray(service.removeLegacyUnits || []);
|
|
@@ -338,7 +357,8 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
338
357
|
const preservePaths = uniqueStringArray(installer.preservePaths);
|
|
339
358
|
const successHints = uniqueStringArray(installer.successHints, [`${cliName} --version`, `${cliName} --help`]);
|
|
340
359
|
const rawBranchInstallUrl = `${repository.baseUrl}/raw/branch/${repository.branch}/${file}`;
|
|
341
|
-
|
|
360
|
+
// Gitea (like GitHub) resolves the `latest` download path to the newest published release.
|
|
361
|
+
const releaseAssetInstallUrl = `${repository.baseUrl}/releases/download/latest/${releaseAssetName}`;
|
|
342
362
|
const releaseNotesInstallUrl = `${repository.baseUrl}/releases/download/$VERSION/${releaseAssetName}`;
|
|
343
363
|
|
|
344
364
|
return {
|
|
@@ -375,6 +395,7 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
375
395
|
primaryPreservePath: preservePaths[0],
|
|
376
396
|
hasPreservePaths: preservePaths.length > 0,
|
|
377
397
|
successHints,
|
|
398
|
+
extraFiles: extrasArg.installed,
|
|
378
399
|
};
|
|
379
400
|
}
|
|
380
401
|
|
|
@@ -393,6 +414,7 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
393
414
|
assetsConfig: Record<string, any>,
|
|
394
415
|
binaryBuild: IBinaryBuild,
|
|
395
416
|
installerConfig: Record<string, any>,
|
|
417
|
+
extrasArg: IBinaryExtras,
|
|
396
418
|
): Record<string, any> {
|
|
397
419
|
const releaseWorkflow = isPlainObject(assetsConfig.releaseWorkflow) ? assetsConfig.releaseWorkflow : {};
|
|
398
420
|
const includeInstallerAsset =
|
|
@@ -405,15 +427,18 @@ export class AssetsFormatter extends BaseFormatter {
|
|
|
405
427
|
if (includeInstallerAsset) {
|
|
406
428
|
releaseFileNames.push(installerConfig.releaseAssetName);
|
|
407
429
|
}
|
|
430
|
+
releaseFileNames.push(...extrasArg.assets.map((assetArg) => assetArg.name));
|
|
408
431
|
return {
|
|
409
432
|
...releaseWorkflow,
|
|
410
433
|
enabled: releaseWorkflow.enabled !== false,
|
|
411
434
|
file: releaseWorkflow.file || '.gitea/workflows/release.yml',
|
|
412
|
-
installCommand: releaseWorkflow.installCommand || 'pnpm install --ignore-scripts',
|
|
435
|
+
installCommand: releaseWorkflow.installCommand || 'pnpm install --frozen-lockfile --ignore-scripts',
|
|
413
436
|
compileCommand: releaseWorkflow.compileCommand || 'pnpm exec tsbundle && pnpm exec tssea build',
|
|
414
437
|
packNpmArtifact: releaseWorkflow.packNpmArtifact === true,
|
|
415
438
|
includeInstallerAsset,
|
|
416
439
|
releaseFileNames,
|
|
440
|
+
extraAssets: extrasArg.assets,
|
|
441
|
+
hasExtraAssets: extrasArg.assets.length > 0,
|
|
417
442
|
keepReleases: releaseWorkflow.keepReleases ?? 0,
|
|
418
443
|
binaryOutDir: binaryBuild.outDir,
|
|
419
444
|
};
|