@dotenc/cli 0.1.0 → 0.1.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/src/cli.js +0 -0
- package/dist/src/commands/init.js +3 -3
- package/dist/src/commands/prompts/chooseEnvironment.js +1 -1
- package/dist/src/commands/token/export.js +1 -1
- package/dist/src/commands/token/import.js +1 -1
- package/dist/src/helpers/getDefaultEditor.js +1 -1
- package/dist/src/helpers/token.js +1 -1
- package/package.json +2 -2
package/dist/src/cli.js
CHANGED
|
File without changes
|
|
@@ -22,8 +22,8 @@ export const initCommand = async (environmentArg) => {
|
|
|
22
22
|
// Output success message
|
|
23
23
|
console.log("Initialization complete!");
|
|
24
24
|
console.log("Next steps:");
|
|
25
|
-
console.log(`1. Use "
|
|
26
|
-
console.log(`2. Use "
|
|
27
|
-
console.log('3. Use "
|
|
25
|
+
console.log(`1. Use "dotenc edit -e ${environment}" to securely edit your safe environment variables.`);
|
|
26
|
+
console.log(`2. Use "dotenc run -e ${environment} <command> [args...]" to run your application.`);
|
|
27
|
+
console.log('3. Use "dotenc init -e [environment]" to initialize a new environment.');
|
|
28
28
|
console.log("4. Use the git-ignored .env file to edit your local environment variables. They will have priority over any safe environment.");
|
|
29
29
|
};
|
|
@@ -4,7 +4,7 @@ export const chooseEnvironmentPrompt = async (message) => {
|
|
|
4
4
|
const files = await fs.readdir(process.cwd());
|
|
5
5
|
const envFiles = files.filter((file) => file.startsWith(".env.") && file.endsWith(".enc"));
|
|
6
6
|
if (!envFiles.length) {
|
|
7
|
-
console.log('No environment files found. To create a new environment, run "
|
|
7
|
+
console.log('No environment files found. To create a new environment, run "dotenc init"');
|
|
8
8
|
}
|
|
9
9
|
const result = await inquirer.prompt([
|
|
10
10
|
{
|
|
@@ -4,7 +4,7 @@ export const tokenExportCommand = async (environmentArg) => {
|
|
|
4
4
|
const environment = environmentArg;
|
|
5
5
|
const { projectId } = await getProjectConfig();
|
|
6
6
|
if (!projectId) {
|
|
7
|
-
throw new Error('No project found. Run "
|
|
7
|
+
throw new Error('No project found. Run "dotenc init" to create one.');
|
|
8
8
|
}
|
|
9
9
|
const token = await getToken(environment);
|
|
10
10
|
console.log(`Token for the ${environment} environment: ${token}`);
|
|
@@ -4,7 +4,7 @@ export const tokenImportCommand = async (token, environmentArg) => {
|
|
|
4
4
|
const environment = environmentArg;
|
|
5
5
|
const { projectId } = await getProjectConfig();
|
|
6
6
|
if (!projectId) {
|
|
7
|
-
throw new Error('No project found. Run "
|
|
7
|
+
throw new Error('No project found. Run "dotenc init" to create one.');
|
|
8
8
|
}
|
|
9
9
|
await addToken(projectId, environment, token);
|
|
10
10
|
console.log(`Token imported to the ${environment} environment.`);
|
|
@@ -37,5 +37,5 @@ export const getDefaultEditor = async () => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
// If no editor is found, throw an error
|
|
40
|
-
throw new Error('No text editor found. Please set the EDITOR environment variable, configure an editor using "
|
|
40
|
+
throw new Error('No text editor found. Please set the EDITOR environment variable, configure an editor using "dotenc config editor <command>", or install a text editor (e.g., nano, vim, or notepad).');
|
|
41
41
|
};
|
|
@@ -13,7 +13,7 @@ export const getToken = async (environment) => {
|
|
|
13
13
|
const tokens = JSON.parse(await fs.readFile(tokensFile, "utf-8"));
|
|
14
14
|
return tokens[projectId][environment];
|
|
15
15
|
}
|
|
16
|
-
throw new Error("No token found. Please set the TOKEN environment variable or import the token using `
|
|
16
|
+
throw new Error("No token found. Please set the TOKEN environment variable or import the token using `dotenc import-token -e <environment> <token>`.");
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Adds or updates a token for a specific project and environment.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotenc/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "🔐 Secure, encrypted environment variables that live in your codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"dotenc": "./dist/cli.js"
|
|
7
|
+
"dotenc": "./dist/src/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|