Skip to content

Commit

Permalink
refactor: library build and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Oct 19, 2023
1 parent e738738 commit 75a0135
Show file tree
Hide file tree
Showing 45 changed files with 601 additions and 583 deletions.
5 changes: 0 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
}
]
}
28 changes: 16 additions & 12 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,10 @@ jobs:
run: npx nx run-many --target=test --all --parallel=5
- name: Build for publishing
shell: bash
# configuration ci will put the dists in each project directory so changesets can publish
# NOTE: changed from ci to production and added script for copy
run: npx nx run-many --target=build --configuration=production --all --parallel=5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
- name: Copy dists for publishing
run: ./scripts/copy-dists-for-publishing.sh
- name: Create Release Pull Request or Publish to NPM
uses: changesets/action@v1
with:
commit: 'chore: release packages'
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Containers
shell: bash
run: npx nx run-many --target=container --configuration=production -all --parallel=5
Expand All @@ -68,3 +56,19 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
# If there are changesets, then update the release pull request
- name: Update release pull request or release versions
id: changesets
uses: changesets/action@v1
with:
commit: 'chore: release packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Replace src code with dists for publishing
run: ./scripts/replace-src-with-dists-for-publishing.sh
# If there are no changesets, then try to publish to NPM,
# if the latest versions are already published, may fail
- name: Publish to NPM
if: steps.changesets.outputs.hasChangesets == 'false'
run: npm run release
15 changes: 5 additions & 10 deletions libs/data-sources/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
16 changes: 14 additions & 2 deletions libs/data-sources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
"name": "@siafoundation/data-sources",
"description": "Data sources used for stats on the website.",
"version": "0.1.0",
"type": "commonjs",
"private": true,
"license": "MIT"
"license": "MIT",
"dependencies": {
"axios": "^0.27.2",
"feed": "^4.2.2",
"rss-parser": "^3.13.0",
"lodash": "^4.17.21",
"@notionhq/client": "^2.2.8",
"gray-matter": "^4.0.3",
"next-mdx-remote": "^4.0.3",
"remark-gfm": "^3.0.1",
"dotenv": "^16.0.3",
"tslib": "^2.6.2"
},
"types": "./src/index.d.ts"
}
5 changes: 4 additions & 1 deletion libs/data-sources/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/data-sources/**/*.ts"]
"lintFilePatterns": [
"libs/data-sources/**/*.ts",
"libs/data-sources/package.json"
]
}
},
"test": {
Expand Down
15 changes: 5 additions & 10 deletions libs/design-system/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
69 changes: 68 additions & 1 deletion libs/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,72 @@
"name": "@siafoundation/design-system",
"description": "React-based design system used across Sia apps and websites",
"version": "0.57.0",
"license": "MIT"
"license": "MIT",
"dependencies": {
"@siafoundation/react-icons": "*",
"@siafoundation/sia-js": "*",
"@siafoundation/react-core": "*",
"@visx/group": "2.17.0",
"@visx/react-spring": "2.18.0",
"@visx/glyph": "2.17.0",
"@siafoundation/react-sia-central": "*",
"class-variance-authority": "^0.7.0",
"lodash": "^4.17.21",
"react": "18.2.0",
"swr": "^2.1.1",
"bignumber.js": "^9.0.2",
"next": "13.5.2",
"react-idle-timer": "^5.7.2",
"axios": "^0.27.2",
"react-hook-form": "^7.43.9",
"use-local-storage-state": "^18.3.3",
"formik": "^2.2.9",
"yup": "^0.32.11",
"react-qr-code": "^2.0.7",
"next-themes": "^0.2.1",
"date-fns": "^2.28.0",
"@visx/scale": "^2.18.0",
"@visx/pattern": "^2.17.0",
"@visx/brush": "^2.18.0",
"@visx/responsive": "^2.17.0",
"@visx/shape": "^2.18.0",
"@visx/curve": "^2.17.0",
"@visx/marker": "^2.18.0",
"@visx/axis": "^2.18.0",
"@visx/gradient": "^2.17.0",
"@visx/grid": "^2.18.0",
"@visx/tooltip": "^2.17.0",
"@visx/event": "^2.17.0",
"d3-array": "^3.1.6",
"@visx/xychart": "^2.18.0",
"react-dropzone": "^14.2.3",
"@radix-ui/react-radio-group": "^1.0.0",
"tailwindcss": "3.2.7",
"@next/font": "13.1.1",
"tailwind-scrollbar": "^2.0.1",
"tailwindcss-text-fill": "^0.2.0",
"tailwindcss-shadow-fill": "^1.0.1",
"@tailwindcss/container-queries": "^0.1.1",
"@radix-ui/react-accordion": "^1.0.0",
"@radix-ui/react-avatar": "^1.0.0",
"react-currency-input-field": "^3.6.5",
"@radix-ui/react-checkbox": "^1.0.0",
"framer-motion": "^7.6.5",
"@radix-ui/react-dialog": "^1.0.0",
"@radix-ui/react-dropdown-menu": "^1.0.0",
"@radix-ui/react-hover-card": "^1.0.3",
"@radix-ui/react-label": "^1.0.0",
"@radix-ui/react-separator": "^1.0.0",
"@radix-ui/react-navigation-menu": "^1.1.3",
"@radix-ui/react-popover": "^1.0.0",
"@radix-ui/react-progress": "^1.0.0",
"@radix-ui/react-scroll-area": "^1.0.0",
"@radix-ui/react-switch": "^1.0.0",
"@radix-ui/react-tabs": "^1.0.0",
"@radix-ui/react-tooltip": "^1.0.0",
"clipboard-polyfill": "^3.0.3",
"react-hot-toast": "^2.2.0",
"@nx/react": "16.8.1"
},
"types": "./src/index.d.ts"
}
5 changes: 4 additions & 1 deletion libs/design-system/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/design-system/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": [
"libs/design-system/**/*.{ts,tsx,js,jsx}",
"libs/design-system/package.json"
]
}
},
"test": {
Expand Down
2 changes: 1 addition & 1 deletion libs/design-system/src/components/PaginatorKnownTotal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
PageLast16,
} from '@siafoundation/react-icons'
import { useRouter } from 'next/router'
import { LoadingDots } from '..'
import { LoadingDots } from '../components/LoadingDots'

type Props = {
offset: number
Expand Down
2 changes: 1 addition & 1 deletion libs/design-system/src/core/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import React from 'react'
import * as AccordionPrimitive from '@radix-ui/react-accordion'
import { ChevronDown16 } from '@siafoundation/react-icons'
import { cva } from 'class-variance-authority'
import { VariantProps } from '../types'
import { Button } from './Button'
import { ChevronDown16 } from '@siafoundation/react-icons'

export const Accordion = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Root>,
Expand Down
15 changes: 5 additions & 10 deletions libs/react-core/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
11 changes: 10 additions & 1 deletion libs/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
"name": "@siafoundation/react-core",
"description": "Core Sia types and library methods.",
"version": "0.14.0",
"license": "MIT"
"license": "MIT",
"dependencies": {
"swr": "^2.1.1",
"react": "18.2.0",
"axios": "^0.27.2",
"next": "13.5.2",
"use-local-storage-state": "^18.3.3",
"detect-gpu": "^5.0.34"
},
"types": "./src/index.d.ts"
}
5 changes: 4 additions & 1 deletion libs/react-core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/react-core/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": [
"libs/react-core/**/*.{ts,tsx,js,jsx}",
"libs/react-core/package.json"
]
}
},
"test": {
Expand Down
17 changes: 6 additions & 11 deletions libs/react-hostd/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "src/types.ts"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
7 changes: 6 additions & 1 deletion libs/react-hostd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"name": "@siafoundation/react-hostd",
"description": " React hooks for interacting with `hostd`.",
"version": "0.9.0",
"license": "MIT"
"license": "MIT",
"dependencies": {
"@siafoundation/react-core": "*",
"swr": "^2.1.1"
},
"types": "./src/index.d.ts"
}
5 changes: 4 additions & 1 deletion libs/react-hostd/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/react-hostd/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": [
"libs/react-hostd/**/*.{ts,tsx,js,jsx}",
"libs/react-hostd/package.json"
]
}
},
"test": {
Expand Down
15 changes: 5 additions & 10 deletions libs/react-icons/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
6 changes: 5 additions & 1 deletion libs/react-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"name": "@siafoundation/react-icons",
"description": "React-based icons used across Sia apps and websites",
"version": "0.0.1",
"license": "MIT"
"license": "MIT",
"dependencies": {
"@carbon/icons-react": "^10.47.0"
},
"types": "./src/index.d.ts"
}
6 changes: 5 additions & 1 deletion libs/react-icons/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"entryFile": "libs/react-icons/src/index.ts",
"external": ["react/jsx-runtime"],
"rollupConfig": "@nx/react/plugins/bundle-rollup",
"format": ["esm", "cjs"],
"compiler": "swc",
"assets": [
{
Expand All @@ -30,7 +31,10 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/react-icons/**/*.{ts,tsx,js,jsx}"]
"lintFilePatterns": [
"libs/react-icons/**/*.{ts,tsx,js,jsx}",
"libs/react-icons/package.json"
]
}
},
"test": {
Expand Down
Loading

0 comments on commit 75a0135

Please sign in to comment.