@byline/cli 6.1.0 → 6.2.1
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/dist/templates/ui-byline/components/code/code.module.css +101 -0
- package/dist/templates/ui-byline/components/code/code.tsx +17 -8
- package/dist/templates/ui-byline/components/code/theme.ts +33 -0
- package/package.json +2 -2
- package/dist/lib/pg-url.d.ts +0 -11
- package/dist/lib/pg-url.d.ts.map +0 -1
- package/dist/lib/pg-url.js +0 -22
- package/dist/lib/pg-url.js.map +0 -1
- package/dist/phases/stub.d.ts +0 -3
- package/dist/phases/stub.d.ts.map +0 -1
- package/dist/phases/stub.js +0 -25
- package/dist/phases/stub.js.map +0 -1
- package/dist/ui/snippet.d.ts +0 -2
- package/dist/ui/snippet.d.ts.map +0 -1
- package/dist/ui/snippet.js +0 -7
- package/dist/ui/snippet.js.map +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.root,
|
|
2
|
+
:global(.light) .root,
|
|
3
|
+
:global([data-theme="light"]) .root {
|
|
4
|
+
/* Prism One Light palette. */
|
|
5
|
+
--code-background: hsl(230, 1%, 98%);
|
|
6
|
+
--code-text: hsl(230, 8%, 24%);
|
|
7
|
+
--code-comment: hsl(230, 4%, 64%);
|
|
8
|
+
--code-literal: hsl(35, 99%, 36%);
|
|
9
|
+
--code-keyword: hsl(301, 63%, 40%);
|
|
10
|
+
--code-property: hsl(5, 74%, 59%);
|
|
11
|
+
--code-string: hsl(119, 34%, 47%);
|
|
12
|
+
--code-function: hsl(221, 87%, 60%);
|
|
13
|
+
--code-url: hsl(198, 99%, 37%);
|
|
14
|
+
--code-punctuation: var(--code-string);
|
|
15
|
+
--code-maybe-class: var(--code-text);
|
|
16
|
+
--code-scroll-thumb: color-mix(in srgb, var(--theme-400) 40%, white);
|
|
17
|
+
--code-scroll-hover: color-mix(in srgb, var(--theme-400) 55%, white);
|
|
18
|
+
--code-scroll-track: color-mix(in srgb, var(--theme-400) 8%, white);
|
|
19
|
+
--code-border: color-mix(in srgb, var(--theme-400) 20%, white);
|
|
20
|
+
--code-copy-background: var(--gray-50);
|
|
21
|
+
--code-copy-hover: var(--gray-100);
|
|
22
|
+
--code-copy-icon: var(--gray-700);
|
|
23
|
+
--code-copy-border: color-mix(in srgb, var(--theme-400) 35%, white);
|
|
24
|
+
border-color: var(--code-border);
|
|
25
|
+
color-scheme: light;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:global(.dark) .root,
|
|
29
|
+
:global([data-theme="dark"]) .root {
|
|
30
|
+
/* Prism One Dark syntax colors, with the existing dark code surface. */
|
|
31
|
+
--code-background: color-mix(in srgb, var(--gray-950) 80%, transparent);
|
|
32
|
+
--code-text: hsl(220, 14%, 71%);
|
|
33
|
+
--code-comment: hsl(220, 10%, 40%);
|
|
34
|
+
--code-literal: hsl(29, 54%, 61%);
|
|
35
|
+
--code-keyword: hsl(286, 60%, 67%);
|
|
36
|
+
--code-property: hsl(355, 65%, 65%);
|
|
37
|
+
--code-string: hsl(95, 38%, 62%);
|
|
38
|
+
--code-function: hsl(207, 82%, 66%);
|
|
39
|
+
--code-url: hsl(187, 47%, 55%);
|
|
40
|
+
--code-punctuation: var(--code-text);
|
|
41
|
+
--code-maybe-class: var(--code-literal);
|
|
42
|
+
--code-scroll-thumb: var(--theme-400);
|
|
43
|
+
--code-scroll-hover: var(--theme-300);
|
|
44
|
+
--code-scroll-track: var(--theme-900);
|
|
45
|
+
--code-border: var(--theme-600);
|
|
46
|
+
--code-copy-background: var(--gray-900);
|
|
47
|
+
--code-copy-hover: color-mix(in srgb, var(--gray-800) 50%, transparent);
|
|
48
|
+
--code-copy-icon: var(--gray-200);
|
|
49
|
+
--code-copy-border: initial;
|
|
50
|
+
color-scheme: dark;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.copyButton {
|
|
54
|
+
background-color: var(--code-copy-background);
|
|
55
|
+
border-color: var(--code-copy-border, var(--button-variant-outlined-border));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.copyButton:hover {
|
|
59
|
+
background-color: var(--code-copy-hover);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.copyButton:focus,
|
|
63
|
+
.copyButton:active {
|
|
64
|
+
--ring-color: var(--code-copy-border, var(--button-ring-color));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.copyIcon {
|
|
68
|
+
fill: var(--code-copy-icon);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.scroller {
|
|
72
|
+
overflow-x: auto;
|
|
73
|
+
/* Let the explicit WebKit scrollbar render instead of the inherited
|
|
74
|
+
scrollbar-color selecting an auto-hiding native scrollbar on macOS. */
|
|
75
|
+
scrollbar-color: auto;
|
|
76
|
+
scrollbar-width: auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.scroller::-webkit-scrollbar {
|
|
80
|
+
height: 0.625rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.scroller::-webkit-scrollbar-thumb {
|
|
84
|
+
background: var(--code-scroll-thumb);
|
|
85
|
+
border-radius: 0.3125rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.scroller::-webkit-scrollbar-thumb:hover {
|
|
89
|
+
background: var(--code-scroll-hover);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.scroller::-webkit-scrollbar-track {
|
|
93
|
+
background: var(--code-scroll-track);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@supports not selector(::-webkit-scrollbar) {
|
|
97
|
+
.scroller {
|
|
98
|
+
scrollbar-color: var(--code-scroll-thumb) var(--code-scroll-track);
|
|
99
|
+
scrollbar-width: thin;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import { CopyButton } from '@byline/ui/react'
|
|
4
4
|
/* eslint-disable no-param-reassign */
|
|
5
5
|
import cx from 'clsx'
|
|
6
|
-
import { Highlight
|
|
6
|
+
import { Highlight } from 'prism-react-renderer'
|
|
7
|
+
|
|
8
|
+
import styles from './code.module.css'
|
|
9
|
+
import { codeTheme } from './theme'
|
|
7
10
|
|
|
8
11
|
type CodeIntrinsicProps = React.JSX.IntrinsicElements['pre']
|
|
9
12
|
interface CodeProps extends CodeIntrinsicProps {
|
|
@@ -17,19 +20,25 @@ export function Code({ code, className, language }: CodeProps): React.JSX.Elemen
|
|
|
17
20
|
// Prism calls `.toLowerCase()` on this value, so null and empty legacy values need a fallback.
|
|
18
21
|
const resolvedLanguage = language != null && language.length > 0 ? language : 'typescript'
|
|
19
22
|
return (
|
|
20
|
-
<Highlight theme={
|
|
21
|
-
{({ tokens, getLineProps, getTokenProps }) => (
|
|
22
|
-
<div
|
|
23
|
+
<Highlight theme={codeTheme} code={code} language={resolvedLanguage}>
|
|
24
|
+
{({ style, tokens, getLineProps, getTokenProps }) => (
|
|
25
|
+
<div
|
|
26
|
+
className={cx(
|
|
27
|
+
styles.root,
|
|
28
|
+
'code group min-w-0 overflow-hidden rounded border relative mb-4'
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
23
31
|
<CopyButton
|
|
24
32
|
variant="outlined"
|
|
25
33
|
intent="primary"
|
|
26
|
-
className=
|
|
27
|
-
containerClassName="
|
|
28
|
-
svgClassName=
|
|
34
|
+
className={styles.copyButton}
|
|
35
|
+
containerClassName="absolute top-2 right-2 invisible group-hover:visible group-focus-within:visible"
|
|
36
|
+
svgClassName={styles.copyIcon}
|
|
29
37
|
text={code}
|
|
30
38
|
/>
|
|
31
39
|
<pre
|
|
32
|
-
|
|
40
|
+
style={style}
|
|
41
|
+
className={cx(styles.scroller, 'm-0 py-5 px-4 rounded-none', className)}
|
|
33
42
|
>
|
|
34
43
|
<code className="not-prose">
|
|
35
44
|
{tokens.map((line, i) => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PrismTheme } from 'prism-react-renderer'
|
|
2
|
+
|
|
3
|
+
// Stable on the server and client. CSS selects the One Light / One Dark
|
|
4
|
+
// palette using the document class set by the existing early theme detector.
|
|
5
|
+
export const codeTheme: PrismTheme = {
|
|
6
|
+
plain: {
|
|
7
|
+
color: 'var(--code-text)',
|
|
8
|
+
backgroundColor: 'var(--code-background)',
|
|
9
|
+
},
|
|
10
|
+
styles: [
|
|
11
|
+
{ types: ['comment', 'prolog', 'cdata'], style: { color: 'var(--code-comment)' } },
|
|
12
|
+
{ types: ['doctype', 'entity'], style: { color: 'var(--code-text)' } },
|
|
13
|
+
{ types: ['punctuation'], style: { color: 'var(--code-punctuation)' } },
|
|
14
|
+
{
|
|
15
|
+
types: ['attr-name', 'class-name', 'boolean', 'constant', 'number', 'atrule'],
|
|
16
|
+
style: { color: 'var(--code-literal)' },
|
|
17
|
+
},
|
|
18
|
+
{ types: ['maybe-class-name'], style: { color: 'var(--code-maybe-class)' } },
|
|
19
|
+
{ types: ['keyword'], style: { color: 'var(--code-keyword)' } },
|
|
20
|
+
{ types: ['property', 'tag', 'symbol', 'deleted'], style: { color: 'var(--code-property)' } },
|
|
21
|
+
{
|
|
22
|
+
types: ['selector', 'string', 'char', 'builtin', 'inserted', 'regex', 'attr-value'],
|
|
23
|
+
style: { color: 'var(--code-string)' },
|
|
24
|
+
},
|
|
25
|
+
{ types: ['variable', 'operator', 'function'], style: { color: 'var(--code-function)' } },
|
|
26
|
+
{ types: ['url'], style: { color: 'var(--code-url)' } },
|
|
27
|
+
{ types: ['deleted'], style: { textDecorationLine: 'line-through' } },
|
|
28
|
+
{ types: ['inserted'], style: { textDecorationLine: 'underline' } },
|
|
29
|
+
{ types: ['italic'], style: { fontStyle: 'italic' } },
|
|
30
|
+
{ types: ['important', 'bold'], style: { fontWeight: 'bold' } },
|
|
31
|
+
{ types: ['important'], style: { color: 'var(--code-text)' } },
|
|
32
|
+
],
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@byline/cli",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
|
-
"version": "6.1
|
|
5
|
+
"version": "6.2.1",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.9.0"
|
|
8
8
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"typescript": "^7.0.2",
|
|
62
62
|
"unified": "^11.0.5",
|
|
63
63
|
"vitest": "^5.0.0",
|
|
64
|
-
"@byline/core": "6.1
|
|
64
|
+
"@byline/core": "6.2.1"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public",
|
package/dist/lib/pg-url.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface PgConn {
|
|
2
|
-
host: string;
|
|
3
|
-
port: number;
|
|
4
|
-
user: string;
|
|
5
|
-
password: string;
|
|
6
|
-
database: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function buildPgUrl(c: PgConn): string;
|
|
9
|
-
export declare function parsePgUrl(raw: string): PgConn;
|
|
10
|
-
export declare function withDatabase(c: PgConn, database: string): PgConn;
|
|
11
|
-
//# sourceMappingURL=pg-url.d.ts.map
|
package/dist/lib/pg-url.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pg-url.d.ts","sourceRoot":"","sources":["../../src/lib/pg-url.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY9C;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/lib/pg-url.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function buildPgUrl(c) {
|
|
2
|
-
const u = encodeURIComponent(c.user);
|
|
3
|
-
const p = encodeURIComponent(c.password);
|
|
4
|
-
return `postgresql://${u}:${p}@${c.host}:${c.port}/${encodeURIComponent(c.database)}`;
|
|
5
|
-
}
|
|
6
|
-
export function parsePgUrl(raw) {
|
|
7
|
-
const url = new URL(raw);
|
|
8
|
-
if (url.protocol !== 'postgresql:' && url.protocol !== 'postgres:') {
|
|
9
|
-
throw new Error(`expected postgresql:// URL, got ${url.protocol}`);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
host: url.hostname,
|
|
13
|
-
port: url.port ? Number(url.port) : 5432,
|
|
14
|
-
user: decodeURIComponent(url.username),
|
|
15
|
-
password: decodeURIComponent(url.password),
|
|
16
|
-
database: url.pathname.replace(/^\//, '') || 'postgres',
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export function withDatabase(c, database) {
|
|
20
|
-
return { ...c, database };
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=pg-url.js.map
|
package/dist/lib/pg-url.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pg-url.js","sourceRoot":"","sources":["../../src/lib/pg-url.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACpC,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACxC,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,kBAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAA;AACvF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IACxB,IAAI,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;QACxC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,QAAQ,EAAE,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC1C,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,UAAU;KACxD,CAAA;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,QAAgB;IACtD,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAA;AAC3B,CAAC"}
|
package/dist/phases/stub.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjD,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAoB3D"}
|
package/dist/phases/stub.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function stubPhase(id, title) {
|
|
2
|
-
return {
|
|
3
|
-
id,
|
|
4
|
-
title,
|
|
5
|
-
defaultMode: 'confirm',
|
|
6
|
-
async detect(ctx) {
|
|
7
|
-
return ctx.state.isComplete(id) ? 'done' : 'pending';
|
|
8
|
-
},
|
|
9
|
-
async plan() {
|
|
10
|
-
return {
|
|
11
|
-
writes: [],
|
|
12
|
-
commands: [],
|
|
13
|
-
notes: [`${id}: not yet implemented in @byline/cli ${currentVersion()}`],
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
async apply(_plan, ctx) {
|
|
17
|
-
ctx.logger.warn(`${id} — phase is stubbed; please follow the manual instructions in docs`);
|
|
18
|
-
return { state: 'pending' };
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function currentVersion() {
|
|
23
|
-
return '0.1.0';
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=stub.js.map
|
package/dist/phases/stub.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stub.js","sourceRoot":"","sources":["../../src/phases/stub.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,SAAS,CAAC,EAAW,EAAE,KAAa;IAClD,OAAO;QACL,EAAE;QACF,KAAK;QACL,WAAW,EAAE,SAAS;QACtB,KAAK,CAAC,MAAM,CAAC,GAAY;YACvB,OAAO,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QACtD,CAAC;QACD,KAAK,CAAC,IAAI;YACR,OAAO;gBACL,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,KAAK,EAAE,CAAC,GAAG,EAAE,wCAAwC,cAAc,EAAE,EAAE,CAAC;aACzE,CAAA;QACH,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,oEAAoE,CAAC,CAAA;YAC1F,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QAC7B,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/ui/snippet.d.ts
DELETED
package/dist/ui/snippet.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/ui/snippet.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAI5E"}
|
package/dist/ui/snippet.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import pc from 'picocolors';
|
|
2
|
-
export function renderSnippet(title, body, lang = '') {
|
|
3
|
-
const header = pc.dim(`--- ${title}${lang ? ` (${lang})` : ''} ---`);
|
|
4
|
-
const footer = pc.dim('---');
|
|
5
|
-
return `${header}\n${body}\n${footer}`;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=snippet.js.map
|
package/dist/ui/snippet.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../src/ui/snippet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAY,EAAE,IAAI,GAAG,EAAE;IAClE,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IACpE,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC5B,OAAO,GAAG,MAAM,KAAK,IAAI,KAAK,MAAM,EAAE,CAAA;AACxC,CAAC"}
|