climaybe 1.4.0 → 1.4.2

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/bin/cli.js CHANGED
@@ -1,13 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { readFileSync, existsSync } from 'node:fs';
3
4
  import { createRequire } from 'node:module';
4
5
  import { dirname, join } from 'node:path';
5
6
  import { fileURLToPath } from 'node:url';
6
7
  import { run } from '../src/index.js';
7
8
 
8
- // Resolve version from package.json next to this bin (works with npm link / global install)
9
9
  const require = createRequire(import.meta.url);
10
10
  const binDir = dirname(fileURLToPath(import.meta.url));
11
- const pkg = require(join(binDir, '..', 'package.json'));
11
+ const packageDir = join(binDir, '..');
12
12
 
13
- run(process.argv, pkg.version);
13
+ // Prefer version baked at publish (bin/version.txt) so the running binary always reports its own version
14
+ const versionFile = join(binDir, 'version.txt');
15
+ let version;
16
+ if (existsSync(versionFile)) {
17
+ version = readFileSync(versionFile, 'utf8').trim();
18
+ } else {
19
+ version = require(join(packageDir, 'package.json')).version;
20
+ }
21
+
22
+ run(process.argv, version, packageDir);
@@ -0,0 +1 @@
1
+ 1.4.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "climaybe",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Shopify CI/CD CLI — scaffolds workflows, branch strategy, and store config for single-store and multi-store theme repos",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,8 @@
31
31
  "homepage": "https://github.com/electricmaybe/climaybe#readme",
32
32
  "scripts": {
33
33
  "test": "node scripts/run-tests.js 2>&1 | tee test.log",
34
- "prepare": "husky"
34
+ "prepare": "husky",
35
+ "prepublishOnly": "node -e \"require('fs').writeFileSync('bin/version.txt', require('./package.json').version)\""
35
36
  },
36
37
  "release": {
37
38
  "branches": [
package/src/index.js CHANGED
@@ -8,14 +8,16 @@ import { updateWorkflowsCommand } from './commands/update-workflows.js';
8
8
  /**
9
9
  * Create the CLI program (for testing and for run).
10
10
  * @param {string} [version] - Version string (from bin/cli.js when run as CLI; from package.json in tests).
11
+ * @param {string} [packageDir] - Package root dir (shown with --version so user can see which install is running).
11
12
  */
12
- export function createProgram(version = '0.0.0') {
13
+ export function createProgram(version = '0.0.0', packageDir = '') {
13
14
  const program = new Command();
15
+ const versionDisplay = packageDir ? `${version}\n from: ${packageDir}` : version;
14
16
 
15
17
  program
16
18
  .name('climaybe')
17
19
  .description('Shopify CI/CD CLI — scaffolds workflows, branch strategy, and store config')
18
- .version(version);
20
+ .version(versionDisplay);
19
21
 
20
22
  program
21
23
  .command('init')
@@ -52,6 +54,6 @@ export function createProgram(version = '0.0.0') {
52
54
  return program;
53
55
  }
54
56
 
55
- export function run(argv, version) {
56
- createProgram(version).parse(argv);
57
+ export function run(argv, version, packageDir = '') {
58
+ createProgram(version, packageDir).parse(argv);
57
59
  }
@@ -86,8 +86,15 @@ jobs:
86
86
  fi
87
87
  echo "Shopify credentials are configured for alias: ${{ steps.resolve.outputs.alias }}"
88
88
 
89
+ cleanup-themes:
90
+ needs: extract-pr-number
91
+ uses: ./.github/workflows/reusable-cleanup-themes.yml
92
+ with:
93
+ pr_number: ${{ needs.extract-pr-number.outputs.pr_number }}
94
+ secrets: inherit
95
+
89
96
  share-theme:
90
- needs: [validate-environment, extract-pr-number]
97
+ needs: [validate-environment, extract-pr-number, cleanup-themes]
91
98
  uses: ./.github/workflows/reusable-share-theme.yml
92
99
  with:
93
100
  pr_number: ${{ needs.extract-pr-number.outputs.pr_number }}