@multiplatform.one/cli 1.0.31 → 1.0.32

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.
@@ -14,7 +14,9 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
14
14
  if ((await execa("git", [
15
15
  "rev-parse",
16
16
  "--is-inside-work-tree"
17
- ])).stdout.trim() === "true") {
17
+ ], {
18
+ reject: false
19
+ })).exitCode === 0) {
18
20
  throw new Error("multiplatform.one cannot be initialized inside a git repository");
19
21
  }
20
22
  const cookieCutterConfig = {
@@ -42,14 +44,18 @@ program.command("update").argument("[remote]", "the remote to use", "https://git
42
44
  if ((await execa("git", [
43
45
  "rev-parse",
44
46
  "--is-inside-work-tree"
45
- ])).stdout.trim() !== "true") {
47
+ ], {
48
+ reject: false
49
+ })).exitCode !== 0) {
46
50
  throw new Error("multiplatform.one cannot be updated outside of a git repository");
47
51
  }
48
52
  if ((await execa("git", [
49
53
  "diff",
50
54
  "--cached",
51
55
  "--quiet"
52
- ])).stdout.trim() !== "true") {
56
+ ], {
57
+ reject: false
58
+ })).exitCode !== 0) {
53
59
  throw new Error("multiplatform.one cannot be updated with uncommitted changes");
54
60
  }
55
61
  const projectRoot = (await execa("git", [
@@ -73,8 +79,8 @@ program.command("update").argument("[remote]", "the remote to use", "https://git
73
79
  cookieCutterConfigFile,
74
80
  remote
75
81
  ], {
76
- stdio: "inherit",
77
- cwd: projectRoot
82
+ cwd: projectRoot,
83
+ stdio: "inherit"
78
84
  });
79
85
  });
80
86
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/cli",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "author": "BitSpur <support@bitspur.com> (https://bitspur.com)",
5
5
  "contributors": [
6
6
  {
@@ -52,7 +52,7 @@
52
52
  "@types/node": "~20.12.13",
53
53
  "tsup": "^8.1.0",
54
54
  "typescript": "~5.3.3",
55
- "@multiplatform.one/utils": "^0.0.16"
55
+ "@multiplatform.one/utils": "^0.0.17"
56
56
  },
57
57
  "dependencies": {
58
58
  "commander": "^9.5.0",
@@ -43,7 +43,7 @@ program
43
43
  .option('--name <name>', 'the name of the project')
44
44
  .description('init multiplatform.one')
45
45
  .action(async (remote) => {
46
- if ((await execa('git', ['rev-parse', '--is-inside-work-tree'])).stdout.trim() === 'true') {
46
+ if ((await execa('git', ['rev-parse', '--is-inside-work-tree'], { reject: false })).exitCode === 0) {
47
47
  throw new Error('multiplatform.one cannot be initialized inside a git repository');
48
48
  }
49
49
  const cookieCutterConfig: CookieCutterConfig = {
@@ -81,10 +81,16 @@ program
81
81
  .argument('[remote]', 'the remote to use', 'https://gitlab.com/bitspur/multiplatform.one/cookiecutter')
82
82
  .description('update multiplatform.one')
83
83
  .action(async (remote) => {
84
- if ((await execa('git', ['rev-parse', '--is-inside-work-tree'])).stdout.trim() !== 'true') {
84
+ if ((await execa('git', ['rev-parse', '--is-inside-work-tree'], { reject: false })).exitCode !== 0) {
85
85
  throw new Error('multiplatform.one cannot be updated outside of a git repository');
86
86
  }
87
- if ((await execa('git', ['diff', '--cached', '--quiet'])).stdout.trim() !== 'true') {
87
+ if (
88
+ (
89
+ await execa('git', ['diff', '--cached', '--quiet'], {
90
+ reject: false,
91
+ })
92
+ ).exitCode !== 0
93
+ ) {
88
94
  throw new Error('multiplatform.one cannot be updated with uncommitted changes');
89
95
  }
90
96
  const projectRoot = (await execa('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
@@ -112,8 +118,8 @@ program
112
118
  remote,
113
119
  ],
114
120
  {
115
- stdio: 'inherit',
116
121
  cwd: projectRoot,
122
+ stdio: 'inherit',
117
123
  },
118
124
  );
119
125
  });