@swell/cli 2.0.15 → 2.0.17

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.
@@ -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: string;
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 separated by a comma',
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 the crontab value',
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 tbe route be public (public_key) or private (secret_key)?',
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: 'What will the endpoint be?',
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 starter framework',
56
+ name: 'Do not install a frontend framework',
57
57
  value: null,
58
58
  },
59
59
  ]),
60
60
  ],
61
61
  message: directCreate
62
- ? `Choose a framework for your hosted${kind ? ` ${kind} ` : ' '}app frontend`
63
- : `Install a framework for your hosted${kind ? ` ${kind} ` : ' '}app frontend?`,
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);
@@ -114,7 +114,7 @@ export const FrontendProjectTypes = [
114
114
  slug: 'astro',
115
115
  },
116
116
  ];
117
- const frontendProjectConfigExtensions = ['.mjs', '.js'];
117
+ const frontendProjectConfigExtensions = ['.mjs', '.js', '.ts', '.cjs'];
118
118
  export function getAppSlugId(app) {
119
119
  return toAppId(app.private_id) || app.public_id || app.id;
120
120
  }