Skip to content

Commit

Permalink
Move /pkg to /packages/publint
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Dec 21, 2024
1 parent 6e2553d commit d5e384d
Show file tree
Hide file tree
Showing 111 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
branches:
- master
paths:
- 'pkg/**'
- 'packages/**'
- '.github/workflows/ci.yml'
- '!**.md'
pull_request:
paths:
- 'pkg/**'
- 'packages/**'
- '.github/workflows/ci.yml'
- '!**.md'

Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ The project requires [`pnpm 8`](https://pnpm.io) and [`Node.js 16`](https://node

There are 3 parts to this repo:

- [pkg](./pkg) - The `publint` npm package
- [packages/publint](./packages/publint) - The `publint` npm package
- [site](./site) - The website
- [analysis](./analysis) - The analysis automation that lints popular npm packages for displaying their results on the website

## Development

### pkg
### packages/publint

The `pkg` workspace has the `lib`, `src`, and `tests` directories.
The `packages/publint` workspace has the `lib`, `src`, and `tests` directories.

`src` contains most of `publint`'s source code, and `lib` contains entrypoints that uses APIs from `src` (to provide default environment-specific information). You can check the `exports` field of `pkg/package.json` to see how they're linked.
`src` contains most of `publint`'s source code, and `lib` contains entrypoints that uses APIs from `src` (to provide default environment-specific information). You can check the `exports` field of `packages/publint/package.json` to see how they're linked.

`tests` contains unit tests that runs the test projects under `tests/fixtures`.

### site

The `site` workspace is a Vite & Svelte multiple page application. It powers https://publint.dev.

It has a `packfix` command (`pnpm packfix`) which packages up fixtures from [pkg/tests/fixtures](./pkg/tests/fixtures). Once packed, when running the dev server, you can search for the fixture name, e.g. `publint-test-1`, and it'll load the package locally. This can be used for quick testing.
It has a `packfix` command (`pnpm packfix`) which packages up fixtures from [packages/publint/tests/fixtures](./packages/publint/tests/fixtures). Once packed, when running the dev server, you can search for the fixture name, e.g. `publint-test-1`, and it'll load the package locally. This can be used for quick testing.

### analysis

Expand All @@ -36,7 +36,7 @@ There's also an additional `pnpm bench` command that solely benchmarks the time

## Testing

You can run the unit tests with `pnpm test` in the root or `pkg` directory.
You can run the unit tests with `pnpm test` in the root or `packages/publint` directory.

## Pull requests

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ $ npx publint ./node_modules/some-lib
$ npx publint deps
```

Or try it online at https://publint.dev. For JavaScript usage, see [pkg/README.md](./pkg/README.md).
Or try it online at https://publint.dev. For JavaScript usage, see [packages/publint/README.md](./packages/publint/README.md).

## Development

Use `pnpm install` to install all project dependencies.

There are 3 parts to this repo:

- [pkg](./pkg) - The `publint` npm package
- [packages/publint](./packages/publint) - The `publint` npm package
- [site](./site) - The website
- [analysis](./analysis) - The analysis automation that lints popular npm packages for displaying their results on the website

Expand Down
2 changes: 1 addition & 1 deletion analysis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async function fetchPkgData(pkg) {
const cachedFileUrl = getCacheTarFileUrl(pkg, version)
usedCacheFileBaseNames.push(path.basename(cachedFileUrl.href))

/** @type {ArrayBuffer} */
/** @type {ArrayBuffer | SharedArrayBuffer} */
let resultBuffer

if (fss.existsSync(cachedFileUrl)) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"lint": "prettier \"**/*.{js,ts,css,md,svelte,html}\" --check",
"format": "prettier \"**/*.{js,ts,css,md,svelte,html}\" --write",
"typecheck": "tsc -p pkg && tsc -p site && tsc -p analysis",
"test": "pnpm --dir pkg test"
"typecheck": "tsc -p packages/publint && tsc -p site && tsc -p analysis",
"test": "pnpm --dir packages/publint test"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:
- analysis
- pkg
- site
- 'packages/*'
3 changes: 1 addition & 2 deletions site/scripts/packFixtures.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import cp from 'child_process'
import fs from 'node:fs/promises'
import fss from 'node:fs'
import path from 'node:path'

const fixtureDir = path.resolve('../pkg/tests/fixtures')
const fixtureDir = path.resolve('../packages/publint/tests/fixtures')
const fixtures = (await fs.readdir(fixtureDir, { withFileTypes: true }))
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name)
Expand Down

0 comments on commit d5e384d

Please sign in to comment.