@nativescript/cloudflare-cli 0.1.0-beta.1 → 0.1.0-beta.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/README.md CHANGED
@@ -4,7 +4,7 @@ Mirror a NativeScript project into an ns-edge project from a terminal or a Vite
4
4
 
5
5
  ```sh
6
6
  npm i -D @nativescript/cloudflare-cli@beta
7
- npx ns-edge create --server https://preview.nativescript.org --token <create token>
7
+ npx ns-edge create --server https://preview.nativescript.org --token <create token> # --template vue for nativescript-vue
8
8
  npx ns-edge watch # push, then every save
9
9
  npx ns-edge qr # print the pairing QR code again
10
10
  ```
package/dist/bin.js CHANGED
@@ -55,7 +55,7 @@ async function printPairing(ref) {
55
55
  const commands = {
56
56
  async create() {
57
57
  const server = flag('server') ?? 'http://localhost:5173';
58
- const ref = await createProject(server, flag('token') ?? process.env.NS_EDGE_CREATE_TOKEN);
58
+ const ref = await createProject(server, flag('token') ?? process.env.NS_EDGE_CREATE_TOKEN, flag('template'));
59
59
  await writeFile(join(root, CONFIG), JSON.stringify(ref, null, 2) + '\n');
60
60
  console.log(`Created project ${ref.id} (saved to ${CONFIG}; it holds the project keys, keep it out of git)`);
61
61
  await printPairing(ref);
@@ -125,7 +125,7 @@ const commands = {
125
125
  async help() {
126
126
  console.log(`ns-edge <command>
127
127
 
128
- create [--server <url>] [--token <t>]
128
+ create [--server <url>] [--token <t>] [--template core|vue]
129
129
  create an edge project and save .ns-edge.json
130
130
  push upload app/ and server/ in one transaction
131
131
  watch push, then stream every save to the edge
package/dist/sync.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface ApplyResult {
17
17
  /** Project-relative paths that are mirrored to the edge. */
18
18
  export declare const SYNCED: RegExp;
19
19
  export declare function projectUrl(ref: ProjectRef): string;
20
- export declare function createProject(server: string, token?: string): Promise<ProjectRef>;
20
+ export declare function createProject(server: string, token?: string, template?: string): Promise<ProjectRef>;
21
21
  /** Sends a batch as one edge transaction, so devices see one consistent update. */
22
22
  export declare function applyChanges(ref: ProjectRef, changes: {
23
23
  path: string;
package/dist/sync.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { readFile, readdir, stat } from 'node:fs/promises';
2
2
  import { join, relative, sep } from 'node:path';
3
3
  /** Project-relative paths that are mirrored to the edge. */
4
- export const SYNCED = /^(app|server)\/.+\.(ts|mts|js|mjs|xml|css|json)$/;
4
+ export const SYNCED = /^(app|server)\/.+\.(ts|mts|js|mjs|vue|xml|css|json)$/;
5
5
  export function projectUrl(ref) {
6
6
  return `${ref.server.replace(/\/$/, '')}/p/${ref.id}`;
7
7
  }
8
- export async function createProject(server, token) {
9
- const res = await fetch(`${server.replace(/\/$/, '')}/api/projects`, {
8
+ export async function createProject(server, token, template) {
9
+ const query = template ? `?template=${encodeURIComponent(template)}` : '';
10
+ const res = await fetch(`${server.replace(/\/$/, '')}/api/projects${query}`, {
10
11
  method: 'POST',
11
12
  headers: token ? { authorization: `Bearer ${token}` } : {},
12
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/cloudflare-cli",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "Mirror a NativeScript project into an ns-edge project from a terminal or a Vite dev server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",