Skip to content

Commit

Permalink
RC version (#311)
Browse files Browse the repository at this point in the history
* feat: ๐ŸŽธ change brand to @ice/pkg (#310)
* feat/bundled-output (#317)
* feat: ๐ŸŽธ transform mode works
* feat: ๐ŸŽธ supporting bundling files
* fix: ๐Ÿ› resolve files with .js suffix
* fix: ๐Ÿ› resolve esm path
* fix: ๐Ÿ› fixe excludes (#319)
* fix: ๐Ÿ› docusaurus builds error when no static dir exis (#321)
  • Loading branch information
maoxiaoke authored Apr 15, 2022
1 parent 16cd7c4 commit 428969a
Show file tree
Hide file tree
Showing 54 changed files with 1,655 additions and 1,449 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ node_modules
__tests__
examples/**/esm
examples/**/es
examples/**/esnext
examples/**/es2017
examples/**/cjs
examples/**/lib
examples/**/dist
examples/**/build
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hi! Iโ€™m really excited that you are interested in contributing to ICE. Before

## ๅŽ†ๅฒๅˆ†ๆ”ฏ

### [stable/0.x](https://github.com/ice-lab/pkg-cli/tree/stable/0.x/)
### [stable/0.x](https://github.com/ice-lab/icepkg/tree/stable/0.x/)

- [email protected] ๅŽ†ๅฒ็‰ˆๆœฌ๏ผŒไปฅๅŠ็›ธๅ…ณๅŒ…๏ผˆๅทฒๅ‘ๅธƒๆ–ฐๆ–นๆกˆ๏ผ‰
- [email protected] ๅŽ†ๅฒ็‰ˆๆœฌ๏ผˆๅทฒๅ‘ๅธƒ 3.x๏ผ‰
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ packages/*/es/
**/pnpm-global
examples/**/esm
examples/**/es
examples/**/esnext
examples/**/es2017
examples/**/cjs
examples/**/lib
examples/**/dist
examples/**/.vscode
Expand Down
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @ice/pkg-cli
# @ice/pkg

NPM ๅŒ…็š„ๅผ€ๅ‘่งฃๅ†ณๆ–นๆกˆใ€‚

Expand All @@ -15,26 +15,26 @@ NPM ๅŒ…็š„ๅผ€ๅ‘่งฃๅ†ณๆ–นๆกˆใ€‚
ๅœจ้กน็›ฎไธ‹ๅฎ‰่ฃ…๏ผš

```shell
$ npm i -D @ice/pkg-cli
$ npm i -D @ice/pkg

# ๆˆ–้€š่ฟ‡ pnpm ๅฎ‰่ฃ…
$ pnpm i -D @ice/pkg-cli
$ pnpm i -D @ice/pkg
```

## ไฝฟ็”จ

```shell
# ๆž„ๅปบ
$ pkg-cli build
$ ice-pkg build

# ๅฎžๆ—ถ็ผ–่ฏ‘ es&lib ไบง็‰ฉ
$ pkg-cli start
$ ice-pkg start

# ๅฎžๆ—ถ็ผ–่ฏ‘ dist ไบง็‰ฉ
$ pkg-cli start --dist
$ ice-pkg start --dist

# ็ป„ไปถ้ข„่งˆ
$ pkg-cli start --doc
$ ice-pkg start --doc
```

### ็ผ–ๅ†™ไปฃ็ ้™ๅˆถ
Expand All @@ -52,7 +52,7 @@ import { mulitply } from './directory'; // ๅผ•็”จ็›ธๅฏน่ทฏๅพ„ไธ‹็š„้ป˜่ฎค็š„ ind
...
```

ๅœจ esm ่ง„่Œƒไธ‹๏ผŒไปฅไธŠ็š„ๅ†™ๆณ•ๅฑžไบŽ**ไธ่ง„่Œƒๅ†™ๆณ•**๏ผŒๅ› ๆญค `@ice/pkg-cli` ไบฆไธๆ”ฏๆŒไธŠ่ฟฐๅ†™ๆณ•ใ€‚ๆญฃ็กฎ็š„ๅ†™ๆณ•ๅฆ‚ไธ‹๏ผš
ๅœจ esm ่ง„่Œƒไธ‹๏ผŒไปฅไธŠ็š„ๅ†™ๆณ•ๅฑžไบŽ**ไธ่ง„่Œƒๅ†™ๆณ•**๏ผŒๅ› ๆญค `@ice/pkg` ไบฆไธๆ”ฏๆŒไธŠ่ฟฐๅ†™ๆณ•ใ€‚ๆญฃ็กฎ็š„ๅ†™ๆณ•ๅฆ‚ไธ‹๏ผš

```ts
import { add } from './filename.js'; // ๅผ•็”จ็›ธๅฏน่ทฏๅพ„็š„ๆ–‡ไปถ
Expand All @@ -72,7 +72,7 @@ import { mulitply } from './directory/index.js'; // ๅผ•็”จ็›ธๅฏน่ทฏๅพ„ไธ‹็š„้ป˜

### Package Exports

็›ฎๅ‰๏ผŒPackage ๅฏผๅ‡บไพ่ต– `main`ใ€`module` ๅ’Œ `exports` ็ญ‰ๅฏผๅ‡บ้…็ฝฎใ€‚`@ice/pkg-cli` ้ป˜่ฎค็š„ๅฏผๅ‡บ้…็ฝฎไธบ๏ผš
็›ฎๅ‰๏ผŒPackage ๅฏผๅ‡บไพ่ต– `main`ใ€`module` ๅ’Œ `exports` ็ญ‰ๅฏผๅ‡บ้…็ฝฎใ€‚`@ice/pkg` ้ป˜่ฎค็š„ๅฏผๅ‡บ้…็ฝฎไธบ๏ผš

```json
{
Expand Down Expand Up @@ -122,7 +122,7 @@ module.exports = {

#### ็ผ–่ฏ‘ CommonJs ็š„ Packge Exports

่‹ฅๅผ€ๅฏ [lib](#lib) ้…็ฝฎ๏ผŒๅˆ™ `@ice/pkg-cli` ไผš็ผ–่ฏ‘ๅ‡บ CommonJs ไบง็‰ฉใ€‚ๆญคๆ—ถ๏ผŒๆŽจ่็š„ Package Exports ้…็ฝฎๅฆ‚ไธ‹๏ผš
่‹ฅๅผ€ๅฏ [lib](#lib) ้…็ฝฎ๏ผŒๅˆ™ `@ice/pkg` ไผš็ผ–่ฏ‘ๅ‡บ CommonJs ไบง็‰ฉใ€‚ๆญคๆ—ถ๏ผŒๆŽจ่็š„ Package Exports ้…็ฝฎๅฆ‚ไธ‹๏ผš

```diff
{
Expand All @@ -143,7 +143,7 @@ module.exports = {
### ้…็ฝฎ

`@ice/pkg-cli` ๆ”ฏๆŒ็š„้…็ฝฎๆ–‡ไปถๆœ‰๏ผš
`@ice/pkg` ๆ”ฏๆŒ็š„้…็ฝฎๆ–‡ไปถๆœ‰๏ผš

+ `build.json`
+ `build.config.js`
Expand All @@ -155,7 +155,7 @@ module.exports = {

```ts
// build.config.ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
minify: true,
Expand All @@ -174,7 +174,7 @@ export default defineConfig({
ๆฏ”ๅฆ‚๏ผŒๅฐ† `@` ๆŒ‡ๅ‘ `./src/` ็›ฎๅฝ•ใ€‚

```ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
alias: {
Expand All @@ -188,7 +188,7 @@ export default defineConfig({
+ ็ฑปๅž‹ `boolean`
+ ้ป˜่ฎค `false`

่ฎพ็ฝฎไธบ `false` ๅฏไปฅ็ฆ็”จไปฃ็ ๆททๆท†่ƒฝๅŠ›ใ€‚`@ice/pkg-cli` ไฝฟ็”จ [swc](https://github.com/swc-project/swc) ่ฟ›่กŒๆททๆท†ใ€‚
่ฎพ็ฝฎไธบ `false` ๅฏไปฅ็ฆ็”จไปฃ็ ๆททๆท†่ƒฝๅŠ›ใ€‚`@ice/pkg` ไฝฟ็”จ [swc](https://github.com/swc-project/swc) ่ฟ›่กŒๆททๆท†ใ€‚

#### define

Expand All @@ -198,7 +198,7 @@ export default defineConfig({
้…็ฝฎๅ…จๅฑ€ๅ˜้‡๏ผŒๅœจๆž„ๅปบๆ—ถไผš่ขซ้™ๆ€ๆ›ฟๆขใ€‚

```ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
define: {
Expand All @@ -215,7 +215,7 @@ export default defineConfig({
ๅฏไปฅไฝฟ็”จ [babelPlugin](https://babeljs.io/docs/en/plugins/) ๆฅ้ข„ๅค„็†ไธ€ไบ›ไปฃ็ ็‰‡ๆฎตใ€‚่ขซ babelPlugin ๅค„็†่ฟ‡็š„ไปฃ็ ๏ผŒๆŽฅไธ‹ๆฅไปไผšไบค็ป™ swc ๅš่ฟ›ไธ€ๆญฅ็š„ๅค„็†ใ€‚

```js
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
plugins: [["transform-remove-console", { "exclude": ["error", "warn"] }]]
Expand All @@ -227,7 +227,7 @@ export default defineConfig({
+ ็ฑปๅž‹ `boolean`
+ ้ป˜่ฎค `false`

ไธบ JavaScript ไปฃ็ ็”Ÿๆˆ็ฑปๅž‹ๆ–‡ไปถใ€‚`@ice/pkg-cli` ้ป˜่ฎคไธบๆ–‡ไปถๅŽ็ผ€ไธบ `.ts` ็”Ÿๆˆ็ฑปๅž‹ๆ–‡ไปถใ€‚
ไธบ JavaScript ไปฃ็ ็”Ÿๆˆ็ฑปๅž‹ๆ–‡ไปถใ€‚`@ice/pkg` ้ป˜่ฎคไธบๆ–‡ไปถๅŽ็ผ€ไธบ `.ts` ็”Ÿๆˆ็ฑปๅž‹ๆ–‡ไปถใ€‚

ๅฆ‚ๆžœไฝฟ็”จ [jsdoc](https://jsdoc.app/) ไธบ JavaScript ็”Ÿๆˆไบ†็ฑปๅž‹ๆณจ่งฃ๏ผŒ่ฏฅ้…็ฝฎไผš้žๅธธๆœ‰ๆ•ˆใ€‚

Expand Down Expand Up @@ -255,7 +255,7 @@ export function add(a: number, b: number): number;
+ ็ฑปๅž‹ `boolean`
+ ้ป˜่ฎค `false`

`@ice/pkg-cli` ้ป˜่ฎค็”Ÿๆˆ `esm` ๆจกๅ—่ง„่Œƒ็š„ไปฃ็ ใ€‚`esm` ๆจกๅ—ๅทฒๅนฟๆณ›ๅบ”็”จไบŽ Node๏ผˆ^12.20.0 || ^14.13.1 || >=16.0.0๏ผ‰ๅ’Œ Browser ็ซฏ๏ผˆwebpack 4 & webpack 5 & vite & rollup๏ผ‰ใ€‚
`@ice/pkg` ้ป˜่ฎค็”Ÿๆˆ `esm` ๆจกๅ—่ง„่Œƒ็š„ไปฃ็ ใ€‚`esm` ๆจกๅ—ๅทฒๅนฟๆณ›ๅบ”็”จไบŽ Node๏ผˆ^12.20.0 || ^14.13.1 || >=16.0.0๏ผ‰ๅ’Œ Browser ็ซฏ๏ผˆwebpack 4 & webpack 5 & vite & rollup๏ผ‰ใ€‚

่‹ฅ้œ€่ฆ็”Ÿๆˆ `commonjs` ่ง„่Œƒ็š„ไบง็‰ฉ๏ผŒๅฏไปฅ้…็ฝฎ่ฏฅ้€‰้กน๏ผŒๅˆ™ไผš็”Ÿๆˆ `lib` ๆ–‡ไปถ็›ฎๅฝ•๏ผŒๅญ˜ๆ”พ `commonjs` ไบง็‰ฉใ€‚

Expand All @@ -273,14 +273,14 @@ export function add(a: number, b: number): number;
+ ็ฑปๅž‹ `array`
+ ้ป˜่ฎค `[]`

`@ice/pkg-cli` ๅŸบไบŽ [build-scripts](https://github.com/ice-lab/build-scripts) ๆ’ไปถ็ณป็ปŸใ€‚ๆ›ดๅคšๅ†…ๅฎน่ฏทๅ‚่€ƒ [ๆ’ไปถๅผ€ๅ‘](#ๆ’ไปถๅผ€ๅ‘)ใ€‚
`@ice/pkg` ๅŸบไบŽ [build-scripts](https://github.com/ice-lab/build-scripts) ๆ’ไปถ็ณป็ปŸใ€‚ๆ›ดๅคšๅ†…ๅฎน่ฏทๅ‚่€ƒ [ๆ’ไปถๅผ€ๅ‘](#ๆ’ไปถๅผ€ๅ‘)ใ€‚

#### umd

+ ็ฑปๅž‹ `object`
+ ้ป˜่ฎค `{}`

`@ice/pkg-cli` ๆไพ›่ฟ‡ๆธกๆ€ง็š„ [umd](https://github.com/umdjs/umd) bundle ไบง็‰ฉใ€‚้…็ฝฎๅผ€ๅฏ๏ผŒๅˆ™็”Ÿๆˆ `dist` ๆ–‡ไปถ็›ฎๅฝ•๏ผŒๅญ˜ๆ”พ bundle ไบง็‰ฉใ€‚
`@ice/pkg` ๆไพ›่ฟ‡ๆธกๆ€ง็š„ [umd](https://github.com/umdjs/umd) bundle ไบง็‰ฉใ€‚้…็ฝฎๅผ€ๅฏ๏ผŒๅˆ™็”Ÿๆˆ `dist` ๆ–‡ไปถ็›ฎๅฝ•๏ผŒๅญ˜ๆ”พ bundle ไบง็‰ฉใ€‚

`umd` ้…็ฝฎๆœ‰ไปฅไธ‹ๅ‚ๆ•ฐ๏ผš

Expand Down Expand Up @@ -310,7 +310,7 @@ library ๅฏผๅ‡บ็š„ๅ็งฐ๏ผŒๅฏไปฅ้€š่ฟ‡ `window[name]` ่ฎฟ้—ฎใ€‚้ป˜่ฎคไธบ `packag
+ ็ฑปๅž‹ `boolean | object`
+ ้ป˜่ฎค `true`

ๆททๆท†ไปฃ็ ใ€‚ไนŸๅฏไปฅ้…็ฝฎๅ…ทไฝ“็š„ [ๆททๆท†็ญ–็•ฅ](https://swc.rs/docs/configuration/minification)ใ€‚`@ali/pkg-cli` ไฝฟ็”จ swc ่ฟ›่กŒไปฃ็ ๆททๆท†ใ€‚
ๆททๆท†ไปฃ็ ใ€‚ไนŸๅฏไปฅ้…็ฝฎๅ…ทไฝ“็š„ [ๆททๆท†็ญ–็•ฅ](https://swc.rs/docs/configuration/minification)ใ€‚`@ice/pkg` ไฝฟ็”จ swc ่ฟ›่กŒไปฃ็ ๆททๆท†ใ€‚

##### env

Expand All @@ -324,7 +324,7 @@ library ๅฏผๅ‡บ็š„ๅ็งฐ๏ผŒๅฏไปฅ้€š่ฟ‡ `window[name]` ่ฎฟ้—ฎใ€‚้ป˜่ฎคไธบ `packag
่‹ฅ้…็ฝฎไธบ๏ผš

```ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
umd: {
Expand All @@ -339,16 +339,16 @@ export default defineConfig({
})
```

`@ice/pkg-cli` ไผšๆ นๆฎๅฏนๅบ”็š„ browserlist ่ฟ›่กŒๅฏนๅบ”็š„่ฏญๆณ•่ฝฌๆข๏ผŒไปฅๅŠๆทปๅŠ ๅฏนๅบ”็š„ polyfillsใ€‚
`@ice/pkg` ไผšๆ นๆฎๅฏนๅบ”็š„ browserlist ่ฟ›่กŒๅฏนๅบ”็š„่ฏญๆณ•่ฝฌๆข๏ผŒไปฅๅŠๆทปๅŠ ๅฏนๅบ”็š„ polyfillsใ€‚

### ๆ’ไปถๅผ€ๅ‘

`@ice/pkg-cli` ๅŸบไบŽ [build-scripts](https://github.com/ice-lab/build-scripts) ๆ’ไปถ็ณป็ปŸใ€‚้€š่ฟ‡ build-scripts ๆ’ไปถ๏ผŒๅฏไปฅๆžๅคงๅœฐๆ‰ฉๅฑ• `@ice/pkg-cli` ็š„่ƒฝๅŠ›ใ€‚
`@ice/pkg` ๅŸบไบŽ [build-scripts](https://github.com/ice-lab/build-scripts) ๆ’ไปถ็ณป็ปŸใ€‚้€š่ฟ‡ build-scripts ๆ’ไปถ๏ผŒๅฏไปฅๆžๅคงๅœฐๆ‰ฉๅฑ• `@ice/pkg` ็š„่ƒฝๅŠ›ใ€‚

ๆ’ไปถ็š„ไฝฟ็”จๅฆ‚ไธ‹๏ผš

```ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
plugins: [
Expand All @@ -359,7 +359,7 @@ export default defineConfig({

#### ไฟฎๆ”น้ป˜่ฎค้…็ฝฎ

ๅฏไปฅ้€š่ฟ‡ `onGetConfig` API๏ผŒๅฏไปฅไฟฎๆ”น Package ็ผ–่ฏ‘็š„ๅ…ฅๅฃใ€ๅ‡บๅฃ็ญ‰ `@ice/pkg-cli` ็ญ‰้ป˜่ฎค้…็ฝฎ๏ผš
ๅฏไปฅ้€š่ฟ‡ `onGetConfig` API๏ผŒๅฏไปฅไฟฎๆ”น Package ็ผ–่ฏ‘็š„ๅ…ฅๅฃใ€ๅ‡บๅฃ็ญ‰ `@ice/pkg` ็ญ‰้ป˜่ฎค้…็ฝฎ๏ผš

```ts
const plugin = (api) => {
Expand All @@ -375,7 +375,7 @@ const plugin = (api) => {
}
```

`@ice/pkg-cli` ๆณจๅ†Œไธ‰ไธช build-script ไปปๅŠก๏ผš
`@ice/pkg` ๆณจๅ†Œไธ‰ไธช build-script ไปปๅŠก๏ผš

+ `component-es` - ไธปไปปๅŠก๏ผŒ้ป˜่ฎคๅฏๅŠจ
+ `component-esnext` - ไธปไปปๅŠก๏ผŒ้ป˜่ฎคๅฏๅŠจ
Expand Down Expand Up @@ -458,7 +458,7 @@ swc ็ผ–่ฏ‘้€‰้กนใ€‚ๅ…ทไฝ“ๅฏๅ‚่€ƒ [swc ้…็ฝฎ](https://swc.rs/docs/configuratio

#### ๆ’ไปถ็”Ÿๅ‘ฝๅ‘จๆœŸ้’ฉๅญ

`@ice/pkg-cli` ๆ’ไปถๆไพ›ไธ€ไธ‹็”Ÿๅ‘ฝๅ‘จๆœŸ้’ฉๅญ๏ผš
`@ice/pkg` ๆ’ไปถๆไพ›ไธ€ไธ‹็”Ÿๅ‘ฝๅ‘จๆœŸ้’ฉๅญ๏ผš

+ build ๅ‘ฝไปค๏ผš

Expand All @@ -482,17 +482,17 @@ swc ็ผ–่ฏ‘้€‰้กนใ€‚ๅ…ทไฝ“ๅฏๅ‚่€ƒ [swc ้…็ฝฎ](https://swc.rs/docs/configuratio

### ็ป„ไปถ้ข„่งˆ

`@ice/pkg-cli` ไพ่ต– [@ice/pkg-plugin-docusaurus](https://github.com/ice-lab/component-next/tree/main/packages/plugin-docusaurus) ๆ’ไปถๆ”ฏๆŒ็ผ–ๅ†™ๆ–‡ๆกฃๅ’Œ้ข„่งˆ็ป„ไปถ๏ผŒๆ‰€ๆœ‰ๆ–‡ๆกฃ้ป˜่ฎคๅญ˜ๆ”พ่‡ณ `docs` ๆ–‡ไปถๅคนไธ‹ใ€‚ๆ”ฏๆŒไปฅ `.md` ๅŠ `.mdx` ไธบๅŽ็ผ€็š„ๆ–‡ๆกฃใ€‚็”จๆณ•๏ผš
`@ice/pkg` ไพ่ต– [@ice/pkg-plugin-docusaurus](https://github.com/ice-lab/component-next/tree/main/packages/plugin-docusaurus) ๆ’ไปถๆ”ฏๆŒ็ผ–ๅ†™ๆ–‡ๆกฃๅ’Œ้ข„่งˆ็ป„ไปถ๏ผŒๆ‰€ๆœ‰ๆ–‡ๆกฃ้ป˜่ฎคๅญ˜ๆ”พ่‡ณ `docs` ๆ–‡ไปถๅคนไธ‹ใ€‚ๆ”ฏๆŒไปฅ `.md` ๅŠ `.mdx` ไธบๅŽ็ผ€็š„ๆ–‡ๆกฃใ€‚็”จๆณ•๏ผš

```shell
# ่‹ฅๅญ˜ๅœจ docs ๆ–‡ไปถๅคน๏ผŒๅˆ™้ป˜่ฎคๅฏๅŠจๆ–‡ๆกฃ้ข„่งˆ๏ผ›ๅนถๅฏๅŠจ es/lib ็ผ–่ฏ‘
$ pkg-cli start
$ ice-pkg start

# ไธๅฏๅŠจๆ–‡ๆกฃ้ข„่งˆ
$ pkg-cli start --doc=false
$ ice-pkg start --doc=false

# ่‹ฅๅญ˜ๅœจ docs ๆ–‡ไปถๅคน๏ผŒๅˆ™้ป˜่ฎคๆž„ๅปบ้ข„่งˆไบง็‰ฉ
$ pkg-cli build
$ ice-pkg build
```

#### ๅฆ‚ไฝ•ไนฆๅ†™ๆ–‡ๆกฃ
Expand Down Expand Up @@ -684,7 +684,7 @@ export interface PluginDocusaurusOptions {
ไฝฟ็”จๆ–นๅผๅฆ‚ไธ‹๏ผš

```ts
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion examples/package/README.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# package-basic

## ่ฟ™ๆ˜ฏไธ€ไธช `@ice/pkg-cli` ็š„ demo
## ่ฟ™ๆ˜ฏไธ€ไธช `@ice/pkg` ็š„ demo
16 changes: 11 additions & 5 deletions examples/package/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { defineConfig } from '@ice/pkg-cli';
import { defineConfig } from '@ice/pkg';

export default defineConfig({
minify: false,
babelPlugins: ['transform-remove-console'],
plugins: [
'@ice/pkg-plugin-docusaurus',
// '@ice/pkg-plugin-docusaurus',
// './plugin.js',
],
sourceMaps: true,
sourceMaps: 'inline',
define: {
__buildVersion: '0.1.2',
__buildNumber: 15,
__buildObject: {
a: '2',
},
},
transform: {
excludes: '**/test/*',
},
bundle: {
development: true,
formats: ['esm', 'es2017'],
externals: true,
},
});
1 change: 1 addition & 0 deletions examples/package/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const __DEV__: boolean;
8 changes: 4 additions & 4 deletions examples/package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"default": "./es/index.js"
},
"scripts": {
"build": "CONSOLA_LEVEL=4 pkg-cli build",
"start": "CONSOLA_LEVEL=4 pkg-cli start",
"help": "pkg-cli --help",
"build": "CONSOLA_LEVEL=4 ice-pkg build",
"start": "CONSOLA_LEVEL=4 ice-pkg start",
"help": "ice-pkg --help",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@ice/pkg-cli": "workspace: *",
"@ice/pkg": "workspace: *",
"@ice/pkg-plugin-docusaurus": "workspace: *",
"babel-plugin-transform-remove-console": "^6.9.4",
"consola": "^2.15.3"
Expand Down
26 changes: 16 additions & 10 deletions examples/package/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useEffect, useState } from 'react';

import { multiply } from './test.js';

// import './index.css';
// import './index.scss';

import { multiply } from './test.js';
// import { multiply } from './test.js';

// eslint-disable-next-line no-undef
console.log('ๆต‹่ฏ•ไธ€ไธ‹', 'china');
// console.log('ๆต‹่ฏ•ไธ€ไธ‹', 'china');

// ่ฟ™ไธชๅŠŸ่ƒฝ้œ€่ฆ core.js ไธบ 3.7 ไปฅๅŽๆ‰ไผš็”Ÿๆ•ˆ
// const a = 'abbbccccddd'.replaceAll('b', 'f');
Expand All @@ -15,25 +17,29 @@ console.log('ๆต‹่ฏ•ไธ€ไธ‹', 'china');


// ๆต‹่ฏ•ไธ€ไธ‹ define
const add = (a) => a + __buildNumber;
// const add = (a) => a + __buildNumber;
// console.log('add', add);

export { multiply };
// export { multiply };

// polyfills ็ฎ€ๅ•้ชŒ่ฏ
const concatArr = [1, 2, 3].concat(8);
// const concatArr = [1, 2, 3].concat(8);

// async function testPromise() {
// await Promise.resolve(true);
// }

async function testPromise() {
await Promise.resolve(true);
}
// if (__DEV__) {
// console.log('isDevelopment--');
// }

console.log('testPromise', testPromise);
// console.log('testPromise', testPromise);

const App = () => {
const [count, setCount] = useState(0);

useEffect(() => {
console.log('component-update');
console.log('component-update', [1, 2, 3].concat(8), multiply(1)(2));
// throw new Error('fsfds');
}, []);

Expand Down
Loading

0 comments on commit 428969a

Please sign in to comment.