powersync 0.1.1 → 0.1.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
@@ -13,7 +13,7 @@ $ npm install -g powersync
13
13
  $ powersync COMMAND
14
14
  running command...
15
15
  $ powersync (--version)
16
- powersync/0.1.1 linux-x64 node-v20.11.0
16
+ powersync/0.1.2 linux-x64 node-v20.11.0
17
17
  $ powersync --help [COMMAND]
18
18
  USAGE
19
19
  $ powersync COMMAND
@@ -74,7 +74,7 @@ EXAMPLES
74
74
  $ powersync init
75
75
  ```
76
76
 
77
- _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/init.ts)_
77
+ _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/init.ts)_
78
78
 
79
79
  ## `powersync instance config`
80
80
 
@@ -91,7 +91,7 @@ EXAMPLES
91
91
  $ powersync instance config
92
92
  ```
93
93
 
94
- _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/config.ts)_
94
+ _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/config.ts)_
95
95
 
96
96
  ## `powersync instance create`
97
97
 
@@ -118,7 +118,7 @@ EXAMPLES
118
118
  $ powersync instance create
119
119
  ```
120
120
 
121
- _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/create.ts)_
121
+ _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/create.ts)_
122
122
 
123
123
  ## `powersync instance deploy`
124
124
 
@@ -143,7 +143,7 @@ EXAMPLES
143
143
  $ powersync instance deploy
144
144
  ```
145
145
 
146
- _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/deploy.ts)_
146
+ _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/deploy.ts)_
147
147
 
148
148
  ## `powersync instance destroy`
149
149
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ powersync instance destroy --instanceId=1234
166
166
  ```
167
167
 
168
- _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/destroy.ts)_
168
+ _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/destroy.ts)_
169
169
 
170
170
  ## `powersync instance schema`
171
171
 
@@ -182,7 +182,7 @@ EXAMPLES
182
182
  $ powersync instance schema
183
183
  ```
184
184
 
185
- _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/schema.ts)_
185
+ _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/schema.ts)_
186
186
 
187
187
  ## `powersync instance set`
188
188
 
@@ -204,7 +204,7 @@ EXAMPLES
204
204
  $ powersync instance set --instanceId=1234
205
205
  ```
206
206
 
207
- _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/set.ts)_
207
+ _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/set.ts)_
208
208
 
209
209
  ## `powersync instance status`
210
210
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ powersync instance status
222
222
  ```
223
223
 
224
- _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/status.ts)_
224
+ _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/status.ts)_
225
225
 
226
226
  ## `powersync instance stop`
227
227
 
@@ -243,7 +243,7 @@ EXAMPLES
243
243
  $ powersync instance stop --instanceId=1234
244
244
  ```
245
245
 
246
- _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/stop.ts)_
246
+ _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/stop.ts)_
247
247
 
248
248
  ## `powersync instance sync-rules deploy`
249
249
 
@@ -268,7 +268,7 @@ EXAMPLES
268
268
  $ powersync instance sync-rules deploy -f path/to/file
269
269
  ```
270
270
 
271
- _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/deploy.ts)_
271
+ _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/sync-rules/deploy.ts)_
272
272
 
273
273
  ## `powersync instance sync-rules generate-schema`
274
274
 
@@ -294,7 +294,7 @@ EXAMPLES
294
294
  $ powersync instance sync-rules generate-schema -f path/to/file
295
295
  ```
296
296
 
297
- _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/generate-schema.ts)_
297
+ _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/sync-rules/generate-schema.ts)_
298
298
 
299
299
  ## `powersync instance sync-rules validate`
300
300
 
@@ -318,7 +318,7 @@ EXAMPLES
318
318
  $ powersync instance sync-rules validate -f path/to/file
319
319
  ```
320
320
 
321
- _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/validate.ts)_
321
+ _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instance/sync-rules/validate.ts)_
322
322
 
323
323
  ## `powersync instances`
324
324
 
@@ -335,5 +335,5 @@ EXAMPLES
335
335
  $ powersync instances
336
336
  ```
337
337
 
338
- _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instances.ts)_
338
+ _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.1.2/src/commands/instances.ts)_
339
339
  <!-- commandsstop -->
@@ -37,7 +37,9 @@ export default class Init extends Command {
37
37
  ];
38
38
  const appAnswers = await inquirer.prompt(appQuestions);
39
39
  const orgId = organizations.objects[0].id;
40
- fs.mkdirSync(POWERSYNC_DIRECTORY);
40
+ if (!fs.existsSync(POWERSYNC_DIRECTORY)) {
41
+ fs.mkdirSync(POWERSYNC_DIRECTORY);
42
+ }
41
43
  if (fs.existsSync(ENV_FILE_PATH)) {
42
44
  fs.unlinkSync(ENV_FILE_PATH);
43
45
  }
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { homedir } from 'node:os';
2
2
  import path from 'node:path';
3
- export const POWERSYNC_DIRECTORY = path.join(homedir(), '/powersync');
3
+ export const POWERSYNC_DIRECTORY = path.join(homedir(), '/.powersync');
4
4
  export const ENV_FILE_PATH = `${POWERSYNC_DIRECTORY}/.env.powersync`;
5
5
  export const ENDPOINTS = {
6
6
  ACCOUNTS_URL: 'https://accounts.journeyapps.com',
@@ -11093,7 +11093,7 @@ main$1.exports.populate = DotenvModule.populate;
11093
11093
 
11094
11094
  main$1.exports = DotenvModule;
11095
11095
 
11096
- const POWERSYNC_DIRECTORY = path$1.join(homedir(), "/powersync");
11096
+ const POWERSYNC_DIRECTORY = path$1.join(homedir(), "/.powersync");
11097
11097
  const ENV_FILE_PATH = `${POWERSYNC_DIRECTORY}/.env.powersync`;
11098
11098
  const ENDPOINTS = {
11099
11099
  ACCOUNTS_URL: "https://accounts.journeyapps.com",
@@ -11482,7 +11482,7 @@ main$1.exports.populate = DotenvModule.populate;
11482
11482
 
11483
11483
  main$1.exports = DotenvModule;
11484
11484
 
11485
- const POWERSYNC_DIRECTORY = path$1.join(homedir(), "/powersync");
11485
+ const POWERSYNC_DIRECTORY = path$1.join(homedir(), "/.powersync");
11486
11486
  const ENV_FILE_PATH = `${POWERSYNC_DIRECTORY}/.env.powersync`;
11487
11487
  const ENDPOINTS = {
11488
11488
  ACCOUNTS_URL: "https://accounts.journeyapps.com",
package/dist/utils.js CHANGED
@@ -20,10 +20,8 @@ export const checkForValidEnvFile = (cliName, requiresInstanceId = false) => {
20
20
  }
21
21
  };
22
22
  export const updateEnvFileVariableValue = (variableName, newValue) => {
23
- // Currently assume there is only a .env file in the root of the project
24
- const envFilePath = '.env';
25
23
  try {
26
- const data = fs.readFileSync(envFilePath, 'utf8');
24
+ const data = fs.readFileSync(ENV_FILE_PATH, 'utf8');
27
25
  const lines = data.split('\n');
28
26
  let variableFound = false;
29
27
  // Find and update the desired variable
@@ -40,7 +38,7 @@ export const updateEnvFileVariableValue = (variableName, newValue) => {
40
38
  lines.push(variableName + '=' + newValue);
41
39
  }
42
40
  const updatedContent = lines.join('\n');
43
- fs.writeFileSync(envFilePath, updatedContent, 'utf8');
41
+ fs.writeFileSync(ENV_FILE_PATH, updatedContent, 'utf8');
44
42
  }
45
43
  catch (error) {
46
44
  console.error(error);
@@ -510,5 +510,5 @@
510
510
  ]
511
511
  }
512
512
  },
513
- "version": "0.1.1"
513
+ "version": "0.1.2"
514
514
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "/dist",
17
17
  "/oclif.manifest.json"
18
18
  ],
19
- "version": "0.1.1",
19
+ "version": "0.1.2",
20
20
  "bugs": "https://github.com/powersync-ja/cli/issues",
21
21
  "types": "dist/index.d.ts",
22
22
  "exports": "./lib/index.js",