Skip to content

Commit 9c9b4b0

Browse files
committed
doc
1 parent b97aa64 commit 9c9b4b0

File tree

23 files changed

+89
-147
lines changed

23 files changed

+89
-147
lines changed

params.md

Lines changed: 0 additions & 109 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/cli/build/build.test.ts

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,20 @@ describe('build command', async () => {
155155

156156
test('build options', async () => {
157157
const fixturePath = path.join(__dirname, 'options');
158-
await fse.remove(path.join(fixturePath, 'fooDist'));
158+
await fse.remove(path.join(fixturePath, 'dist/ok'));
159159

160160
const stdout = runCliSync(
161-
'build ' + '--entry="./src/*" ' + '--dist-path=dist/ok ' + '--no-bundle ',
162-
// '--format=esm ' +
163-
// '--syntax=es2015 ' +
164-
// '--target=web ' +
165-
// '--dts=true ' +
166-
// '--external=./bar ' +
167-
// '--minify=false ' +
168-
// '--auto-extension=false' +
161+
'build ' +
162+
'--entry="./src/*" ' +
163+
'--dist-path=dist/ok ' +
164+
'--no-bundle ' +
165+
'--format=esm ' +
166+
`--syntax='["node 14", "Chrome 103"]' ` +
167+
'--target=web ' +
168+
'--dts=true ' +
169+
'--externals=./bar ' +
170+
'--minify=false ' +
171+
'--auto-extension=false',
169172
{
170173
cwd: fixturePath,
171174
env: {
@@ -176,15 +179,22 @@ describe('build command', async () => {
176179
);
177180

178181
const rslibConfigText = stripAnsi(extractRslibConfig(stdout));
179-
console.log('👩‍❤️‍💋‍👩', stdout);
180182
expect(rslibConfigText).toMatchInlineSnapshot(`
181183
"{
182184
lib: [
183185
{
184-
format: 'cjs',
185-
output: { distPath: { root: 'dist/ok' } },
186186
bundle: false,
187-
source: { entry: { index: './src/*' } }
187+
source: { entry: { index: './src/*' } },
188+
format: 'esm',
189+
output: {
190+
distPath: { root: 'dist/ok' },
191+
target: 'web',
192+
minify: false,
193+
externals: [ './bar' ]
194+
},
195+
syntax: [ 'node 14', 'Chrome 103' ],
196+
dts: true,
197+
autoExtension: 'false'
188198
}
189199
],
190200
_privateMeta: {
@@ -194,10 +204,15 @@ describe('build command', async () => {
194204
}"
195205
`);
196206

197-
// const files = await globContentJSON(path.join(fixturePath, 'fooDist'));
198-
// const fileNames = Object.keys(files).sort();
199-
// expect(fileNames).toMatchInlineSnapshot(`[]`);
200-
// const output = files[fileNames[0]!];
201-
// expect(output).toMatch(/export { .* }/);
207+
const files = await globContentJSON(path.join(fixturePath, 'dist/ok'));
208+
const fileNames = Object.keys(files).sort();
209+
expect(fileNames).toMatchInlineSnapshot(`
210+
[
211+
"<ROOT>/tests/integration/cli/build/options/dist/ok/foo.d.ts",
212+
"<ROOT>/tests/integration/cli/build/options/dist/ok/foo.js",
213+
]
214+
`);
215+
const output = files[fileNames[1]!];
216+
expect(output).toMatch(/export { .* }/);
202217
});
203218
});

tests/integration/cli/build/fooDist/index.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/integration/cli/build/options/rslib.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { defineConfig } from '@rslib/core';
33
export default defineConfig({
44
lib: [
55
{
6+
bundle: false,
7+
source: {
8+
entry: {
9+
index: './src/*',
10+
},
11+
},
612
format: 'cjs',
713
output: {
814
distPath: {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "@rslib/tsconfig/base",
3+
"compilerOptions": {
4+
"baseUrl": "./"
5+
},
6+
"include": ["src"]
7+
}

tests/scripts/shared.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export const rslibBinPath = join(
2929

3030
export function runCliSync(command: string, options?: ExecSyncOptions) {
3131
try {
32-
console.log('🤯', command);
3332
const stdout = execSync(`node ${rslibBinPath} ${command}`, options);
3433
return stdout.toString();
3534
} catch (error) {

website/docs/en/config/lib/auto-extension.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- **Type:** `boolean`
44
- **Default:** `true`
5+
- **CLI:** `--auto-extension` / `--no-auto-extension`
56

67
Whether to automatically set the file extension based on the [`format`](/config/lib/format) option in the JavaScript output files.
78

website/docs/en/config/lib/auto-external.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type AutoExternal =
2626
- **Default:**
2727
- `true` when [format](/config/lib/format) is `cjs` or `esm`
2828
- `false` when [format](/config/lib/format) is `umd` or `mf`
29+
- **CLI:** `--auto-external` / `--no-auto-external`
2930

3031
Whether to automatically externalize dependencies of different dependency types and do not bundle them.
3132

website/docs/en/config/lib/bundle.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- **Type:** `boolean`
44
- **Default:** `true`
5+
- **CLI:** `--bundle` / `--no-bundle`
56

67
Specify whether to bundle the library, which is known as bundle mode when `bundle` is set to `true`, and bundleless mode when set to `false`.
78

0 commit comments

Comments
 (0)