auklet 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -429
- package/dist/cli/build.d.ts +3 -5
- package/dist/cli/build.js +86 -23
- package/dist/cli/buildCss.d.ts +10 -5
- package/dist/cli/buildCss.js +21 -17
- package/dist/cli/buildWorkspace.d.ts +24 -0
- package/dist/cli/buildWorkspace.js +43 -0
- package/dist/cli/dev.d.ts +2 -1
- package/dist/cli/dev.js +130 -23
- package/dist/cli/main.js +167 -26
- package/dist/cli/parse/build.d.ts +63 -0
- package/dist/cli/{buildArgs.js → parse/build.js} +47 -22
- package/dist/cli/parse/core.d.ts +14 -0
- package/dist/cli/parse/core.js +68 -0
- package/dist/cli/parse/dev.d.ts +18 -0
- package/dist/cli/parse/dev.js +4 -0
- package/dist/cli/parse/owner.d.ts +11 -0
- package/dist/cli/parse/owner.js +25 -0
- package/dist/cli/parse/publish.d.ts +19 -0
- package/dist/cli/parse/publish.js +60 -0
- package/dist/cli/parse/workspace.d.ts +14 -0
- package/dist/cli/parse/workspace.js +60 -0
- package/dist/css/inspect.js +4 -3
- package/dist/publish/api/pnpmApi.d.ts +0 -4
- package/dist/publish/api/pnpmApi.js +0 -34
- package/dist/publish/cli.d.ts +0 -16
- package/dist/publish/cli.js +5 -122
- package/dist/publish/inspect.js +2 -2
- package/dist/publish/targetResolver.js +28 -72
- package/dist/publish/types.d.ts +1 -7
- package/dist/workspace/targets.d.ts +31 -0
- package/dist/workspace/targets.js +144 -0
- package/package.json +1 -1
- package/dist/cli/buildArgs.d.ts +0 -9
- package/dist/cli/publish.d.ts +0 -2
- package/dist/cli/publish.js +0 -9
- /package/dist/cli/{values.d.ts → parse/values.d.ts} +0 -0
- /package/dist/cli/{values.js → parse/values.js} +0 -0
package/README.md
CHANGED
|
@@ -6,211 +6,144 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
auklet is a build tool for TypeScript packages. It wraps `tsdown` for
|
|
9
|
-
JavaScript output, generates CSS style entries for
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
JavaScript output, generates CSS style entries for component packages, provides
|
|
10
|
+
a Vite dev plugin for virtual package CSS, and includes pnpm workspace publish
|
|
11
|
+
helpers.
|
|
12
12
|
|
|
13
|
-
It is
|
|
13
|
+
It is intended for single-package libraries, component packages, and pnpm
|
|
14
|
+
monorepos.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
- single-package component libraries;
|
|
17
|
-
- pnpm monorepo TypeScript libraries;
|
|
18
|
-
- pnpm monorepo component packages.
|
|
19
|
-
|
|
20
|
-
Requirements:
|
|
16
|
+
## Requirements
|
|
21
17
|
|
|
22
18
|
- Node.js `>=22`
|
|
23
|
-
- pnpm
|
|
24
|
-
|
|
25
|
-
## Quick Start
|
|
26
|
-
|
|
27
|
-
`auklet.config.js` or `auklet.config.mjs` is optional. Without it, auklet uses
|
|
28
|
-
`src` as source, `dist` as output, no module output, and default JavaScript
|
|
29
|
-
formats.
|
|
30
|
-
|
|
31
|
-
For a component package, a minimal config usually looks like this:
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
import { defineConfig } from 'auklet';
|
|
35
|
-
|
|
36
|
-
export const config = defineConfig({
|
|
37
|
-
modules: true,
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Build JavaScript and CSS output:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
auk build
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Import generated CSS entries from the package:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
import '@scope/ui/style.css';
|
|
51
|
-
import '@scope/ui/components/Button.css';
|
|
52
|
-
```
|
|
19
|
+
- pnpm `10.27.0`
|
|
53
20
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { aukletStylePlugin } from 'auklet';
|
|
58
|
-
|
|
59
|
-
export default {
|
|
60
|
-
plugins: [aukletStylePlugin()],
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## CLI
|
|
21
|
+
## Commands
|
|
65
22
|
|
|
66
23
|
The package exposes both `auk` and `auklet`.
|
|
67
24
|
|
|
25
|
+
### Build And Dev
|
|
26
|
+
|
|
68
27
|
| Command | Description |
|
|
69
28
|
| ----------------------- | --------------------------------------------------------------------- |
|
|
70
|
-
| `auk dev` | Watch JavaScript and CSS output together. |
|
|
71
29
|
| `auk build` | Remove configured output, then build JavaScript and CSS. |
|
|
72
30
|
| `auk build-js` | Run tsdown with auklet's built-in config unless `--config` is passed. |
|
|
73
|
-
| `auk build-js --watch` | Pass watch mode through to tsdown. |
|
|
74
31
|
| `auk build-css` | Generate CSS output only. |
|
|
75
32
|
| `auk build-css --watch` | Watch source/config/style files and rebuild CSS. |
|
|
76
|
-
| `auk
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
33
|
+
| `auk dev` | Watch JavaScript and CSS output for the current package. |
|
|
34
|
+
|
|
35
|
+
Build and dev flags:
|
|
36
|
+
|
|
37
|
+
| Flag | Commands | Description |
|
|
38
|
+
| ----------------------------- | ------------------------------------------------------ | -------------------------------------------------- |
|
|
39
|
+
| `--source <dir>` | `build`, `build-js`, `build-css`, `dev`, `inspect css` | Source directory. |
|
|
40
|
+
| `--output <dir>` | `build`, `build-js`, `build-css`, `dev`, `inspect css` | Output directory. |
|
|
41
|
+
| `--modules` | `build`, `build-js`, `build-css`, `dev`, `inspect css` | Enable unbundled module output. |
|
|
42
|
+
| `--no-modules` | `build`, `build-js`, `build-css`, `dev`, `inspect css` | Disable unbundled module output. |
|
|
43
|
+
| `--build.formats <formats>` | `build`, `build-js`, `dev`, `inspect css` | Comma-separated `cjs`, `esm`, and/or `iife`. |
|
|
44
|
+
| `--build.target <target>` | `build`, `build-js`, `dev`, `inspect css` | JavaScript target passed to tsdown. |
|
|
45
|
+
| `--build.platform <platform>` | `build`, `build-js`, `dev`, `inspect css` | `node`, `neutral`, or `browser`. |
|
|
46
|
+
| `--build.tsconfig <file>` | `build`, `build-js`, `dev`, `inspect css` | TypeScript config file. |
|
|
47
|
+
| `--watch`, `-w` | `build-css` | Watch CSS output. |
|
|
48
|
+
| `--filter <pattern>` | `build`, `dev` | Select workspace packages by package name. |
|
|
49
|
+
| `--workspace` | `build`, `dev` | Alias for `--filter '*'`. |
|
|
50
|
+
| `--deps` | `build`, `dev` | Include selected packages' workspace dependencies. |
|
|
51
|
+
| `--private` | `build`, `dev` | Include private workspace packages. |
|
|
93
52
|
|
|
94
|
-
|
|
95
|
-
| ----------------------------- | -------------------------------------------- |
|
|
96
|
-
| `--source <dir>` | Source directory. |
|
|
97
|
-
| `--output <dir>` | Output directory. |
|
|
98
|
-
| `--modules` | Enable unbundled module output. |
|
|
99
|
-
| `--no-modules` | Disable unbundled module output. |
|
|
100
|
-
| `--build.formats <formats>` | Comma-separated `cjs`, `esm`, and/or `iife`. |
|
|
101
|
-
| `--build.target <target>` | JavaScript target passed to tsdown. |
|
|
102
|
-
| `--build.platform <platform>` | `node`, `neutral`, or `browser`. |
|
|
103
|
-
| `--build.tsconfig <file>` | TypeScript config file. |
|
|
53
|
+
Notes:
|
|
104
54
|
|
|
105
|
-
|
|
55
|
+
- `build-js` and single-package `dev` pass unknown flags through to tsdown.
|
|
56
|
+
- Build override flags cannot be combined with tsdown `--config`, `-c`, or
|
|
57
|
+
`--no-config`.
|
|
58
|
+
- Workspace `build` runs each target package's own `build` script.
|
|
59
|
+
- Workspace `dev` runs each target package's own `dev` script. Packages without
|
|
60
|
+
a `dev` script fail fast.
|
|
61
|
+
- Workspace `build` and `dev` skip private packages by default. Use `--private`
|
|
62
|
+
to include them.
|
|
63
|
+
|
|
64
|
+
### Publish
|
|
65
|
+
|
|
66
|
+
| Command | Description |
|
|
67
|
+
| ------------- | ------------------------------------ |
|
|
68
|
+
| `auk publish` | Run the pnpm-based publish workflow. |
|
|
69
|
+
|
|
70
|
+
Publish flags:
|
|
71
|
+
|
|
72
|
+
| Flag | Description |
|
|
73
|
+
| -------------------- | ------------------------------------------------------------------------ |
|
|
74
|
+
| `--filter <pattern>` | Select workspace packages by package name. |
|
|
75
|
+
| `--workspace` | Alias for `--filter '*'`. |
|
|
76
|
+
| `--version <value>` | Publish version, such as `patch`, `minor`, `major`, or an exact version. |
|
|
77
|
+
| `--dry-run` | Plan and validate without writing versions, git, or registry state. |
|
|
78
|
+
| `--no-format` | Disable auklet's publish output formatter for this run. |
|
|
79
|
+
| `--no-git` | Skip release commit and tag. |
|
|
80
|
+
| `--allow-dirty` | Allow publishing from a dirty worktree. |
|
|
81
|
+
| `--ignore-scripts` | Skip publish lifecycle hooks. |
|
|
82
|
+
| `--otp <code>` | Forward an npm 2FA one-time password. |
|
|
83
|
+
| `--token <value>` | Set `NODE_AUTH_TOKEN` and `NPM_TOKEN` for publish subprocesses. |
|
|
84
|
+
|
|
85
|
+
### Inspect
|
|
86
|
+
|
|
87
|
+
| Command | Description |
|
|
88
|
+
| --------------------- | ----------------------------------------------------------------- |
|
|
89
|
+
| `auk inspect publish` | Check publish readiness without changing files or registry state. |
|
|
90
|
+
| `auk inspect pack` | Check package entry/export files before publishing. |
|
|
91
|
+
| `auk inspect css` | Explain CSS output entry, theme, and module plans. |
|
|
92
|
+
|
|
93
|
+
Inspect flags:
|
|
94
|
+
|
|
95
|
+
| Flag | Commands | Description |
|
|
96
|
+
| -------------------- | ----------------- | ------------------------------------------------------------ |
|
|
97
|
+
| publish flags | `inspect publish` | Uses the same selection/version/auth flags as `auk publish`. |
|
|
98
|
+
| `--filter <pattern>` | `inspect pack` | Select workspace packages by package name. |
|
|
99
|
+
| build/dev flags | `inspect css` | Uses the same build override flags as `auk build`. |
|
|
100
|
+
|
|
101
|
+
### Owner
|
|
102
|
+
|
|
103
|
+
| Command | Description |
|
|
104
|
+
| ---------------------- | ---------------------------- |
|
|
105
|
+
| `auk owner add <user>` | Add npm owners through pnpm. |
|
|
106
|
+
|
|
107
|
+
Owner flags:
|
|
108
|
+
|
|
109
|
+
| Flag | Description |
|
|
110
|
+
| -------------------- | ------------------------------------------ |
|
|
111
|
+
| `--filter <pattern>` | Add owners to matching workspace packages. |
|
|
112
|
+
| `--package <name>` | Add owners to explicit npm packages. |
|
|
113
|
+
| `--otp <code>` | Forward an npm owner-management 2FA code. |
|
|
114
|
+
|
|
115
|
+
### Misc
|
|
116
|
+
|
|
117
|
+
| Command | Description |
|
|
118
|
+
| --------------- | --------------------- |
|
|
119
|
+
| `auk version` | Print auklet version. |
|
|
120
|
+
| `auk --version` | Print auklet version. |
|
|
121
|
+
| `auk --help` | Print CLI help. |
|
|
122
|
+
|
|
123
|
+
## Parameter Notes
|
|
124
|
+
|
|
125
|
+
- `--filter` is a package-name filter, not pnpm's full filter syntax.
|
|
126
|
+
Supported patterns are `*`, exact package names, and scoped globs such as
|
|
127
|
+
`@scope/*`.
|
|
128
|
+
- String and boolean CLI values can reference loaded environment variables with
|
|
129
|
+
`env:NAME`, for example `auk build --source env:AUKLET_SOURCE` or
|
|
130
|
+
`auk publish --token env:NODE_AUTH_TOKEN`.
|
|
131
|
+
- auklet loads `.env` and `.env.local` files by default. Shell environment
|
|
132
|
+
values keep the highest priority; package `.env.local` overrides package
|
|
133
|
+
`.env`; root `.env.local` overrides root `.env`.
|
|
134
|
+
- Config precedence is:
|
|
106
135
|
|
|
107
136
|
```text
|
|
108
137
|
CLI flags > auklet.config.js / auklet.config.mjs > auklet defaults
|
|
109
138
|
```
|
|
110
139
|
|
|
111
|
-
`build-js` passes unknown flags through to tsdown. Auklet build override flags
|
|
112
|
-
cannot be combined with tsdown custom config flags:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# not allowed
|
|
116
|
-
auk build-js --source source --config tsdown.config.ts
|
|
117
|
-
auk build-js --output build -c tsdown.config.ts
|
|
118
|
-
auk build-js --modules --no-config
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
When `--config`, `-c`, or `--no-config` is used, tsdown owns the full build
|
|
122
|
-
config. Use auklet config files or tsdown config code directly instead of
|
|
123
|
-
auklet CLI overrides.
|
|
124
|
-
|
|
125
|
-
Publish controls stay on CLI flags:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
auk publish
|
|
129
|
-
auk publish --filter @scope/ui
|
|
130
|
-
auk publish --version patch --dry-run
|
|
131
|
-
auk publish --no-format
|
|
132
|
-
auk publish --no-git
|
|
133
|
-
auk publish --otp 123456
|
|
134
|
-
auk publish --token npm_xxx
|
|
135
|
-
auk inspect publish --version patch
|
|
136
|
-
auk inspect pack --filter @scope/ui
|
|
137
|
-
auk inspect css --modules
|
|
138
|
-
auk owner add alice
|
|
139
|
-
auk owner add alice --filter @scope/ui --otp 123456
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
Target selection:
|
|
143
|
-
|
|
144
|
-
```text
|
|
145
|
-
auk publish
|
|
146
|
-
├─ --filter <pattern> publish matching workspace packages
|
|
147
|
-
└─ no --filter publish the current package
|
|
148
|
-
└─ private monorepo root -> fail; use --filter
|
|
149
|
-
|
|
150
|
-
auk owner add <user...>
|
|
151
|
-
├─ --filter <pattern> add owners to matching workspace packages
|
|
152
|
-
├─ --package <name> add owners to explicit npm packages
|
|
153
|
-
└─ no selector add owners to the current package
|
|
154
|
-
└─ private package -> fail
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
`--no-format` disables auklet's publish output formatter for that run. It is not
|
|
158
|
-
configured in `package.json`.
|
|
159
|
-
`--no-git` skips auklet's release commit and tag for that run. The publish flow
|
|
160
|
-
still checks that the git worktree is clean unless `--allow-dirty` is also set.
|
|
161
|
-
Before writing versions, auklet checks npm authentication from each target
|
|
162
|
-
package directory. Package-local `.npmrc` files and
|
|
163
|
-
`package.json#publishConfig.registry` are respected.
|
|
164
|
-
`--otp` is forwarded to `pnpm publish` for npm accounts or organizations that
|
|
165
|
-
require publish 2FA, and to `pnpm owner add` for owner management 2FA.
|
|
166
|
-
Build and publish commands load `.env` and `.env.local` files by default. In
|
|
167
|
-
monorepos, root env files are loaded before target package env files, and local
|
|
168
|
-
env files override normal env files. Shell environment values keep the highest
|
|
169
|
-
priority:
|
|
170
|
-
|
|
171
|
-
1. `process.env`
|
|
172
|
-
2. target package `.env.local`
|
|
173
|
-
3. target package `.env`
|
|
174
|
-
4. root `.env.local`
|
|
175
|
-
5. root `.env`
|
|
176
|
-
|
|
177
|
-
String CLI values can reference the loaded environment with `env:NAME`, for
|
|
178
|
-
example `auk build --source env:AUKLET_SOURCE`. Boolean CLI values also support
|
|
179
|
-
`env:NAME` when passed explicitly, for example
|
|
180
|
-
`auk publish --dry-run=env:AUKLET_DRY_RUN`.
|
|
181
|
-
`--token <value>` sets `NODE_AUTH_TOKEN` and `NPM_TOKEN` for publish
|
|
182
|
-
subprocesses. Use `--token env:NODE_AUTH_TOKEN` to read the token from the
|
|
183
|
-
loaded environment instead of putting the token value in the command.
|
|
184
|
-
The token still needs npmrc auth config, for example:
|
|
185
|
-
|
|
186
|
-
```ini
|
|
187
|
-
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
When a package uses `package.json#publishConfig.registry`, the npmrc token entry
|
|
191
|
-
must target that registry. In CI, prefer an npm automation token over `--otp`.
|
|
192
|
-
|
|
193
|
-
`auk inspect publish` accepts the same publish selection and version flags as
|
|
194
|
-
`auk publish`. It resolves the publish plan, checks package entry/export files,
|
|
195
|
-
then checks registry authentication and whether target versions already exist.
|
|
196
|
-
It does not write versions, run hooks, build, commit, tag, or publish packages.
|
|
197
|
-
Local package file failures or registry issues exit with code 1.
|
|
198
|
-
|
|
199
|
-
`auk inspect pack` accepts `--filter` for workspace package selection. It checks
|
|
200
|
-
whether `package.json` entry fields, `exports`, `bin`, `types`, CSS entry fields,
|
|
201
|
-
and declared `files` paths point to existing package files.
|
|
202
|
-
|
|
203
|
-
`auk inspect css` accepts the same build override flags as `auk build`. It
|
|
204
|
-
prints the normalized CSS plan, including output entries, theme files, and
|
|
205
|
-
module entries. When run from a pnpm workspace root, it inspects workspace child
|
|
206
|
-
packages instead of the root package. It does not write CSS output, but
|
|
207
|
-
dependency CSS files must already exist when the plan relies on external package
|
|
208
|
-
style entries or component auto imports.
|
|
209
|
-
|
|
210
140
|
## Configuration
|
|
211
141
|
|
|
212
|
-
`auklet.config.js` or `auklet.config.mjs` is
|
|
213
|
-
|
|
142
|
+
`auklet.config.js` or `auklet.config.mjs` is optional. Without it, auklet uses
|
|
143
|
+
`src` as source, `dist` as output, no module output, and default JavaScript
|
|
144
|
+
formats.
|
|
145
|
+
|
|
146
|
+
Config files must export a named `config` binding:
|
|
214
147
|
|
|
215
148
|
```js
|
|
216
149
|
import { defineConfig } from 'auklet';
|
|
@@ -221,6 +154,7 @@ export const config = defineConfig({
|
|
|
221
154
|
modules: true,
|
|
222
155
|
build: {
|
|
223
156
|
formats: ['esm', 'cjs'],
|
|
157
|
+
target: 'es2022',
|
|
224
158
|
},
|
|
225
159
|
styles: {
|
|
226
160
|
themes: {
|
|
@@ -236,250 +170,3 @@ export const config = defineConfig({
|
|
|
236
170
|
},
|
|
237
171
|
});
|
|
238
172
|
```
|
|
239
|
-
|
|
240
|
-
Configuration reference:
|
|
241
|
-
|
|
242
|
-
| Path | Default | Description |
|
|
243
|
-
| ------------------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
244
|
-
| `source` | `'src'` | Source directory relative to the current package root. |
|
|
245
|
-
| `output` | `'dist'` | Build output directory. `auk build` removes it before rebuilding. |
|
|
246
|
-
| `modules` | `false` | Generate unbundled module JS output and module-level CSS output. |
|
|
247
|
-
| `styles.themes` | `{}` | Current package theme entries, keyed by theme name. Values are paths relative to the current package root. |
|
|
248
|
-
| `styles.dependencies` | `{}` | External package style rules, keyed by dependency package name. |
|
|
249
|
-
| `styles.dependencies[pkg].entry` | `undefined` | Package-level style entry or entries from the dependency package. |
|
|
250
|
-
| `styles.dependencies[pkg].themes` | `undefined` | Theme entries from the dependency package, keyed by current package theme name. |
|
|
251
|
-
| `styles.dependencies[pkg].components` | `undefined` | Module CSS auto import rules. The name is historical; rules can point to paths such as `/pages/**.css` or `/blocks/**.css`. |
|
|
252
|
-
| `build.formats` | `['cjs', 'esm', 'iife']` | Package-level bundle formats. |
|
|
253
|
-
| `build.target` | `'es2020'` | JavaScript target passed to tsdown. |
|
|
254
|
-
| `build.platform` | `'neutral'` | Runtime platform: `node`, `neutral`, or `browser`. |
|
|
255
|
-
| `build.banner` | generated | Custom bundle banner. |
|
|
256
|
-
| `build.externals` | `[]` | Extra external package names combined with package dependencies. |
|
|
257
|
-
| `build.alias` | `{}` | Path aliases passed to tsdown. |
|
|
258
|
-
| `build.mainFields` | IIFE only | Package entry field resolution order for bundle output. |
|
|
259
|
-
| `build.globals` | `{}` | Global names for IIFE externals. |
|
|
260
|
-
| `build.tsconfig` | nearest `tsconfig.json` | TypeScript config path relative to package root. |
|
|
261
|
-
| `build.configureTsdown` | `undefined` | Final hook for each generated tsdown config. |
|
|
262
|
-
|
|
263
|
-
Common dependency rule:
|
|
264
|
-
|
|
265
|
-
```ts
|
|
266
|
-
{
|
|
267
|
-
entry: '/style.css',
|
|
268
|
-
components: ['/pages/**.css', '/components/**.css'],
|
|
269
|
-
themes: {
|
|
270
|
-
dark: '/themes/dark.css',
|
|
271
|
-
light: '/themes/light.css',
|
|
272
|
-
},
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
`configureTsdown` receives the generated tsdown config and a context:
|
|
277
|
-
|
|
278
|
-
```ts
|
|
279
|
-
type ConfigureTsdownContext = {
|
|
280
|
-
kind: 'bundle' | 'module';
|
|
281
|
-
format: 'cjs' | 'esm' | 'iife';
|
|
282
|
-
packageRoot: string;
|
|
283
|
-
output: string;
|
|
284
|
-
packageName?: string;
|
|
285
|
-
};
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## CSS Conventions And Limits
|
|
289
|
-
|
|
290
|
-
CSS auto import only scans `.tsx` files. `.ts` and `.d.ts` files do not
|
|
291
|
-
participate.
|
|
292
|
-
|
|
293
|
-
Supported source syntax:
|
|
294
|
-
|
|
295
|
-
```tsx
|
|
296
|
-
import { Button } from '@scope/ui';
|
|
297
|
-
import { Card as UICard } from '@scope/ui';
|
|
298
|
-
import { Dialog } from '@scope/ui/components/Dialog';
|
|
299
|
-
|
|
300
|
-
export { Button } from '@scope/ui';
|
|
301
|
-
export { Card } from '@scope/ui/components/Card';
|
|
302
|
-
|
|
303
|
-
import { Dialog as BaseDialog } from '@scope/ui';
|
|
304
|
-
export { BaseDialog as Dialog };
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Unsupported:
|
|
308
|
-
|
|
309
|
-
```ts
|
|
310
|
-
export * from '@scope/ui/components/Button';
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
`export *` is intentionally unsupported because auklet cannot reliably infer the
|
|
314
|
-
final exported component names, so it cannot infer CSS paths safely.
|
|
315
|
-
|
|
316
|
-
Inference rules:
|
|
317
|
-
|
|
318
|
-
- Package-root named imports use the imported name. For example, `Button` from
|
|
319
|
-
`@scope/ui` tries `@scope/ui/components/Button.css`.
|
|
320
|
-
- Local aliases do not affect package-root inference. `Button as UIButton`
|
|
321
|
-
still uses `Button`.
|
|
322
|
-
- Deep imports use the import path. `@scope/ui/components/Button` tries
|
|
323
|
-
`@scope/ui/components/Button.css`.
|
|
324
|
-
- Missing inferred CSS files are skipped.
|
|
325
|
-
- Duplicate imports inferred from JS and handwritten source CSS are deduped.
|
|
326
|
-
|
|
327
|
-
Same-package source imports can be resolved through:
|
|
328
|
-
|
|
329
|
-
- relative paths such as `../Button`;
|
|
330
|
-
- `package.json#imports`, preferring the `source` condition;
|
|
331
|
-
- `tsconfig.json` `compilerOptions.paths`.
|
|
332
|
-
|
|
333
|
-
Only candidates resolved into the current package `source` directory are treated
|
|
334
|
-
as same-package CSS dependencies.
|
|
335
|
-
|
|
336
|
-
`build-css` handles CSS entry generation and simple `@import` expansion. It does
|
|
337
|
-
not aim to replace a full CSS toolchain. In particular, keep these boundaries in
|
|
338
|
-
mind:
|
|
339
|
-
|
|
340
|
-
- It does not process preprocessors such as Sass or Less.
|
|
341
|
-
- It does not implement CSS Modules.
|
|
342
|
-
- It does not perform URL rebasing.
|
|
343
|
-
- It does not evaluate conditional CSS import semantics beyond auklet's style
|
|
344
|
-
entry rules.
|
|
345
|
-
- It expects source CSS files and package/style paths to exist on disk.
|
|
346
|
-
|
|
347
|
-
## CSS Output
|
|
348
|
-
|
|
349
|
-
`build-css` generates package-level `index.css` when source styles exist.
|
|
350
|
-
|
|
351
|
-
When `modules: true` is enabled, auklet also generates module-level CSS output
|
|
352
|
-
under `dist/es` and `dist/lib`, aligned with JavaScript module output.
|
|
353
|
-
|
|
354
|
-
Typical output structure:
|
|
355
|
-
|
|
356
|
-
```text
|
|
357
|
-
dist/
|
|
358
|
-
index.css
|
|
359
|
-
es/
|
|
360
|
-
style/
|
|
361
|
-
index.css
|
|
362
|
-
module.css
|
|
363
|
-
external.css
|
|
364
|
-
themes/
|
|
365
|
-
light.css
|
|
366
|
-
dark.css
|
|
367
|
-
components/
|
|
368
|
-
Button/
|
|
369
|
-
index.css
|
|
370
|
-
style/index.css
|
|
371
|
-
lib/
|
|
372
|
-
...
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
Entry semantics:
|
|
376
|
-
|
|
377
|
-
- `index.css`: package-level aggregate CSS.
|
|
378
|
-
- `style/index.css`: style entry for the current format.
|
|
379
|
-
- `style/module.css`: module styles from the current package.
|
|
380
|
-
- `style/external.css`: external style entry.
|
|
381
|
-
- `themes/*.css`: theme style entry.
|
|
382
|
-
- `components/*/style/index.css`: module-level style entry. `components/` is a
|
|
383
|
-
common output path, not a restriction that the internal model only supports
|
|
384
|
-
components.
|
|
385
|
-
|
|
386
|
-
If a generated CSS file is empty, auklet writes a placeholder comment so the
|
|
387
|
-
output is not a completely empty file.
|
|
388
|
-
|
|
389
|
-
## Vite Plugin
|
|
390
|
-
|
|
391
|
-
`aukletStylePlugin` is the Vite dev entry point. It turns package CSS imports
|
|
392
|
-
into virtual CSS modules. It only applies to the Vite dev server; production
|
|
393
|
-
builds still use `auk build` or `auk build-css`.
|
|
394
|
-
|
|
395
|
-
Single-package mode is the default:
|
|
396
|
-
|
|
397
|
-
```ts
|
|
398
|
-
import { aukletStylePlugin } from 'auklet';
|
|
399
|
-
|
|
400
|
-
export default {
|
|
401
|
-
plugins: [aukletStylePlugin()],
|
|
402
|
-
};
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
Use monorepo mode when a workspace demo/app needs to work with multiple
|
|
406
|
-
workspace packages:
|
|
407
|
-
|
|
408
|
-
```ts
|
|
409
|
-
import { aukletStylePlugin } from 'auklet';
|
|
410
|
-
|
|
411
|
-
export default {
|
|
412
|
-
plugins: [aukletStylePlugin({ mode: 'monorepo' })],
|
|
413
|
-
};
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
Primary options:
|
|
417
|
-
|
|
418
|
-
| Option | Default | Description |
|
|
419
|
-
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
420
|
-
| `mode` | `'package'` | `'package'` treats Vite root as the package root. `'monorepo'` finds `pnpm-workspace.yaml` upward from Vite root and reads pnpm workspace packages. |
|
|
421
|
-
| `root` | inferred | Custom graph root. Usually unnecessary. |
|
|
422
|
-
|
|
423
|
-
Supported dev CSS imports:
|
|
424
|
-
|
|
425
|
-
```ts
|
|
426
|
-
import '@scope/app/style.css';
|
|
427
|
-
import '@scope/app/external.css';
|
|
428
|
-
import '@scope/app/module.css';
|
|
429
|
-
import '@scope/app/components/Button.css';
|
|
430
|
-
import '@scope/app/themes/light.css';
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
In dev mode, workspace package style dependencies keep using auklet virtual CSS
|
|
434
|
-
recursion so style changes across packages can be tracked. Third-party CSS
|
|
435
|
-
dependencies are resolved from the package root that declares them and emitted
|
|
436
|
-
as Vite `/@fs/...` imports.
|
|
437
|
-
|
|
438
|
-
## Build Constants
|
|
439
|
-
|
|
440
|
-
`auk build` injects these compile-time constants into bundles:
|
|
441
|
-
|
|
442
|
-
- `__DEV__`: `true` when `process.env.NODE_ENV !== 'production'`, otherwise
|
|
443
|
-
`false`.
|
|
444
|
-
- `__TEST__`: always `false` in package builds.
|
|
445
|
-
- `__VERSION__`: current package version.
|
|
446
|
-
|
|
447
|
-
Vitest uses test-friendly values with the same names: `__DEV__` is `true`,
|
|
448
|
-
`__TEST__` is `true`, and `__VERSION__` is `'unknown'`.
|
|
449
|
-
|
|
450
|
-
## Programmatic API
|
|
451
|
-
|
|
452
|
-
The root package entry exposes the Vite plugin, configuration helpers, and a
|
|
453
|
-
small set of build helpers used by projects that need to compose auklet
|
|
454
|
-
programmatically. Publish and owner workflows remain CLI/internal implementation
|
|
455
|
-
details.
|
|
456
|
-
|
|
457
|
-
Public exports include:
|
|
458
|
-
|
|
459
|
-
- `aukletStylePlugin`
|
|
460
|
-
- `loadAukletConfig`
|
|
461
|
-
- `runTsdown`
|
|
462
|
-
- `defineKernelPackageConfigFromFile`
|
|
463
|
-
- `defineKernelPackageConfigFromOptions`
|
|
464
|
-
- `runAukletCli`
|
|
465
|
-
- `AukletStylePluginOptions`
|
|
466
|
-
- `AukletConfig`
|
|
467
|
-
- `PackageBuildOptions`
|
|
468
|
-
- `StyleOptions`
|
|
469
|
-
- related user-facing TypeScript types
|
|
470
|
-
|
|
471
|
-
## Development
|
|
472
|
-
|
|
473
|
-
```bash
|
|
474
|
-
pnpm i
|
|
475
|
-
pnpm test
|
|
476
|
-
pnpm typecheck
|
|
477
|
-
pnpm build
|
|
478
|
-
pnpm run format
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
Notes:
|
|
482
|
-
|
|
483
|
-
- `pnpm build` rewrites `dist`.
|
|
484
|
-
- `pnpm run format` formats `bin`, `src`, `dist`, `examples`, and related files.
|
|
485
|
-
- Read `docs/testing.md` before changing tests.
|
package/dist/cli/build.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function runBuildJs(
|
|
3
|
-
|
|
4
|
-
}): Promise<number>;
|
|
5
|
-
export declare function runBuild(args: Array<string>): Promise<number>;
|
|
1
|
+
import type { BuildCommandOptions, BuildJsCommandOptions } from '#auklet/cli/parse/build';
|
|
2
|
+
export declare function runBuildJs(options: BuildJsCommandOptions): Promise<number>;
|
|
3
|
+
export declare function runBuild(options: BuildCommandOptions): Promise<number>;
|