refactor: rename to single package 'newspaperui' for simpler install

This commit is contained in:
sunzhongyi
2026-05-21 11:20:01 +08:00
parent 6d29e1a3e6
commit 60831e07aa
24 changed files with 42 additions and 38 deletions
+15 -10
View File
@@ -1,7 +1,7 @@
{
"name": "newspaperui-components",
"name": "newspaperui",
"version": "0.1.0",
"description": "Production-grade newspaper layout React components",
"description": "Production-grade newspaper layout React components with built-in theme and utilities",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -11,7 +11,8 @@
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"./style.css": "./dist/style.css"
},
"files": [
"dist"
@@ -22,16 +23,13 @@
"test": "vitest run",
"test:watch": "vitest",
"lint": "tsc --noEmit",
"clean": "rm -rf dist"
"clean": "rm -rf dist",
"prepublishOnly": "pnpm build"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"dependencies": {
"newspaperui-theme": "workspace:*",
"newspaperui-utils": "workspace:*"
},
"devDependencies": {
"@testing-library/react": "^16.1.0",
"@testing-library/jest-dom": "^6.6.3",
@@ -59,9 +57,16 @@
"layout",
"typography",
"css-grid",
"multi-column"
"multi-column",
"indesign",
"editorial"
],
"publishConfig": {
"access": "public"
"access": "public",
"dependencies": {}
},
"dependencies": {
"newspaperui-theme": "workspace:*",
"newspaperui-utils": "workspace:*"
}
}
@@ -7,7 +7,7 @@ import {
Headline,
Subhead,
BodyText,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
@@ -7,7 +7,7 @@ import {
Subhead,
BodyText,
Masthead,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
@@ -8,7 +8,7 @@ import {
BodyText,
Figure,
PullQuote,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
@@ -7,7 +7,7 @@ import {
Subhead,
BodyText,
Rule,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
@@ -7,7 +7,7 @@ import {
Subhead,
BodyText,
Rule,
} from 'newspaperui-components';
} from 'newspaperui';
import { CodeBlock } from '@/components/CodeBlock';
export default function ResponsivePage() {
@@ -7,7 +7,7 @@ import {
Subhead,
BodyText,
Rule,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
export default function SpanningPage() {
@@ -6,7 +6,7 @@ import {
Headline,
Subhead,
BodyText,
} from 'newspaperui-components';
} from 'newspaperui';
import { Demo } from '@/components/Demo';
import { PropsTable } from '@/components/PropsTable';
+1 -1
View File
@@ -11,7 +11,7 @@ import {
Byline,
Dateline,
Caption,
} from 'newspaperui-components';
} from 'newspaperui';
import { visualWeights, resolveFontSize } from 'newspaperui-theme';
import { Demo } from '@/components/Demo';
+1 -1
View File
@@ -6,7 +6,7 @@ import {
Headline,
Subhead,
BodyText,
} from 'newspaperui-components';
} from 'newspaperui';
import { ThemeToggle } from '@/components/ThemeToggle';
interface Swatch {
+1 -1
View File
@@ -1,5 +1,5 @@
'use client';
import { Layout, Section, Article, Rule, Headline, Subhead, Kicker, BodyText, Byline, Dateline, Figure, PullQuote } from 'newspaperui-components';
import { Layout, Section, Article, Rule, Headline, Subhead, Kicker, BodyText, Byline, Dateline, Figure, PullQuote } from 'newspaperui';
export default function EnFeature() {
return (
@@ -1,5 +1,5 @@
'use client';
import { Layout, Section, Article, Rule, BodyText, Figure } from 'newspaperui-components';
import { Layout, Section, Article, Rule, BodyText, Figure } from 'newspaperui';
const jp = { fontFamily: 'var(--font-family-cjk-jp)' };
const jpAccent = { color: 'var(--nui-accent-ink-blue)' };
+1 -1
View File
@@ -1,6 +1,6 @@
'use client';
import Link from 'next/link';
import { Layout, Section, Article, Headline, Subhead, Kicker } from 'newspaperui-components';
import { Layout, Section, Article, Headline, Subhead, Kicker } from 'newspaperui';
const blocks = [
{
@@ -1,5 +1,5 @@
'use client';
import { Layout, Section, Article, Rule, BodyText, Quote } from 'newspaperui-components';
import { Layout, Section, Article, Rule, BodyText, Quote } from 'newspaperui';
const cn = { fontFamily: 'var(--font-family-cjk-serif)' };
const cnRed = { color: 'var(--nui-accent-cjk-red)' };
+1 -1
View File
@@ -1,5 +1,5 @@
'use client';
import { Layout, Section, Article, BodyText, Quote, Figure, PullQuote } from 'newspaperui-components';
import { Layout, Section, Article, BodyText, Quote, Figure, PullQuote } from 'newspaperui';
const cn = { fontFamily: 'var(--font-family-cjk-serif)' };
const cnRed = { color: 'var(--nui-accent-cjk-red)' };
@@ -1,5 +1,5 @@
'use client';
import { Layout, Section, Article, Rule, BodyText, Figure } from 'newspaperui-components';
import { Layout, Section, Article, Rule, BodyText, Figure } from 'newspaperui';
const cn = { fontFamily: 'var(--font-family-cjk-serif)' };
const cnRed = { color: 'var(--nui-accent-cjk-red)' };
+1 -1
View File
@@ -4,7 +4,7 @@ import {
Layout, Section, Article, Masthead, Rule,
Headline, Subhead, Kicker, BodyText, Byline, Dateline, Caption,
PullQuote, Footer,
} from 'newspaperui-components';
} from 'newspaperui';
// ─── Presets ────────────────────────────────────────────────────────────────
@@ -4,7 +4,7 @@ import {
Layout, Section, Article, Masthead,
Headline, Subhead, Kicker, BodyText, Byline, Dateline,
Figure, PullQuote,
} from 'newspaperui-components';
} from 'newspaperui';
export default function BlackletterFrontPage() {
return (
@@ -4,7 +4,7 @@ import {
Layout, Section, Article, Masthead, Rule,
Headline, Subhead, Kicker, BodyText, Byline, Dateline,
Figure, PullQuote,
} from 'newspaperui-components';
} from 'newspaperui';
export default function FrontPage() {
return (
+1 -1
View File
@@ -3,7 +3,7 @@ import {
Layout, Section, Article, Masthead, Rule, Folio, IndexBox, Factbox,
Headline, Subhead, Kicker, BodyText, Byline, Dateline,
Figure, PullQuote, Footer, BreakingNewsBanner,
} from 'newspaperui-components';
} from 'newspaperui';
import Link from 'next/link';
export default function LandingPage() {
+4 -1
View File
@@ -1,7 +1,10 @@
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { cx } from 'newspaperui-utils';
function cx(...args: (string | false | null | undefined)[]): string {
return args.filter(Boolean).join(' ');
}
interface NavItem {
label: string;
+1 -1
View File
@@ -7,7 +7,7 @@ const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
images: { unoptimized: true },
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
transpilePackages: ['newspaperui-components', 'newspaperui-theme', 'newspaperui-utils'],
transpilePackages: ['newspaperui'],
};
const withMDX = createMDX({
+2 -3
View File
@@ -20,9 +20,8 @@
"react-dom": "^18.3.1",
"rehype-pretty-code": "^0.14.3",
"shiki": "^4.1.0",
"newspaperui-components": "workspace:*",
"newspaperui-theme": "workspace:*",
"newspaperui-utils": "workspace:*"
"newspaperui": "workspace:*",
"newspaperui-theme": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.10.5",
+1 -4
View File
@@ -96,15 +96,12 @@ importers:
'@types/mdx':
specifier: ^2.0.13
version: 2.0.13
newspaperui-components:
newspaperui:
specifier: workspace:*
version: link:../components
newspaperui-theme:
specifier: workspace:*
version: link:../theme
newspaperui-utils:
specifier: workspace:*
version: link:../utils
next:
specifier: ^15.1.6
version: 15.5.18(@babel/core@7.29.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)