Skip to content

Commit

Permalink
feat: 初始化项目
Browse files Browse the repository at this point in the history
  • Loading branch information
asurance committed Oct 14, 2024
1 parent 8de9092 commit ccd8b99
Show file tree
Hide file tree
Showing 11 changed files with 5,378 additions and 484 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/deply_doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy Doc site to Pages

on:
push:
branches:
- master

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
cache: pnpm

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: pnpm install

- name: Build Doc
run: pnpm build:doc

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc_build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
35 changes: 35 additions & 0 deletions .github/workflows/public_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Public Packages

on:
push:
branches:
- master

workflow_dispatch:

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
cache: pnpm
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: pnpm install

- name: Build Package
run: pnpm build

- name: Publish Package
run: pnpm release
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ log/
**/*/typings/auto-generated

modern.config.local.*

doc_build
3 changes: 3 additions & 0 deletions docs/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
9 changes: 9 additions & 0 deletions docs/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import './index.css';
export const frontmatter = {
pageType: 'blank',
};

export default function App() {
return <div className="text-red-600">主页</div>;
}
3 changes: 2 additions & 1 deletion modern.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig, moduleTools } from '@modern-js/module-tools';
import { modulePluginDoc } from '@modern-js/plugin-rspress';

export default defineConfig({
plugins: [moduleTools()],
plugins: [moduleTools(), modulePluginDoc()],
buildPreset: 'npm-library',
});
55 changes: 36 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,62 @@
{
"name": "use-atom-creator",
"version": "0.1.0",
"types": "./dist/types/index.d.ts",
"version": "1.0.0",
"description": "A React hook for creating atoms easily",
"keywords": ["react", "jotai", "hook"],
"homepage": "https://github.com/asurance/use-atom-creator",
"bugs": {
"url": "https://github.com/asurance/use-atom-creator/issues"
},
"license": "MIT",
"author": "asurance",
"sideEffects": [],
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
"types": "./dist/types/index.d.ts",
"scripts": {
"prepare": "modern build && simple-git-hooks",
"dev": "modern dev",
"build": "modern build",
"build:watch": "modern build -w",
"reset": "npx rimraf node_modules ./**/node_modules",
"lint": "biome check",
"change": "modern change",
"build:doc": "modern build --platform",
"bump": "modern bump",
"pre": "modern pre",
"change": "modern change",
"change-status": "modern change-status",
"dev": "modern dev",
"gen-release-note": "modern gen-release-note",
"release": "modern release",
"lint": "biome check",
"new": "modern new",
"pre": "modern pre",
"prepare": "modern build && simple-git-hooks",
"release": "modern release",
"reset": "npx rimraf node_modules ./**/node_modules",
"upgrade": "modern upgrade"
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
"biome check --files-ignore-unknown=true"
]
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"dependencies": {},
"peerDependencies": {},
"devDependencies": {
"@modern-js/module-tools": "2.60.3",
"@biomejs/biome": "1.8.3",
"typescript": "~5.0.4",
"@modern-js/module-tools": "2.60.3",
"@modern-js/plugin-rspress": "1.33.1",
"@types/node": "~16.11.7",
"rimraf": "^6.0.1",
"@types/react": "^18.3.11",
"jotai": "^2.10.0",
"lint-staged": "~13.1.0",
"simple-git-hooks": "^2.11.1"
"react": "^18.3.1",
"rimraf": "^6.0.1",
"simple-git-hooks": "^2.11.1",
"tailwindcss": "^3.4.13",
"typescript": "~5.0.4"
},
"peerDependencies": {
"@types/react": "*",
"jotai": "*",
"react": "*"
},
"sideEffects": [],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand Down
Loading

0 comments on commit ccd8b99

Please sign in to comment.