Skip to content

Commit

Permalink
feat: ✨ setup api extractor
Browse files Browse the repository at this point in the history
βž• add @microsoft/api-extractor, @microsoft/api-documenter, npm-run-all
πŸ”§ setup api extractor
πŸ”§ update turborepo config
πŸ”¨ update scripts
πŸ‘· update actions
kwaa committed May 23, 2023

Verified

This commit was signed with the committer’s verified signature.
kwaa 藍+85CD
1 parent 7e46f31 commit 1be7aef
Showing 17 changed files with 517 additions and 171 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -13,3 +13,4 @@ jobs:
with:
publish_dir: docs/.vitepress/dist
cname: fff.js.org
build_command: pnpm docs:build
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# build output
coverage
dist
docs/.vitepress/cache
docs/.vitepress/dist
packages/**/dist
packages/**/coverage
docs/references

# dependencies
node_modules
43 changes: 43 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"apiReport": {
"enabled": false
},
"bundledPackages": [
"fff-flavored-frontmatter",
"indiekit-preset-fff",
"markdown-it-fff",
"remark-fff"
],
"compiler": {},
"docModel": {
"apiJsonFilePath": "<projectFolder>/dist/api-extractor/<unscopedPackageName>.api.json",
"enabled": true
},
"dtsRollup": {
"enabled": false
},
"mainEntryPointFilePath": "<projectFolder>/packages/<unscopedPackageName>/dist/index.d.ts",
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"ae-wrong-input-file-type": {
"logLevel": "warning"
},
"default": {
"logLevel": "warning"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
}
}
},
"tsdocMetadata": {
}
}
168 changes: 92 additions & 76 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,202 +1,218 @@
import { version } from '../package.json'
import { defineConfig } from 'vitepress'
import { withPwa } from '@vite-pwa/vitepress'
import footnote from 'markdown-it-footnote'
import { defineConfig } from 'vitepress'

import { version } from '../package.json'

const nav = () => [
{
text: version,
items: [
{
text: 'Changelog',
link: '/version/changelog',
text: 'Changelog',
},
{
text: 'Contributing',
link: '/intro/contributing',
text: 'Contributing',
},
],
text: version,
},
]

const sidebar = () => [
{
text: 'Introduction',
collapsible: true,
items: [
{ text: 'What is FFF?', link: '/intro/what-is-fff' },
{ text: 'Implementing', link: '/intro/implementing' },
{ link: '/intro/what-is-fff', text: 'What is FFF?' },
{ link: '/intro/implementing', text: 'Implementing' },
{
text: 'Contributing',
link: '/intro/contributing',
text: 'Contributing',
},
{ text: 'Showcase', link: '/intro/showcase' },
{ link: '/intro/showcase', text: 'Showcase' },
],
text: 'Introduction',
},
{
text: 'Concepts',
collapsible: true,
items: [
{
text: 'Object Media',
link: '/concepts/object-media',
text: 'Object Media',
},
{
text: 'Flags',
link: '/concepts/flags',
text: 'Flags',
},
{
link: '/concepts/flavor-transform',
text: 'Flavor Transform',
link: '/concepts/flavor-transform'
}
},
],
text: 'Concepts',
},
{
collapsible: true,
items: [
{
link: '/packages/fff-flavored-frontmatter',
text: 'fff-flavored-frontmatter',
},
{ link: '/packages/remark-fff', text: 'remark-fff' },
{ link: '/packages/markdown-it-fff', text: 'markdown-it-fff' },
{ link: '/packages/indiekit-preset-fff', text: 'indiekit-preset-fff' },
{ link: '/packages/create-fff', text: 'create-fff' },
],
text: 'Packages',
},
{
collapsible: true,
items: [
{
link: '/references/fff-flavored-frontmatter',
text: 'fff-flavored-frontmatter',
link: '/packages/fff-flavored-frontmatter',
},
{ text: 'remark-fff', link: '/packages/remark-fff' },
{ text: 'markdown-it-fff', link: '/packages/markdown-it-fff' },
{ text: 'indiekit-preset-fff', link: '/packages/indiekit-preset-fff' },
{ text: 'create-fff', link: '/packages/create-fff'}
{ link: '/references/remark-fff', text: 'remark-fff' },
{ link: '/references/markdown-it-fff', text: 'markdown-it-fff' },
{ link: '/references/indiekit-preset-fff', text: 'indiekit-preset-fff' },
// { link: '/references/create-fff', text: 'create-fff' },
],
link: '/references/index',
text: 'References',
},
{
text: 'Version',
collapsible: true,
items: [
{ text: 'Changelog', link: '/version/changelog' },
{ text: '0.6 (draft)', link: '/version/0.6'},
{ text: '0.5', link: '/version/0.5' },
{ text: '0.4', link: '/version/0.4' },
{ text: '0.3', link: '/version/0.3' },
{ text: '0.2', link: '/version/0.2' },
{ text: '0.1', link: '/version/0.1' },
{ link: '/version/changelog', text: 'Changelog' },
{ link: '/version/0.6', text: '0.6 (draft)' },
{ link: '/version/0.5', text: '0.5' },
{ link: '/version/0.4', text: '0.4' },
{ link: '/version/0.3', text: '0.3' },
{ link: '/version/0.2', text: '0.2' },
{ link: '/version/0.1', text: '0.1' },
],
text: 'Version',
},
]

export default withPwa(
defineConfig({
lang: 'en-US',
title: 'FFF Flavored Frontmatter',
titleTemplate: 'FFF',
description: 'The Flexible & Functional Frontmatter Solution.',
appearance: 'dark',
lastUpdated: true,
markdown: {
theme: {
light: 'material-theme-lighter',
dark: 'material-theme-darker',
},
config: (md) => md.use(footnote),
},
description: 'The Flexible & Functional Frontmatter Solution.',
head: [
[
'link',
{ rel: 'icon', href: '/glowing_star.svg', type: 'image/svg+xml' },
{ href: '/glowing_star.svg', rel: 'icon', type: 'image/svg+xml' },
],
[
'link',
{
rel: 'manifest',
href: '/manifest.webmanifest',
rel: 'manifest',
type: 'application/manifest+json',
},
],
[
'meta',
{
property: 'og:image',
content:
'https://og-image.vercel.app/**FFF**%20Flavored%20Frontmatter.png?theme=dark&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fvercel-triangle-white.svg&images=https%3A%2F%2Ffff.js.org%2Fglowing_star.svg&widths=256&widths=384&heights=256&heights=384',
property: 'og:image',
},
],
[
'meta',
{
property: 'twitter:image',
content:
'https://og-image.vercel.app/**FFF**%20Flavored%20Frontmatter.png?theme=dark&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fvercel-triangle-white.svg&images=https%3A%2F%2Ffff.js.org%2Fglowing_star.svg&widths=256&widths=384&heights=256&heights=384',
property: 'twitter:image',
},
],
['meta', { property: 'twitter:card', content: 'summary' }],
['meta', { content: 'summary', property: 'twitter:card' }],
[
'script',
{
src: 'https://plausible.kwaa.dev/js/plausible.js',
defer: '',
'data-domain': 'fff.js.org',
'defer': '',
'src': 'https://plausible.kwaa.dev/js/plausible.js',
},
],
],
themeConfig: {
nav: nav(),
sidebar: sidebar(),
siteTitle: 'FFF',
logo: '/glowing_star.svg',
socialLinks: [
{ icon: 'github', link: 'https://github.com/importantimport/fff' },
],
editLink: {
pattern: 'https://github.com/importantimport/fff/edit/main/:path',
text: 'Suggest changes to this page',
lang: 'en-US',
lastUpdated: true,
markdown: {
config: md => md.use(footnote),
theme: {
dark: 'material-theme-darker',
light: 'material-theme-lighter',
},
},
pwa: {
registerType: 'autoUpdate',
includeManifestIcons: false,
manifest: {
id: '/',
name: 'FFF Flavored Frontmatter',
short_name: 'FFF',
description: 'The Flexible & Functional Frontmatter Solution.',
theme_color: '#fdd835',
icons: [
{
src: 'glowing_star.svg',
purpose: 'any',
sizes: 'any',
src: 'glowing_star.svg',
type: 'image/svg+xml',
purpose: 'any',
},
],
id: '/',
name: 'FFF Flavored Frontmatter',
short_name: 'FFF',
theme_color: '#fdd835',
},
registerType: 'autoUpdate',
workbox: {
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365,
},
cacheableResponse: {
statuses: [0, 200],
},
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 365,
maxEntries: 10,
},
},
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'gstatic-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365,
},
cacheableResponse: {
statuses: [0, 200],
},
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 365,
maxEntries: 10,
},
},
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
},
],
},
},
})
themeConfig: {
editLink: {
pattern: 'https://github.com/importantimport/fff/edit/main/:path',
text: 'Suggest changes to this page',
},
logo: '/glowing_star.svg',
nav: nav(),
sidebar: sidebar(),
siteTitle: 'FFF',
socialLinks: [
{ icon: 'github', link: 'https://github.com/importantimport/fff' },
],
},
title: 'FFF Flavored Frontmatter',
titleTemplate: 'FFF',
}),
)
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@
"name": "fff-docs",
"version": "0.5.3",
"private": true,
"description": "The Flexible & Functional Frontmatter Solution.",
"author": "藍+85CD",
"license": "WTFPL",
"description": "The Flexible & Functional Frontmatter Solution.",
"homepage": "https://fff.js.org",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "docs"
},
"homepage": "https://fff.js.org",
"bugs": "https://github.com/importantimport/fff/issues",
"scripts": {
"dev": "vitepress dev",
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "fff-monorepo",
"type": "module",
"version": "0.4.0",
"private": true,
"type": "module",
"scripts": {
"preinstall": "npx -y only-allow pnpm",
"dev": "pnpm -rF fff-docs dev",
"build": "turbo run build",
"build": "turbo run build --filter=./packages/*",
"docs:build": "run-s build docs:build:api-extractor docs:build:api-documenter docs:build:vitepress",
"docs:build:api-extractor": "turbo run api-extractor",
"docs:build:api-documenter": "api-documenter markdown -i dist/api-extractor -o docs/references",
"docs:build:vitepress": "turbo run build --filter=fff-docs",
"test": "turbo run test",
"test:watch": "turbo run test:watch",
"coverage": "turbo run coverage",
@@ -18,8 +22,11 @@
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@importantimport/eslint-config": "^0.0.6",
"@microsoft/api-documenter": "^7.22.6",
"@microsoft/api-extractor": "^7.35.0",
"@vitest/coverage-c8": "^0.31.1",
"eslint": "^8.41.0",
"npm-run-all": "^4.1.5",
"tsup": "^6.7.0",
"tsx": "^3.12.7",
"turbo": "^1.9.8",
32 changes: 15 additions & 17 deletions packages/create-fff/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
{
"name": "create-fff",
"type": "module",
"version": "0.5.3",
"description": "Create FFF-related configuration files.",
"author": "藍+85CD",
"license": "WTFPL",
"keywords": [
"fff",
"fff-flavored-frontmatter",
"typescript"
],
"description": "Create FFF-related configuration files.",
"homepage": "https://fff.js.org",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/create-fff"
},
"homepage": "https://fff.js.org",
"bugs": "https://github.com/importantimport/fff/issues",
"type": "module",
"module": "./dist/index.js",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": "./dist/index.js",
"keywords": [
"fff",
"fff-flavored-frontmatter",
"typescript"
],
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": "./dist/index.js",
"files": ["dist"],
"scripts": {
"dev": "tsx src/index.ts",
"build": "tsup",
5 changes: 5 additions & 0 deletions packages/fff-flavored-frontmatter/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/packages/<unscopedPackageName>/dist/fff.d.ts"
}
31 changes: 16 additions & 15 deletions packages/fff-flavored-frontmatter/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "fff-flavored-frontmatter",
"type": "module",
"version": "0.5.3",
"description": "Type definition of the FFF Flavored Frontmatter.",
"author": "藍+85CD",
"license": "WTFPL",
"homepage": "https://fff.js.org",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/fff-flavored-frontmatter"
},
"bugs": "https://github.com/importantimport/fff/issues",
"keywords": [
"fff",
"fff-flavored-frontmatter",
@@ -12,27 +21,18 @@
"front-matter",
"typescript"
],
"description": "Type definition of the FFF Flavored Frontmatter.",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/fff-flavored-frontmatter"
},
"homepage": "https://fff.js.org",
"bugs": "https://github.com/importantimport/fff/issues",
"type": "module",
"source": "./fff.ts",
"module": "./dist/fff.mjs",
"main": "./dist/fff.cjs",
"types": "./dist/fff.d.ts",
"exports": {
".": {
"import": "./dist/fff.mjs",
"types": "./dist/fff.d.ts",
"require": "./dist/fff.cjs",
"types": "./dist/fff.d.ts"
"import": "./dist/fff.mjs"
},
"./package.json": "./package.json"
},
"main": "./dist/fff.cjs",
"module": "./dist/fff.mjs",
"types": "./dist/fff.d.ts",
"files": [
"fff.ts",
"dist"
@@ -41,6 +41,7 @@
"build": "tsup",
"build:watch": "tsup --watch",
"lint": "eslint src",
"lint:fix": "eslint src --fix"
"lint:fix": "eslint src --fix",
"api-extractor": "api-extractor run --local --verbose"
}
}
5 changes: 5 additions & 0 deletions packages/indiekit-preset-fff/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/packages/<unscopedPackageName>/dist/index.d.ts"
}
3 changes: 2 additions & 1 deletion packages/indiekit-preset-fff/package.json
Original file line number Diff line number Diff line change
@@ -37,7 +37,8 @@
"build": "tsup",
"build:watch": "tsup --watch",
"lint": "eslint src",
"lint:fix": "eslint src --fix"
"lint:fix": "eslint src --fix",
"api-extractor": "api-extractor run --local --verbose"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
5 changes: 5 additions & 0 deletions packages/markdown-it-fff/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/packages/<unscopedPackageName>/dist/index.d.ts"
}
41 changes: 20 additions & 21 deletions packages/markdown-it-fff/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "markdown-it-fff",
"type": "module",
"version": "0.5.3",
"description": "markdown-it plugin for auto-conversion other frontmatter variable formats to FFF Flavored Frontmatter.",
"author": "藍+85CD",
"license": "WTFPL",
"homepage": "https://fff.js.org",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/markdown-it-fff"
},
"bugs": "https://github.com/importantimport/fff/issues",
"keywords": [
"fff",
"fff-flavored-frontmatter",
@@ -14,46 +23,36 @@
"markdown-it-plugin",
"typescript"
],
"description": "markdown-it plugin for auto-conversion other frontmatter variable formats to FFF Flavored Frontmatter.",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/markdown-it-fff"
},
"homepage": "https://fff.js.org",
"bugs": "https://github.com/importantimport/fff/issues",
"type": "module",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"import": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": ["dist"],
"scripts": {
"build": "tsup",
"build:watch": "tsup --watch",
"test": "vitest run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint": "eslint src",
"lint:fix": "eslint src --fix"
"lint:fix": "eslint src --fix",
"api-extractor": "api-extractor run --local --verbose"
},
"dependencies": {
"fff-flavored-frontmatter": "workspace:*"
},
"devDependencies": {
"@mdit-vue/plugin-frontmatter": "^0.12.0",
"@types/linkify-it": "^3.0.2",
"@types/markdown-it": "^12.2.3",
"@types/mdurl": "^1.0.2",
"markdown-it": "^13.0.1"
},
"dependencies": {
"fff-flavored-frontmatter": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions packages/remark-fff/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/packages/<unscopedPackageName>/dist/index.d.ts"
}
41 changes: 20 additions & 21 deletions packages/remark-fff/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "remark-fff",
"type": "module",
"version": "0.5.3",
"description": "Remark plugin for auto-conversion other frontmatter variable formats to FFF Flavored Frontmatter.",
"author": "藍+85CD",
"license": "WTFPL",
"homepage": "https://fff.js.org",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/remark-fff"
},
"bugs": "https://github.com/importantimport/fff/issues",
"keywords": [
"fff",
"fff-flavored-frontmatter",
@@ -14,45 +23,35 @@
"remark-plugin",
"typescript"
],
"description": "Remark plugin for auto-conversion other frontmatter variable formats to FFF Flavored Frontmatter.",
"repository": {
"type": "git",
"url": "https://github.com/importantimport/fff.git",
"directory": "packages/remark-fff"
},
"homepage": "https://fff.js.org",
"bugs": "https://github.com/importantimport/fff/issues",
"type": "module",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"import": "./dist/index.mjs"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": ["dist"],
"scripts": {
"build": "tsup",
"build:watch": "tsup --watch",
"test": "vitest run",
"test:watch": "vitest",
"coverage": "vitest run --coverage",
"lint": "eslint src",
"lint:fix": "eslint src --fix"
"lint:fix": "eslint src --fix",
"api-extractor": "api-extractor run --local --verbose"
},
"dependencies": {
"fff-flavored-frontmatter": "workspace:*"
},
"devDependencies": {
"remark": "^14.0.3",
"remark-frontmatter": "^4.0.1",
"unified": "^10.1.2",
"vfile": "^5.3.7"
},
"dependencies": {
"fff-flavored-frontmatter": "workspace:*"
}
}
257 changes: 257 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": [
".env",
"tsconfig.json",
"tsup.config.ts"
],
"pipeline": {
"api-extractor": {
"cache": false,
"dependsOn": ["^build"]
},
"build": {
"dependsOn": [
"^build"
],
"dependsOn": ["^build"],
"outputs": [
".vitepress/dist/**",
"dist/**"
]
},
"coverage": {
"outputs": ["coverage/**"]
},
"lint": {},
"lint:fix": {},
"test": {
"outputs": []
},
"test:watch": {
"cache": false
},
"coverage": {},
"lint": {},
"lint:fix": {}
},
"globalDependencies": [
".env",
"tsconfig.json",
"tsup.config.ts"
]
}
}
}

0 comments on commit 1be7aef

Please sign in to comment.