fix(bytemd): svelte entry

This commit is contained in:
Rongjian Zhang 2022-03-25 21:28:42 +08:00
parent 8d1e291353
commit a0c8a316fe
6 changed files with 29 additions and 30 deletions

4
.gitignore vendored
View File

@ -1,8 +1,8 @@
*.log
.DS_Store
node_modules
dist
lib
dist/
svelte/
package-lock.json
tsconfig.tsbuildinfo
coverage

View File

@ -41,7 +41,7 @@ export default defineConfig({
console.log('building helpers.js...')
await vite.build({
build: {
outDir: 'packages/bytemd/dist/svelte',
outDir: 'packages/bytemd/svelte',
lib: {
entry: 'packages/bytemd/src/helpers.ts',
formats: ['es'],
@ -57,7 +57,7 @@ export default defineConfig({
await vite.build({
build: {
emptyOutDir: false,
outDir: 'packages/bytemd/dist/svelte',
outDir: 'packages/bytemd/svelte',
lib: {
entry: 'packages/bytemd/src/index.ts',
formats: ['es'],
@ -73,12 +73,10 @@ export default defineConfig({
})
const files = await glob('packages/bytemd/src/*.svelte')
console.log(
'processing svelte files...' //files
)
console.log('processing svelte files...')
for (let file of files) {
const dest = file.replace('/src/', '/dist/svelte/')
const dest = file.replace('/src/', '/svelte/')
await fs.ensureDir(path.dirname(dest))
if (fs.statSync(file).isDirectory()) return

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "norm build",
"dev": "norm",
"dev": "echo 'export * from \"../src/index\"' > packages/bytemd/svelte/index.js && norm",
"docs:build": "vitepress build docs",
"docs:dev": "vitepress dev docs",
"docs:serve": "vitepress serve docs",

View File

@ -30,7 +30,8 @@
"types": "./dist/index.d.ts",
"files": [
"dist",
"locales"
"locales",
"svelte"
],
"dependencies": {
"@types/codemirror": "^5.60.5"
@ -55,7 +56,5 @@
"vfile": "^5.3.2",
"word-count": "^0.2.2"
},
"publishConfig": {
"svelte": "./dist/svelte"
}
"svelte": "./svelte/index.js"
}

View File

@ -129,7 +129,7 @@ importers:
packages/plugin-breaks:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
remark-breaks: ^3.0.2
devDependencies:
bytemd: link:../bytemd
@ -137,7 +137,7 @@ importers:
packages/plugin-footnotes:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
remark-footnotes: ^4.0.1
devDependencies:
bytemd: link:../bytemd
@ -146,7 +146,7 @@ importers:
packages/plugin-frontmatter:
specifiers:
'@types/js-yaml': ^4.0.5
bytemd: ^1.11.0
bytemd: ^1.12.0
js-yaml: ^4.1.0
remark-frontmatter: ^4.0.1
vfile: ^5.3.2
@ -159,7 +159,7 @@ importers:
packages/plugin-gemoji:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
remark-gemoji: ^7.0.1
devDependencies:
bytemd: link:../bytemd
@ -167,7 +167,7 @@ importers:
packages/plugin-gfm:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
remark-gfm: ^3.0.1
devDependencies:
bytemd: link:../bytemd
@ -175,7 +175,7 @@ importers:
packages/plugin-highlight:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
highlight.js: ^11.5.0
dependencies:
highlight.js: 11.5.0
@ -184,7 +184,7 @@ importers:
packages/plugin-highlight-ssr:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
highlight.js: ^11.5.0
rehype-highlight: ^5.0.2
dependencies:
@ -195,9 +195,9 @@ importers:
packages/plugin-math:
specifiers:
'@bytemd/plugin-math-common': ^1.11.0
'@bytemd/plugin-math-common': ^1.12.0
'@types/katex': ^0.11.1
bytemd: ^1.11.0
bytemd: ^1.12.0
katex: ^0.15.2
remark-math: ^5.1.1
dependencies:
@ -210,14 +210,14 @@ importers:
packages/plugin-math-common:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
devDependencies:
bytemd: link:../bytemd
packages/plugin-math-ssr:
specifiers:
'@bytemd/plugin-math-common': ^1.11.0
bytemd: ^1.11.0
'@bytemd/plugin-math-common': ^1.12.0
bytemd: ^1.12.0
rehype-katex: ^6.0.2
remark-math: ^5.1.1
devDependencies:
@ -228,7 +228,7 @@ importers:
packages/plugin-medium-zoom:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
medium-zoom: ^1.0.6
dependencies:
medium-zoom: 1.0.6
@ -238,7 +238,7 @@ importers:
packages/plugin-mermaid:
specifiers:
'@types/mermaid': ^8.2.8
bytemd: ^1.11.0
bytemd: ^1.12.0
mermaid: ^8.14.0
dependencies:
'@types/mermaid': 8.2.8
@ -249,7 +249,7 @@ importers:
packages/react:
specifiers:
'@types/react': ^17.0.40
bytemd: ^1.11.0
bytemd: ^1.12.0
react: ^17.0.2
dependencies:
bytemd: link:../bytemd
@ -259,7 +259,7 @@ importers:
packages/vue:
specifiers:
bytemd: ^1.11.0
bytemd: ^1.12.0
vue: ^2.6.14
dependencies:
bytemd: link:../bytemd

View File

@ -64,11 +64,13 @@ libs.forEach((p) => {
// for compatible with old version
'./lib/locales/*': './locales/*',
}
pkg.files = ['dist', 'locales']
if (pkg.name === 'bytemd') {
pkg.exports['./dist/index.css'] = './dist/style.css'
pkg.exports['./dist/index.min.css'] = './dist/style.css'
pkg.files = ['dist', 'locales', 'svelte']
}
pkg.files = ['dist', 'locales']
fs.writeJsonSync(pkgPath, pkg)
})