Skip to content
Closed
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
2 changes: 2 additions & 0 deletions .changeset/dirty-steaks-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
3 changes: 0 additions & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
":automergeAll",
":automergePr",
":automergeRequireAllStatusChecks",
":enableVulnerabilityAlerts",
":label(dependencies)",
":maintainLockFilesMonthly",
Expand Down
28 changes: 8 additions & 20 deletions .github/workflows/continuous_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,23 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Get node version
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: node
- name: Setup node ${{ steps.node.outputs.version }}
uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ steps.node.outputs.version }}
cache: pnpm
- name: Setup .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
node-version-file: ".nvmrc"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build # Check composite action to avoid creating two jobs to reuse workflows https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action
run: pnpm build
- name: Publish pre-release version(s)
if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
run: |
pnpm --filter=\!@examples/\* --recursive exec pnpm version "$(pnpm show ./ version)-next-${GITHUB_SHA::7}"
pnpm --filter=\!@examples/\* --recursive exec pnpm publish --tag next --no-git-checks
pnpm --filter="!." --filter="!./applications/*" --filter="!./examples/*" --filter="!./tools/*" --recursive exec \
node -e "const fs=require('fs'),pkg=JSON.parse(fs.readFileSync('package.json'));pkg.version=pkg.version+'-next-${GITHUB_SHA::7}';fs.writeFileSync('package.json',JSON.stringify(pkg,null,2)+'\n');"
pnpm --filter="!." --filter="!./applications/*" --filter="!./examples/*" --filter="!./tools/*" --recursive exec pnpm publish --tag next --no-git-checks
- name: Create release pull request
if: "!contains(github.event.head_commit.message, 'chore: release package(s)')"
uses: changesets/action@v1
Expand All @@ -60,4 +49,3 @@ jobs:
publish: pnpm release:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 3 additions & 4 deletions .github/workflows/conventional_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@v6
id: check_pr_rule
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -29,8 +29,7 @@ jobs:
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: The subject must start with a lowercase character
# Create a sticky comment to display the detailed error
- uses: marocchino/sticky-pull-request-comment@v2
- uses: marocchino/sticky-pull-request-comment@v3
if: always() && (steps.check_pr_rule.outputs.error_message != null)
with:
header: check_pr_comment
Expand All @@ -42,7 +41,7 @@ jobs:
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.check_pr_rule.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
uses: marocchino/sticky-pull-request-comment@v3
with:
header: check_pr_comment
delete: true
4 changes: 2 additions & 2 deletions .github/workflows/dependency_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.actor == 'renovate[bot]'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
Expand All @@ -21,7 +21,7 @@ jobs:
git config --global user.email adbayb@gmail.com
git config --global user.name 'Ayoub Adib'
- name: Create changelog entry
uses: actions/github-script@v7
uses: actions/github-script@v9
# Credits to https://github.com/backstage/backstage/blob/bcc11651add5a2589898dfb9d665ebb9d412201b/.github/workflows/sync_renovate-changesets.yml
with:
script: |
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Get node version
run: echo "version=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: node
- name: Setup node ${{ steps.node.outputs.version }}
uses: actions/setup-node@v4
uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ steps.node.outputs.version }}
cache: pnpm
- name: Setup cache
id: cache
uses: actions/cache@v4
with:
path: |
./node_modules
./turbo
key: ${{ runner.os }}-cache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cache-
node-version-file: ".nvmrc"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
Expand Down
7 changes: 0 additions & 7 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
save-exact=true
public-hoist-pattern[]=*changesets*
public-hoist-pattern[]=*commitlint*
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*turbo*
public-hoist-pattern[]=*typescript*
public-hoist-pattern[]=*types*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.13.0
24.15.0
25 changes: 11 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@
"astro"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": "explicit",
"source.fixAll.ts": "explicit",
"source.addMissingImports.ts": "explicit",
"source.organizeImports": "never",
"source.organizeLinkDefinitions": "explicit",
"source.removeUnused.ts": "never",
"source.removeUnusedImports": "never",
"source.sortImports": "never"
},
"workbench.editor.labelFormat": "short",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"grammarly.selectors": [
{
"language": "mdx",
"scheme": "file"
},
{
"language": "md",
"scheme": "file"
}
]
"js/ts.tsdk.path": "node_modules/typescript/lib",
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
"workbench.editor.labelFormat": "short"
}
2 changes: 1 addition & 1 deletion applications/cli/bin/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

import { join } from "node:path";
import { createRequire } from "node:module";
import { join } from "node:path";

const package_ = createRequire(import.meta.url)("../package.json");

Expand Down
4 changes: 2 additions & 2 deletions applications/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"@sdk-usage/plugin-typescript": "workspace:^"
},
"devDependencies": {
"@types/node": "22.10.6",
"quickbundle": "2.8.0"
"@types/node": "24.12.4",
"quickbundle": "2.9.0"
},
"publishConfig": {
"access": "public",
Expand Down
8 changes: 3 additions & 5 deletions applications/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import process from "node:process";

import typescriptSyntaxPlugin from "@sdk-usage/plugin-typescript";
import jsxSyntaxPlugin from "@sdk-usage/plugin-jsx";
import { createInstance } from "@sdk-usage/core";
import jsxPlugin from "@sdk-usage/plugin-jsx";
import typescriptPlugin from "@sdk-usage/plugin-typescript";

const instance = createInstance(process.cwd(), {
plugins: [jsxSyntaxPlugin, typescriptSyntaxPlugin],
plugins: [jsxPlugin, typescriptPlugin],
});

const main = async () => {
Expand Down
6 changes: 3 additions & 3 deletions examples/chakra-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"start": "sdk-usage"
},
"dependencies": {
"@chakra-ui/react": "^3.3.1",
"react": "^18.3.1"
"@chakra-ui/react": "^3.35.0",
"react": "^19.2.6"
},
"devDependencies": {
"@sdk-usage/cli": "workspace:*",
"@types/react": "18.3.18"
"@types/react": "19.2.14"
}
}
3 changes: 2 additions & 1 deletion examples/chakra-ui/src/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Button as ChakraButton, Link as ChakraLink } from "@chakra-ui/react";
import type { LinkProps as ChakraLinkProps } from "@chakra-ui/react";

import { Button as ChakraButton, Link as ChakraLink } from "@chakra-ui/react";

export type ButtonProps = {
readonly children: string;
readonly test: ChakraLinkProps["hrefLang"];
Expand Down
10 changes: 5 additions & 5 deletions libraries/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
},
"dependencies": {
"@open-vanilla/visitor": "^1.0.0",
"@swc/core": "^1.10.7",
"fdir": "^6.4.2",
"picomatch": "^4.0.2"
"@swc/core": "^1.15.33",
"fdir": "^6.5.0",
"picomatch": "^4.0.4"
},
"devDependencies": {
"@types/node": "22.10.6",
"quickbundle": "2.8.0"
"@types/node": "24.12.4",
"quickbundle": "2.9.0"
},
"publishConfig": {
"access": "public",
Expand Down
17 changes: 9 additions & 8 deletions libraries/core/src/createInstance.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { readFileSync } from "node:fs";

import type { Package } from "./types";
import { scan } from "./modules/scanner";
import type { ScanOptions } from "./modules/scanner";
import type { Item } from "./entities/item";
import type { Plugin } from "./modules/plugin";
import { parse } from "./modules/parser";
import { require, resolvePackageJson } from "./helpers";
import type { ScanOptions } from "./modules/scanner";
import type { Package } from "./types";

import { createItem } from "./entities/item";
import type { Item } from "./entities/item";
import { require, resolvePackageJson } from "./helpers";
import { parse } from "./modules/parser";
import { scan } from "./modules/scanner";

type Options = Partial<
Pick<ScanOptions, "excludeFolders" | "includeFiles"> & {
{
/**
* Only analyze components imported from the specificied module list.
*/
Expand All @@ -24,7 +25,7 @@ type Options = Partial<
* @default false
*/
resolveInstalledVersions: boolean;
}
} & Pick<ScanOptions, "excludeFolders" | "includeFiles">
>;

export const createInstance = (path: string, options: Options) => {
Expand Down
36 changes: 18 additions & 18 deletions libraries/core/src/entities/item/createItem.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable sort-keys-custom-order/object-keys */
import type { Package } from "../../types";
import { createLocation } from "./createLocation";
import type { CreateLocationInput, Location } from "./createLocation";

import { createLocation } from "./createLocation";

export type Item = {
name: string;
createdAt: string;
input: {
data: Record<string, unknown>;
Expand All @@ -14,19 +13,20 @@ export type Item = {
};
location: Location;
module: Package["name"];
name: string;
type: string;
version: Package["version"];
};

export type ItemDTO = Partial<Pick<Item, "input">> &
Pick<Item, "module" | "name" | "type"> & {
offset: number;
};
export type ItemDTO = {
offset: number;
} & Partial<Pick<Item, "input">> &
Pick<Item, "module" | "name" | "type">;

type CreateItemInput = Partial<Pick<Item, "input">> &
Pick<Item, "module" | "name" | "type" | "version"> & {
location: CreateLocationInput;
};
type CreateItemInput = {
location: CreateLocationInput;
} & Partial<Pick<Item, "input">> &
Pick<Item, "module" | "name" | "type" | "version">;

/**
* Aggregate factory that creates an item.
Expand All @@ -42,26 +42,26 @@ type CreateItemInput = Partial<Pick<Item, "input">> &
* createItem({ ... });
*/
export const createItem = ({
name,
input,
location,
module,
name,
type,
version,
}: CreateItemInput) => {
const item: Item = {
name,
type,
module,
version,
createdAt: new Date().toISOString(),
location: createLocation(location),
input: {
data: input?.data ?? {},
metadata: {
withSpreading: input?.metadata.withSpreading ?? false,
},
data: input?.data ?? {},
},
location: createLocation(location),
module,
name,
type,
version,
};

return item;
Expand Down
12 changes: 6 additions & 6 deletions libraries/core/src/entities/item/createLocation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { relative } from "node:path";

export type CreateLocationInput = {
code: string;
offset: number;
path: string;
} & Pick<Location, "file" | "link" | "module">;

export type Location = {
column: number;
file: string;
Expand All @@ -8,12 +14,6 @@ export type Location = {
module: string;
};

export type CreateLocationInput = Pick<Location, "file" | "link" | "module"> & {
code: string;
offset: number;
path: string;
};

export const createLocation = ({
code,
file,
Expand Down
Loading
Loading