diff --git a/.gitignore b/.gitignore index 08d1deb..4eb6752 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ *.log .DS_Store node_modules -dist -lib +dist/ +svelte/ package-lock.json tsconfig.tsbuildinfo coverage diff --git a/norm.config.mjs b/norm.config.mjs index 4f8ba20..3df302c 100644 --- a/norm.config.mjs +++ b/norm.config.mjs @@ -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 diff --git a/package.json b/package.json index 5d23bca..676da83 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/bytemd/package.json b/packages/bytemd/package.json index 7967427..26e39e2 100644 --- a/packages/bytemd/package.json +++ b/packages/bytemd/package.json @@ -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" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d952fd0..405206b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/scripts/postinstall.mjs b/scripts/postinstall.mjs index abb3726..f2c84d6 100644 --- a/scripts/postinstall.mjs +++ b/scripts/postinstall.mjs @@ -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) })