Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
京东前端
nutui-react
提交
37a90002
N
nutui-react
项目概览
京东前端
/
nutui-react
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nutui-react
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37a90002
编写于
10月 15, 2021
作者:
W
wangbei16
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: add build config
上级
6c9e1aeb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
68 addition
and
8 deletion
+68
-8
package.json
package.json
+6
-1
scripts/generate-nutui.js
scripts/generate-nutui.js
+9
-4
tsconfig.json
tsconfig.json
+5
-3
vite.config.build.ts
vite.config.build.ts
+48
-0
未找到文件。
package.json
浏览文件 @
37a90002
{
"name"
:
"nutui-react"
,
"version"
:
"0.0.0"
,
"version"
:
"1.0.0"
,
"main"
:
"dist/nutui.react.umd.js"
,
"module"
:
"dist/nutui.react.es.js"
,
"style"
:
"dist/style.css"
,
"typings"
:
"dist/dts/src/packages/nutui.react.d.ts"
,
"scripts"
:
{
"add"
:
"node scripts/createComponentMode.js"
,
"generate:file"
:
"node scripts/generate-nutui.js"
,
"checked"
:
"npm run generate:file && tsc"
,
"dev"
:
"npm run checked && vite --open --force"
,
"build"
:
"npm run checked && vite build --config vite.config.build.ts && tsc"
,
"prepare"
:
"husky install"
},
"lint-staged"
:
{
...
...
scripts/generate-nutui.js
浏览文件 @
37a90002
...
...
@@ -8,7 +8,7 @@ config.nav.map((item) => {
item
.
packages
.
forEach
((
element
)
=>
{
let
{
name
,
show
,
type
}
=
element
if
(
show
)
{
importStr
+=
`import
${
name
}
from './
packages/
${
name
.
toLowerCase
()}
';\n`
importStr
+=
`import
${
name
}
from './
${
name
.
toLowerCase
()}
';\n`
packages
.
push
(
name
)
}
})
...
...
@@ -17,6 +17,11 @@ config.nav.map((item) => {
let
fileStr
=
`
${
importStr
}
export {
${
packages
.
join
(
'
,
'
)}
};`
fs
.
outputFile
(
path
.
resolve
(
__dirname
,
'
../src/nutui.ts
'
),
fileStr
,
'
utf8
'
,
(
error
)
=>
{
if
(
error
)
throw
error
})
fs
.
outputFile
(
path
.
resolve
(
__dirname
,
'
../src/packages/nutui.react.ts
'
),
fileStr
,
'
utf8
'
,
(
error
)
=>
{
if
(
error
)
throw
error
}
)
tsconfig.json
浏览文件 @
37a90002
...
...
@@ -5,7 +5,10 @@
"target"
:
"ESNext"
,
"types"
:
[
"vite/client"
],
"allowJs"
:
false
,
"skipLibCheck"
:
false
,
"declaration"
:
true
,
"emitDeclarationOnly"
:
true
,
"declarationDir"
:
"./dist/dts"
,
"skipLibCheck"
:
true
,
"esModuleInterop"
:
false
,
"allowSyntheticDefaultImports"
:
true
,
"strict"
:
true
,
...
...
@@ -14,7 +17,6 @@
"moduleResolution"
:
"Node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"noEmit"
:
true
,
"jsx"
:
"react"
,
"lib"
:
[
"esnext"
,
"dom"
],
"outDir"
:
"./tsc/test"
,
...
...
@@ -23,5 +25,5 @@
}
},
"include"
:
[
"src/**/*.ts"
,
"src/**/*.d.ts"
,
"src/**/*.tsx"
],
"exclude"
:
[
"./node_modules"
]
"exclude"
:
[
"./node_modules
/*
"
]
}
vite.config.build.ts
0 → 100644
浏览文件 @
37a90002
import
{
defineConfig
}
from
'
vite
'
import
reactRefresh
from
'
@vitejs/plugin-react-refresh
'
import
path
from
'
path
'
import
config
from
'
./package.json
'
const
banner
=
`/*!
*
${
config
.
name
}
v
${
config
.
version
}
${
new
Date
()}
* (c) 2021 @jdf2e.
* Released under the MIT License.
*/`
const
resolve
=
path
.
resolve
// https://vitejs.dev/config/
export
default
defineConfig
({
resolve
:
{
alias
:
[{
find
:
'
@
'
,
replacement
:
resolve
(
__dirname
,
'
./src
'
)
}],
},
css
:
{
preprocessorOptions
:
{
scss
:
{
// example : additionalData: `@import "./src/design/styles/variables";`
// dont need include file extend .scss
additionalData
:
`@import "@/styles/variables.scss";@import "@/sites/assets/styles/variables.scss";`
,
},
},
},
plugins
:
[
reactRefresh
()],
build
:
{
rollupOptions
:
{
// 请确保外部化那些你的库中不需要的依赖
external
:
[
'
react
'
,
'
react-dom
'
],
output
:
{
banner
,
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
globals
:
{
react
:
'
React
'
,
'
react-dom
'
:
'
ReactDOM
'
,
},
},
},
lib
:
{
entry
:
'
src/packages/nutui.react.ts
'
,
name
:
'
nutui.react
'
,
fileName
:
'
nutui.react
'
,
formats
:
[
'
es
'
,
'
umd
'
],
},
},
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录