auklet 0.0.7 → 0.0.8
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 +2 -3
- package/bin/entry.cjs +17 -10
- package/dist/build/cleanOutput.d.ts +9 -0
- package/dist/build/cleanOutput.js +15 -0
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -21,7 +21,6 @@ Build utilities for TypeScript packages and module CSS output.
|
|
|
21
21
|
## Requirements
|
|
22
22
|
|
|
23
23
|
- Node.js `>=22`
|
|
24
|
-
- pnpm `10.27.0`
|
|
25
24
|
|
|
26
25
|
## CLI
|
|
27
26
|
|
|
@@ -38,7 +37,7 @@ pnpm auk dev
|
|
|
38
37
|
|
|
39
38
|
Commands:
|
|
40
39
|
|
|
41
|
-
- `build` removes `
|
|
40
|
+
- `build` removes the configured `output` directory, builds JavaScript output, then builds CSS output.
|
|
42
41
|
- `build-js` runs tsdown with the default auklet tsdown config unless a config flag is passed.
|
|
43
42
|
- `build-css` generates module CSS output.
|
|
44
43
|
- `build-css --watch` watches source/config files and rebuilds CSS.
|
|
@@ -85,7 +84,7 @@ export const config: AukletConfig = {
|
|
|
85
84
|
### Style Options
|
|
86
85
|
|
|
87
86
|
- `source`: source directory relative to the package root. Defaults to `src`.
|
|
88
|
-
- `output`: build output directory relative to the package root. Defaults to `dist`.
|
|
87
|
+
- `output`: build output directory relative to the package root. Defaults to `dist`. `auk build` removes this directory before writing JavaScript and CSS output.
|
|
89
88
|
- `styles.themes`: package theme style entries. Defaults to `{}`.
|
|
90
89
|
- `styles.dependencies`: external package style dependencies. Defaults to `{}`.
|
|
91
90
|
|
package/bin/entry.cjs
CHANGED
|
@@ -16,12 +16,18 @@ const runVersion = async () => {
|
|
|
16
16
|
return 0;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
const shouldWatch = args.includes('--watch') || args.includes('-w');
|
|
19
|
+
const loadCurrentAukletConfig = async (options) => {
|
|
21
20
|
const { loadAukletConfig } = await import('../dist/configLoader.js');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return loadAukletConfig(process.cwd(), options);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const runBuildStyle = async (args, options = {}) => {
|
|
25
|
+
const shouldWatch = args.includes('--watch') || args.includes('-w');
|
|
26
|
+
const aukletConfig =
|
|
27
|
+
options.aukletConfig ??
|
|
28
|
+
(await loadCurrentAukletConfig({
|
|
29
|
+
cacheBust: shouldWatch,
|
|
30
|
+
}));
|
|
25
31
|
|
|
26
32
|
if (shouldWatch) {
|
|
27
33
|
const { ModuleStyleWatcher } = await import('../dist/css/watch/watcher.js');
|
|
@@ -53,15 +59,16 @@ const runBuildJs = async (args) => {
|
|
|
53
59
|
};
|
|
54
60
|
|
|
55
61
|
const runBuild = async (args) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
const aukletConfig = await loadCurrentAukletConfig();
|
|
63
|
+
const { cleanAukletOutputByConfig } = await import(
|
|
64
|
+
'../dist/build/cleanOutput.js'
|
|
65
|
+
);
|
|
66
|
+
cleanAukletOutputByConfig(process.cwd(), aukletConfig);
|
|
60
67
|
|
|
61
68
|
const jsExitCode = await runBuildJs(args);
|
|
62
69
|
if (jsExitCode) return jsExitCode;
|
|
63
70
|
|
|
64
|
-
return runBuildStyle([]);
|
|
71
|
+
return runBuildStyle([], { aukletConfig });
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
const runDev = async () => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AukletConfig, LoadAukletConfigOptions } from '#auklet/types';
|
|
2
|
+
export declare function cleanAukletOutputByConfig(
|
|
3
|
+
packageRoot: string,
|
|
4
|
+
config?: AukletConfig,
|
|
5
|
+
): void;
|
|
6
|
+
export declare function cleanAukletOutput(
|
|
7
|
+
packageRoot: string,
|
|
8
|
+
options?: LoadAukletConfigOptions,
|
|
9
|
+
): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { normalizeAukletConfig } from '#auklet/config';
|
|
4
|
+
import { loadAukletConfig } from '#auklet/configLoader';
|
|
5
|
+
export function cleanAukletOutputByConfig(packageRoot, config = {}) {
|
|
6
|
+
const normalizedConfig = normalizeAukletConfig(config);
|
|
7
|
+
fs.rmSync(path.join(packageRoot, normalizedConfig.output), {
|
|
8
|
+
recursive: true,
|
|
9
|
+
force: true,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export async function cleanAukletOutput(packageRoot, options = {}) {
|
|
13
|
+
const rawConfig = await loadAukletConfig(packageRoot, options);
|
|
14
|
+
cleanAukletOutputByConfig(packageRoot, rawConfig);
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auklet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "chentao.arthur",
|
|
6
6
|
"packageManager": "pnpm@10.27.0",
|
|
@@ -53,6 +53,15 @@
|
|
|
53
53
|
"dist",
|
|
54
54
|
"!dist/__tests__"
|
|
55
55
|
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"build",
|
|
58
|
+
"typescript",
|
|
59
|
+
"css",
|
|
60
|
+
"vite",
|
|
61
|
+
"components",
|
|
62
|
+
"monorepo",
|
|
63
|
+
"tsdown"
|
|
64
|
+
],
|
|
56
65
|
"dependencies": {
|
|
57
66
|
"unrun": "^0.3.0",
|
|
58
67
|
"execa": "^9.1.0",
|