Skip to content

Commit

Permalink
feat: init command
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Jun 4, 2023
1 parent f8513cc commit 1d977bb
Show file tree
Hide file tree
Showing 18 changed files with 996 additions and 46 deletions.
23 changes: 16 additions & 7 deletions README.md
Expand Up @@ -11,17 +11,19 @@ npm install @sanity/pkg-utils -D
## Basic usage

```sh
# Initialize a new package
npx @sanity/pkg-utils@latest init

# In a Node.js package directory with `package.json` present

# Check the package
# This will validate the package.json file
pkg-utils
pkg-utils check

# Build the package
pkg-utils build --tsconfig tsconfig.dist.json
pkg-utils build

# Watch the package
pkg-utils watch --tsconfig tsconfig.dist.json
pkg-utils watch
```

Run `pkg-utils -h` for more information on CLI usage.
Expand All @@ -38,8 +40,15 @@ control. You may then add a configuration file named `package.config.ts` (or `.j
import {defineConfig} from '@sanity/pkg-utils'

export default defineConfig({
// Minify bundled JavaScript
minify: true,
extract: {
rules: {
// do not require internal members to be prefixed with `_`
'ae-internal-missing-underscore': 'off',
},
},

// the path to the tsconfig file for distributed builds
tsconfig: 'tsconfig.dist.json',
})
```

Expand Down Expand Up @@ -89,7 +98,7 @@ Override or modify the value of the `exports` before it’s parsed internally.
```
- Default: `undefined`

Configure the level of reporting of \`@microsoft/api-extractor\` (which is used to bundle the
Configure the level of reporting of [API Extractor](https://api-extractor.com/) (which is used to bundle the
type definitions, as well as lint the TSDoc of the package).

#### `external`
Expand Down
10 changes: 9 additions & 1 deletion package.json
Expand Up @@ -139,12 +139,18 @@
"esbuild": "^0.17.19",
"esbuild-register": "^3.4.2",
"find-config": "^1.0.0",
"get-latest-version": "^5.0.1",
"git-url-parse": "^13.1.0",
"globby": "^11.1.0",
"jsonc-parser": "^3.2.0",
"mkdirp": "^3.0.1",
"outdent": "^0.8.0",
"parse-git-config": "^3.0.0",
"pkg-up": "^3.1.0",
"prettier": "^2.8.8",
"prettier-plugin-packagejson": "^2.4.3",
"pretty-bytes": "^5.6.0",
"prompts": "^2.4.2",
"recast": "^0.23.2",
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
Expand All @@ -162,8 +168,11 @@
"@types/babel__core": "^7.20.1",
"@types/cpx": "^1.5.2",
"@types/find-config": "^1.0.1",
"@types/git-url-parse": "^9.0.1",
"@types/node": "^20.2.5",
"@types/parse-git-config": "^3.0.1",
"@types/prettier": "^2.7.2",
"@types/prompts": "^2.4.4",
"@types/treeify": "^1.0.0",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.59.7",
Expand All @@ -180,7 +189,6 @@
"lint-staged": "^13.2.2",
"npm-run-all": "^4.1.5",
"outdent": "^0.8.0",
"prettier-plugin-packagejson": "^2.4.3",
"rollup-plugin-visualizer": "^5.9.0",
"semantic-release": "^21.0.2",
"ts-node": "^10.9.1",
Expand Down

0 comments on commit 1d977bb

Please sign in to comment.