Skip to content

Commit

Permalink
feat(block): rename rallie to @rallie/block
Browse files Browse the repository at this point in the history
  • Loading branch information
ones-liupengfei committed Oct 24, 2022
1 parent 69ceeff commit dd5a967
Show file tree
Hide file tree
Showing 54 changed files with 479 additions and 134 deletions.
547 changes: 448 additions & 99 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"packages/*"
],
"scripts": {
"prepare": "npm run bootstrap && husky install",
"prepare": "husky install && npm run bootstrap",
"bootstrap": "lerna bootstrap --force-local",
"clean": "lerna clean && rm -rf node_modules",
"test": "npm run build && jest --coverage",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rallie",
"name": "@rallie/block",
"version": "0.10.0",
"description": "a progressive micro front framework",
"main": "./dist/index.umd.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
{
file: pkg.main,
format: 'umd',
name: 'Rallie',
name: 'RallieBlock',
exports: 'named',
},
{
Expand Down
6 changes: 1 addition & 5 deletions packages/rallie/src/block.ts → packages/block/src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { touchBus } from '@rallie/core'
import type { CallbackType, Socket } from '@rallie/core'
import { constant, errors } from './utils'

export class Block<
State extends Record<string, any>,
Events extends Record<string, CallbackType>,
Methods extends Record<string, CallbackType>,
> {
export class Block<State extends Record<string, any>, Events extends Record<string, CallbackType>, Methods extends Record<string, CallbackType>> {
protected socket: Socket
public name: string
public state: State
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/playground/apps/host-app/block.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'

interface HostApp {
events: {
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/apps/host-app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'
import { hostApp } from './block'

registerBlock(hostApp)
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/apps/react-app/blocks/react-app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'

export const reactApp = createBlock('react-app')
2 changes: 1 addition & 1 deletion packages/playground/apps/react-app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reactApp } from './blocks/react-app'
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'

registerBlock(reactApp)
.relyOn(['lib:react', 'lib:react-dom', 'host-app'])
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/apps/vue-app/blocks/vue-app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'

type State = {
count: number
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/apps/vue-app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'
import { vueApp } from './blocks/vue-app'

registerBlock(vueApp)
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerBlock, createBlock } from 'rallie'
import { registerBlock, createBlock } from '@rallie/block'
import { jsdelivrLibraryLoader, dynamicImportLoader, htmlLoader } from './middlewares' // eslint-disable-line
import loadHtml from '@rallie/load-html' // eslint-disable-line

Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@rallie/react": "0.10.0",
"@rallie/vue": "0.10.0",
"naive-ui": "^2.21.1",
"rallie": "0.10.0"
"@rallie/block": "0.10.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^1.0.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"url": "https://github.com/ralliejs/rallie/issues"
},
"peerDependencies": {
"rallie": "^0.6.0",
"@rallie/block": "^0.6.0",
"react": ">=16.8.0"
},
"devDependencies": {
"@rallie/core": "0.10.0",
"rallie": "0.10.0"
"@rallie/block": "0.10.0"
}
}
4 changes: 2 additions & 2 deletions packages/react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
exports: 'named',
globals: {
react: 'React',
rallie: 'Rallie',
'@rallie/block': 'RallieBlock',
},
},
{
Expand All @@ -23,5 +23,5 @@ export default {
},
],
plugins: [resolve(), commonJs(), typescript()],
external: ['react', 'rallie'],
external: ['react', '@rallie/block'],
}
2 changes: 1 addition & 1 deletion packages/react/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import type { Block, CreatedBlock } from 'rallie'
import type { Block, CreatedBlock } from '@rallie/block'

export function useBlockState<T extends Block<any, any, any>, U>(block: T, getter: (state: T['state']) => U, deps: any[] = []) {
const [value, setValue] = React.useState<U>(getter(block.state))
Expand Down
2 changes: 1 addition & 1 deletion packages/react/test/blocks/consumer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'
import { useBlockState } from '../../src'

interface ConsumerType {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/test/blocks/producer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'
import { useBlockState, useBlockEvents, useBlockMethods } from '../../src'

interface ProducerType {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/test/hooks.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { producer, Producer } from './blocks/producer'
import { consumer, Consumer } from './blocks/consumer'
import { render, fireEvent, act, screen, cleanup } from '@testing-library/react'
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'

registerBlock(producer)
.onActivate(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"url": "https://github.com/ralliejs/rallie/issues"
},
"peerDependencies": {
"rallie": "^0.6.0",
"@rallie/block": "^0.6.0",
"vue": ">=2.0.0"
},
"devDependencies": {
"rallie": "0.10.0"
"@rallie/block": "0.10.0"
}
}
6 changes: 3 additions & 3 deletions packages/vue/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import pkg from './package.json'

const commonConfigs = {
plugins: [resolve(), commonJs(), typescript()],
external: ['vue', 'rallie'],
external: ['vue', '@rallie/block'],
}

export default [
Expand All @@ -19,7 +19,7 @@ export default [
exports: 'named',
globals: {
vue: 'Vue',
rallie: 'Rallie',
'@rallie/block': 'RallieBlock',
},
},
{
Expand All @@ -39,7 +39,7 @@ export default [
name: 'RallieVueMixin',
exports: 'named',
globals: {
rallie: 'Rallie',
'@rallie/block': 'RallieBlock',
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { onBeforeUnmount, onBeforeMount, ref, UnwrapRef } from 'vue'
import type { Block, CreatedBlock } from 'rallie'
import type { Block, CreatedBlock } from '@rallie/block'

export function useBlockState<T extends Block<any, any, any>, U>(block: T, getter: (state: T['state']) => U) {
const stateRef = ref<U>(getter(block.state))
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/mixins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Block, CreatedBlock } from 'rallie'
import type { Block, CreatedBlock } from '@rallie/block'

export function mixinBlockState<T extends Block<any, any, any>, U>(block: T, mapStateToComputed: (state: T['state']) => U) {
let unwatchState = null
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/test/blocks/consumer/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'

export const consumer = createBlock('consumer')
export const producer = consumer.connect<{
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/test/blocks/producer/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBlock } from 'rallie'
import { createBlock } from '@rallie/block'

export const producer = createBlock<{
state: {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/test/hooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { render, fireEvent, screen, cleanup } from '@testing-library/vue'
import { HooksProducer, producer } from './blocks/producer'
import { HooksConsumer, consumer } from './blocks/consumer'
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'

registerBlock(producer)
.onActivate(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/test/mixins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { render, fireEvent, screen, cleanup } from '@testing-library/vue'
import { MixinsProducer, producer } from './blocks/producer'
import { MixinsConsumer, consumer } from './blocks/consumer'
import { registerBlock } from 'rallie'
import { registerBlock } from '@rallie/block'

registerBlock(producer)
.onActivate(() => {
Expand Down

0 comments on commit dd5a967

Please sign in to comment.