@bostonuniversity/buwp-local 0.5.1 → 0.5.2

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.
@@ -174,6 +174,44 @@ async function setupCommand(options) {
174
174
  console.log(chalk.gray('You can override specific credentials per-project using .env.local files.\n'));
175
175
  }
176
176
 
177
+ /**
178
+ * Prompt user to delete the source credentials file
179
+ * @param {string} filePath - Path to the file to delete
180
+ * @param {boolean} hasFailures - Whether some credentials failed to import
181
+ */
182
+ async function promptToDeleteSourceFile(filePath, hasFailures = false) {
183
+ const fileExists = fs.existsSync(filePath);
184
+ if (!fileExists) {
185
+ return; // File already deleted or doesn't exist
186
+ }
187
+
188
+ console.log(chalk.yellow('🔐 Source Credentials File Security'));
189
+ console.log(chalk.gray(` Location: ${filePath}`));
190
+ console.log(chalk.gray(' This file contains plaintext credentials and should be deleted.'));
191
+ console.log('');
192
+
193
+ const defaultDelete = !hasFailures; // Default to yes if all imported successfully
194
+ const { shouldDelete } = await prompts({
195
+ type: 'confirm',
196
+ name: 'shouldDelete',
197
+ message: 'Delete the source credentials file now?',
198
+ initial: defaultDelete
199
+ });
200
+
201
+ if (shouldDelete) {
202
+ try {
203
+ fs.unlinkSync(filePath);
204
+ console.log(chalk.green(`✓ Deleted: ${filePath}\n`));
205
+ } catch (err) {
206
+ console.log(chalk.red(`✗ Failed to delete file: ${err.message}`));
207
+ console.log(chalk.yellow(`⚠️ Please manually delete: ${filePath}\n`));
208
+ }
209
+ } else {
210
+ console.log(chalk.yellow(`⚠️ Remember to manually delete: ${filePath}`));
211
+ console.log(chalk.yellow(' This file contains plaintext credentials.\n'));
212
+ }
213
+ }
214
+
177
215
  /**
178
216
  * Bulk import credentials from JSON file
179
217
  * @param {string} filePath - Path to credentials JSON file
@@ -289,6 +327,16 @@ async function bulkImportFromFile(filePath, force) {
289
327
 
290
328
  console.log(chalk.gray('These credentials will be used automatically by all buwp-local projects.'));
291
329
  console.log(chalk.gray('You can override specific credentials per-project using .env.local files.\n'));
330
+
331
+ // Offer to delete the source file
332
+ if (failCount === 0) {
333
+ // All credentials imported successfully - safe to delete
334
+ await promptToDeleteSourceFile(filePath);
335
+ } else if (successCount > 0) {
336
+ // Some imported successfully - ask with a warning
337
+ console.log(chalk.yellow('⚠️ Not all credentials imported successfully.\n'));
338
+ await promptToDeleteSourceFile(filePath, true);
339
+ }
292
340
  }
293
341
 
294
342
  /**
@@ -81,6 +81,8 @@ async function startCommand(options) {
81
81
  const tempEnvFileFlag = tempEnvPath ? `--env-file ${tempEnvPath}` : '';
82
82
 
83
83
  try {
84
+ // This is the actual docker compose up command that starts everything
85
+ // If there is a local .env file, it will take over the temp env file generated from the keychain, because it is specified last.
84
86
  execSync(
85
87
  `docker compose -p ${projectName} ${tempEnvFileFlag} ${envFileFlag} -f ${composePath} up -d`,
86
88
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bostonuniversity/buwp-local",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Local WordPress development environment for Boston University projects",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BU WordPress Local Development
2
2
 
3
- This repository contains resources and instructions for setting up a local WordPress development environment for Boston University projects. It uses the BU WordPress container image and provides the additional resoures needed to run it locally with Docker.
3
+ This repository contains resources and instructions for setting up a local WordPress development environment for Boston University projects. It uses the BU WordPress container image and provides the additional resources needed to run it locally with Docker.
4
4
 
5
5
 
6
6
  ## Quickstart for plugin or theme development
@@ -43,6 +43,10 @@ This repository contains resources and instructions for setting up a local WordP
43
43
 
44
44
  This will guide you through setting up your project name, hostname, port mappings, volume mappings, and service options.
45
45
 
46
+ If you choose plugin, theme, or mu-plugin project type, the setup will automatically add volume mappings for your current directory into the appropriate WordPress location in the container.
47
+
48
+ If you choose sandbox project type, you will need to manually add volume mappings to your `.buwp-local.json` file later, or you can run without any volume mappings.
49
+
46
50
  6. **Setup local hostname**: Add your project's local hostname (e.g. `myproject.local`) to your `/etc/hosts` file
47
51
 
48
52
  7. **Start your local environment**:
@@ -80,3 +84,11 @@ Your local WordPress site should now be accessible at the hostname you configure
80
84
  ```
81
85
 
82
86
  This will download the latest snapshot from the specified source and import it into your local WordPress environment.
87
+
88
+
89
+
90
+
91
+ scp username@ist-wp-app-dv01.bu.edu:/etc/ist-apps/buwp-local-credentials.json ~/Downloads/
92
+
93
+
94
+ scp jaydub@ist-wp-app-dv01.bu.edu:/etc/ist-apps/buwp-local-credentials.json ~/Downloads/