Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"
- run: yarn install --immutable
- run: yarn lint
- run: yarn build
- run: yarn typecheck
- run: yarn test
32 changes: 32 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
deploy-docs:
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- run: corepack enable

- uses: actions/setup-node@v4
with:
cache: "yarn"
cache-dependency-path: "yarn.lock"
node-version-file: ".nvmrc"

- name: Install dependencies
run: yarn install

- name: Deploy a docs site
run: |-
cd docs
yarn vercel deploy --yes --prod --token=${{ secrets.VERCEL_TOKEN }}
113 changes: 29 additions & 84 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,50 @@ name: Release
on:
push:
branches:
- "*"
tags:
- "v*.*.*"
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
deployments: write

pull-requests: write
id-token: write
steps:
- name: Checkout
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- run: corepack enable
- name: Enable Corepack
run: corepack enable

- uses: actions/setup-node@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "yarn"
cache-dependency-path: "yarn.lock"
node-version-file: ".nvmrc"

- if: github.ref_type == 'branch'
run: |
jq \
--arg build "$GITHUB_RUN_NUMBER" \
--arg commit "${GITHUB_SHA::8}" \
'.version = .version + "-dev." + $build + "+" + $commit' \
packages/cli/package.json > packages/cli/package.json.tmp
mv packages/cli/package.json.tmp packages/cli/package.json
- name: Install Dependencies
run: yarn install --immutable

- run: yarn install
- name: Build
run: yarn build

- name: Build and pack CLI
run: |
yarn workspace docflow build
mkdir -p out
cd packages/cli
yarn pack --out ../../out/docflow-cli.tgz
- name: Type Check
run: yarn typecheck

- id: extract-changelog
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
input-file: CHANGELOG.md
heading-level: 2
heading-title-text: version ${{ github.ref_name }}
ignore-case: true
omit-heading: true

- run: cat ${{ steps.extract-changelog.outputs.output-file }}

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ steps.extract-changelog.outputs.output-file }}
repository: ${{ github.repository }}
generate_release_notes: false
token: ${{ secrets.GITHUB_TOKEN }}
files: out/*.tgz

- name: Publish to registry
if: |
github.event_name == 'push' &&
(github.ref_type == 'tag' || github.ref == 'refs/heads/main')
run: |
set -ex
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
npm whoami
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
npm publish --provenance --access public docflow-cli.tgz
else
npm publish --provenance --access public --tag dev docflow-cli.tgz
fi
title: "chore: version packages"
commit: "chore: version packages"
version: yarn changeset:version
publish: yarn changeset:publish
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ${{ github.workspace }}/out/

deploy-docs:
if: github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- run: corepack enable

- uses: actions/setup-node@v4
with:
cache: "yarn"
cache-dependency-path: "yarn.lock"
node-version-file: ".nvmrc"

- name: Install dependencies
run: yarn install

- name: Deploy a docs site
run: |-
cd docs
yarn vercel deploy --yes --prod --token=${{ secrets.VERCEL_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "docflow-docs",
"private": true,
"packageManager": "yarn@4.9.1",
"scripts": {
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
{
"name": "docflow-monorepo",
"private": true,
"workspaces": [
"packages/*",
"docs"
],
"scripts": {
"lint": "eslint ."
"lint": "yarn workspaces foreach -ptR --from 'packages/*' run lint",
"typecheck": "yarn workspaces foreach -ptR --from 'packages/*' run typecheck",
"build": "yarn workspaces foreach -ptR --from 'packages/*' run build",
"test": "yarn workspaces foreach -ptR --from 'packages/*' run test",
"changeset:version": "changeset version",
"changeset:publish": "changeset publish"
},
"packageManager": "yarn@4.9.1",
"resolutions": {
"node-gyp@npm:latest": "npm:11.2.0"
},
"devDependencies": {
"@changesets/cli": "^2.29.8",
"@eslint/js": "^9.9.1",
"@types/eslint": "^9",
"@types/eslint__js": "^8.42.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"prepack": "yarn build",
"build": "tsdown",
"typecheck": "tsc --noEmit",
"test": "vitest",
"test": "vitest run src/tests --exclude 'src/tests/e2e'",
"test:e2e": "vitest run src/tests/e2e",
"lint": "eslint ."
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/config/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export async function loadConfig(rootPath: string) {
{
files: "package.json",
extensions: [],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
rewrite: (pkg: any) => pkg?.[MODULE_NAME],
},
],
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/src/tests/core/parser/jsdoc/jsdoc-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
} from "../../../../core/parser/jsdoc/jsdoc-utils.js";
import { getTsProject } from "../../../../core/get-ts-project.js";
import { getTsConfigPath } from "../../../../core/get-ts-config-path.js";
import { createE2EWorkspace, E2EWorkspace } from "../../../utils/create-e2e-workspace.js";
import {
createE2EWorkspace,
E2EWorkspace,
} from "../../../utils/create-e2e-workspace.js";

describe("jsdoc-utils", () => {
let workspace: E2EWorkspace;
Expand Down Expand Up @@ -67,8 +70,6 @@ describe("jsdoc-utils", () => {
it("should handle different tag names", async () => {
const workspace = await createE2EWorkspace();
const tsConfigPath = getTsConfigPath(workspace.root, "packages/core");
const project = getTsProject(tsConfigPath);

await workspace.write(
"packages/core/src/test-tags.ts",
`
Expand All @@ -80,7 +81,7 @@ describe("jsdoc-utils", () => {
export function testFunction() {
return true;
}
`,
`
);

const updatedProject = getTsProject(tsConfigPath);
Expand Down
30 changes: 16 additions & 14 deletions packages/cli/src/tests/core/parser/jsdoc/parse-jsdoc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { parseJSDoc } from "../../../../core/parser/jsdoc/parse-jsdoc.js";
import { JSDocParser } from "../../../../core/parser/jsdoc/jsdoc-parser.js";
import { ExportDeclaration } from "../../../../core/types/parser.types.js";
import { getTsProject } from "../../../../core/get-ts-project.js";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { getTsConfigPath } from "../../../../core/get-ts-config-path.js";
import { getTsProject } from "../../../../core/get-ts-project.js";
import { JSDocParser } from "../../../../core/parser/jsdoc/jsdoc-parser.js";
import { parseJSDoc } from "../../../../core/parser/jsdoc/parse-jsdoc.js";
import { getExportedDeclarationsBySourceFile } from "../../../../core/parser/source/get-exported-declarations-by-sourcefile.js";
import { createE2EWorkspace, E2EWorkspace } from "../../../utils/create-e2e-workspace.js";
import {
createE2EWorkspace,
E2EWorkspace,
} from "../../../utils/create-e2e-workspace.js";

describe("parseJSDoc", () => {
let workspace: E2EWorkspace;
Expand All @@ -29,7 +31,7 @@ describe("parseJSDoc", () => {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const addExport = exportDeclarations.find(
(exp) => exp.symbolName === "add",
(exp) => exp.symbolName === "add"
);

expect(addExport).toBeDefined();
Expand All @@ -54,7 +56,7 @@ describe("parseJSDoc", () => {
export function minimalJSDoc(x: number): number {
return x * 2;
}
`,
`
);

const tsConfigPath = getTsConfigPath(workspace.root, "packages/core");
Expand All @@ -66,7 +68,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(testFile!);
const minimalExport = exportDeclarations.find(
(exp) => exp.symbolName === "minimalJSDoc",
(exp) => exp.symbolName === "minimalJSDoc"
);

expect(minimalExport).toBeDefined();
Expand All @@ -90,7 +92,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const addExport = exportDeclarations.find(
(exp) => exp.symbolName === "add",
(exp) => exp.symbolName === "add"
);

expect(addExport).toBeDefined();
Expand All @@ -117,7 +119,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const addExport = exportDeclarations.find(
(exp) => exp.symbolName === "add",
(exp) => exp.symbolName === "add"
);

expect(addExport).toBeDefined();
Expand All @@ -139,7 +141,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const addExport = exportDeclarations.find(
(exp) => exp.symbolName === "add",
(exp) => exp.symbolName === "add"
);

expect(addExport).toBeDefined();
Expand All @@ -162,7 +164,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const addExport = exportDeclarations.find(
(exp) => exp.symbolName === "add",
(exp) => exp.symbolName === "add"
);

expect(addExport).toBeDefined();
Expand All @@ -186,7 +188,7 @@ export function minimalJSDoc(x: number): number {

const exportDeclarations = getExportedDeclarationsBySourceFile(mathFile!);
const multiplyExport = exportDeclarations.find(
(exp) => exp.symbolName === "multiply",
(exp) => exp.symbolName === "multiply"
);

expect(multiplyExport).toBeDefined();
Expand Down
Loading