mythix 2.8.4 → 2.8.6
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 +1 -1
- package/src/cli/deploy-command.js +33 -10
package/package.json
CHANGED
|
@@ -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 =
|
|
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 (
|
|
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,
|
|
@@ -484,6 +499,9 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
484
499
|
}
|
|
485
500
|
|
|
486
501
|
let commandString = commands.map((command) => {
|
|
502
|
+
if (!command)
|
|
503
|
+
return;
|
|
504
|
+
|
|
487
505
|
if (Nife.isEmpty(command.args))
|
|
488
506
|
return `${this.sudo(deployConfig)}${command.command}`;
|
|
489
507
|
|
|
@@ -495,7 +513,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
495
513
|
};
|
|
496
514
|
|
|
497
515
|
return `${this.sudo(deployConfig, command.sudo)}${command.command} ${command.args.map(escapeArgument).join(' ')}`;
|
|
498
|
-
}).join(' && ');
|
|
516
|
+
}).filter(Boolean).join(' && ');
|
|
499
517
|
|
|
500
518
|
if (options && Nife.isNotEmpty(options.sshArgs))
|
|
501
519
|
args = args.concat(options.sshArgs);
|
|
@@ -557,8 +575,13 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
557
575
|
if (typeof target.preDeploy === 'function')
|
|
558
576
|
return await target.preDeploy.call(this, target, deployConfig);
|
|
559
577
|
|
|
578
|
+
let {
|
|
579
|
+
relativeConfigPath,
|
|
580
|
+
} = deployConfig;
|
|
581
|
+
|
|
560
582
|
await this.executeRemoteCommands(target, deployConfig, [
|
|
561
|
-
{ command: 'mkdir', args: [ '-p', this.joinUnixPath(decodeURIComponent(target.pathname)
|
|
583
|
+
{ command: 'mkdir', args: [ '-p', this.joinUnixPath(decodeURIComponent(target.pathname)) ] },
|
|
584
|
+
(relativeConfigPath) && { command: 'mkdir', args: [ '-p', this.joinUnixPath(decodeURIComponent(target.pathname), 'shared') ] },
|
|
562
585
|
]);
|
|
563
586
|
}
|
|
564
587
|
|
|
@@ -724,7 +747,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
724
747
|
{ command: 'ln', args: [ '-s', `"${deployLocation}"`, `"${currentLinkLocation}"` ] },
|
|
725
748
|
]);
|
|
726
749
|
|
|
727
|
-
if (target.index === 0) {
|
|
750
|
+
if (target.index === 0 && deployConfig.migrations !== false) {
|
|
728
751
|
let targetLocation = `"${decodeURIComponent(target.pathname)}/current"`;
|
|
729
752
|
|
|
730
753
|
let serviceUser = target.serviceUser || target.uri.username;
|
|
@@ -739,11 +762,11 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
739
762
|
// Cleanup old deploy versions
|
|
740
763
|
await this.cleanupOldDeployVersions(target, deployConfig);
|
|
741
764
|
|
|
742
|
-
if (Nife.isNotEmpty(target.restartService)) {
|
|
765
|
+
if (target.restartService !== false && Nife.isNotEmpty(target.restartService)) {
|
|
743
766
|
await this.executeRemoteCommands(target, deployConfig, [
|
|
744
767
|
target.restartService,
|
|
745
768
|
]);
|
|
746
|
-
} else {
|
|
769
|
+
} else if (target.restartService !== false) {
|
|
747
770
|
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
771
|
}
|
|
749
772
|
}
|