Skip to content

Commit 93464d3

Browse files
luhc228hzwjzqiansheng.wjz
authored
release 1.5.3 (#1030)
* chore: version * feat: add material hook (#1024) * feat: add material hook * feat: 增加log * feat: 升级版本,补充changelog * feat: 补充log * feat: 修改文件名 * feat: 修改方法名 Co-authored-by: qiansheng.wjz <qiansheng.wjz@alibaba-inc.com> * fix: lint Co-authored-by: wjz <15158133684@163.com> Co-authored-by: qiansheng.wjz <qiansheng.wjz@alibaba-inc.com>
1 parent 87c8566 commit 93464d3

File tree

13 files changed

+198
-8
lines changed

13 files changed

+198
-8
lines changed

extensions/appworks/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [1.5.3](https://github.com/apptools-lab/appworks/releases/tag/v1.5.3)
4+
5+
- Feat: add material hooks for other extensions
6+
37
## [1.5.2](https://github.com/apptools-lab/appworks/releases/tag/v1.5.2)
48
- Feat: add className={styles.xxx} automatic completion [#1002](https://github.com/apptools-lab/appworks/pull/1002)
59
- Feat: Doctor use AppLint [#1001](https://github.com/apptools-lab/appworks/pull/1001)

extensions/appworks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "AppWorks",
44
"description": "Application Development Pack, provide visualization and intelligent technology to build Universal Application faster and better, support Web / H5 / MiniProgram(小程序) Application.",
55
"publisher": "iceworks-team",
6-
"version": "1.5.2",
6+
"version": "1.5.3",
77
"engines": {
88
"vscode": "^1.41.0"
99
},

extensions/material-helper/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 1.1.4
4+
5+
- feat: exports material hook register function
6+
37
## 1.1.3
48

59
- chore: update taobao npm registry from `https://registry.npm.taobao.org` to `https://registry.npmmirror.com`

extensions/material-helper/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Component Helper",
44
"description": "Easily use Component in React/Vue/Rax.",
55
"publisher": "iceworks-team",
6-
"version": "1.1.3",
6+
"version": "1.1.4",
77
"main": "./build/extension.js",
88
"engines": {
99
"vscode": "^1.41.0"
@@ -389,4 +389,4 @@
389389
"extensionDependencies": [
390390
"iceworks-team.iceworks-refactor"
391391
]
392-
}
392+
}

extensions/material-helper/src/extension.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connectService, getHtmlForWebview } from '@appworks/connector/lib/vscod
33
import { initExtension, registerCommand } from '@appworks/common-service';
44
import { autoSetContext as autoSetContextByProject } from '@appworks/project-service';
55
import { ICEWORKS_ICON_PATH } from '@appworks/constant';
6+
import { hookUtil } from '@appworks/material-engine';
67
import services from './services/index';
78
import propsAutoComplete from './propsAutoComplete';
89
import i18n from './i18n';
@@ -129,6 +130,25 @@ export function activate(context: vscode.ExtensionContext) {
129130
importAutoComplete();
130131
// help user complete React Component's propTypes;
131132
propTypesAutoComplete();
133+
134+
// exports
135+
return {
136+
/*
137+
example:
138+
139+
hookUtil.registerHook('block.addBlockCode', (data, args) => {
140+
console.log('block.addBlockCode', JSON.stringify(data), JSON.stringify(args));
141+
});
142+
hookUtil.registerHook('component.addCode', (data, args) => {
143+
console.log('component.addCode', JSON.stringify(data), JSON.stringify(args));
144+
});
145+
hookUtil.registerHook('page.generate', (data, args) => {
146+
console.log('page.generate', JSON.stringify(data), JSON.stringify(args));
147+
});
148+
149+
*/
150+
registerHook: hookUtil.registerHook,
151+
};
132152
}
133153

134154
export function deactivate() { }

packages/material-engine/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 0.2.2
4+
5+
- feat: add hook utils
6+
37
## 0.2.1
48

59
- feat: support get component type

packages/material-engine/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@appworks/material-engine",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "AppWorks Material Engine for VSCode extension.",
55
"files": [
66
"lib"
@@ -51,4 +51,4 @@
5151
"prepublishOnly": "npm run compile"
5252
},
5353
"gitHead": "fc5b35f95ab4cc24898845916acf598c2f34d576"
54-
}
54+
}

packages/material-engine/src/block/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import * as upperCamelCase from 'uppercamelcase';
2424
import * as transfromTsToJs from 'transform-ts-to-js';
2525
import i18n from './i18n';
2626
import { generateBlockName } from './utils/generateBlockName';
27+
import { trigger } from '../utils/hook';
2728

2829
const { window, Position } = vscode;
2930

@@ -137,6 +138,9 @@ export async function addBlockCode(block: IMaterialBlock) {
137138

138139
// install block dependencies
139140
await bulkInstallMaterialsDependencies([block], projectPath);
141+
142+
// trigger hook
143+
trigger('block.addBlockCode', block, { fsPath });
140144
}
141145

142146
export async function insertBlock(activeTextEditor: vscode.TextEditor, blockName: string) {

packages/material-engine/src/component/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import insertComponent from './utils/insertComponent';
3636
import transformComponentsMap from './utils/transformComponentsMap';
3737
import transformTextComponent from './utils/transformTextComponent';
3838
import i18nService from './i18n';
39+
import { trigger } from '../utils/hook';
3940

4041
const { window, Position } = vscode;
4142

@@ -118,6 +119,9 @@ export async function addCode(dataSource: IMaterialComponent) {
118119
terminal.sendText(createNpmCommand(addDependencyAction, `${npm}@${version || 'latest'}`, '--save'), true);
119120
// activate the textEditor
120121
window.showTextDocument(activeTextEditor.document, activeTextEditor.viewColumn);
122+
123+
// trigger hook
124+
trigger('component.addCode', dataSource, { fsPath });
121125
}
122126

123127
export async function generateComponentCode(

packages/material-engine/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ import * as router from './router';
55
import * as page from './page';
66
import * as scaffold from './scaffold';
77
import * as menu from './menu';
8+
import * as hookUtil from './utils/hook';
89

9-
export { block, component, material, router, page, scaffold, menu };
10+
export { block, component, material, router, page, scaffold, menu, hookUtil };

0 commit comments

Comments
 (0)