@noahyu/cd-cli 1.2.0 → 1.2.1

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/dist/bin/cli.js CHANGED
@@ -3,7 +3,9 @@ import { program } from 'commander';
3
3
  import { deployCommand, initConfig, listVersions, rollbackVersion } from '../src/index.js';
4
4
  import { getVersion } from '../src/utils/get-version.js';
5
5
 
6
- program.version(getVersion(), '-v, --version').description('Simple CI/CD deployment tool');
6
+ program
7
+ .version(getVersion('../../package.json', import.meta.url), '-v, --version')
8
+ .description('Simple CI/CD deployment tool');
7
9
  program
8
10
  .command('deploy')
9
11
  .alias('cd')
@@ -1,13 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import fse from 'fs-extra';
3
3
  import parseJson from 'parse-json';
4
- import { fileURLToPath } from 'url';
5
- import { dirname, join } from 'path';
6
4
 
7
- function getVersion() {
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
- const packageJsonPath = join(__dirname, '../../package.json');
5
+ function getVersion(path, baseUrl) {
6
+ const packageJsonPath = new URL(path, baseUrl);
11
7
  let packageJsonContent;
12
8
  try {
13
9
  packageJsonContent = fse.readFileSync(packageJsonPath, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noahyu/cd-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Global CLI tool for simple project deployment with version management",
5
5
  "type": "module",
6
6
  "main": "./dist/bin/cli.js",