Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
big fixes, update info & update commands, create latest api dir
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jan 1, 2022
1 parent c8c5089 commit 82be4a1
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
RELEASE: ${{ github.event.inputs.release }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}

permissions: write-all

Expand Down Expand Up @@ -68,6 +67,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.RELEASE }}
name: "Editor of v${{ env.RELEASE }}"
repository: "scmn-dev/editor"
files: |
./tools/editor/editor.exe
Expand Down
19 changes: 0 additions & 19 deletions api/github/api.ts

This file was deleted.

16 changes: 16 additions & 0 deletions api/latest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import axios from "axios";

export const GetLatest = async (repo: string) => {
let url = "https://api.secman.dev/latest";

if (repo === "core") {
url = "https://api.secman.dev/latest-core";
}

try {
const res = await axios.get(url);
return res.data;
} catch (error) {
console.error(error);
}
};
1 change: 0 additions & 1 deletion constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import path from "path";
env.config();

export const PRIMARY_COLOR: any = "#1163E6";
export const GH_TOKEN: any = process.env.GH_TOKEN;
export const API_URL: any = "https://api.secman.dev";
export const HOMEDIR: any = process.env.HOME || process.env.USERPROFILE;
export const CHARS = {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/plugin-plugins": "^1.10.1",
"@types/bcrypt": "5.0.0",
"@types/crypto-js": "^4.0.2",
"@types/lodash.template": "^4.5.0",
"@types/node": "^16.11.6",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command, flags } from "@oclif/command";
import { GetLatestGHRelease } from "../../api/github/api";
import { GetLatest } from "../../api/latest";
import { readConfigFile } from "../../app/config";

export default class Info extends Command {
Expand All @@ -14,7 +14,7 @@ export default class Info extends Command {
async run() {
const { flags } = this.parse(Info);

const smca_version = await GetLatestGHRelease("core");
const smca_version = await GetLatest("core");
const name = readConfigFile("name") ?? "No User";

console.log(`Secman CLI
Expand Down
13 changes: 6 additions & 7 deletions src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { spinner } from "@secman/spinner";
import { platform } from "os";
import * as sh from "shelljs";
const powershell = require("powershell");
import { GetLatestGHRelease } from "../../api/github/api";
import { GetLatest } from "../../api/latest";
import { bold } from "../../design/layout";

export default class Update extends Command {
Expand All @@ -18,7 +18,7 @@ export default class Update extends Command {

const spnr = spinner("📦 Checking for updates...");
const currentVersion = "v" + this.config.version;
const latestVersion = await GetLatestGHRelease("secman");
const latestVersion = await GetLatest("secman")
const successMsg =
"Secman CLI upgraded to " + latestVersion + " successfully";

Expand All @@ -31,7 +31,7 @@ export default class Update extends Command {
"🚧 Upgrading Secman CLI from " +
bold(currentVersion) +
" to " +
bold(latestVersion) +
latestVersion +
"\n"
).start();

Expand All @@ -47,10 +47,9 @@ export default class Update extends Command {
sh.exec(`
if [ "$SM_PROVIDER" = "script" ]; then
sudo apt-get update && sudo apt-get update -y secman
elif [ "$SM_PROVIDER" = "brew" ]; then
brew upgrade secman
elif [ "$SM_PROVIDER" = "snap" ]; then
sudo snap refresh secman
elif [ "$SM_PROVIDER" != "script" ]; then
echo "if you are using a non-script provider, you must manually update the CLI"
echo "like if you installed it with homebrew, run 'brew upgrade secman'"
else
npm upgrade -g secman
fi
Expand Down
1 change: 0 additions & 1 deletion src/commands/whoami.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Command, flags } from "@oclif/command";
import { readConfigFile } from "../../app/config";
import { PRIMARY_COLOR } from "../../constants";
import { bold, withPrimary } from "../../design/layout";

export default class WhoamI extends Command {
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,6 @@
resolved "https://registry.yarnpkg.com/@types/aws-lambda/-/aws-lambda-8.10.88.tgz#1f18ac2e15be30376e86a688a943390e7d6683e5"
integrity sha512-Gbdr5tmGMGV1bgWDEfgNnfqtS9YVKDCkyAgYPmYIeEQFTSjU+VzVoE0Gc1MyrzREdk3Iu5daUCRU9eQL5s+iYQ==

"@types/[email protected]":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@types/bcrypt/-/bcrypt-5.0.0.tgz#a835afa2882d165aff5690893db314eaa98b9f20"
integrity sha512-agtcFKaruL8TmcvqbndlqHPSJgsolhf/qPWchFlgnW1gECTN/nKbFcoFnvKAQRFfKbh+BO6A3SWdJu9t+xF3Lw==
dependencies:
"@types/node" "*"

"@types/btoa-lite@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/btoa-lite/-/btoa-lite-1.0.0.tgz#e190a5a548e0b348adb0df9ac7fa5f1151c7cca4"
Expand Down

0 comments on commit 82be4a1

Please sign in to comment.