@aikidosec/safe-chain 1.0.11 → 1.0.12
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/README.md +4 -4
- package/bin/safe-chain.js +10 -10
- package/package.json +1 -1
- package/src/shell-integration/{setupShell.js → setup.js} +1 -1
- package/src/shell-integration/{setupShell.spec.js → setup.spec.js} +1 -1
- package/src/shell-integration/{removeShell.js → teardown.js} +1 -1
- package/src/shell-integration/{removeShell.spec.js → teardown.spec.js} +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Installing the Aikido Safe Chain is easy. You just need 3 simple steps:
|
|
|
14
14
|
```
|
|
15
15
|
2. **Setup the shell integration** by running:
|
|
16
16
|
```shell
|
|
17
|
-
safe-chain setup
|
|
17
|
+
safe-chain setup
|
|
18
18
|
```
|
|
19
19
|
3. **Restart your terminal** to start using the Aikido Safe Chain.
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ The Aikido Safe Chain will setup aliases in your shell for the commands **npm**,
|
|
|
26
26
|
|
|
27
27
|
### Creating shell aliases
|
|
28
28
|
|
|
29
|
-
The `setup
|
|
29
|
+
The `setup` command will detect which shells are installed and add the aliases for **npm**, **npx**, and **yarn** to your shell startup scripts.
|
|
30
30
|
|
|
31
31
|
Supported shells include:
|
|
32
32
|
|
|
@@ -40,7 +40,7 @@ After adding the alias, **the shell needs to restart in order to load the alias*
|
|
|
40
40
|
|
|
41
41
|
### Removing shell aliases
|
|
42
42
|
|
|
43
|
-
The `
|
|
43
|
+
The `teardown` command will remove the aliases for **npm**, **npx**, and **yarn** from your shell startup scripts. This is useful if you want to stop using the Aikido Safe Chain or if you want to switch to a different package manager.
|
|
44
44
|
|
|
45
45
|
## Uninstallation
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ To uninstall the Aikido Safe Chain, you can run the following command:
|
|
|
48
48
|
|
|
49
49
|
1. **Remove all aliases from your shell** by running:
|
|
50
50
|
```shell
|
|
51
|
-
safe-chain
|
|
51
|
+
safe-chain teardown
|
|
52
52
|
```
|
|
53
53
|
2. **Uninstall the Aikido Safe Chain package** using npm:
|
|
54
54
|
```shell
|
package/bin/safe-chain.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { ui } from "../src/environment/userInteraction.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { setup } from "../src/shell-integration/setup.js";
|
|
6
|
+
import { teardown } from "../src/shell-integration/teardown.js";
|
|
7
7
|
|
|
8
8
|
if (process.argv.length < 3) {
|
|
9
9
|
ui.writeError("No command provided. Please provide a command to execute.");
|
|
@@ -19,10 +19,10 @@ if (command === "help" || command === "--help" || command === "-h") {
|
|
|
19
19
|
process.exit(0);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
if (command === "setup
|
|
23
|
-
|
|
24
|
-
} else if (command === "
|
|
25
|
-
|
|
22
|
+
if (command === "setup") {
|
|
23
|
+
setup();
|
|
24
|
+
} else if (command === "teardown") {
|
|
25
|
+
teardown();
|
|
26
26
|
} else {
|
|
27
27
|
ui.writeError(`Unknown command: ${command}.`);
|
|
28
28
|
ui.emptyLine();
|
|
@@ -38,19 +38,19 @@ function writeHelp() {
|
|
|
38
38
|
);
|
|
39
39
|
ui.emptyLine();
|
|
40
40
|
ui.writeInformation(
|
|
41
|
-
`Available commands: ${chalk.cyan("setup
|
|
42
|
-
"
|
|
41
|
+
`Available commands: ${chalk.cyan("setup")}, ${chalk.cyan(
|
|
42
|
+
"teardown"
|
|
43
43
|
)}, ${chalk.cyan("help")}`
|
|
44
44
|
);
|
|
45
45
|
ui.emptyLine();
|
|
46
46
|
ui.writeInformation(
|
|
47
47
|
`- ${chalk.cyan(
|
|
48
|
-
"safe-chain setup
|
|
48
|
+
"safe-chain setup"
|
|
49
49
|
)}: This will setup your shell to wrap safe-chain around npm, npx and yarn.`
|
|
50
50
|
);
|
|
51
51
|
ui.writeInformation(
|
|
52
52
|
`- ${chalk.cyan(
|
|
53
|
-
"safe-chain
|
|
53
|
+
"safe-chain teardown"
|
|
54
54
|
)}: This will remove safe-chain aliases from your shell configuration.`
|
|
55
55
|
);
|
|
56
56
|
ui.emptyLine();
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { getAliases } from "./helpers.js";
|
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import { EOL } from "os";
|
|
7
7
|
|
|
8
|
-
export async function
|
|
8
|
+
export async function setup() {
|
|
9
9
|
ui.writeInformation(
|
|
10
10
|
chalk.bold("Setting up shell aliases.") +
|
|
11
11
|
" This will wrap safe-chain around npm, npx, and yarn commands."
|
|
@@ -3,7 +3,7 @@ import assert from "node:assert";
|
|
|
3
3
|
import { EOL, tmpdir } from "node:os";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { getAliases } from "./helpers.js";
|
|
6
|
-
import { readOrCreateStartupFile, appendAliasesToFile } from "./
|
|
6
|
+
import { readOrCreateStartupFile, appendAliasesToFile } from "./setup.js";
|
|
7
7
|
|
|
8
8
|
describe("setupShell", () => {
|
|
9
9
|
function runSetupTestsForEnvironment(shell, startupExtension, expectedAliases) {
|
|
@@ -5,7 +5,7 @@ import { getAliases } from "./helpers.js";
|
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import { EOL } from "os";
|
|
7
7
|
|
|
8
|
-
export async function
|
|
8
|
+
export async function teardown() {
|
|
9
9
|
ui.writeInformation(
|
|
10
10
|
chalk.bold("Removing shell aliases.") +
|
|
11
11
|
" This will remove safe-chain aliases for npm, npx, and yarn commands."
|
|
@@ -3,9 +3,9 @@ import assert from "node:assert";
|
|
|
3
3
|
import { EOL, tmpdir } from "node:os";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { getAliases } from "./helpers.js";
|
|
6
|
-
import { removeAliasesFromFile } from "./
|
|
6
|
+
import { removeAliasesFromFile } from "./teardown.js";
|
|
7
7
|
|
|
8
|
-
describe("
|
|
8
|
+
describe("teardown", () => {
|
|
9
9
|
function runRemovalTestsForEnvironment(shell, startupExtension, expectedAliases) {
|
|
10
10
|
describe(`${shell} shell removal`, () => {
|
|
11
11
|
it(`should remove aliases from ${shell} file`, () => {
|