mythix 2.8.4 → 2.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mythix",
3
- "version": "2.8.4",
3
+ "version": "2.8.5",
4
4
  "description": "Mythix is a NodeJS web-app framework",
5
5
  "main": "src/index",
6
6
  "scripts": {
@@ -112,6 +112,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
112
112
 
113
113
  let {
114
114
  relativeFileName,
115
+ stats,
115
116
  } = context;
116
117
 
117
118
  let shouldIncludeFile = true;
@@ -121,7 +122,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
121
122
  if (useGitIgnore && matchesAnyPattern(useGitIgnore))
122
123
  shouldIncludeFile = false;
123
124
 
124
- if (Nife.isNotEmpty(include))
125
+ if (Nife.isNotEmpty(include) && !stats.isDirectory())
125
126
  shouldIncludeFile = matchesAnyPattern(include);
126
127
 
127
128
  if (Nife.isNotEmpty(exclude) && matchesAnyPattern(exclude))
@@ -301,6 +302,14 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
301
302
  FileSystem.copyFileSync(sourceFilePath, targetFilePath);
302
303
  }
303
304
 
305
+ formatOutputPath(context, deployConfig) {
306
+ let { formatOutputPath } = deployConfig;
307
+ if (typeof formatOutputPath === 'function')
308
+ return formatOutputPath.call(this, context, deployConfig);
309
+
310
+ return context.targetPath;
311
+ }
312
+
304
313
  async copyProjectFilesToDeployFolder(deployConfig) {
305
314
  let {
306
315
  tempLocation,
@@ -320,7 +329,13 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
320
329
  for (let i = 0, il = filesToDeploy.length; i < il; i++) {
321
330
  let sourcePath = filesToDeploy[i];
322
331
  let relativeFilePath = sourcePath.substring(projectLocation.length).replace(/^[/\\]+/, '');
323
- let targetPath = Path.join(deployFolderLocation, relativeFilePath);
332
+ let targetPath = this.formatOutputPath({
333
+ targetPath: Path.join(deployFolderLocation, relativeFilePath),
334
+ outputPath: projectLocation,
335
+ deployPath: deployFolderLocation,
336
+ relativeFilePath,
337
+ sourcePath,
338
+ }, deployConfig);
324
339
 
325
340
  await this.copyFile(dryRun, sourcePath, targetPath);
326
341
  }
@@ -339,19 +354,19 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
339
354
 
340
355
  let deployLocation = Path.join(tempLocation, ('' + version));
341
356
 
342
- if (!installModulesCommand) {
357
+ if (installModulesCommand == null) {
343
358
  let yarnLockLocation = Path.join(deployLocation, 'yarn.lock');
344
359
  if (FileSystem.existsSync(yarnLockLocation))
345
360
  installModulesCommand = { command: 'bash', args: [ '--login', '-c', '"yarn --prod"' ] };
346
361
  else
347
362
  installModulesCommand = { command: 'bash', args: [ '--login', '-c', '"npm i --omit=dev"' ] };
348
- } else if (Nife.isEmpty(typeof installModulesCommand !== 'function' && Nife.isEmpty(installModulesCommand.command))) {
363
+ } else if (installModulesCommand !== false && Nife.isEmpty(typeof installModulesCommand !== 'function' && Nife.isEmpty(installModulesCommand.command))) {
349
364
  throw new Error('You specified a "installModulesCommand" in your deploy config, but no "command" property found... you need to specify "installModulesCommand" as an object "{ installModulesCommand: { command: "npm", args: [ "i" ] } }", or as a function.');
350
365
  }
351
366
 
352
367
  if (typeof installModulesCommand === 'function') {
353
368
  await installModulesCommand(deployConfig);
354
- } else {
369
+ } else if (installModulesCommand) {
355
370
  await this.executeRemoteCommands(target, deployConfig, [
356
371
  { sudo: false, command: 'cd', args: [ `"${remoteLocation}"` ]},
357
372
  installModulesCommand,
@@ -557,9 +572,15 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
557
572
  if (typeof target.preDeploy === 'function')
558
573
  return await target.preDeploy.call(this, target, deployConfig);
559
574
 
560
- await this.executeRemoteCommands(target, deployConfig, [
561
- { command: 'mkdir', args: [ '-p', this.joinUnixPath(decodeURIComponent(target.pathname), 'shared') ] },
562
- ]);
575
+ let {
576
+ relativeConfigPath,
577
+ } = deployConfig;
578
+
579
+ if (relativeConfigPath) {
580
+ await this.executeRemoteCommands(target, deployConfig, [
581
+ { command: 'mkdir', args: [ '-p', this.joinUnixPath(decodeURIComponent(target.pathname), 'shared') ] },
582
+ ]);
583
+ }
563
584
  }
564
585
 
565
586
  async allRemotesDeploy(deployConfig) {
@@ -724,7 +745,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
724
745
  { command: 'ln', args: [ '-s', `"${deployLocation}"`, `"${currentLinkLocation}"` ] },
725
746
  ]);
726
747
 
727
- if (target.index === 0) {
748
+ if (target.index === 0 && deployConfig.migrations !== false) {
728
749
  let targetLocation = `"${decodeURIComponent(target.pathname)}/current"`;
729
750
 
730
751
  let serviceUser = target.serviceUser || target.uri.username;
@@ -739,11 +760,11 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
739
760
  // Cleanup old deploy versions
740
761
  await this.cleanupOldDeployVersions(target, deployConfig);
741
762
 
742
- if (Nife.isNotEmpty(target.restartService)) {
763
+ if (target.restartService !== false && Nife.isNotEmpty(target.restartService)) {
743
764
  await this.executeRemoteCommands(target, deployConfig, [
744
765
  target.restartService,
745
766
  ]);
746
- } else {
767
+ } else if (target.restartService !== false) {
747
768
  console.log(` !!!NOTICE!!! "restartService" command is not defined on your deploy "targets[${target.index}]". Your service will not be automatically restarted. Please make sure to manually restart your application service on this remote target.`);
748
769
  }
749
770
  }