@rocapine/community 0.10.1 → 0.10.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.
@@ -95,7 +95,9 @@ async function runInit(options = {}) {
95
95
  continue;
96
96
  const destDir = path.join(functionsDestRoot, fnName);
97
97
  fs.cpSync(srcDir, destDir, { recursive: true, filter: install_shared_1.isShippedFunctionFile });
98
- writtenPaths.push(...(0, install_shared_1.listFilesRecursive)(destDir));
98
+ // Only what we copied: a host file already in the folder (e.g. `_shared`)
99
+ // must neither land in the manifest nor be deleted by the rollback below.
100
+ writtenPaths.push(...(0, install_shared_1.shippedRelFiles)(srcDir).map((rel) => path.join(destDir, rel)));
99
101
  }
100
102
  }
101
103
  catch (err) {
@@ -181,7 +181,7 @@ async function runUpgrade(options = {}) {
181
181
  ];
182
182
  const touchedFunctionDirPrefixes = touchedFunctionDirs.map((d) => `${(0, install_shared_1.toRelativePosix)(cwd, d)}/`);
183
183
  // The template's files only — never host files living in the same folder.
184
- const touchedFunctionFiles = touchedFunctionDirs.flatMap((d) => shippedRelFiles(path.join(functionsSrcRoot, path.basename(d))).map((rel) => (0, install_shared_1.toRelativePosix)(cwd, path.join(d, rel))));
184
+ const touchedFunctionFiles = touchedFunctionDirs.flatMap((d) => (0, install_shared_1.shippedRelFiles)(path.join(functionsSrcRoot, path.basename(d))).map((rel) => (0, install_shared_1.toRelativePosix)(cwd, path.join(d, rel))));
185
185
  const survivingOldFiles = manifest.installedFiles.filter((f) => !touchedFunctionDirPrefixes.some((prefix) => f.startsWith(prefix)));
186
186
  const installedFiles = [
187
187
  ...new Set([...survivingOldFiles, ...touchedFunctionFiles, ...addedMigrations]),
@@ -230,15 +230,10 @@ function reconstructInstalledTemplateIds(installedFiles) {
230
230
  }
231
231
  return ids;
232
232
  }
233
- function shippedRelFiles(srcDir) {
234
- return (0, install_shared_1.listFilesRecursive)(srcDir)
235
- .filter(install_shared_1.isShippedFunctionFile)
236
- .map((f) => path.relative(srcDir, f));
237
- }
238
233
  /** Files a previous upgrade installed in `destDir` (per the manifest) that the
239
234
  * current template no longer ships. */
240
235
  function staleFiles(srcDir, destDir, cwd, installedFiles) {
241
- const shipped = new Set(shippedRelFiles(srcDir).map((rel) => rel.split(path.sep).join("/")));
236
+ const shipped = new Set((0, install_shared_1.shippedRelFiles)(srcDir).map((rel) => rel.split(path.sep).join("/")));
242
237
  const prefix = `${(0, install_shared_1.toRelativePosix)(cwd, destDir)}/`;
243
238
  return installedFiles
244
239
  .filter((f) => f.startsWith(prefix) && !shipped.has(f.slice(prefix.length)))
@@ -250,7 +245,7 @@ function staleFiles(srcDir, destDir, cwd, installedFiles) {
250
245
  function functionDirDiffers(srcDir, destDir, stale) {
251
246
  if (stale.length > 0)
252
247
  return true;
253
- return shippedRelFiles(srcDir).some((rel) => {
248
+ return (0, install_shared_1.shippedRelFiles)(srcDir).some((rel) => {
254
249
  const dest = path.join(destDir, rel);
255
250
  return (!fs.existsSync(dest) || !fs.readFileSync(path.join(srcDir, rel)).equals(fs.readFileSync(dest)));
256
251
  });
@@ -54,6 +54,8 @@ export declare function addSeconds(date: Date, seconds: number): Date;
54
54
  * functions, and ignored when diffing a host's function dir. */
55
55
  export declare function isShippedFunctionFile(file: string): boolean;
56
56
  export declare function listFilesRecursive(dir: string): string[];
57
+ /** A template function dir's shipped files, relative to `srcDir`. */
58
+ export declare function shippedRelFiles(srcDir: string): string[];
57
59
  export declare function toRelativePosix(base: string, target: string): string;
58
60
  /** Resolves `dirRel` against `cwd`, throwing if it would escape the project root. */
59
61
  export declare function resolveContainedDir(cwd: string, dirRel: string): string;
@@ -46,6 +46,7 @@ exports.formatTimestamp = formatTimestamp;
46
46
  exports.addSeconds = addSeconds;
47
47
  exports.isShippedFunctionFile = isShippedFunctionFile;
48
48
  exports.listFilesRecursive = listFilesRecursive;
49
+ exports.shippedRelFiles = shippedRelFiles;
49
50
  exports.toRelativePosix = toRelativePosix;
50
51
  exports.resolveContainedDir = resolveContainedDir;
51
52
  exports.settingsSeedSql = settingsSeedSql;
@@ -207,6 +208,12 @@ function listFilesRecursive(dir) {
207
208
  }
208
209
  return files;
209
210
  }
211
+ /** A template function dir's shipped files, relative to `srcDir`. */
212
+ function shippedRelFiles(srcDir) {
213
+ return listFilesRecursive(srcDir)
214
+ .filter(isShippedFunctionFile)
215
+ .map((f) => path.relative(srcDir, f));
216
+ }
210
217
  function toRelativePosix(base, target) {
211
218
  return path.relative(base, target).split(path.sep).join("/");
212
219
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocapine/community",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "CLI to install, upgrade and adopt the Rocapine Community SDK's Supabase backend (migrations, Edge Functions) into a project.",
5
5
  "license": "MIT",
6
6
  "repository": {