wp-migrate-core 0.1.0-demo
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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/src/adapters.d.ts +25 -0
- package/dist/src/adapters.js +11 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +250 -0
- package/dist/src/core.d.ts +9 -0
- package/dist/src/core.js +603 -0
- package/dist/src/generate.d.ts +2 -0
- package/dist/src/generate.js +555 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/report.d.ts +7 -0
- package/dist/src/report.js +761 -0
- package/dist/src/types.d.ts +83 -0
- package/dist/src/types.js +1 -0
- package/fixtures/demo-wordpress.xml +111 -0
- package/package.json +59 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export type OutputTarget = "astro" | "next" | "nuxt";
|
|
2
|
+
export type WordPressContentType = "page" | "post";
|
|
3
|
+
export type WordPressStatus = "publish" | "draft" | "future" | "pending" | "private" | "trash" | "inherit" | "unknown";
|
|
4
|
+
export type SourceEditor = "classic" | "gutenberg" | "elementor" | "mixed";
|
|
5
|
+
export type ConversionDisposition = "native" | "legacy-html" | "manual" | "blocked";
|
|
6
|
+
export type MigrationNodeKind = "root" | "section" | "group" | "columns" | "column" | "paragraph" | "heading" | "list" | "quote" | "code" | "html" | "image" | "gallery" | "button" | "separator" | "spacer" | "embed" | "shortcode" | "form" | "query" | "unknown";
|
|
7
|
+
export interface MigrationNode {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly source: "classic" | "gutenberg" | "elementor" | "shortcode";
|
|
10
|
+
readonly sourceType: string;
|
|
11
|
+
readonly kind: MigrationNodeKind;
|
|
12
|
+
readonly conversion: ConversionDisposition;
|
|
13
|
+
readonly attributes: Readonly<Record<string, unknown>>;
|
|
14
|
+
readonly children: readonly MigrationNode[];
|
|
15
|
+
readonly text?: string;
|
|
16
|
+
readonly rawHtml?: string;
|
|
17
|
+
}
|
|
18
|
+
export type MigrationIssueSeverity = "warning" | "blocker";
|
|
19
|
+
export type MigrationIssueCode = "WXR_NO_ITEMS" | "WXR_ITEM_MISSING_ID" | "GUTENBERG_UNCLOSED_BLOCK" | "GUTENBERG_UNMATCHED_CLOSE" | "GUTENBERG_INVALID_ATTRIBUTES" | "GUTENBERG_DYNAMIC_BLOCK" | "GUTENBERG_MEDIA_UNSUPPORTED" | "GUTENBERG_UNKNOWN_BLOCK" | "SHORTCODE_UNSUPPORTED" | "ELEMENTOR_INVALID_DATA" | "ELEMENTOR_FORM_UNSUPPORTED" | "ELEMENTOR_QUERY_UNSUPPORTED" | "ELEMENTOR_IMAGE_REMOTE_MEDIA" | "ELEMENTOR_BUTTON_UNSAFE_URL" | "ELEMENTOR_WIDGET_UNKNOWN";
|
|
20
|
+
export interface MigrationIssue {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly severity: MigrationIssueSeverity;
|
|
23
|
+
readonly code: MigrationIssueCode;
|
|
24
|
+
readonly sourceId: string;
|
|
25
|
+
readonly route?: string;
|
|
26
|
+
readonly nodeId?: string;
|
|
27
|
+
readonly title: string;
|
|
28
|
+
readonly message: string;
|
|
29
|
+
readonly evidence?: string;
|
|
30
|
+
readonly requiredAction: string;
|
|
31
|
+
}
|
|
32
|
+
export interface WordPressTerm {
|
|
33
|
+
readonly domain: string;
|
|
34
|
+
readonly nicename: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
}
|
|
37
|
+
export type WordPressPostMeta = Readonly<Record<string, readonly string[]>>;
|
|
38
|
+
export interface ContentRecord {
|
|
39
|
+
readonly sourceId: string;
|
|
40
|
+
readonly wordpressId: number;
|
|
41
|
+
readonly type: WordPressContentType;
|
|
42
|
+
readonly status: WordPressStatus;
|
|
43
|
+
readonly title: string;
|
|
44
|
+
readonly slug: string;
|
|
45
|
+
readonly route?: string;
|
|
46
|
+
readonly publishedAt?: string;
|
|
47
|
+
readonly modifiedAt?: string;
|
|
48
|
+
readonly author?: string;
|
|
49
|
+
readonly editor: SourceEditor;
|
|
50
|
+
readonly rawContent: string;
|
|
51
|
+
readonly meta: WordPressPostMeta;
|
|
52
|
+
readonly terms: readonly WordPressTerm[];
|
|
53
|
+
readonly nodes: readonly MigrationNode[];
|
|
54
|
+
readonly issues: readonly MigrationIssue[];
|
|
55
|
+
}
|
|
56
|
+
export interface MigrationSummary {
|
|
57
|
+
readonly records: number;
|
|
58
|
+
readonly pages: number;
|
|
59
|
+
readonly posts: number;
|
|
60
|
+
readonly nodes: number;
|
|
61
|
+
readonly nativeNodes: number;
|
|
62
|
+
readonly manualNodes: number;
|
|
63
|
+
readonly blockedNodes: number;
|
|
64
|
+
readonly reviewItems: number;
|
|
65
|
+
readonly warnings: number;
|
|
66
|
+
readonly blockers: number;
|
|
67
|
+
}
|
|
68
|
+
export interface MigrationProject {
|
|
69
|
+
readonly site: {
|
|
70
|
+
readonly title: string;
|
|
71
|
+
readonly url?: string;
|
|
72
|
+
};
|
|
73
|
+
readonly source: {
|
|
74
|
+
readonly title?: string;
|
|
75
|
+
readonly url?: string;
|
|
76
|
+
};
|
|
77
|
+
readonly records: readonly ContentRecord[];
|
|
78
|
+
readonly issues: readonly MigrationIssue[];
|
|
79
|
+
readonly summary: MigrationSummary;
|
|
80
|
+
}
|
|
81
|
+
export interface InspectOptions {
|
|
82
|
+
readonly includeDrafts?: boolean;
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<rss version="2.0"
|
|
3
|
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
|
4
|
+
xmlns:wp="http://wordpress.org/export/1.2/"
|
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
6
|
+
xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/">
|
|
7
|
+
<channel>
|
|
8
|
+
<title>Bright Path Plumbing</title>
|
|
9
|
+
<link>https://brightpath.example</link>
|
|
10
|
+
<description>Demo migration fixture</description>
|
|
11
|
+
<wp:base_site_url>https://brightpath.example</wp:base_site_url>
|
|
12
|
+
<wp:base_blog_url>https://brightpath.example</wp:base_blog_url>
|
|
13
|
+
|
|
14
|
+
<item>
|
|
15
|
+
<title>Home</title>
|
|
16
|
+
<link>https://brightpath.example/</link>
|
|
17
|
+
<dc:creator><![CDATA[niko]]></dc:creator>
|
|
18
|
+
<content:encoded><![CDATA[
|
|
19
|
+
<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
20
|
+
<div class="wp-block-group">
|
|
21
|
+
<!-- wp:heading {"level":1} --><h1>Plumbing without the runaround</h1><!-- /wp:heading -->
|
|
22
|
+
<!-- wp:paragraph --><p>Clear prices, scheduled arrivals and repairs that last.</p><!-- /wp:paragraph -->
|
|
23
|
+
<!-- wp:buttons --><div class="wp-block-buttons"><!-- wp:button --><div class="wp-block-button"><a class="wp-block-button__link" href="/contact/">Request a quote</a></div><!-- /wp:button --></div><!-- /wp:buttons -->
|
|
24
|
+
</div>
|
|
25
|
+
<!-- /wp:group -->
|
|
26
|
+
<!-- wp:latest-posts {"postsToShow":3,"displayPostDate":true} /-->
|
|
27
|
+
]]></content:encoded>
|
|
28
|
+
<excerpt:encoded><![CDATA[Local plumbing services.]]></excerpt:encoded>
|
|
29
|
+
<wp:post_id>10</wp:post_id>
|
|
30
|
+
<wp:post_date>2026-06-01 09:00:00</wp:post_date>
|
|
31
|
+
<wp:post_name>home</wp:post_name>
|
|
32
|
+
<wp:status>publish</wp:status>
|
|
33
|
+
<wp:post_type>page</wp:post_type>
|
|
34
|
+
</item>
|
|
35
|
+
|
|
36
|
+
<item>
|
|
37
|
+
<title>Services</title>
|
|
38
|
+
<link>https://brightpath.example/services/</link>
|
|
39
|
+
<dc:creator><![CDATA[niko]]></dc:creator>
|
|
40
|
+
<content:encoded><![CDATA[]]></content:encoded>
|
|
41
|
+
<wp:post_id>11</wp:post_id>
|
|
42
|
+
<wp:post_date>2026-06-02 09:00:00</wp:post_date>
|
|
43
|
+
<wp:post_name>services</wp:post_name>
|
|
44
|
+
<wp:status>publish</wp:status>
|
|
45
|
+
<wp:post_type>page</wp:post_type>
|
|
46
|
+
<wp:postmeta>
|
|
47
|
+
<wp:meta_key><![CDATA[_elementor_edit_mode]]></wp:meta_key>
|
|
48
|
+
<wp:meta_value><![CDATA[builder]]></wp:meta_value>
|
|
49
|
+
</wp:postmeta>
|
|
50
|
+
<wp:postmeta>
|
|
51
|
+
<wp:meta_key><![CDATA[_elementor_data]]></wp:meta_key>
|
|
52
|
+
<wp:meta_value><![CDATA[[
|
|
53
|
+
{
|
|
54
|
+
"id":"hero01",
|
|
55
|
+
"elType":"container",
|
|
56
|
+
"settings":{"content_width":"boxed","padding":{"unit":"px","top":"72","right":"24","bottom":"72","left":"24"}},
|
|
57
|
+
"elements":[
|
|
58
|
+
{"id":"h001","elType":"widget","widgetType":"heading","settings":{"title":"Repairs, installations and maintenance","header_size":"h1"},"elements":[]},
|
|
59
|
+
{"id":"t001","elType":"widget","widgetType":"text-editor","settings":{"editor":"<p>Residential plumbing handled by licensed technicians.</p>"},"elements":[]},
|
|
60
|
+
{"id":"b001","elType":"widget","widgetType":"button","settings":{"text":"Request a quote","link":{"url":"/contact/"}},"elements":[]}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id":"services01",
|
|
65
|
+
"elType":"container",
|
|
66
|
+
"settings":{"flex_direction":"row"},
|
|
67
|
+
"elements":[
|
|
68
|
+
{"id":"i001","elType":"widget","widgetType":"image","settings":{"image":{"url":"https://brightpath.example/wp-content/uploads/2026/05/repair.jpg","id":301},"image_size":"large"},"elements":[]},
|
|
69
|
+
{"id":"p001","elType":"widget","widgetType":"posts","settings":{"posts_per_page":3,"orderby":"menu_order"},"elements":[]},
|
|
70
|
+
{"id":"x001","elType":"widget","widgetType":"essential-addons-testimonial-slider","settings":{"autoplay":"yes"},"elements":[]}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
]]]></wp:meta_value>
|
|
74
|
+
</wp:postmeta>
|
|
75
|
+
</item>
|
|
76
|
+
|
|
77
|
+
<item>
|
|
78
|
+
<title>Contact</title>
|
|
79
|
+
<link>https://brightpath.example/contact/</link>
|
|
80
|
+
<dc:creator><![CDATA[niko]]></dc:creator>
|
|
81
|
+
<content:encoded><![CDATA[
|
|
82
|
+
<!-- wp:heading --><h2>Request a quote</h2><!-- /wp:heading -->
|
|
83
|
+
<!-- wp:paragraph --><p>Tell us what needs attention.</p><!-- /wp:paragraph -->
|
|
84
|
+
[gravityform id="4" title="false" description="false"]
|
|
85
|
+
]]></content:encoded>
|
|
86
|
+
<wp:post_id>12</wp:post_id>
|
|
87
|
+
<wp:post_date>2026-06-03 09:00:00</wp:post_date>
|
|
88
|
+
<wp:post_name>contact</wp:post_name>
|
|
89
|
+
<wp:status>publish</wp:status>
|
|
90
|
+
<wp:post_type>page</wp:post_type>
|
|
91
|
+
</item>
|
|
92
|
+
|
|
93
|
+
<item>
|
|
94
|
+
<title>How to stop a leaking tap</title>
|
|
95
|
+
<link>https://brightpath.example/guides/stop-a-leaking-tap/</link>
|
|
96
|
+
<dc:creator><![CDATA[niko]]></dc:creator>
|
|
97
|
+
<category domain="category" nicename="guides"><![CDATA[Guides]]></category>
|
|
98
|
+
<content:encoded><![CDATA[
|
|
99
|
+
<!-- wp:heading --><h2>Find the shut-off valve</h2><!-- /wp:heading -->
|
|
100
|
+
<!-- wp:paragraph --><p>Turn off the local valve before removing the tap handle.</p><!-- /wp:paragraph -->
|
|
101
|
+
<!-- wp:image {"id":302,"sizeSlug":"large"} --><figure class="wp-block-image size-large"><img src="https://brightpath.example/wp-content/uploads/2026/05/tap.jpg" alt="Tap handle removed" /></figure><!-- /wp:image -->
|
|
102
|
+
<!-- wp:quote --><blockquote class="wp-block-quote"><p>Do not force a seized valve.</p></blockquote><!-- /wp:quote -->
|
|
103
|
+
]]></content:encoded>
|
|
104
|
+
<wp:post_id>20</wp:post_id>
|
|
105
|
+
<wp:post_date>2026-06-04 09:00:00</wp:post_date>
|
|
106
|
+
<wp:post_name>stop-a-leaking-tap</wp:post_name>
|
|
107
|
+
<wp:status>publish</wp:status>
|
|
108
|
+
<wp:post_type>post</wp:post_type>
|
|
109
|
+
</item>
|
|
110
|
+
</channel>
|
|
111
|
+
</rss>
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wp-migrate-core",
|
|
3
|
+
"version": "0.1.0-demo",
|
|
4
|
+
"description": "Turn a WordPress WXR export into an Astro handoff, with a repair queue for the parts that still need a human.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"wordpress",
|
|
7
|
+
"wordpress-migration",
|
|
8
|
+
"wxr",
|
|
9
|
+
"astro",
|
|
10
|
+
"elementor",
|
|
11
|
+
"gutenberg",
|
|
12
|
+
"cli",
|
|
13
|
+
"typescript"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/src/index.js",
|
|
17
|
+
"types": "./dist/src/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/src/index.d.ts",
|
|
21
|
+
"import": "./dist/src/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"wp-migrate-core": "dist/src/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/src",
|
|
29
|
+
"fixtures/demo-wordpress.xml"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"test": "npm run build && node --test dist/**/*.test.js",
|
|
34
|
+
"demo": "npm run build && node dist/src/cli.js demo",
|
|
35
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
36
|
+
"prepack": "npm run clean && npm run build",
|
|
37
|
+
"prepublishOnly": "npm test"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^24.0.0",
|
|
44
|
+
"typescript": "^7.0.0"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/lame13/wp-migrate-core.git"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/lame13/wp-migrate-core/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://indexlane.dev",
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"tag": "demo"
|
|
58
|
+
}
|
|
59
|
+
}
|