@glpkg/cli 0.2.3 → 0.3.10

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.
@@ -1,24 +1,17 @@
1
- "use strict";
2
1
  /**
3
2
  * Publish Command - Publish packages to GitLab
4
3
  */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.publishCommand = void 0;
10
- const commander_1 = require("commander");
11
- const chalk_1 = __importDefault(require("chalk"));
12
- const ora_1 = __importDefault(require("ora"));
13
- const child_process_1 = require("child_process");
14
- const core_1 = require("@glpkg/core");
15
- const adapters_npm_1 = require("@glpkg/adapters.npm");
16
- const adapters_generic_1 = require("@glpkg/adapters.generic");
17
- const adapters_pypi_1 = require("@glpkg/adapters.pypi");
18
- const adapters_go_1 = require("@glpkg/adapters.go");
19
- const adapters_nuget_1 = require("@glpkg/adapters.nuget");
20
- const fallback_1 = require("@glpkg/fallback");
21
- exports.publishCommand = new commander_1.Command('publish')
4
+ import { Command } from 'commander';
5
+ import chalk from 'chalk';
6
+ import ora from 'ora';
7
+ import { execSync } from 'child_process';
8
+ import { createTokenManager, createConfigManager, createClient, incrementVersion, addPrerelease, } from '@glpkg/core';
9
+ import { createNpmrcManager, createPackageJsonManager, } from '@glpkg/adapters.npm';
10
+ import { createManifestReader, createTarballCreator, createUploader, } from '@glpkg/adapters.generic';
11
+ import { createPyProjectManager, createCommandExecutor as createPythonExecutor, buildProjectUploadUrl, } from '@glpkg/adapters.pypi';
12
+ import { createGoModManager, createCommandExecutor as createGoExecutor, normalizeVersion, } from '@glpkg/adapters.go';
13
+ import { createCsProjManager, createCommandExecutor as createDotNetExecutor, buildProjectPushUrl, } from '@glpkg/adapters.nuget';
14
+ export const publishCommand = new Command('publish')
22
15
  .alias('pub')
23
16
  .argument('[type]', 'Publish type: latest, dev, beta', 'latest')
24
17
  .description('Publish package to GitLab registry')
@@ -53,7 +46,7 @@ exports.publishCommand = new commander_1.Command('publish')
53
46
  }
54
47
  }
55
48
  catch (error) {
56
- console.error(chalk_1.default.red('✗'), 'Publish failed:', error.message);
49
+ console.error(chalk.red('✗'), 'Publish failed:', error.message);
57
50
  process.exit(1);
58
51
  }
59
52
  });
@@ -61,10 +54,10 @@ exports.publishCommand = new commander_1.Command('publish')
61
54
  * Publish npm package
62
55
  */
63
56
  async function publishNpm(type, options) {
64
- console.log(chalk_1.default.blue.bold('glpkg publish'), chalk_1.default.gray('(npm)'));
57
+ console.log(chalk.blue.bold('glpkg publish'), chalk.gray('(npm)'));
65
58
  console.log();
66
- const tokenManager = (0, core_1.createTokenManager)();
67
- const configManager = (0, core_1.createConfigManager)();
59
+ const tokenManager = createTokenManager();
60
+ const configManager = createConfigManager();
68
61
  const token = tokenManager.resolveToken(options.token);
69
62
  // Apply defaults (CLI options override defaults)
70
63
  const defaultGitTag = configManager.getDefault('publish.gitTag');
@@ -73,19 +66,19 @@ async function publishNpm(type, options) {
73
66
  // If not explicitly set (still 'true'), check defaults
74
67
  const shouldGitTag = options.gitTag === 'false' ? false : (options.gitTag === 'true' ? (defaultGitTag ?? true) : true);
75
68
  const shouldPush = options.push === 'false' ? false : (options.push === 'true' ? (defaultPush ?? true) : true);
76
- const pkgManager = (0, adapters_npm_1.createPackageJsonManager)();
77
- const npmrcManager = (0, adapters_npm_1.createNpmrcManager)();
69
+ const pkgManager = createPackageJsonManager();
70
+ const npmrcManager = createNpmrcManager();
78
71
  // Check git status
79
72
  if (!options.dryRun) {
80
73
  checkGitClean(options.force);
81
74
  }
82
75
  // Detect project info
83
- const spinner = (0, ora_1.default)('Detecting project info...').start();
76
+ const spinner = ora('Detecting project info...').start();
84
77
  let projectInfo;
85
78
  try {
86
- const glabOutput = (0, child_process_1.execSync)('glab api projects/:id -X GET', { encoding: 'utf-8' });
79
+ const glabOutput = execSync('glab api projects/:id -X GET', { encoding: 'utf-8' });
87
80
  const project = JSON.parse(glabOutput);
88
- const client = (0, core_1.createClient)({ token });
81
+ const client = createClient({ token });
89
82
  const groupInfo = await client.getGroup(project.namespace.path);
90
83
  projectInfo = {
91
84
  projectId: project.id,
@@ -97,7 +90,7 @@ async function publishNpm(type, options) {
97
90
  }
98
91
  catch (error) {
99
92
  spinner.fail('Failed to detect project');
100
- console.error(chalk_1.default.yellow('→'), 'Run "glab auth login" to authenticate');
93
+ console.error(chalk.yellow('→'), 'Run "glab auth login" to authenticate');
101
94
  throw error;
102
95
  }
103
96
  // Setup .npmrc
@@ -116,9 +109,9 @@ async function publishNpm(type, options) {
116
109
  const version = pkgManager.getVersion();
117
110
  const name = pkgManager.getName();
118
111
  // Publish
119
- const publishSpinner = (0, ora_1.default)(`Publishing ${name}@${version}...`).start();
112
+ const publishSpinner = ora(`Publishing ${name}@${version}...`).start();
120
113
  if (options.dryRun) {
121
- (0, child_process_1.execSync)('npm publish --dry-run', {
114
+ execSync('npm publish --dry-run', {
122
115
  stdio: 'inherit',
123
116
  env: tokenManager.getEnvWithToken(token),
124
117
  });
@@ -126,28 +119,11 @@ async function publishNpm(type, options) {
126
119
  }
127
120
  else {
128
121
  const tag = type === 'dev' ? 'dev' : type === 'beta' ? 'beta' : 'latest';
129
- (0, child_process_1.execSync)(`npm publish --tag ${tag} --registry=${registryUrl}`, {
122
+ execSync(`npm publish --tag ${tag} --registry=${registryUrl}`, {
130
123
  stdio: 'inherit',
131
124
  env: tokenManager.getEnvWithToken(token),
132
125
  });
133
126
  publishSpinner.succeed(`Published ${name}@${version}`);
134
- // Save to local cache for immediate install availability
135
- try {
136
- const packOutput = (0, child_process_1.execSync)('npm pack --json', { encoding: 'utf-8' });
137
- const packResult = JSON.parse(packOutput);
138
- const tarballName = Array.isArray(packResult) ? packResult[0].filename : packResult.filename;
139
- if (tarballName) {
140
- const localCache = new fallback_1.LocalPackageCache();
141
- const tarballPath = require('path').join(process.cwd(), tarballName);
142
- await localCache.save(name, version, tarballPath);
143
- // Clean up the tarball file
144
- require('fs').unlinkSync(tarballPath);
145
- console.log(chalk_1.default.gray('○'), 'Saved to local cache');
146
- }
147
- }
148
- catch {
149
- // Cache save failure is not critical, continue
150
- }
151
127
  // Save package metadata
152
128
  configManager.savePackageInfo({
153
129
  packageName: name,
@@ -170,8 +146,8 @@ async function publishNpm(type, options) {
170
146
  }
171
147
  }
172
148
  console.log();
173
- console.log(chalk_1.default.green('✓'), 'Publish complete!');
174
- console.log(chalk_1.default.gray('Package URL:'), `https://gitlab.com/${projectInfo.pathWithNamespace}/-/packages`);
149
+ console.log(chalk.green('✓'), 'Publish complete!');
150
+ console.log(chalk.gray('Package URL:'), `https://gitlab.com/${projectInfo.pathWithNamespace}/-/packages`);
175
151
  }
176
152
  finally {
177
153
  npmrcManager.restore();
@@ -181,21 +157,21 @@ async function publishNpm(type, options) {
181
157
  * Publish generic package
182
158
  */
183
159
  async function publishGeneric(options) {
184
- console.log(chalk_1.default.blue.bold('glpkg publish'), chalk_1.default.gray('(generic)'));
160
+ console.log(chalk.blue.bold('glpkg publish'), chalk.gray('(generic)'));
185
161
  console.log();
186
- const tokenManager = (0, core_1.createTokenManager)();
162
+ const tokenManager = createTokenManager();
187
163
  const token = tokenManager.resolveToken(options.token);
188
- const manifestReader = (0, adapters_generic_1.createManifestReader)();
189
- const tarballCreator = (0, adapters_generic_1.createTarballCreator)();
190
- const uploader = (0, adapters_generic_1.createUploader)('gitlab.com', token);
164
+ const manifestReader = createManifestReader();
165
+ const tarballCreator = createTarballCreator();
166
+ const uploader = createUploader('gitlab.com', token);
191
167
  // Read manifest
192
168
  const manifest = manifestReader.read(options.manifest);
193
- console.log(chalk_1.default.gray('○'), `Package: ${manifest.name}@${manifest.version}`);
169
+ console.log(chalk.gray('○'), `Package: ${manifest.name}@${manifest.version}`);
194
170
  // Detect project
195
- const spinner = (0, ora_1.default)('Detecting project...').start();
171
+ const spinner = ora('Detecting project...').start();
196
172
  let projectId;
197
173
  try {
198
- const glabOutput = (0, child_process_1.execSync)('glab api projects/:id -X GET', { encoding: 'utf-8' });
174
+ const glabOutput = execSync('glab api projects/:id -X GET', { encoding: 'utf-8' });
199
175
  const project = JSON.parse(glabOutput);
200
176
  projectId = project.id;
201
177
  spinner.succeed(`Project ID: ${projectId}`);
@@ -205,15 +181,15 @@ async function publishGeneric(options) {
205
181
  throw error;
206
182
  }
207
183
  // Create tarball
208
- const tarballSpinner = (0, ora_1.default)('Creating tarball...').start();
184
+ const tarballSpinner = ora('Creating tarball...').start();
209
185
  const tarballResult = tarballCreator.create(manifest);
210
186
  tarballSpinner.succeed(`Created: ${manifestReader.getOutputName()}`);
211
187
  // Upload
212
188
  if (options.dryRun) {
213
- console.log(chalk_1.default.yellow('→'), 'Dry-run: skipping upload');
189
+ console.log(chalk.yellow('→'), 'Dry-run: skipping upload');
214
190
  }
215
191
  else {
216
- const uploadSpinner = (0, ora_1.default)('Uploading...').start();
192
+ const uploadSpinner = ora('Uploading...').start();
217
193
  const result = await uploader.upload({
218
194
  projectId,
219
195
  gitlabHost: 'gitlab.com',
@@ -225,15 +201,6 @@ async function publishGeneric(options) {
225
201
  });
226
202
  if (result.success) {
227
203
  uploadSpinner.succeed('Upload complete');
228
- // Save to local cache for immediate install availability
229
- try {
230
- const localCache = new fallback_1.LocalPackageCache();
231
- await localCache.save(manifest.name, manifest.version, tarballResult.tarballPath);
232
- console.log(chalk_1.default.gray('○'), 'Saved to local cache');
233
- }
234
- catch {
235
- // Cache save failure is not critical
236
- }
237
204
  }
238
205
  else {
239
206
  uploadSpinner.fail(result.error || 'Upload failed');
@@ -241,36 +208,36 @@ async function publishGeneric(options) {
241
208
  }
242
209
  }
243
210
  console.log();
244
- console.log(chalk_1.default.green('✓'), 'Publish complete!');
211
+ console.log(chalk.green('✓'), 'Publish complete!');
245
212
  }
246
213
  /**
247
214
  * Publish PyPI package
248
215
  */
249
216
  async function publishPyPI(type, options) {
250
- console.log(chalk_1.default.blue.bold('glpkg publish'), chalk_1.default.gray('(pypi)'));
217
+ console.log(chalk.blue.bold('glpkg publish'), chalk.gray('(pypi)'));
251
218
  console.log();
252
- const tokenManager = (0, core_1.createTokenManager)();
253
- const configManager = (0, core_1.createConfigManager)();
219
+ const tokenManager = createTokenManager();
220
+ const configManager = createConfigManager();
254
221
  const token = tokenManager.resolveToken(options.token);
255
222
  // Apply defaults
256
223
  const defaultGitTag = configManager.getDefault('publish.gitTag');
257
224
  const defaultPush = configManager.getDefault('publish.push');
258
225
  const shouldGitTag = options.gitTag === 'false' ? false : (options.gitTag === 'true' ? (defaultGitTag ?? true) : true);
259
226
  const shouldPush = options.push === 'false' ? false : (options.push === 'true' ? (defaultPush ?? true) : true);
260
- const pyprojectManager = (0, adapters_pypi_1.createPyProjectManager)();
261
- const executor = (0, adapters_pypi_1.createCommandExecutor)();
227
+ const pyprojectManager = createPyProjectManager();
228
+ const executor = createPythonExecutor();
262
229
  // Check tools availability
263
230
  if (!executor.hasBuild()) {
264
- console.error(chalk_1.default.red('✗'), 'python build not found. Install with: pip install build');
231
+ console.error(chalk.red('✗'), 'python build not found. Install with: pip install build');
265
232
  process.exit(1);
266
233
  }
267
234
  if (!executor.hasTwine()) {
268
- console.error(chalk_1.default.red('✗'), 'twine not found. Install with: pip install twine');
235
+ console.error(chalk.red('✗'), 'twine not found. Install with: pip install twine');
269
236
  process.exit(1);
270
237
  }
271
238
  // Check pyproject.toml exists
272
239
  if (!pyprojectManager.exists()) {
273
- console.error(chalk_1.default.red('✗'), 'pyproject.toml not found');
240
+ console.error(chalk.red('✗'), 'pyproject.toml not found');
274
241
  process.exit(1);
275
242
  }
276
243
  // Check git status
@@ -278,11 +245,11 @@ async function publishPyPI(type, options) {
278
245
  checkGitClean(options.force);
279
246
  }
280
247
  // Detect project
281
- const spinner = (0, ora_1.default)('Detecting project...').start();
248
+ const spinner = ora('Detecting project...').start();
282
249
  let projectId;
283
250
  let pathWithNamespace;
284
251
  try {
285
- const glabOutput = (0, child_process_1.execSync)('glab api projects/:id -X GET', { encoding: 'utf-8' });
252
+ const glabOutput = execSync('glab api projects/:id -X GET', { encoding: 'utf-8' });
286
253
  const project = JSON.parse(glabOutput);
287
254
  projectId = project.id;
288
255
  pathWithNamespace = project.path_with_namespace;
@@ -295,16 +262,16 @@ async function publishPyPI(type, options) {
295
262
  // Handle version bump
296
263
  if (options.bump) {
297
264
  const currentVersion = pyprojectManager.getVersion();
298
- const newVersion = (0, core_1.incrementVersion)(currentVersion.replace(/-.*$/, ''), options.bump);
265
+ const newVersion = incrementVersion(currentVersion.replace(/-.*$/, ''), options.bump);
299
266
  pyprojectManager.setVersion(newVersion);
300
- console.log(chalk_1.default.gray('○'), `Version: ${currentVersion} → ${newVersion}`);
267
+ console.log(chalk.gray('○'), `Version: ${currentVersion} → ${newVersion}`);
301
268
  }
302
269
  const name = pyprojectManager.getName();
303
270
  const version = pyprojectManager.getVersion();
304
- console.log(chalk_1.default.gray('○'), `Package: ${name}@${version}`);
271
+ console.log(chalk.gray('○'), `Package: ${name}@${version}`);
305
272
  // Build
306
273
  if (!options.noBuild) {
307
- const buildSpinner = (0, ora_1.default)('Building package...').start();
274
+ const buildSpinner = ora('Building package...').start();
308
275
  try {
309
276
  executor.build();
310
277
  buildSpinner.succeed('Build complete');
@@ -315,13 +282,13 @@ async function publishPyPI(type, options) {
315
282
  }
316
283
  }
317
284
  // Upload with twine
318
- const uploadUrl = (0, adapters_pypi_1.buildProjectUploadUrl)(projectId);
285
+ const uploadUrl = buildProjectUploadUrl(projectId);
319
286
  if (options.dryRun) {
320
- console.log(chalk_1.default.yellow('→'), 'Dry-run: skipping upload');
321
- console.log(chalk_1.default.gray(' Would upload to:'), uploadUrl);
287
+ console.log(chalk.yellow('→'), 'Dry-run: skipping upload');
288
+ console.log(chalk.gray(' Would upload to:'), uploadUrl);
322
289
  }
323
290
  else {
324
- const uploadSpinner = (0, ora_1.default)('Uploading to GitLab PyPI registry...').start();
291
+ const uploadSpinner = ora('Uploading to GitLab PyPI registry...').start();
325
292
  try {
326
293
  executor.upload('dist/*', uploadUrl, {
327
294
  username: '__token__',
@@ -342,30 +309,30 @@ async function publishPyPI(type, options) {
342
309
  }
343
310
  }
344
311
  console.log();
345
- console.log(chalk_1.default.green('✓'), 'Publish complete!');
346
- console.log(chalk_1.default.gray('Package URL:'), `https://gitlab.com/${pathWithNamespace}/-/packages`);
312
+ console.log(chalk.green('✓'), 'Publish complete!');
313
+ console.log(chalk.gray('Package URL:'), `https://gitlab.com/${pathWithNamespace}/-/packages`);
347
314
  }
348
315
  /**
349
316
  * Publish Go module
350
317
  * Go modules are published via git tags - GitLab automatically serves them via Go proxy
351
318
  */
352
319
  async function publishGo(type, options) {
353
- console.log(chalk_1.default.blue.bold('glpkg publish'), chalk_1.default.gray('(go)'));
320
+ console.log(chalk.blue.bold('glpkg publish'), chalk.gray('(go)'));
354
321
  console.log();
355
- const configManager = (0, core_1.createConfigManager)();
356
- const goModManager = (0, adapters_go_1.createGoModManager)();
357
- const executor = (0, adapters_go_1.createCommandExecutor)();
322
+ const configManager = createConfigManager();
323
+ const goModManager = createGoModManager();
324
+ const executor = createGoExecutor();
358
325
  // Apply defaults
359
326
  const defaultPush = configManager.getDefault('publish.push');
360
327
  const shouldPush = options.push === 'false' ? false : (options.push === 'true' ? (defaultPush ?? true) : true);
361
328
  // Check Go availability
362
329
  if (!executor.hasGo()) {
363
- console.error(chalk_1.default.red('✗'), 'Go not found. Please install Go.');
330
+ console.error(chalk.red('✗'), 'Go not found. Please install Go.');
364
331
  process.exit(1);
365
332
  }
366
333
  // Check go.mod exists
367
334
  if (!goModManager.exists()) {
368
- console.error(chalk_1.default.red('✗'), 'go.mod not found');
335
+ console.error(chalk.red('✗'), 'go.mod not found');
369
336
  process.exit(1);
370
337
  }
371
338
  // Check git status
@@ -375,12 +342,12 @@ async function publishGo(type, options) {
375
342
  // Read module info
376
343
  const goMod = goModManager.read();
377
344
  const modulePath = goMod.module;
378
- console.log(chalk_1.default.gray('○'), `Module: ${modulePath}`);
345
+ console.log(chalk.gray('○'), `Module: ${modulePath}`);
379
346
  // Detect project
380
- const spinner = (0, ora_1.default)('Detecting project...').start();
347
+ const spinner = ora('Detecting project...').start();
381
348
  let pathWithNamespace;
382
349
  try {
383
- const glabOutput = (0, child_process_1.execSync)('glab api projects/:id -X GET', { encoding: 'utf-8' });
350
+ const glabOutput = execSync('glab api projects/:id -X GET', { encoding: 'utf-8' });
384
351
  const project = JSON.parse(glabOutput);
385
352
  pathWithNamespace = project.path_with_namespace;
386
353
  spinner.succeed(`Project: ${pathWithNamespace}`);
@@ -394,11 +361,11 @@ async function publishGo(type, options) {
394
361
  if (options.bump) {
395
362
  // Get latest tag and bump
396
363
  try {
397
- const latestTag = (0, child_process_1.execSync)('git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"', {
364
+ const latestTag = execSync('git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"', {
398
365
  encoding: 'utf-8',
399
366
  }).trim();
400
367
  const currentVersion = latestTag.replace(/^v/, '');
401
- version = (0, adapters_go_1.normalizeVersion)((0, core_1.incrementVersion)(currentVersion, options.bump));
368
+ version = normalizeVersion(incrementVersion(currentVersion, options.bump));
402
369
  }
403
370
  catch {
404
371
  version = 'v0.1.0';
@@ -407,47 +374,47 @@ async function publishGo(type, options) {
407
374
  else {
408
375
  // Get version from latest tag or default
409
376
  try {
410
- version = (0, child_process_1.execSync)('git describe --tags --abbrev=0 2>/dev/null', {
377
+ version = execSync('git describe --tags --abbrev=0 2>/dev/null', {
411
378
  encoding: 'utf-8',
412
379
  }).trim();
413
380
  // Bump patch for new release
414
381
  const currentVersion = version.replace(/^v/, '');
415
- version = (0, adapters_go_1.normalizeVersion)((0, core_1.incrementVersion)(currentVersion, 'patch'));
382
+ version = normalizeVersion(incrementVersion(currentVersion, 'patch'));
416
383
  }
417
384
  catch {
418
385
  version = 'v0.1.0';
419
386
  }
420
387
  }
421
- console.log(chalk_1.default.gray('○'), `Version: ${version}`);
388
+ console.log(chalk.gray('○'), `Version: ${version}`);
422
389
  // Validate module
423
- const validateSpinner = (0, ora_1.default)('Validating module...').start();
390
+ const validateSpinner = ora('Validating module...').start();
424
391
  const tidyResult = executor.modTidy();
425
392
  if (!tidyResult.success) {
426
393
  validateSpinner.fail('Module validation failed');
427
394
  if (tidyResult.stderr) {
428
- console.error(chalk_1.default.gray(' '), tidyResult.stderr.trim());
395
+ console.error(chalk.gray(' '), tidyResult.stderr.trim());
429
396
  }
430
397
  throw new Error('go mod tidy failed');
431
398
  }
432
399
  validateSpinner.succeed('Module validated');
433
400
  if (options.dryRun) {
434
- console.log(chalk_1.default.yellow('→'), 'Dry-run: would create tag', version);
435
- console.log(chalk_1.default.yellow('→'), 'Dry-run: would push tag to remote');
401
+ console.log(chalk.yellow('→'), 'Dry-run: would create tag', version);
402
+ console.log(chalk.yellow('→'), 'Dry-run: would push tag to remote');
436
403
  }
437
404
  else {
438
405
  // Create git tag
439
- const tagSpinner = (0, ora_1.default)(`Creating tag ${version}...`).start();
406
+ const tagSpinner = ora(`Creating tag ${version}...`).start();
440
407
  try {
441
408
  // Commit go.mod/go.sum if changed
442
409
  try {
443
- (0, child_process_1.execSync)('git add go.mod go.sum 2>/dev/null && git commit -m "chore: update go.mod" --allow-empty', {
410
+ execSync('git add go.mod go.sum 2>/dev/null && git commit -m "chore: update go.mod" --allow-empty', {
444
411
  stdio: 'pipe',
445
412
  });
446
413
  }
447
414
  catch {
448
415
  // No changes to commit
449
416
  }
450
- (0, child_process_1.execSync)(`git tag ${version}`, { stdio: 'pipe' });
417
+ execSync(`git tag ${version}`, { stdio: 'pipe' });
451
418
  tagSpinner.succeed(`Created tag: ${version}`);
452
419
  }
453
420
  catch (error) {
@@ -456,10 +423,10 @@ async function publishGo(type, options) {
456
423
  }
457
424
  // Push tag
458
425
  if (shouldPush) {
459
- const pushSpinner = (0, ora_1.default)('Pushing to remote...').start();
426
+ const pushSpinner = ora('Pushing to remote...').start();
460
427
  try {
461
- (0, child_process_1.execSync)('git push', { stdio: 'pipe' });
462
- (0, child_process_1.execSync)('git push --tags', { stdio: 'pipe' });
428
+ execSync('git push', { stdio: 'pipe' });
429
+ execSync('git push --tags', { stdio: 'pipe' });
463
430
  pushSpinner.succeed('Pushed to remote');
464
431
  }
465
432
  catch {
@@ -468,36 +435,36 @@ async function publishGo(type, options) {
468
435
  }
469
436
  }
470
437
  console.log();
471
- console.log(chalk_1.default.green('✓'), 'Publish complete!');
472
- console.log(chalk_1.default.gray('Module URL:'), `https://gitlab.com/${pathWithNamespace}`);
438
+ console.log(chalk.green('✓'), 'Publish complete!');
439
+ console.log(chalk.gray('Module URL:'), `https://gitlab.com/${pathWithNamespace}`);
473
440
  console.log();
474
- console.log(chalk_1.default.gray('To install:'));
475
- console.log(chalk_1.default.cyan(` go get ${modulePath}@${version}`));
441
+ console.log(chalk.gray('To install:'));
442
+ console.log(chalk.cyan(` go get ${modulePath}@${version}`));
476
443
  }
477
444
  /**
478
445
  * Publish NuGet package
479
446
  */
480
447
  async function publishNuGet(type, options) {
481
- console.log(chalk_1.default.blue.bold('glpkg publish'), chalk_1.default.gray('(nuget)'));
448
+ console.log(chalk.blue.bold('glpkg publish'), chalk.gray('(nuget)'));
482
449
  console.log();
483
- const tokenManager = (0, core_1.createTokenManager)();
484
- const configManager = (0, core_1.createConfigManager)();
450
+ const tokenManager = createTokenManager();
451
+ const configManager = createConfigManager();
485
452
  const token = tokenManager.resolveToken(options.token);
486
453
  // Apply defaults
487
454
  const defaultGitTag = configManager.getDefault('publish.gitTag');
488
455
  const defaultPush = configManager.getDefault('publish.push');
489
456
  const shouldGitTag = options.gitTag === 'false' ? false : (options.gitTag === 'true' ? (defaultGitTag ?? true) : true);
490
457
  const shouldPush = options.push === 'false' ? false : (options.push === 'true' ? (defaultPush ?? true) : true);
491
- const csprojManager = (0, adapters_nuget_1.createCsProjManager)();
492
- const executor = (0, adapters_nuget_1.createCommandExecutor)();
458
+ const csprojManager = createCsProjManager();
459
+ const executor = createDotNetExecutor();
493
460
  // Check dotnet CLI availability
494
461
  if (!executor.hasDotNet()) {
495
- console.error(chalk_1.default.red('✗'), 'dotnet CLI not found. Please install .NET SDK.');
462
+ console.error(chalk.red('✗'), 'dotnet CLI not found. Please install .NET SDK.');
496
463
  process.exit(1);
497
464
  }
498
465
  // Check .csproj exists
499
466
  if (!csprojManager.exists()) {
500
- console.error(chalk_1.default.red('✗'), '.csproj file not found');
467
+ console.error(chalk.red('✗'), '.csproj file not found');
501
468
  process.exit(1);
502
469
  }
503
470
  // Check git status
@@ -505,11 +472,11 @@ async function publishNuGet(type, options) {
505
472
  checkGitClean(options.force);
506
473
  }
507
474
  // Detect project
508
- const spinner = (0, ora_1.default)('Detecting project...').start();
475
+ const spinner = ora('Detecting project...').start();
509
476
  let projectId;
510
477
  let pathWithNamespace;
511
478
  try {
512
- const glabOutput = (0, child_process_1.execSync)('glab api projects/:id -X GET', { encoding: 'utf-8' });
479
+ const glabOutput = execSync('glab api projects/:id -X GET', { encoding: 'utf-8' });
513
480
  const project = JSON.parse(glabOutput);
514
481
  projectId = project.id;
515
482
  pathWithNamespace = project.path_with_namespace;
@@ -525,20 +492,20 @@ async function publishNuGet(type, options) {
525
492
  let version = csprojManager.getVersion();
526
493
  // Handle version bump
527
494
  if (options.bump) {
528
- const newVersion = (0, core_1.incrementVersion)(version.replace(/-.*$/, ''), options.bump);
495
+ const newVersion = incrementVersion(version.replace(/-.*$/, ''), options.bump);
529
496
  csprojManager.setVersion(newVersion);
530
- console.log(chalk_1.default.gray('○'), `Version: ${version} → ${newVersion}`);
497
+ console.log(chalk.gray('○'), `Version: ${version} → ${newVersion}`);
531
498
  version = newVersion;
532
499
  }
533
- console.log(chalk_1.default.gray('○'), `Package: ${packageId}@${version}`);
500
+ console.log(chalk.gray('○'), `Package: ${packageId}@${version}`);
534
501
  // Build and pack
535
502
  if (!options.noBuild) {
536
- const buildSpinner = (0, ora_1.default)('Building and packing...').start();
503
+ const buildSpinner = ora('Building and packing...').start();
537
504
  const packResult = executor.pack({ configuration: 'Release' });
538
505
  if (!packResult.success) {
539
506
  buildSpinner.fail('Build failed');
540
507
  if (packResult.stderr) {
541
- console.error(chalk_1.default.gray(' '), packResult.stderr.trim());
508
+ console.error(chalk.gray(' '), packResult.stderr.trim());
542
509
  }
543
510
  throw new Error('dotnet pack failed');
544
511
  }
@@ -565,18 +532,18 @@ async function publishNuGet(type, options) {
565
532
  }
566
533
  }
567
534
  if (!nupkgPath) {
568
- console.error(chalk_1.default.red('✗'), '.nupkg file not found');
535
+ console.error(chalk.red('✗'), '.nupkg file not found');
569
536
  process.exit(1);
570
537
  }
571
- console.log(chalk_1.default.gray('○'), `Package: ${nupkgPath}`);
538
+ console.log(chalk.gray('○'), `Package: ${nupkgPath}`);
572
539
  // Push to GitLab
573
- const pushUrl = (0, adapters_nuget_1.buildProjectPushUrl)(projectId);
540
+ const pushUrl = buildProjectPushUrl(projectId);
574
541
  if (options.dryRun) {
575
- console.log(chalk_1.default.yellow('→'), 'Dry-run: skipping push');
576
- console.log(chalk_1.default.gray(' Would push to:'), pushUrl);
542
+ console.log(chalk.yellow('→'), 'Dry-run: skipping push');
543
+ console.log(chalk.gray(' Would push to:'), pushUrl);
577
544
  }
578
545
  else {
579
- const pushSpinner = (0, ora_1.default)('Pushing to GitLab NuGet registry...').start();
546
+ const pushSpinner = ora('Pushing to GitLab NuGet registry...').start();
580
547
  const pushResult = executor.push(nupkgPath, {
581
548
  source: pushUrl,
582
549
  apiKey: token,
@@ -595,14 +562,14 @@ async function publishNuGet(type, options) {
595
562
  else {
596
563
  pushSpinner.fail('Push failed');
597
564
  if (pushResult.stderr) {
598
- console.error(chalk_1.default.gray(' '), pushResult.stderr.trim());
565
+ console.error(chalk.gray(' '), pushResult.stderr.trim());
599
566
  }
600
567
  throw new Error('dotnet nuget push failed');
601
568
  }
602
569
  }
603
570
  console.log();
604
- console.log(chalk_1.default.green('✓'), 'Publish complete!');
605
- console.log(chalk_1.default.gray('Package URL:'), `https://gitlab.com/${pathWithNamespace}/-/packages`);
571
+ console.log(chalk.green('✓'), 'Publish complete!');
572
+ console.log(chalk.gray('Package URL:'), `https://gitlab.com/${pathWithNamespace}/-/packages`);
606
573
  }
607
574
  /**
608
575
  * Bump version in package.json
@@ -613,20 +580,20 @@ async function bumpVersion(pkgManager, type, bump) {
613
580
  if (type === 'dev') {
614
581
  // Dev version: x.y.z-dev.timestamp
615
582
  const timestamp = Date.now();
616
- newVersion = (0, core_1.addPrerelease)(currentVersion.replace(/-.*$/, ''), 'dev', timestamp);
583
+ newVersion = addPrerelease(currentVersion.replace(/-.*$/, ''), 'dev', timestamp);
617
584
  }
618
585
  else if (bump) {
619
586
  const baseVersion = currentVersion.replace(/-.*$/, '');
620
- newVersion = (0, core_1.incrementVersion)(baseVersion, bump);
587
+ newVersion = incrementVersion(baseVersion, bump);
621
588
  if (type === 'beta') {
622
- newVersion = (0, core_1.addPrerelease)(newVersion, 'beta', 0);
589
+ newVersion = addPrerelease(newVersion, 'beta', 0);
623
590
  }
624
591
  }
625
592
  else {
626
593
  return; // No bump needed
627
594
  }
628
595
  pkgManager.setVersion(newVersion);
629
- console.log(chalk_1.default.gray('○'), `Version: ${currentVersion} → ${newVersion}`);
596
+ console.log(chalk.gray('○'), `Version: ${currentVersion} → ${newVersion}`);
630
597
  }
631
598
  /**
632
599
  * Check git working directory is clean
@@ -634,18 +601,18 @@ async function bumpVersion(pkgManager, type, bump) {
634
601
  */
635
602
  function checkGitClean(force = false) {
636
603
  try {
637
- const status = (0, child_process_1.execSync)('git status --porcelain', { encoding: 'utf-8' });
604
+ const status = execSync('git status --porcelain', { encoding: 'utf-8' });
638
605
  if (status.trim()) {
639
606
  if (force) {
640
- console.log(chalk_1.default.yellow('⚠'), 'Git working directory is not clean');
641
- console.log(chalk_1.default.yellow(' →'), chalk_1.default.bold('It is strongly recommended to commit your changes before publishing'));
642
- console.log(chalk_1.default.gray(' Continuing with --force...'));
607
+ console.log(chalk.yellow('⚠'), 'Git working directory is not clean');
608
+ console.log(chalk.yellow(' →'), chalk.bold('It is strongly recommended to commit your changes before publishing'));
609
+ console.log(chalk.gray(' Continuing with --force...'));
643
610
  console.log();
644
611
  return false;
645
612
  }
646
613
  else {
647
- console.error(chalk_1.default.red('✗'), 'Git working directory is not clean');
648
- console.error(chalk_1.default.yellow('→'), 'Commit or stash changes, or use --force');
614
+ console.error(chalk.red('✗'), 'Git working directory is not clean');
615
+ console.error(chalk.yellow('→'), 'Commit or stash changes, or use --force');
649
616
  process.exit(1);
650
617
  }
651
618
  }
@@ -661,11 +628,11 @@ function checkGitClean(force = false) {
661
628
  */
662
629
  function createGitTag(version, manifestFile = 'package.json') {
663
630
  try {
664
- (0, child_process_1.execSync)(`git add ${manifestFile} && git commit -m "chore: release v${version}" --allow-empty`, {
631
+ execSync(`git add ${manifestFile} && git commit -m "chore: release v${version}" --allow-empty`, {
665
632
  stdio: 'pipe',
666
633
  });
667
- (0, child_process_1.execSync)(`git tag v${version}`, { stdio: 'pipe' });
668
- console.log(chalk_1.default.gray('○'), `Created tag: v${version}`);
634
+ execSync(`git tag v${version}`, { stdio: 'pipe' });
635
+ console.log(chalk.gray('○'), `Created tag: v${version}`);
669
636
  }
670
637
  catch {
671
638
  // Ignore errors
@@ -676,14 +643,14 @@ function createGitTag(version, manifestFile = 'package.json') {
676
643
  */
677
644
  function pushToRemote(includeTags) {
678
645
  try {
679
- (0, child_process_1.execSync)('git push', { stdio: 'pipe' });
646
+ execSync('git push', { stdio: 'pipe' });
680
647
  if (includeTags) {
681
- (0, child_process_1.execSync)('git push --tags', { stdio: 'pipe' });
648
+ execSync('git push --tags', { stdio: 'pipe' });
682
649
  }
683
- console.log(chalk_1.default.gray('○'), 'Pushed to remote');
650
+ console.log(chalk.gray('○'), 'Pushed to remote');
684
651
  }
685
652
  catch {
686
- console.log(chalk_1.default.yellow('⚠'), 'Failed to push (you can push manually)');
653
+ console.log(chalk.yellow('⚠'), 'Failed to push (you can push manually)');
687
654
  }
688
655
  }
689
656
  //# sourceMappingURL=publish.js.map