runcloud 0.2.158 → 0.2.159
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/dist/backendTemplate.js +27 -0
- package/dist/commands/create.js +2 -3
- package/dist/commands/init.js +2 -3
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/runcloud-0.2.159.tgz +0 -0
- package/runcloud-0.2.158.tgz +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { extractSnapshot } from './archive.js';
|
|
4
|
+
export async function scaffoldBackend(client, dir) {
|
|
5
|
+
const template = await client.getBinary('/newly_backend/backend_template');
|
|
6
|
+
await extractSnapshot(template, dir);
|
|
7
|
+
excludeBackendFromAppTypecheck(dir);
|
|
8
|
+
}
|
|
9
|
+
const EXPO_BASE_EXCLUDE = ['node_modules', 'babel.config.js', 'metro.config.js', 'jest.config.js', 'android', 'ios'];
|
|
10
|
+
function excludeBackendFromAppTypecheck(dir) {
|
|
11
|
+
const path = join(dir, 'tsconfig.json');
|
|
12
|
+
if (!existsSync(path))
|
|
13
|
+
return;
|
|
14
|
+
let config;
|
|
15
|
+
try {
|
|
16
|
+
config = JSON.parse(readFileSync(path, 'utf8'));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
console.log('Add "backend" to "exclude" in tsconfig.json so the app typecheck skips the backend.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const exclude = Array.isArray(config.exclude) ? config.exclude : EXPO_BASE_EXCLUDE;
|
|
23
|
+
if (exclude.includes('backend'))
|
|
24
|
+
return;
|
|
25
|
+
config.exclude = [...exclude, 'backend'];
|
|
26
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`);
|
|
27
|
+
}
|
package/dist/commands/create.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { ApiClient, ApiError, friendlyApiError } from '../api.js';
|
|
4
4
|
import { requireCredentials, writeProjectLink } from '../config.js';
|
|
5
|
-
import {
|
|
5
|
+
import { scaffoldBackend } from '../backendTemplate.js';
|
|
6
6
|
function assertNotManagedSession() {
|
|
7
7
|
const managedSessionProjectId = process.env['NEWLY_PROJECT_ID'];
|
|
8
8
|
if (!managedSessionProjectId)
|
|
@@ -25,8 +25,7 @@ export async function runCreate(client, dir, opts) {
|
|
|
25
25
|
pulledAt: new Date().toISOString(),
|
|
26
26
|
});
|
|
27
27
|
try {
|
|
28
|
-
|
|
29
|
-
await extractSnapshot(tar, dir);
|
|
28
|
+
await scaffoldBackend(client, dir);
|
|
30
29
|
}
|
|
31
30
|
catch (e) {
|
|
32
31
|
const msg = e instanceof Error ? e.message : String(e);
|
package/dist/commands/init.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { ApiClient, friendlyApiError } from '../api.js';
|
|
4
|
-
import {
|
|
4
|
+
import { scaffoldBackend } from '../backendTemplate.js';
|
|
5
5
|
import { requireCredentials, resolveProject } from '../config.js';
|
|
6
6
|
export async function runInit(client, dir, projectId) {
|
|
7
7
|
if (existsSync(join(dir, 'backend'))) {
|
|
8
8
|
throw new Error('A `backend/` directory already exists here. Use `newly deploy --env dev` to deploy it.');
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
await extractSnapshot(template, dir);
|
|
10
|
+
await scaffoldBackend(client, dir);
|
|
12
11
|
console.log(`Initialized Newly Backend for project ${projectId}. ` +
|
|
13
12
|
'Run `newly deploy --env dev` to provision the project database and deploy the services.');
|
|
14
13
|
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.2.
|
|
1
|
+
export const CLI_VERSION = '0.2.159';
|
package/package.json
CHANGED
|
Binary file
|
package/runcloud-0.2.158.tgz
DELETED
|
Binary file
|