@youcan/app 2.0.0 → 2.0.2

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.
@@ -5,7 +5,7 @@ import { APP_CONFIG_FILENAME } from '../../../constants.js';
5
5
  import { bootAppWorker, bootWebWorker, bootExtensionWorker } from '../../services/dev/workers/index.js';
6
6
 
7
7
  class Dev extends AppCommand {
8
- static description = 'Run the app in draft mode';
8
+ static description = 'Run the app in dev mode';
9
9
  async run() {
10
10
  const app = await load();
11
11
  const session = await Session.authenticate(this);
@@ -14,8 +14,8 @@ class Dev extends AppCommand {
14
14
  title: 'Syncing app configuration..',
15
15
  async task() {
16
16
  const endpoint = app.config.id == null
17
- ? `${Env.apiHostname()}/apps/draft/create`
18
- : `${Env.apiHostname()}/apps/draft/${app.config.id}/update`;
17
+ ? `${Env.apiHostname()}/apps/create`
18
+ : `${Env.apiHostname()}/apps/${app.config.id}/update`;
19
19
  const res = await Http.post(endpoint, {
20
20
  headers: { Authorization: `Bearer ${session.access_token}` },
21
21
  body: JSON.stringify({
@@ -14,7 +14,7 @@ class Install extends AppCommand {
14
14
  {
15
15
  title: 'Building authorization url',
16
16
  async task(ctx) {
17
- const { url } = await Http.get(`${Env.apiHostname()}/apps/draft/${app.config.id}/authorization-url`);
17
+ const { url } = await Http.get(`${Env.apiHostname()}/apps/${app.config.id}/authorization-url`);
18
18
  ctx.url = url;
19
19
  },
20
20
  },
@@ -22,7 +22,7 @@ class ThemeExtensionWorker extends Worker.Abstract {
22
22
  async boot() {
23
23
  const session = await Session.authenticate(this.command);
24
24
  try {
25
- const res = await Http.post(`${Env.apiHostname()}/apps/draft/${this.app.config.id}/extensions/create`, {
25
+ const res = await Http.post(`${Env.apiHostname()}/apps/${this.app.config.id}/extensions/create`, {
26
26
  headers: { Authorization: `Bearer ${session.access_token}` },
27
27
  body: JSON.stringify({ ...this.extension.config }),
28
28
  });
@@ -98,15 +98,16 @@ class ThemeExtensionWorker extends Worker.Abstract {
98
98
  enqueue(op, type, name) {
99
99
  this.queue.push(async () => {
100
100
  const path = Path.join(this.extension.root, type, name);
101
- await Http.post(`${Env.apiHostname()}/apps/draft/${this.app.config.id}/extensions/${this.extension.id}/file`, {
102
- body: Form.convert({
103
- file_name: name,
104
- file_type: type,
105
- file_operation: op,
106
- file_content: op === 'put'
107
- ? await Form.file(path)
108
- : undefined,
109
- }),
101
+ const payload = {
102
+ file_name: name,
103
+ file_type: type,
104
+ file_operation: op,
105
+ };
106
+ if (op === 'put') {
107
+ payload.file_content = await Form.file(path);
108
+ }
109
+ await Http.post(`${Env.apiHostname()}/apps/${this.app.config.id}/extensions/${this.extension.id}/file`, {
110
+ body: Form.convert(payload),
110
111
  });
111
112
  this.logger.write(`[${op === 'put' ? 'updated' : 'deleted'}] - ${Path.join(type, name)}`);
112
113
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/app",
3
3
  "type": "module",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
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.0.0"
20
+ "@youcan/cli-kit": "2.0.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@oclif/plugin-legacy": "^1.3.0",