@crombolo/import-umbraco 0.9.1 → 0.11.0

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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/index.ts +17 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/import-umbraco",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "Imports an existing Umbraco site into crombolo: a compatibility report, then schema files, a content bundle and view stubs.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -28,10 +28,10 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@crombolo/core": "0.9.1",
32
- "@crombolo/data": "0.9.1",
33
- "@crombolo/schema": "0.9.1",
34
- "@crombolo/transfer": "0.9.1",
31
+ "@crombolo/core": "0.11.0",
32
+ "@crombolo/data": "0.11.0",
33
+ "@crombolo/schema": "0.11.0",
34
+ "@crombolo/transfer": "0.11.0",
35
35
  "@kineco-au/bacpac-importer": "^0.1.0"
36
36
  }
37
37
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Importing an Umbraco site: a compatibility report, and then the files of a
3
- * crombolo site. `docs/16-umbraco-import.md`.
3
+ * crombolo site. `docs/umbraco-import.md`.
4
4
  *
5
5
  * Nothing here writes a database row or a file. The result is a report and a
6
6
  * list of files — schema, a content bundle, view stubs — for the caller to put
@@ -18,7 +18,7 @@ import {
18
18
  writeMemberType,
19
19
  writeSchemaVersion,
20
20
  } from '@crombolo/schema'
21
- import { writeBundle } from '@crombolo/transfer'
21
+ import { writeBundle, writeBundlePackage } from '@crombolo/transfer'
22
22
  import { convertContent } from './content.ts'
23
23
  import { Findings } from './findings.ts'
24
24
  import { type DictionaryItem, type DomainEntry, takeInventory } from './inventory.ts'
@@ -66,6 +66,11 @@ export interface ImportOptions {
66
66
  drafts?: boolean
67
67
  /** Keep the staging database here instead of in a temporary directory. */
68
68
  staging?: string
69
+ /**
70
+ * The crombolo release the new site runs, which its content package declares
71
+ * as its peer range. The importer does not know it itself: the CLI does.
72
+ */
73
+ coreVersion: string
69
74
  }
70
75
 
71
76
  /** One file of the new site: literal text, or a file to copy. */
@@ -295,8 +300,16 @@ export async function planImport(options: ImportOptions): Promise<ImportPlan> {
295
300
  count: files?.assets.length ?? 0,
296
301
  })
297
302
 
298
- // The bundle, in the format `content import` already reads.
299
- for (const file of writeBundle(content.set))
303
+ // The content, as the private bundle package `content import` reads.
304
+ const imported = writeBundlePackage(writeBundle(content.set), {
305
+ name: 'umbraco-import',
306
+ version: '1.0.0',
307
+ id: 'umbraco-import',
308
+ label: `Content imported from ${siteName}`,
309
+ private: true,
310
+ peerRange: `^${options.coreVersion}`,
311
+ })
312
+ for (const file of imported)
300
313
  out.push({ path: `${IMPORT_BUNDLE}/${file.path}`, text: file.text, bytes: file.bytes })
301
314
 
302
315
  if (inventory.urls.length > 0)