mythix 2.8.18 → 2.9.1
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.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Mythix is a NodeJS web-app framework",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"scripts": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"form-data": "^4.0.0",
|
|
36
36
|
"luxon": "^3.1.0",
|
|
37
37
|
"micromatch": "^4.0.5",
|
|
38
|
-
"mythix-orm": "^1.
|
|
38
|
+
"mythix-orm": "^1.10.2",
|
|
39
39
|
"nife": "^1.12.1",
|
|
40
40
|
"prompts": "^2.4.2"
|
|
41
41
|
}
|
package/src/cli/cli-utils.js
CHANGED
|
@@ -78,6 +78,17 @@ class CommandBase {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
childProcess.on('error', (error) => {
|
|
81
|
+
if (options && options.ignoreExitCode) {
|
|
82
|
+
resolve({
|
|
83
|
+
stdout: Buffer.concat(output).toString('utf8'),
|
|
84
|
+
stderr: Buffer.concat(errors).toString('utf8'),
|
|
85
|
+
code: 0,
|
|
86
|
+
error,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
reject({
|
|
82
93
|
stdout: Buffer.concat(output).toString('utf8'),
|
|
83
94
|
stderr: Buffer.concat(errors).toString('utf8'),
|
|
@@ -26,10 +26,14 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
26
26
|
'@title': 'Deploy your application to the specified target',
|
|
27
27
|
'--dry-run': 'Show what would be deployed without actually deploying',
|
|
28
28
|
'--no-cleanup': 'File prep in the temporary file location will not be cleaned up after processing',
|
|
29
|
+
'--direct': 'Skip source control, and deploy the project as-is',
|
|
30
|
+
'--branch': 'Specify branch to deploy (overrides configuration for specified environment)',
|
|
29
31
|
},
|
|
30
32
|
runner: ({ $, Types }) => {
|
|
31
33
|
$('--dry-run', Types.BOOLEAN());
|
|
32
34
|
$('--no-cleanup', Types.BOOLEAN());
|
|
35
|
+
$('--direct', Types.BOOLEAN());
|
|
36
|
+
$('--branch', Types.STRING());
|
|
33
37
|
|
|
34
38
|
return $(
|
|
35
39
|
/[\w-]+/,
|
|
@@ -64,6 +68,10 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
64
68
|
try {
|
|
65
69
|
return await super.spawnCommand(command, args, options);
|
|
66
70
|
} catch (error) {
|
|
71
|
+
console.error('Error with command: ', { dryRun, command, args, options }, error);
|
|
72
|
+
if (error.stderr)
|
|
73
|
+
console.error(error.stderr);
|
|
74
|
+
|
|
67
75
|
if (error instanceof Error)
|
|
68
76
|
throw error;
|
|
69
77
|
|
|
@@ -229,6 +237,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
229
237
|
async cloneProject(deployConfig) {
|
|
230
238
|
let {
|
|
231
239
|
git,
|
|
240
|
+
directDeploy,
|
|
232
241
|
tempLocation,
|
|
233
242
|
rootPath,
|
|
234
243
|
} = deployConfig;
|
|
@@ -242,7 +251,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
242
251
|
|
|
243
252
|
let targetPath = Path.join(tempLocation, 'project');
|
|
244
253
|
|
|
245
|
-
if (!repository) {
|
|
254
|
+
if (directDeploy || !repository) {
|
|
246
255
|
let copyCommand;
|
|
247
256
|
|
|
248
257
|
if (process.platform === 'win32') {
|
|
@@ -833,6 +842,8 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
833
842
|
throw new Error(`Bad "uri" specified for "targets[${index}]": "${rawURI}". No "pathname" found.`);
|
|
834
843
|
});
|
|
835
844
|
|
|
845
|
+
deployConfig.directDeploy = args.direct;
|
|
846
|
+
deployConfig.branchOverride = (Nife.isNotEmpty(args.branch)) ? args.branch : undefined;
|
|
836
847
|
deployConfig.dryRun = args.dryRun;
|
|
837
848
|
deployConfig.version = this.getRevisionNumber();
|
|
838
849
|
|
|
@@ -845,7 +856,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
845
856
|
if (appOptions.configPath)
|
|
846
857
|
deployConfig.relativeConfigPath = appOptions.configPath.substring(deployConfig.rootPath.length).replace(/^[/\\.]+/, '').replace(/[/\\]+$/, '');
|
|
847
858
|
|
|
848
|
-
let git = deployConfig
|
|
859
|
+
let { git } = deployConfig;
|
|
849
860
|
if (git.useGitIgnore) {
|
|
850
861
|
let gitIgnorePath = Path.resolve(deployConfig.rootPath, '.gitignore');
|
|
851
862
|
try {
|
|
@@ -898,7 +909,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
898
909
|
try {
|
|
899
910
|
deployConfig = await this.loadDeployConfig(args);
|
|
900
911
|
} catch (error) {
|
|
901
|
-
console.error(error
|
|
912
|
+
console.error(error);
|
|
902
913
|
return 1;
|
|
903
914
|
}
|
|
904
915
|
|
|
@@ -940,9 +951,21 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
940
951
|
console.log(` -> ${target.uri}`);
|
|
941
952
|
}
|
|
942
953
|
|
|
943
|
-
if (Nife.isEmpty(branch)) {
|
|
954
|
+
if (!deployConfig.directDeploy && Nife.isEmpty(branch)) {
|
|
944
955
|
console.log('');
|
|
945
956
|
console.log(' !!!WARNING!!! "branch" is not set in your deploy configuration. The current file structure will be deployed "as-is". It is highly recommended that you set a "branch" in your deploy configuration.');
|
|
957
|
+
} else if (deployConfig.directDeploy) {
|
|
958
|
+
console.log('');
|
|
959
|
+
console.log(' !!!NOTICE!!! "--direct" argument was specified. Deploying project as-is, bypassing source-control.');
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
if (!deployConfig.directDeploy && !Nife.isEmpty(branch) && deployConfig.branchOverride) {
|
|
963
|
+
console.log('');
|
|
964
|
+
console.log(` !!!NOTICE!!! "--branch" argument was specified. Overriding config branch "${branch}" and using branch "${deployConfig.branchOverride}" instead.`);
|
|
965
|
+
|
|
966
|
+
branch = deployConfig.branchOverride;
|
|
967
|
+
if (git)
|
|
968
|
+
git.branch = deployConfig.branchOverride;
|
|
946
969
|
}
|
|
947
970
|
|
|
948
971
|
console.log('');
|
|
@@ -953,7 +976,7 @@ module.exports = defineCommand('deploy', ({ Parent }) => {
|
|
|
953
976
|
this.mkdirSync(false, tempLocation);
|
|
954
977
|
this.mkdirSync(false, Path.join(tempLocation, deployConfig.version));
|
|
955
978
|
|
|
956
|
-
if (Nife.isNotEmpty(branch) && Nife.isEmpty(repository)) {
|
|
979
|
+
if (!deployConfig.directDeploy && (Nife.isNotEmpty(branch) && Nife.isEmpty(repository))) {
|
|
957
980
|
repository = await this.getRepositoryURL(remoteName);
|
|
958
981
|
if (git)
|
|
959
982
|
git.repository = repository;
|
|
@@ -163,15 +163,22 @@ function browserRequestHandler(routeName, requestOptions) {
|
|
|
163
163
|
var data = requestOptions.data;
|
|
164
164
|
var extraConfig = {};
|
|
165
165
|
var headers = Object.assign(Utils.keysToLowerCase(this.defaultHeaders || {}), Utils.keysToLowerCase(requestOptions.headers || {}));
|
|
166
|
+
var isFormData = (data && (data instanceof FormData || data.constructor.name === 'FormData'));
|
|
166
167
|
|
|
167
168
|
if (data) {
|
|
168
169
|
if (!method.match(/^(GET|HEAD)$/i)) {
|
|
169
|
-
if (
|
|
170
|
-
|
|
170
|
+
if (isFormData) {
|
|
171
|
+
extraConfig = {
|
|
172
|
+
body: data,
|
|
173
|
+
};
|
|
174
|
+
} else {
|
|
175
|
+
if ((headers['content-type'] || '').match(/application\/json/i))
|
|
176
|
+
data = JSON.stringify(data);
|
|
171
177
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
extraConfig = {
|
|
179
|
+
body: data,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
175
182
|
} else {
|
|
176
183
|
var queryString = Utils.dataToQueryString(data);
|
|
177
184
|
if (queryString)
|
|
@@ -193,6 +200,8 @@ function browserRequestHandler(routeName, requestOptions) {
|
|
|
193
200
|
);
|
|
194
201
|
|
|
195
202
|
delete options.data;
|
|
203
|
+
if (isFormData && options.headers)
|
|
204
|
+
delete options.headers['content-type'];
|
|
196
205
|
|
|
197
206
|
globalScope.fetch(url, Utils.cleanObjectProperties(options)).then(
|
|
198
207
|
async function(response) {
|
package/src/models/model.js
CHANGED