Skip to content

Commit

Permalink
build: release v1.2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
vangleer committed Jan 9, 2024
1 parent b8ec0b1 commit c28656e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@es-drager/root",
"version": "1.2.6",
"version": "1.2.7",
"description": "A draggable, resizable, rotatable component based on vue3",
"keywords": [
"drag",
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ watch(
.es-content {
position: relative;
flex: 1;
margin: 20px;
background-color: var(--es-color-bg);
box-shadow: var(--el-box-shadow);
height: calc(100% - var(--es-header-height) - 40px);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/drager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es-drager",
"version": "1.2.6",
"version": "1.2.7",
"description": "A draggable, resizable, rotatable component based on vue3",
"keywords": [
"drag",
Expand Down
7 changes: 4 additions & 3 deletions packages/editor/src/components/editor/GridRect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
</template>

<script setup lang="ts">
import { computed, inject } from 'vue'
import { computed } from 'vue'
import MColor from 'color'
import { useId } from '../../utils'
import { useEditorStore } from '../../store'
const store = useEditorStore()
const props = defineProps({
grid: {
// 小网格的大小
Expand All @@ -67,7 +69,6 @@ const props = defineProps({
smallGridId: String,
gridId: String
})
const theme = inject('theme')!
const smallGridId = computed(() => props.smallGridId || useId('smallGrid'))
const gridId = computed(() => props.gridId || useId('grid'))
Expand All @@ -87,7 +88,7 @@ const color = computed(() => {
['#e4e7ed', '#ebeef5'],
['#414243', '#363637']
]
const [bigGrid, grid] = colors[(theme as any).value === 'light' ? 0 : 1]
const [bigGrid, grid] = colors[store.theme === 'light' ? 0 : 1]
return { bigGrid, grid }
})
Expand Down
8 changes: 5 additions & 3 deletions packages/editor/src/components/layout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ const props = defineProps({
})
const store = useEditorStore()
const theme = computed(() => props.theme)
provide('theme', theme)
const mainRef = ref<HTMLElement>()
const { commands } = useCommand(store)
Expand Down Expand Up @@ -193,6 +190,11 @@ function getData() {
watch(() => props.data, () => {
store.update(props.data)
}, { immediate: true })
watch(() => props.theme, () => {
if (props.theme) {
store.theme = props.theme
}
}, { immediate: true })
onMounted(() => {
init()
})
Expand Down
5 changes: 4 additions & 1 deletion packages/editor/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface EditorState {
preview: Boolean
initWidth: number
initHeight: number
theme: string
}

const defaultData = {
Expand All @@ -23,14 +24,16 @@ const defaultData = {
},
elements: []
}

export const useEditorStore = defineStore('editor', {
state: (): EditorState => {
return {
data: defaultData,
current: {},
preview: false,
initWidth: 1180,
initHeight: 960
initHeight: 960,
theme: localStorage.getItem('theme') || 'light'
}
},
actions: {
Expand Down
7 changes: 7 additions & 0 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ async function publishPackage(pkgName, version) {
const pkgRoot = getPkgRoot(pkgName)
const pkgPath = path.resolve(pkgRoot, 'package.json')
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))

if (pkg.private) {
return
}
Expand All @@ -101,9 +102,15 @@ async function publishPackage(pkgName, version) {

// execSync(`git commit -m "chore: release v${version}"`, { stdio: 'inherit' })
// execSync(`git tag -a v${version} -m "v${version}"`, { stdio: 'inherit' })

// copy README.md
step(`copy README.md...`)
fs.cpSync(path.resolve(__dirname, '../README.md'), path.resolve(pkgRoot, 'README.md'))

execSync('npm publish', { cwd: pkgRoot, stdio: 'inherit' })

console.log(chalk.green(`Successfully published ${pkgName}@${version}`))
fs.unlinkSync(path.resolve(pkgRoot, 'README.md'))
} catch (e) {
if (e.stderr.match(/previously published/)) {
console.log(chalk.red(`Skipping already published: ${pkgName}`))
Expand Down

0 comments on commit c28656e

Please sign in to comment.