create-wirejs-app 2.0.1 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wirejs-app",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Initializes a wirejs package.",
5
5
  "author": "Jon Wire",
6
6
  "license": "MIT",
@@ -1,9 +1,9 @@
1
1
  import { AuthenticationService, FileService, withContext } from 'wirejs-resources';
2
2
  import { defaultGreeting } from '../src/lib/sample-lib.js';
3
3
 
4
- const userTodos = new FileService('userTodoApp');
5
- const wikiPages = new FileService('wikiPages');
6
- const authService = new AuthenticationService('core-users');
4
+ const userTodos = new FileService('app', 'userTodoApp');
5
+ const wikiPages = new FileService('app', 'wikiPages');
6
+ const authService = new AuthenticationService('app', 'core-users');
7
7
 
8
8
  export const auth = authService.buildApi();
9
9
 
@@ -1,7 +1,15 @@
1
1
  import { writeFileSync } from 'fs';
2
2
 
3
+ let API_URL = '/api';
3
4
  const indexModule = await import('./index.js');
4
5
 
6
+ try {
7
+ const backendConfig = await import('./config.js');
8
+ if (backendConfig.apiUrl) API_URL = backendConfig.apiUrl;
9
+ } catch {
10
+ console.log("No backend API config found.");
11
+ }
12
+
5
13
  function dedent(tabs, text) {
6
14
  const tabString = new Array(tabs).fill('\t').join('');
7
15
  return text.trim().replace(new RegExp(`^${tabString}`, 'gm'), '');
@@ -24,7 +32,7 @@ const baseClient = dedent(1, /* js */ `
24
32
  : {};
25
33
  }
26
34
 
27
- const response = await fetch("/api", {
35
+ const response = await fetch("${API_URL}", {
28
36
  method: 'POST',
29
37
  headers: {
30
38
  'Content-Type': 'application/json',
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "dependencies": {
11
11
  "wirejs-dom": "^1.0.34",
12
- "wirejs-resources": "^0.1.1-alpha",
12
+ "wirejs-resources": "^0.1.2-alpha",
13
13
  "dompurify": "^3.2.3",
14
14
  "marked": "^15.0.6"
15
15
  },