@salefronts/cli 1.3.0 → 1.5.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.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+
5
+ function run(cmd) {
6
+ return execSync(cmd, { encoding: "utf-8", stdio: "inherit" });
7
+ }
8
+
9
+ module.exports = function (args) {
10
+ const message = args[0];
11
+
12
+ if (!message) {
13
+ console.error("Usage: sf acp <commit-message>");
14
+ process.exit(1);
15
+ }
16
+
17
+ try {
18
+ run("git add .");
19
+ execSync(`git commit -m "${message.replace(/"/g, '\\"')}"`, {
20
+ encoding: "utf-8",
21
+ stdio: "inherit",
22
+ });
23
+ } catch {
24
+ process.exit(1);
25
+ }
26
+
27
+ try {
28
+ run("git push");
29
+ } catch {
30
+ console.error("Push failed, undoing commit...");
31
+ execSync("git reset --soft HEAD~1", { encoding: "utf-8", stdio: "inherit" });
32
+ process.exit(1);
33
+ }
34
+ };
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+
5
+ function run(cmd) {
6
+ return execSync(cmd, { encoding: "utf-8", stdio: "inherit" });
7
+ }
8
+
9
+ module.exports = function (args) {
10
+ const subcommand = args[0];
11
+
12
+ if (subcommand === "pull") {
13
+ run("HUSKY=0 git subrepo pull src/core");
14
+ } else if (subcommand === "push") {
15
+ run("HUSKY=0 git subrepo push src/core");
16
+ } else {
17
+ console.error("Usage: sf core <pull|push>");
18
+ process.exit(1);
19
+ }
20
+ };
package/commands/help.js CHANGED
@@ -19,7 +19,8 @@ function showHelp() {
19
19
  console.log(' seal Seal Kubernetes secrets');
20
20
  console.log(' unseal Unseal Kubernetes secrets');
21
21
  console.log(' env Generate .env file from K8s secret.yaml');
22
- console.log(' tag Tagging version for the latest commit on main')
22
+ console.log(' tag Tagging version for the latest commit on main');
23
+ console.log(' acp Git add, commit, and push (undo commit if push fails)');
23
24
  }
24
25
 
25
26
  module.exports = async function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salefronts/cli",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "bin": {
5
5
  "sf": "bin/sf"
6
6
  },