@swell/cli 2.0.16 → 2.0.18
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.
|
@@ -79,9 +79,9 @@ behavior by using the --no-git-tag option.`;
|
|
|
79
79
|
if (!(await this.ensureAppExists(undefined, false))) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const localVersion = this.app.version;
|
|
83
83
|
if (amend) {
|
|
84
|
-
const amendVersion = nextVersion ||
|
|
84
|
+
const amendVersion = nextVersion || localVersion;
|
|
85
85
|
const appVersion = await this.getVersion(amendVersion);
|
|
86
86
|
if (appVersion) {
|
|
87
87
|
await this.updateVersion(amendVersion, {
|
|
@@ -93,21 +93,26 @@ behavior by using the --no-git-tag option.`;
|
|
|
93
93
|
}
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
+
const latestVersion = await this.getVersion();
|
|
97
|
+
const remoteVersion = latestVersion?.version;
|
|
98
|
+
// Suggest the next version if not provided
|
|
99
|
+
if (!nextVersion && semver.gt(localVersion, remoteVersion)) {
|
|
100
|
+
nextVersion = localVersion;
|
|
101
|
+
}
|
|
96
102
|
// If the user didn't specify a version, show the latest one
|
|
97
103
|
if (!nextVersion) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this.log(`${style.appConfigValue(this.app.name)} latest remote version is ${style.appConfigValue(latestVersion.version)}.`);
|
|
104
|
+
if (remoteVersion) {
|
|
105
|
+
this.log(`${style.appConfigValue(this.app.name)} latest remote version is ${style.appConfigValue(remoteVersion)}.`);
|
|
101
106
|
}
|
|
102
107
|
else {
|
|
103
|
-
nextVersion =
|
|
108
|
+
nextVersion = localVersion;
|
|
104
109
|
if (!nextVersion) {
|
|
105
110
|
this.error(`${style.appConfigValue(this.app.name)} has not been versioned yet.`);
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
|
-
nextVersion = this.validateAndComputeVersion(nextVersion,
|
|
115
|
+
nextVersion = this.validateAndComputeVersion(nextVersion, localVersion);
|
|
111
116
|
await this.pushAppConfigs();
|
|
112
117
|
await this.deployAppFrontend(false, false);
|
|
113
118
|
if (!message) {
|
|
@@ -175,15 +180,15 @@ behavior by using the --no-git-tag option.`;
|
|
|
175
180
|
// tag the version in git
|
|
176
181
|
await git.spawn(['tag', tag], { cwd: process.cwd() });
|
|
177
182
|
}
|
|
178
|
-
validateAndComputeVersion(nextVersion,
|
|
183
|
+
validateAndComputeVersion(nextVersion, localVersion) {
|
|
179
184
|
let version = nextVersion;
|
|
180
185
|
// compute the value of the next version and check if it's valid
|
|
181
186
|
if (RELEASE_TYPES.includes(nextVersion)) {
|
|
182
187
|
// increment the version
|
|
183
|
-
version = semver.inc(
|
|
188
|
+
version = semver.inc(localVersion, version);
|
|
184
189
|
}
|
|
185
|
-
if (semver.lt(version,
|
|
186
|
-
this.error(`Version ${version} must be greater than the current version ${
|
|
190
|
+
if (semver.lt(version, localVersion)) {
|
|
191
|
+
this.error(`Version ${version} must be greater than the current version ${localVersion}.`);
|
|
187
192
|
}
|
|
188
193
|
return version;
|
|
189
194
|
}
|
|
@@ -12,7 +12,7 @@ export default class CreateApp extends CreateAppCommand {
|
|
|
12
12
|
static flags: any;
|
|
13
13
|
createSwellConfig({ allowOverwrite, inputId, inputStorefrontApp, inputType, inputYes, nestedPath, }: {
|
|
14
14
|
allowOverwrite?: boolean;
|
|
15
|
-
inputId
|
|
15
|
+
inputId?: string;
|
|
16
16
|
inputStorefrontApp?: string;
|
|
17
17
|
inputType?: string;
|
|
18
18
|
inputYes?: boolean;
|
|
@@ -46,7 +46,7 @@ export default class CreateApp extends CreateAppCommand {
|
|
|
46
46
|
options: ['admin', 'integration', 'storefront', 'theme'],
|
|
47
47
|
}),
|
|
48
48
|
};
|
|
49
|
-
async createSwellConfig({ allowOverwrite = true, inputId, inputStorefrontApp, inputType, inputYes, nestedPath = true, }) {
|
|
49
|
+
async createSwellConfig({ allowOverwrite = true, inputId = '', inputStorefrontApp, inputType, inputYes, nestedPath = true, }) {
|
|
50
50
|
let confirmYes = inputYes;
|
|
51
51
|
const type = inputType ||
|
|
52
52
|
(confirmYes
|
|
@@ -138,7 +138,7 @@ export default class CreateApp extends CreateAppCommand {
|
|
|
138
138
|
permissions: [],
|
|
139
139
|
}),
|
|
140
140
|
};
|
|
141
|
-
const appPath = path.join(process.cwd(), appId);
|
|
141
|
+
const appPath = path.join(process.cwd(), inputId || appId);
|
|
142
142
|
if (swellConfigFileExists(appPath)) {
|
|
143
143
|
if (allowOverwrite) {
|
|
144
144
|
if (!confirmYes) {
|
|
@@ -164,7 +164,7 @@ export default class CreateApp extends CreateAppCommand {
|
|
|
164
164
|
if (!confirmCreateApp) {
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
const config = newConfig(nestedPath ? appId : '');
|
|
167
|
+
const config = newConfig(nestedPath ? inputId || appId : '');
|
|
168
168
|
config.clear();
|
|
169
169
|
config.set(swellConfigJson);
|
|
170
170
|
return { appId, config, installedStorefrontApp, swellConfigJson };
|
|
@@ -106,15 +106,15 @@ export default class CreateFunction extends CreateConfigCommand {
|
|
|
106
106
|
trigger = await select({
|
|
107
107
|
choices: [
|
|
108
108
|
{
|
|
109
|
-
name: 'Event',
|
|
109
|
+
name: 'Event (model)',
|
|
110
110
|
value: 'model',
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
name: 'Schedule',
|
|
113
|
+
name: 'Schedule (cron)',
|
|
114
114
|
value: 'cron',
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
|
-
name: 'HTTP',
|
|
117
|
+
name: 'HTTP (route)',
|
|
118
118
|
value: 'route',
|
|
119
119
|
},
|
|
120
120
|
],
|
|
@@ -125,7 +125,7 @@ export default class CreateFunction extends CreateConfigCommand {
|
|
|
125
125
|
if (trigger === 'model' && !events) {
|
|
126
126
|
events = await input({
|
|
127
127
|
default: 'product.created, etc...',
|
|
128
|
-
message: 'Enter event types
|
|
128
|
+
message: 'Enter event types to trigger this function (comma separated)',
|
|
129
129
|
});
|
|
130
130
|
if (events === 'product.created, etc...') {
|
|
131
131
|
events = '';
|
|
@@ -135,7 +135,7 @@ export default class CreateFunction extends CreateConfigCommand {
|
|
|
135
135
|
if (trigger === 'cron' && !schedule) {
|
|
136
136
|
schedule = await input({
|
|
137
137
|
default: '0 0 * * *',
|
|
138
|
-
message: 'Enter
|
|
138
|
+
message: 'Enter a crontab value',
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
let { route } = params;
|
|
@@ -145,14 +145,14 @@ export default class CreateFunction extends CreateConfigCommand {
|
|
|
145
145
|
{ name: 'Public', value: 'public' },
|
|
146
146
|
{ name: 'Private', value: 'private' },
|
|
147
147
|
],
|
|
148
|
-
message: 'Should
|
|
148
|
+
message: 'Should the HTTP route be public (using public_key) or private (using secret_key)?',
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
let { functionName } = params;
|
|
152
152
|
if (!functionName) {
|
|
153
153
|
functionName = await input({
|
|
154
154
|
default: functionName,
|
|
155
|
-
message: '
|
|
155
|
+
message: 'Name your function',
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
const { description } = params;
|
|
@@ -53,14 +53,14 @@ export class CreateAppCommand extends SwellCommand {
|
|
|
53
53
|
? []
|
|
54
54
|
: [
|
|
55
55
|
{
|
|
56
|
-
name: 'Do not install a
|
|
56
|
+
name: 'Do not install a frontend framework',
|
|
57
57
|
value: null,
|
|
58
58
|
},
|
|
59
59
|
]),
|
|
60
60
|
],
|
|
61
61
|
message: directCreate
|
|
62
|
-
? `Choose
|
|
63
|
-
: `Install
|
|
62
|
+
? `Choose framework for your hosted${kind ? ` ${kind} ` : ' '}app frontend`
|
|
63
|
+
: `Install framework for a hosted${kind ? ` ${kind} ` : ' '}app frontend?`,
|
|
64
64
|
}));
|
|
65
65
|
if (frameworkType) {
|
|
66
66
|
const projectType = FrontendProjectTypes.find((type) => type.slug === frameworkType);
|
package/oclif.manifest.json
CHANGED