@youcan/create-app 1.2.0-beta.2 → 1.2.0-beta.4

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.
@@ -3,15 +3,9 @@ interface InitOutput {
3
3
  name: string;
4
4
  template: string;
5
5
  }
6
- export declare const TEMPLATES: {
7
- nuxt: {
8
- label: string;
9
- url: string;
10
- };
11
- 'extension-only': {
12
- label: string;
13
- url: string;
14
- };
15
- };
6
+ export declare const TEMPLATES: Record<string, {
7
+ label: string;
8
+ url?: string;
9
+ }>;
16
10
  declare function initPrompt(command: Cli.Command): Promise<InitOutput>;
17
11
  export default initPrompt;
@@ -7,6 +7,9 @@ const TEMPLATES = {
7
7
  label: 'Start with an extension only',
8
8
  url: 'https://github.com/youcan-shop/shop-app-template-none',
9
9
  },
10
+ 'none': {
11
+ label: 'A blank canvas',
12
+ },
10
13
  };
11
14
  async function initPrompt(command) {
12
15
  const defaults = {
@@ -34,7 +37,7 @@ async function initPrompt(command) {
34
37
  type: 'select',
35
38
  name: 'template',
36
39
  message: 'Your app\'s starting template',
37
- format: v => TEMPLATES[v].url,
40
+ format: v => TEMPLATES[v]?.url,
38
41
  choices: Object
39
42
  .entries(TEMPLATES)
40
43
  .map(([k, v]) => ({ title: v.label, value: k })),
@@ -2,7 +2,7 @@ import type { Cli } from '@youcan/cli-kit';
2
2
  interface InitServiceOptions {
3
3
  name: string;
4
4
  directory: string;
5
- template: string;
5
+ template?: string;
6
6
  }
7
7
  declare function initService(command: Cli.Command, options: InitServiceOptions): Promise<void>;
8
8
  export default initService;
@@ -4,15 +4,20 @@ async function initService(command, options) {
4
4
  const slug = String.hyphenate(options.name);
5
5
  const outdir = Path.join(options.directory, slug);
6
6
  await assertDirectoryAvailability(outdir, slug);
7
- const repo = Github.parseRepositoryReference(options.template);
7
+ const repo = options.template
8
+ ? Github.parseRepositoryReference(options.template)
9
+ : null;
8
10
  await Filesystem.tapIntoTmp(async (tmp) => {
9
11
  const templateDownloadDirectory = Path.join(tmp, 'download');
10
- const url = repo.branch ? `${repo.baseUrl}#${repo.branch}` : repo.baseUrl;
11
12
  await Filesystem.mkdir(templateDownloadDirectory);
12
13
  await Tasks.run({}, [
13
14
  {
14
- title: `Downloading app template from ${url}...`,
15
+ title: 'Closing app template...',
16
+ skip: () => repo == null,
15
17
  task: async () => {
18
+ const url = repo.branch
19
+ ? `${repo.baseUrl}#${repo.branch}`
20
+ : repo.baseUrl;
16
21
  await Git.clone({
17
22
  url,
18
23
  shallow: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/create-app",
3
3
  "type": "module",
4
- "version": "1.2.0-beta.2",
4
+ "version": "1.2.0-beta.4",
5
5
  "description": "A CLI for creating YouCan Shop apps",
6
6
  "author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
7
7
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@oclif/core": "^2.15.0",
26
- "@youcan/cli-kit": "1.2.0-beta.2"
26
+ "@youcan/cli-kit": "1.2.0-beta.4"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@oclif/plugin-legacy": "^1.3.0",