@maka/maka-cli 5.140.0 → 5.142.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maka/maka-cli",
3
- "version": "5.140.0",
3
+ "version": "5.142.0",
4
4
  "type": "module",
5
5
  "summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
6
6
  "description": "A command line tool for scaffolding Meteor 3.x applications using React.",
@@ -9,9 +9,8 @@ const EnvCommand = Command.create({
9
9
  description: `
10
10
  Set or read secrets (KEY VALUE pairs) in a config/<env>/process.env file.
11
11
 
12
- Values are encrypted in place with dotenvx (https://dotenvx.com) for every
13
- environment except local, which stays plaintext for easy local development.
14
- The encrypted process.env and its DOTENV_PUBLIC_KEY are safe to commit; the
12
+ Values are encrypted in place with dotenvx (https://dotenvx.com). The
13
+ encrypted process.env and its DOTENV_PUBLIC_KEY are safe to commit; the
15
14
  sibling .env.keys file holding the private key is gitignored and must never
16
15
  be committed.
17
16
  `,
@@ -4,15 +4,10 @@ import { Log } from '../../tools/log/log.class.js';
4
4
  * Prompts for which environment to target when --env wasn't given.
5
5
  */
6
6
  export async function promptForEnv(cfg, opts = {}) {
7
- const { message = 'Which environment?', excludeLocal = false } = opts;
8
- let configs = cfg.getAppProjectConfigs();
9
- if (excludeLocal) {
10
- configs = configs.filter(config => config !== 'local');
11
- }
7
+ const { message = 'Which environment?' } = opts;
8
+ const configs = cfg.getAppProjectConfigs();
12
9
  if (configs.length === 0) {
13
- Log.error(excludeLocal
14
- ? 'No configuration other than local found. Consider running "maka g:config production" first.'
15
- : 'No configurations found. Consider running "maka g:config local" first.');
10
+ Log.error('No configurations found. Consider running "maka g:config local" first.');
16
11
  process.exit(1);
17
12
  }
18
13
  if (configs.length === 1) {
@@ -23,9 +23,8 @@ Command.create({
23
23
  a MongoDB connection string with a query string:
24
24
  maka env:set --env production MONGO_URL "mongodb+srv://user:pass@host/db?retryWrites=true&w=majority"
25
25
 
26
- For every environment except local, the value is encrypted in place with
27
- dotenvx -- the file's DOTENV_PUBLIC_KEY is generated on first use if it
28
- doesn't already exist. local stays plaintext for easy local development.
26
+ The value is encrypted in place with dotenvx -- the file's DOTENV_PUBLIC_KEY
27
+ is generated on first use if it doesn't already exist.
29
28
  `,
30
29
  examples: [
31
30
  'maka env:set --env production MONGO_URL mongodb://localhost:27017/app',
@@ -34,7 +33,7 @@ Command.create({
34
33
  ]
35
34
  }, async function (args, opts) {
36
35
  try {
37
- const env = opts.env ? this.cfg.getEnvFromShorthand(opts.env) : await promptForEnv(this.cfg, { excludeLocal: true });
36
+ const env = opts.env ? this.cfg.getEnvFromShorthand(opts.env) : await promptForEnv(this.cfg);
38
37
  if (!this.cfg.checkConfigExists(env)) {
39
38
  Log.error(`No configuration: ${env}, consider running "maka g:config ${env}"`);
40
39
  process.exit(1);
@@ -47,8 +46,8 @@ Command.create({
47
46
  for (let i = 0; i < args.length; i += 2) {
48
47
  const key = args[i];
49
48
  const value = args[i + 1];
50
- await this.dotenvx.set(key, value, processEnvPath, { plain: env === 'local' });
51
- Log.success(`Set ${key} in config/${env}/process.env${(env === 'local') ? '' : ' (encrypted)'}`);
49
+ await this.dotenvx.set(key, value, processEnvPath);
50
+ Log.success(`Set ${key} in config/${env}/process.env (encrypted)`);
52
51
  }
53
52
  }
54
53
  catch (e) {
@@ -65,9 +65,7 @@ Generator.create({
65
65
  context,
66
66
  config
67
67
  });
68
- if (destinationKey !== 'local') {
69
- Log.notice(`config/${destinationKey}/process.env starts as plaintext; use "maka env:set --env ${destinationKey} KEY VALUE" to add secrets, which encrypts them with dotenvx on first use.`);
70
- }
68
+ Log.notice(`config/${destinationKey}/process.env starts as plaintext; use "maka env:set --env ${destinationKey} KEY VALUE" to add secrets, which encrypts them with dotenvx on first use.`);
71
69
  }
72
70
  catch (error) {
73
71
  Log.error(error);
@@ -1,5 +1,5 @@
1
1
  // Dotenvx wrapper: loads (and transparently decrypts) process.env-style files,
2
- // and sets/gets individual secrets, encrypting on first use for non-local envs.
2
+ // and sets/gets individual secrets, encrypting on first use.
3
3
  import path from 'path';
4
4
  import dotenvxPkg from '@dotenvx/dotenvx';
5
5
  import { Log } from '../log/log.class.js';
@@ -36,13 +36,12 @@ export class DOTENVX {
36
36
  }
37
37
  /**
38
38
  * Sets a single KEY=value pair into a .env-style file, creating the file's
39
- * keypair on first use if needed. Encrypted by default (matching encrypt());
40
- * pass plain: true to write it unencrypted (used for the local environment).
39
+ * keypair on first use if needed. Always encrypted.
41
40
  */
42
- async set(key, value, filePath, opts = {}) {
41
+ async set(key, value, filePath) {
43
42
  try {
44
43
  const envKeysFile = path.join(path.dirname(filePath), '.env.keys');
45
- await setDotenvxValue(key, value, { path: filePath, envKeysFile, encrypt: !opts.plain });
44
+ await setDotenvxValue(key, value, { path: filePath, envKeysFile, encrypt: true });
46
45
  }
47
46
  catch (e) {
48
47
  errorHandler('set()', e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maka/maka-cli",
3
- "version": "5.140.0",
3
+ "version": "5.142.0",
4
4
  "type": "module",
5
5
  "summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
6
6
  "description": "A command line tool for scaffolding Meteor 3.x applications using React.",