wp-blank-scripts 2.6.2 → 2.6.5

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/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 = {
@@ -176,16 +177,17 @@ async function deployToServer() {
176
177
 
177
178
  async function connectMySQL() {
178
179
  // Environment info
179
- const { host } = settings.server[options.environment];
180
+ const { host, port } = settings.server[options.environment];
180
181
  const { user, password, database } = settings.mysql[options.environment];
181
182
 
182
183
  // Tunnel info
183
184
  const { tunnelHost, tunnelPort } = options;
185
+ const useTunnel = !isCI();
184
186
 
185
187
  return new Promise((resolve, reject) => {
186
188
  m = mysql.createConnection({
187
- host: tunnelHost,
188
- port: tunnelPort,
189
+ host: useTunnel ? tunnelHost : host,
190
+ port: useTunnel ? tunnelPort : port,
189
191
  user,
190
192
  password,
191
193
  database,
@@ -269,13 +271,21 @@ module.exports = async (selectOptions, callbacks) => {
269
271
  }
270
272
 
271
273
  if (options.sql) {
272
- await createTunnel();
274
+ if (!isCI()) {
275
+ await createTunnel();
276
+ }
273
277
  await connectMySQL();
274
278
  const file = isCI()
275
- ? getMostRecentSqlFile()
279
+ ? getMostRecentSqlFile(true)
276
280
  : await exportSql({ environment: options.environment });
277
281
 
278
282
  if (file) {
283
+ await replaceSQL({
284
+ environmentIn: 'local',
285
+ environmentOut: options.environment,
286
+ file,
287
+ });
288
+
279
289
  await deployMySQL(file);
280
290
  }
281
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-blank-scripts",
3
- "version": "2.6.2",
3
+ "version": "2.6.5",
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;