@loopress/cli 0.27.0 → 0.29.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.
- package/README.md +448 -189
- package/bin/dev.js +0 -0
- package/dist/commands/acf/pull.d.ts +9 -1
- package/dist/commands/acf/pull.js +2 -0
- package/dist/commands/acf/push.d.ts +9 -1
- package/dist/commands/acf/push.js +3 -1
- package/dist/commands/api/publish.js +1 -1
- package/dist/commands/app/pull.js +17 -4
- package/dist/commands/app/push.d.ts +3 -0
- package/dist/commands/app/push.js +30 -6
- package/dist/commands/composer/push.js +3 -21
- package/dist/commands/diff.js +1 -1
- package/dist/commands/form/pull.d.ts +9 -1
- package/dist/commands/form/pull.js +3 -1
- package/dist/commands/form/push.d.ts +7 -1
- package/dist/commands/form/push.js +3 -1
- package/dist/commands/init.js +6 -36
- package/dist/commands/menu/pull.d.ts +7 -1
- package/dist/commands/menu/pull.js +2 -0
- package/dist/commands/menu/push.d.ts +7 -1
- package/dist/commands/menu/push.js +3 -1
- package/dist/commands/option/pull.js +4 -4
- package/dist/commands/option/push.js +2 -0
- package/dist/commands/page/push.js +3 -0
- package/dist/commands/plugin/add.js +6 -3
- package/dist/commands/plugin/audit.js +4 -5
- package/dist/commands/plugin/pull.d.ts +7 -1
- package/dist/commands/plugin/pull.js +68 -14
- package/dist/commands/plugin/push.d.ts +5 -1
- package/dist/commands/plugin/push.js +92 -38
- package/dist/commands/plugin/status.d.ts +1 -0
- package/dist/commands/plugin/status.js +21 -2
- package/dist/commands/project/config.js +12 -8
- package/dist/commands/promote.d.ts +2 -0
- package/dist/commands/promote.js +69 -8
- package/dist/commands/pull.js +2 -2
- package/dist/commands/push.d.ts +1 -0
- package/dist/commands/push.js +40 -5
- package/dist/commands/seo/pull.d.ts +8 -1
- package/dist/commands/seo/pull.js +2 -0
- package/dist/commands/seo/push.d.ts +7 -1
- package/dist/commands/seo/push.js +3 -1
- package/dist/commands/snippet/publish.js +1 -1
- package/dist/commands/snippet/pull.js +1 -1
- package/dist/commands/snippet/push.js +1 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +4 -4
- package/dist/commands/theme/pull.d.ts +6 -8
- package/dist/commands/theme/pull.js +30 -26
- package/dist/commands/theme/push.d.ts +8 -9
- package/dist/commands/theme/push.js +54 -111
- package/dist/commands/theme/style/diff.d.ts +2 -0
- package/dist/commands/{theme-styles → theme/style}/diff.js +2 -1
- package/dist/commands/{theme-styles → theme/style}/pull.d.ts +8 -2
- package/dist/commands/{theme-styles → theme/style}/pull.js +6 -4
- package/dist/commands/{theme-styles → theme/style}/push.d.ts +9 -2
- package/dist/commands/{theme-styles → theme/style}/push.js +9 -6
- package/dist/commands/theme/style/rollback.d.ts +2 -0
- package/dist/commands/theme/style/rollback.js +6 -0
- package/dist/commands/theme/template/diff.d.ts +10 -0
- package/dist/commands/theme/template/diff.js +13 -0
- package/dist/commands/theme/template/list.d.ts +13 -0
- package/dist/commands/theme/template/list.js +23 -0
- package/dist/commands/theme/template/push.d.ts +20 -0
- package/dist/commands/theme/template/push.js +44 -0
- package/dist/commands/theme/version/pull.d.ts +23 -0
- package/dist/commands/theme/version/pull.js +43 -0
- package/dist/commands/theme/version/push.d.ts +22 -0
- package/dist/commands/theme/version/push.js +123 -0
- package/dist/hooks/finally.d.ts +2 -1
- package/dist/hooks/finally.js +27 -4
- package/dist/lib/api-client.js +3 -1
- package/dist/lib/app-build.d.ts +5 -0
- package/dist/lib/app-build.js +69 -0
- package/dist/lib/app-manifest.d.ts +4 -0
- package/dist/lib/app-manifest.js +10 -2
- package/dist/lib/base.d.ts +1 -0
- package/dist/lib/base.js +14 -2
- package/dist/lib/bootstrap-full-install.js +45 -14
- package/dist/lib/dev-watch.d.ts +1 -1
- package/dist/lib/dev-watch.js +3 -1
- package/dist/lib/diff-command.d.ts +1 -0
- package/dist/lib/diff-command.js +6 -4
- package/dist/lib/diff-state.js +1 -0
- package/dist/lib/github-release.js +0 -1
- package/dist/lib/local-callback-server.d.ts +12 -6
- package/dist/lib/local-callback-server.js +21 -22
- package/dist/lib/php-files-command.js +3 -1
- package/dist/lib/push-command.d.ts +5 -0
- package/dist/lib/push-command.js +30 -8
- package/dist/lib/resource-state.js +47 -4
- package/dist/lib/rollback-command.d.ts +1 -0
- package/dist/lib/rollback-command.js +8 -6
- package/dist/lib/rotate-app-password.js +2 -2
- package/dist/lib/snapshot-store.js +2 -2
- package/dist/lib/validate-local.js +6 -0
- package/dist/lib/wp-authorize-flow.d.ts +10 -17
- package/dist/lib/wp-authorize-flow.js +24 -28
- package/dist/lib/wp-client.d.ts +4 -1
- package/dist/lib/wp-client.js +25 -1
- package/dist/lib/wp-site-diagnostic.js +37 -0
- package/dist/types/plugin.d.ts +8 -1
- package/dist/types/plugin.js +4 -1
- package/dist/types/project-config.generated.d.ts +19 -2
- package/dist/utils/composer.d.ts +16 -0
- package/dist/utils/composer.js +144 -0
- package/dist/utils/option-format.d.ts +3 -1
- package/dist/utils/option-format.js +14 -3
- package/dist/utils/page-format.d.ts +12 -0
- package/dist/utils/page-format.js +40 -28
- package/dist/utils/plugin-sync.js +1 -1
- package/dist/utils/plugins.d.ts +9 -4
- package/dist/utils/plugins.js +16 -7
- package/dist/utils/resource-dirs.d.ts +2 -0
- package/dist/utils/resource-dirs.js +6 -2
- package/dist/utils/seo-format.d.ts +2 -2
- package/dist/utils/template-format.d.ts +31 -0
- package/dist/utils/template-format.js +43 -0
- package/oclif.manifest.json +841 -63
- package/package.json +24 -17
- package/schemas/project-config.schema.json +25 -4
- package/dist/commands/theme-styles/diff.d.ts +0 -2
- package/dist/commands/theme-styles/rollback.d.ts +0 -2
- package/dist/commands/theme-styles/rollback.js +0 -5
|
@@ -17,13 +17,13 @@ export type RemoteSeoSettings = {
|
|
|
17
17
|
settings: Record<string, unknown>;
|
|
18
18
|
};
|
|
19
19
|
export type SeoRedirect = {
|
|
20
|
-
createdAt:
|
|
20
|
+
createdAt: null | string;
|
|
21
21
|
headerCode: number;
|
|
22
22
|
hits: number;
|
|
23
23
|
id: number;
|
|
24
24
|
sources: unknown;
|
|
25
25
|
status: string;
|
|
26
|
-
updatedAt:
|
|
26
|
+
updatedAt: null | string;
|
|
27
27
|
urlTo: string;
|
|
28
28
|
};
|
|
29
29
|
export declare function redirectFileBase(redirect: SeoRedirect): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type PageProblem, type SlugRule } from './page-format.js';
|
|
2
|
+
export declare const CHILD_THEME_ENDPOINT = "loopress/v1/child-theme";
|
|
3
|
+
export declare const TEMPLATE_SLUG_RULE: SlugRule;
|
|
4
|
+
export type Template = {
|
|
5
|
+
html: string;
|
|
6
|
+
postTypes?: string[];
|
|
7
|
+
slug: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Part = {
|
|
11
|
+
area: string;
|
|
12
|
+
html: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
export type ChildTheme = {
|
|
17
|
+
active: boolean;
|
|
18
|
+
customized: string[];
|
|
19
|
+
exists: boolean;
|
|
20
|
+
parent: string;
|
|
21
|
+
parts: Part[];
|
|
22
|
+
stylesheet: string;
|
|
23
|
+
templates: Template[];
|
|
24
|
+
};
|
|
25
|
+
export declare function parseTemplateFile(slug: string, raw: string): Template;
|
|
26
|
+
export declare function parsePartFile(slug: string, raw: string): Part;
|
|
27
|
+
export declare function readLocalTemplates(templatesDir: string, partsDir: string): Promise<{
|
|
28
|
+
parts: Part[];
|
|
29
|
+
problems: PageProblem[];
|
|
30
|
+
templates: Template[];
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { parseHtmlHeader, readLocalHtmlFiles, titleFromSlug } from './page-format.js';
|
|
2
|
+
export const CHILD_THEME_ENDPOINT = 'loopress/v1/child-theme';
|
|
3
|
+
// Mirrored server-side in ChildThemeController. Looser than a page slug: the template hierarchy
|
|
4
|
+
// embeds post type and taxonomy slugs as is (`taxonomy-download_tag`, `single-my_type`), and those
|
|
5
|
+
// follow sanitize_key(), so lowercase letters, digits, `_` and `-`.
|
|
6
|
+
export const TEMPLATE_SLUG_RULE = {
|
|
7
|
+
message: 'the file name must be lowercase letters, digits, "_" and "-" (e.g. "taxonomy-download_tag.html")',
|
|
8
|
+
pattern: /^[a-z0-9_-]+$/,
|
|
9
|
+
};
|
|
10
|
+
// A block delimiter as the first line (`<!-- wp:template-part ... /-->`, the usual one) is markup,
|
|
11
|
+
// not a header.
|
|
12
|
+
const BLOCK_START = /^\s*<!--\s*\/?wp:/;
|
|
13
|
+
// `{"slug":"header","theme":"twentytwentyfive"}` makes WordPress load the named theme's part, so
|
|
14
|
+
// the child's own parts/header.html would be silently ignored.
|
|
15
|
+
const THEMED_PART = /<!--\s*wp:template-part\s+\{[^}]*"theme"\s*:/;
|
|
16
|
+
function parseFile(raw, keys) {
|
|
17
|
+
const parsed = BLOCK_START.test(raw) ? { body: raw, meta: {} } : parseHtmlHeader(raw, keys);
|
|
18
|
+
if (THEMED_PART.test(parsed.body)) {
|
|
19
|
+
throw new Error('a template-part block has a "theme" attribute, remove it: WordPress would load that theme\'s part instead of the one in parts/');
|
|
20
|
+
}
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
export function parseTemplateFile(slug, raw) {
|
|
24
|
+
const { body, meta } = parseFile(raw, ['title', 'postTypes']);
|
|
25
|
+
const template = { html: body, slug };
|
|
26
|
+
if (meta.title)
|
|
27
|
+
template.title = meta.title;
|
|
28
|
+
if (meta.postTypes)
|
|
29
|
+
template.postTypes = meta.postTypes.split(',').map((type) => type.trim()).filter(Boolean);
|
|
30
|
+
return template;
|
|
31
|
+
}
|
|
32
|
+
// `area` defaults from the name, the way themes name their parts: header, header-large-title...
|
|
33
|
+
export function parsePartFile(slug, raw) {
|
|
34
|
+
const { body, meta } = parseFile(raw, ['title', 'area']);
|
|
35
|
+
const nameArea = /^(header|footer)(-|$)/.exec(slug)?.[1] ?? 'uncategorized';
|
|
36
|
+
return { area: meta.area || nameArea, html: body, slug, title: meta.title || titleFromSlug(slug) };
|
|
37
|
+
}
|
|
38
|
+
// Same directory rules as pages/ (flat, `.html` only), with template slugs, every problem at once.
|
|
39
|
+
export async function readLocalTemplates(templatesDir, partsDir) {
|
|
40
|
+
const templates = await readLocalHtmlFiles(templatesDir, parseTemplateFile, TEMPLATE_SLUG_RULE);
|
|
41
|
+
const parts = await readLocalHtmlFiles(partsDir, parsePartFile, TEMPLATE_SLUG_RULE);
|
|
42
|
+
return { parts: parts.files, problems: [...templates.problems, ...parts.problems], templates: templates.files };
|
|
43
|
+
}
|