Skip to content

Commit

Permalink
chore: add storybook github link and fix publish ci
Browse files Browse the repository at this point in the history
  • Loading branch information
wood3n committed Sep 3, 2024
1 parent c9d7820 commit 32d030d
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 33 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/pre-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PrePublish

on:
pull_request:
types: [opened, synchronize]

jobs:
prePublish:
name: PrePublish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > .npmrc

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: true

- name: Check release plan
# If a version plan file does not exist, the command will print an error message and return a non-zero exit code
run: npx nx release plan:check

- name: Build all packages
run: npx nx run-many -t build

- name: Bump prerelease version
run: npx nx release version --specifier prerelease --preid alpha

- name: Publish packages
run: pnpm publish -r --access public --no-git-checks
30 changes: 15 additions & 15 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
# ./.github/workflows/publish.yml
name: Publish

on:
workflow_dispatch:
push:
tags:
- v*.*.*
branches: master

jobs:
test:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # needed for provenance data generation
pull-requests: write # needed for provenance data generation
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > .npmrc

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: true

- name: Print Environment Info
run: npx nx report
shell: bash
- name: Check release plan
# If a version plan file does not exist, the command will print an error message and return a non-zero exit code
run: npx nx release plan:check

- name: Build components
- name: Build all packages
run: npx nx run-many -t build

- name: Generate changelog and bump version
run: npx nx release --skip-publish

- name: Publish packages
run: npx nx release publish
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: pnpm publish -r --access public --no-git-checks
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,35 @@ pnpm add @fe-kit/utils
```ts
import { download } from "@fe-kit/utils";
```

## development

### install pnpm and nx

```shell
npm install -g pnpm nx
```

### install dependencies

```shell
pnpm i
```

### start

```shell
pnpm run dev:components

// or

pnpm run dev:utils
```

### commit and add changelog

use `nx release plan` to add your changelog and commit.

```shell
nx release plan
```
33 changes: 24 additions & 9 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,51 @@
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"defaultBase": "master",
"targetDefaults": {
"dev": {
"dependsOn": ["^build"],
"cache": true
},
"build": {
"inputs": ["{projectRoot}/src/**/*"],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist"],
"cache": true
},
"build-storybook": {
"inputs": ["{projectRoot}/**/*", "!{projectRoot}/**/*.md"],
"inputs": ["^production", "{projectRoot}/.storybook/**/*", "{projectRoot}/stories/**/*", "{projectRoot}/src/**/*"],
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/storybook-static"],
"cache": true
},
"dev": {
"dependsOn": ["^build"],
"cache": true
}
},
"release": {
"versionPlans": true,
"projects": ["packages/*"],
"projectsRelationship": "independent",
"version": {
"generatorOptions": {
"currentVersionResolver": "registry",
"skipLockFileUpdate": true
},
"git": {
"commit": false,
"stageChanges": false,
"tag": false
}
},
"changelog": {
"projectChangelogs": {
"renderOptions": {
// Whether or not the commit authors should be added to the bottom of the changelog in a "Thank You" section.
"authors": false,
// Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.
"authors": true,
"mapAuthorsToGitHubUsernames": true,
"commitReferences": true,
// Whether or not to include the date in the version title. It can be set to false to disable it, or true to enable with the default of (YYYY-MM-DD).
"versionTitleDate": true
}
},
"git": {
"commit": false,
"stageChanges": false,
"tag": false
}
}
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"dev:components": "npx nx run @fe-kit/components:dev",
"dev:utils": "npx nx run @fe-kit/utils:dev",
"prepare": "husky",
"release": "nx release --skip-publish",
"test": "vitest"
},
"lint-staged": {
Expand Down
1 change: 1 addition & 0 deletions packages/components/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const config: StorybookConfig = {
outline: false, // 禁用 outline 插件
},
},
"@kemuridama/storybook-addon-github",
],
framework: "@storybook/react-vite",
staticDirs: ["../public"],
Expand Down
7 changes: 7 additions & 0 deletions packages/components/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ import "../src/index.css";

const preview: Preview = {
parameters: {
viewport: {
disable: true,
},
options: {
storySort: {
order: ["*", "Changelog"],
},
},
github: {
repository: "wood3n/fe-kit",
branch: "master/packages/components",
},
},
};

Expand Down
18 changes: 13 additions & 5 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## 1.0.3 (2024-08-29)
## 1.0.5 (2024-09-02)

### 🩹 Fixes

- **@fe-kit/components:** fix npm version error

## 1.0.4 (2024-09-02)

### 🩹 Fixes

- **@fe-kit/components:** fix npm version

## 1.0.3 (2024-08-29)

### 🩹 Fixes

Expand All @@ -9,7 +20,6 @@

## 1.0.2 (2024-08-28)


### 🚀 Features

- init project ([1ca72e3](https://github.com/wood3n/fe-kit/commit/1ca72e3))
Expand All @@ -18,7 +28,6 @@

- add react error boundary ([3df8b0e](https://github.com/wood3n/fe-kit/commit/3df8b0e))


### 🩹 Fixes

- fix site logo url and tailwindcss content build ([26a1aea](https://github.com/wood3n/fe-kit/commit/26a1aea))
Expand All @@ -33,7 +42,6 @@

- fix stories error ([4272965](https://github.com/wood3n/fe-kit/commit/4272965))


### 🧱 Updated Dependencies

- Updated @fe-kit/utils to 1.0.2
- Updated @fe-kit/utils to 1.0.2
5 changes: 3 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fe-kit/components",
"version": "1.0.3",
"version": "1.0.5",
"description": "react business components",
"keywords": [
"react",
Expand Down Expand Up @@ -37,12 +37,13 @@
"dependencies": {
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/utilities": "^3.2.2",
"@fe-kit/utils": "workspace:*",
"@fe-kit/utils": "1.0.3-alpha.0",
"@iconify/react": "^5.0.2",
"clsx": "^2.1.1",
"react-pdf": "^9.1.0"
},
"devDependencies": {
"@kemuridama/storybook-addon-github": "^1.3.0",
"@modern-js/module-tools": "^2.58.0",
"@modern-js/plugin-tailwindcss": "^2.58.0",
"@storybook/addon-essentials": "^8.2.8",
Expand Down
17 changes: 16 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 32d030d

Please sign in to comment.