-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* release: 1.0 * refactor: sync release/1.0 * fix: only exit when prepublishOnly (#836) * feat: add recommend extensions (#837) * feat: add recommend extensions * docs: typo * docs: remove * fix: fail to pase ts code (#839) * fix: make sure that the start & end fields exist (#838) * fix: make sure that the start & end fields exist * docs: changelog * docs: 编程 => 编码 * feat: lib-mtop-complete * fix: some mistakes * refactor: update icons (#846) * refactor: icons * docs: icon * docs: update links * fix: update MtopRequest autoComplete * fix: update autoComplete * fix: update * refactor: solved diff * refactor: solved diff * chore: update webview icon (#856) * chore: webview icon * chore: version and changelog * fix: #861 (#862) * feat: hint user install types/rax (#854) * feat: hini user install types/rax * feat: hint user install @types/Rax * refactor: updated * doc: update * fix: change transfer parameters * feat: update (#866) * Feat: release 1.1.0 and update .vscodeignore (#864) * feat: update * feat: update * feat: update * fix hintInstallTypesRax (#868) * feat: support less (#869) Co-authored-by: wuji.xwt <wuji.xwt@alibaba-inc.com> Co-authored-by: alvin.hui <alvin.hui@qq.com> Co-authored-by: Hengchang Lu <44047106+luhc228@users.noreply.github.com> Co-authored-by: GiveMe-A-Name <a455300764b@hotmail.com> Co-authored-by: GiveMe-A-Name <58852732+GiveMe-A-Name@users.noreply.github.com>
- Loading branch information
1 parent
c6330aa
commit f4b2258
Showing
42 changed files
with
405 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
extensions/application-manager/src/hintInstallTypesRax/checkHasTypesRax.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function hasTypesRaxInObject(object: Object): boolean { | ||
const TYPES_RAX = '@types/rax'; | ||
for (const key in object) { | ||
if (key === TYPES_RAX) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
export default (projectPackageJSON: any): boolean => { | ||
const { devDependencies, dependencies } = projectPackageJSON; | ||
let flag = false; | ||
if (devDependencies && typeof devDependencies === 'object' && hasTypesRaxInObject(devDependencies)) { | ||
flag = true; | ||
} | ||
if (dependencies && typeof dependencies === 'object' && hasTypesRaxInObject(dependencies)) { | ||
flag = true; | ||
} | ||
return flag; | ||
}; |
8 changes: 8 additions & 0 deletions
8
extensions/application-manager/src/hintInstallTypesRax/checkIsRaxTsProject.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { getProjectType, getProjectLanguageType } from '@appworks/project-service'; | ||
|
||
export default async function isRaxTsProject(): Promise<boolean> { | ||
const type = await getProjectType(); | ||
const languageType = await getProjectLanguageType(); | ||
return type === 'rax' && languageType === 'ts'; | ||
} | ||
|
52 changes: 52 additions & 0 deletions
52
extensions/application-manager/src/hintInstallTypesRax/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as vscode from 'vscode'; | ||
import runScript from '../terminal/runScript'; | ||
import { getProjectPackageJSON } from '@appworks/project-service/lib/utils'; | ||
import checkHasTypesRax from './checkHasTypesRax'; | ||
import checkIsRaxTsProject from './checkIsRaxTsProject'; | ||
import { projectPath } from '@appworks/project-service'; | ||
import { createNpmCommand, getAddDependencyAction } from '@appworks/common-service'; | ||
import { Recorder } from '@appworks/recorder'; | ||
import i18n from '../i18n'; | ||
|
||
/** | ||
* 检测是否需要提示用户安装 @types/rax | ||
* @returns | ||
*/ | ||
async function checkIsShowTip(): Promise<boolean> { | ||
const projectPackageJSON = await getProjectPackageJSON(); | ||
return await checkIsRaxTsProject() && !checkHasTypesRax(projectPackageJSON); | ||
} | ||
|
||
/** | ||
* 根据用户的选择,自动安装@types/rax | ||
* @param value | ||
*/ | ||
async function installTypesRax(value: string | undefined, recorder: Recorder) { | ||
if (value === i18n.format('extension.applicationManager.hintInstallTypesrax.message.install')) { | ||
recorder.record({ | ||
action: 'actualInstall', | ||
module: 'hintInstallTypesRax', | ||
}); | ||
const terminalName = 'install @typesRax'; | ||
const npmCommandAction = getAddDependencyAction(); | ||
|
||
const script = createNpmCommand(npmCommandAction, '@types/rax', '--save-dev'); | ||
runScript(terminalName, projectPath, script); | ||
} | ||
} | ||
|
||
export default async (recorder: Recorder) => { | ||
if (await checkIsShowTip()) { | ||
recorder.record({ | ||
action: 'showInstallTip', | ||
module: 'hintInstallTypesRax', | ||
}); | ||
vscode.window | ||
.showInformationMessage( | ||
i18n.format('extension.applicationManager.hintInstallTypesrax.message'), | ||
i18n.format('extension.applicationManager.hintInstallTypesrax.message.install'), | ||
i18n.format('extension.applicationManager.hintInstallTypesrax.message.ignore'), | ||
) | ||
.then((value) => installTypesRax(value, recorder)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# Change Log | ||
|
||
## 1.0.1 | ||
|
||
- chore: update webview icon | ||
|
||
## 1.0.0 | ||
|
||
Release 1.0.0 | ||
|
||
## 0.1.0 | ||
|
||
- initialization | ||
- initialization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Change Log | ||
|
||
## 1.0.1 | ||
|
||
- chore: update webview icon | ||
|
||
## 1.0.0 | ||
|
||
Release 1.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.