@youcan/app 2.1.3 → 2.2.0

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.
Files changed (30) hide show
  1. package/dist/cli/commands/app/dev.d.ts +14 -6
  2. package/dist/cli/commands/app/dev.js +81 -48
  3. package/dist/cli/commands/app/generate/extension.d.ts +6 -6
  4. package/dist/cli/commands/app/generate/extension.js +49 -49
  5. package/dist/cli/commands/app/install.d.ts +5 -5
  6. package/dist/cli/commands/app/install.js +20 -20
  7. package/dist/cli/services/dev/workers/app-worker.d.ts +11 -10
  8. package/dist/cli/services/dev/workers/app-worker.js +30 -30
  9. package/dist/cli/services/dev/workers/index.d.ts +11 -10
  10. package/dist/cli/services/dev/workers/index.js +18 -18
  11. package/dist/cli/services/dev/workers/theme-extension-worker.d.ts +15 -15
  12. package/dist/cli/services/dev/workers/theme-extension-worker.js +113 -113
  13. package/dist/cli/services/dev/workers/web-worker.d.ts +11 -11
  14. package/dist/cli/services/dev/workers/web-worker.js +23 -23
  15. package/dist/cli/services/generate/extensions/index.d.ts +2 -2
  16. package/dist/cli/services/generate/extensions/index.js +2 -2
  17. package/dist/cli/services/generate/extensions/theme-extension.d.ts +3 -3
  18. package/dist/cli/services/generate/extensions/theme-extension.js +17 -17
  19. package/dist/cli/services/generate/generate.d.ts +10 -10
  20. package/dist/cli/services/generate/generate.js +24 -24
  21. package/dist/constants.d.ts +5 -5
  22. package/dist/constants.js +4 -4
  23. package/dist/flags.d.ts +3 -3
  24. package/dist/flags.js +7 -7
  25. package/dist/types.d.ts +69 -69
  26. package/dist/util/app-loader.d.ts +2 -2
  27. package/dist/util/app-loader.js +35 -35
  28. package/dist/util/theme-command.d.ts +3 -3
  29. package/dist/util/theme-command.js +1 -1
  30. package/package.json +2 -2
@@ -1,41 +1,41 @@
1
1
  import { Path, Filesystem } from '@youcan/cli-kit';
2
2
  import { APP_CONFIG_FILENAME, DEFAULT_EXTENSIONS_DIR, EXTENSION_CONFIG_FILENAME, DEFAULT_WEBS_DIR, WEB_CONFIG_FILENAME } from '../constants.js';
3
3
 
4
- async function load() {
5
- const path = Path.resolve(Path.cwd(), APP_CONFIG_FILENAME);
6
- if (!await Filesystem.exists(path)) {
7
- throw new Error(`app config not found at ${path}`);
8
- }
9
- const config = await Filesystem.readJsonFile(path);
10
- const app = {
11
- config,
12
- webs: [],
13
- extensions: [],
14
- root: Path.cwd(),
15
- };
16
- app.extensions = await loadExtensions(app);
17
- app.webs = await loadWebs(app);
18
- return app;
19
- }
20
- async function loadExtensions(app) {
21
- const pattern = Path.join(app.root, `${DEFAULT_EXTENSIONS_DIR}/*`, EXTENSION_CONFIG_FILENAME);
22
- const paths = await Filesystem.glob(pattern);
23
- const promises = paths.map(async (p) => {
24
- return {
25
- root: Path.dirname(p),
26
- config: await Filesystem.readJsonFile(p),
27
- };
28
- });
29
- return await Promise.all(promises);
30
- }
31
- async function loadWebs(app) {
32
- const pattern = Path.join(app.root, DEFAULT_WEBS_DIR, WEB_CONFIG_FILENAME);
33
- const paths = await Filesystem.glob(pattern);
34
- const promises = paths.map(async (p) => ({
35
- root: Path.dirname(p),
36
- config: await Filesystem.readJsonFile(p),
37
- }));
38
- return await Promise.all(promises);
4
+ async function load() {
5
+ const path = Path.resolve(Path.cwd(), APP_CONFIG_FILENAME);
6
+ if (!await Filesystem.exists(path)) {
7
+ throw new Error(`app config not found at ${path}`);
8
+ }
9
+ const config = await Filesystem.readJsonFile(path);
10
+ const app = {
11
+ config,
12
+ webs: [],
13
+ extensions: [],
14
+ root: Path.cwd(),
15
+ };
16
+ app.extensions = await loadExtensions(app);
17
+ app.webs = await loadWebs(app);
18
+ return app;
19
+ }
20
+ async function loadExtensions(app) {
21
+ const pattern = Path.join(app.root, `${DEFAULT_EXTENSIONS_DIR}/*`, EXTENSION_CONFIG_FILENAME);
22
+ const paths = await Filesystem.glob(pattern);
23
+ const promises = paths.map(async (p) => {
24
+ return {
25
+ root: Path.dirname(p),
26
+ config: await Filesystem.readJsonFile(p),
27
+ };
28
+ });
29
+ return await Promise.all(promises);
30
+ }
31
+ async function loadWebs(app) {
32
+ const pattern = Path.join(app.root, DEFAULT_WEBS_DIR, WEB_CONFIG_FILENAME);
33
+ const paths = await Filesystem.glob(pattern);
34
+ const promises = paths.map(async (p) => ({
35
+ root: Path.dirname(p),
36
+ config: await Filesystem.readJsonFile(p),
37
+ }));
38
+ return await Promise.all(promises);
39
39
  }
40
40
 
41
41
  export { load };
@@ -1,3 +1,3 @@
1
- import { Cli } from '@youcan/cli-kit';
2
- export declare abstract class AppCommand extends Cli.Command {
3
- }
1
+ import { Cli } from '@youcan/cli-kit';
2
+ export declare abstract class AppCommand extends Cli.Command {
3
+ }
@@ -1,6 +1,6 @@
1
1
  import { Cli } from '@youcan/cli-kit';
2
2
 
3
- class AppCommand extends Cli.Command {
3
+ class AppCommand extends Cli.Command {
4
4
  }
5
5
 
6
6
  export { AppCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/app",
3
3
  "type": "module",
4
- "version": "2.1.3",
4
+ "version": "2.2.0",
5
5
  "description": "OCLIF plugin for building apps",
6
6
  "author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
7
7
  "license": "MIT",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@oclif/core": "^2.15.0",
19
19
  "dayjs": "^1.11.10",
20
- "@youcan/cli-kit": "2.1.3"
20
+ "@youcan/cli-kit": "2.2.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@oclif/plugin-legacy": "^1.3.0",