Skip to content

Commit db43b2f

Browse files
committed
fix: fix conflict between postinstall script and eslint
1 parent 902bf5a commit db43b2f

File tree

11 files changed

+23
-16
lines changed

11 files changed

+23
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DS_Store
22
node_modules
3-
/dist
43
dist
4+
**/dist
55

66
.stylelintcache
77

common/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "common",
3+
"private": true,
4+
"dependencies": {
5+
},
6+
"devDependencies": {
7+
}
8+
}

vite.base.config.ts renamed to common/vite.base.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export const defaultPlugins = [
1414
// https://vitejs.dev/config/
1515
export const baseBuildConfig = defineConfig({
1616
build: {
17-
outDir: path.resolve(__dirname, `./dist/${isVue2 ? 'v2' : 'v3'}`),
17+
outDir: path.resolve(__dirname, `../dist/${isVue2 ? 'v2' : 'v3'}`),
1818
emptyOutDir: false,
1919
target: 'es2018',
2020
lib: {
21-
entry: path.resolve(__dirname, umd ? 'src/global.ts' : 'src/index.ts'),
21+
entry: path.resolve(__dirname, umd ? '../src/global.ts' : '../src/index.ts'),
2222
formats: umd ? ['umd'] : ['es', 'cjs'],
2323
name: 'CodeDiff',
2424
fileName: format => `${outputName}.${format}.js`,

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
"dev:demo": "vue-demi-switch 3 vue3 && pnpm --filter demo dev",
3737
"lint": "eslint .",
3838
"lint:fix": "eslint . --ext .vue,.js,.jsx,.ts,.tsx,json --fix --ignore-path .gitignore",
39-
"postinstall": "node scripts/postinstall.js",
40-
"prepublishOnly": "npm run build",
39+
"postinstall": "node scripts/postinstall.cjs",
4140
"release": "bumpp --commit --no-push --tag && npm publish"
4241
},
4342
"peerDependencies": {

pnpm-lock.yaml

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

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ packages:
33
- vue3-playground
44
- vue2.7-playground
55
- demo
6+
- common

scripts/postinstall.js renamed to scripts/postinstall.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// eslint-disable-next-line unicorn/prefer-node-protocol
21
const fs = require('fs')
3-
const { switchVersion, loadModule } = require('./utils')
2+
const { switchVersion, loadModule } = require('./utils.cjs')
43

54
const Vue = loadModule('vue')
65

scripts/utils.js renamed to scripts/utils.cjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// eslint-disable-next-line unicorn/prefer-node-protocol
21
const fs = require('fs')
3-
// eslint-disable-next-line unicorn/prefer-node-protocol
42
const path = require('path')
53

64
const dir = path.resolve(__dirname, '..', 'dist')

vue2-playground/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { resolve } from 'node:path'
22
import { defineConfig } from 'vite'
33
import { createVuePlugin as vue2 } from 'vite-plugin-vue2'
44
import ScriptSetup from 'unplugin-vue2-script-setup/vite'
5-
import { baseBuildConfig, defaultPlugins } from '../vite.base.config'
5+
import { baseBuildConfig, defaultPlugins } from '../common/vite.base.config'
66

77
export const viteVue2Config = defineConfig({
88
plugins: [vue2(), ...defaultPlugins, ScriptSetup({ reactivityTransform: true })],

vue2.7-playground/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { resolve } from 'node:path'
22
import type { UserConfig } from 'vite'
33
import { defineConfig } from 'vite'
44
import vue2 from '@vitejs/plugin-vue2'
5-
import { baseBuildConfig, defaultPlugins } from '../vite.base.config'
5+
import { baseBuildConfig, defaultPlugins } from '../common/vite.base.config'
66

77
export const viteVue2Config = defineConfig({
88
plugins: [vue2(), ...defaultPlugins],

vue3-playground/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { resolve } from 'node:path'
22
import { defineConfig } from 'vite'
33
import vue3 from '@vitejs/plugin-vue'
4-
import { baseBuildConfig, defaultPlugins } from '../vite.base.config'
4+
import { baseBuildConfig, defaultPlugins } from '../common/vite.base.config'
55

66
export const viteVue3Config = defineConfig({
77
plugins: [vue3(), ...defaultPlugins],

0 commit comments

Comments
 (0)