wp-blank-scripts 2.6.1 → 2.6.4

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/cli/deploy.js CHANGED
@@ -8,7 +8,6 @@ const { DEPLOY_OPTIONS, DEPLOY_MODES } = require('../constants');
8
8
 
9
9
  const getSettings = require('../utils/projectSettings');
10
10
  const exitWithError = require('../utils/exitWithError');
11
- // TODO: Move into function
12
11
  const settings = getSettings();
13
12
  const logger = require('../logger');
14
13
 
package/cli/import.js CHANGED
@@ -1,7 +1,10 @@
1
+ const glob = require('glob');
2
+
1
3
  const importSQL = require('../lib/importSQL');
2
4
  const logger = require('../logger');
3
5
  const getCliOptions = require('../utils/getCliOptions');
4
6
  const exitWithError = require('../utils/exitWithError');
7
+ const getSettings = require('../utils/projectSettings');
5
8
  const getMostRecentSqlFile = require('../utils/getMostRecentSqlFile');
6
9
 
7
10
  // Constants
@@ -21,6 +24,10 @@ function getEnvironmentFromFileName(file) {
21
24
  }
22
25
 
23
26
  module.exports = async () => {
27
+ const settings = getSettings();
28
+ const sqlDir = settings.directories.sql;
29
+ const sqlFiles = glob.sync(`${sqlDir}/**/*.sql`);
30
+
24
31
  try {
25
32
  const options = await getCliOptions([
26
33
  {
package/index.js CHANGED
@@ -72,6 +72,9 @@ yargs
72
72
  })
73
73
  .option('serverPassword', {
74
74
  describe: 'The password for the configured user on the server, if sql is true.',
75
+ })
76
+ .option('serverPrivateKey', {
77
+ describe: 'The path to private key efaults to ~/.ssh/id_rsa',
75
78
  }),
76
79
  deploy
77
80
  )
@@ -15,6 +15,7 @@ const { DEPLOY_MODES } = require('../constants');
15
15
  const getProjectPath = require('../utils/getProjectPath');
16
16
  const getSettings = require('../utils/projectSettings');
17
17
  const logger = require('../logger');
18
+ const replaceSQL = require('../utils/replaceSQL');
18
19
 
19
20
  // Default options
20
21
  const defaultOptions = {
@@ -272,10 +273,16 @@ module.exports = async (selectOptions, callbacks) => {
272
273
  await createTunnel();
273
274
  await connectMySQL();
274
275
  const file = isCI()
275
- ? getMostRecentSqlFile()
276
+ ? getMostRecentSqlFile(true)
276
277
  : await exportSql({ environment: options.environment });
277
278
 
278
279
  if (file) {
280
+ await replaceSQL({
281
+ environmentIn: 'local',
282
+ environmentOut: options.environment,
283
+ file,
284
+ });
285
+
279
286
  await deployMySQL(file);
280
287
  }
281
288
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-blank-scripts",
3
- "version": "2.6.1",
3
+ "version": "2.6.4",
4
4
  "description": "Personal Wordpress Scripts",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -11,12 +11,12 @@ function getMostRecentFile(files) {
11
11
  return sortedFiles[0];
12
12
  }
13
13
 
14
- function getMostRecentSqlFile() {
14
+ function getMostRecentSqlFile(localOnly = false) {
15
15
  const settings = getSettings();
16
16
  const sqlDir = settings.directories.sql;
17
- const sqlFiles = glob.sync(`${sqlDir}/**/*.sql`);
17
+ const sqlFiles = glob.sync(localOnly ? `${sqlDir}/**/EXPORT-LOCAL-*.sql` : `${sqlDir}/**/*.sql`);
18
18
 
19
19
  return getMostRecentFile(sqlFiles);
20
20
  }
21
21
 
22
- module.exports = getMostRecentSqlFile
22
+ module.exports = getMostRecentSqlFile;