Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite27a240

Browse files
committed
Merge branch 'master' into multi-build-script
Signed-off-by: argemiront <argemiront@gmail.com>
2 parents2320b29 +065df38 commite27a240

File tree

11 files changed

+403
-77
lines changed

11 files changed

+403
-77
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
4141
##[0.2.2]
4242

4343
- Fixes issue where app fails on startup without a workspace, and instead returns an error page
44+
45+
##[0.2.3]
46+
47+
- Support Windows OS

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Install CodeRoad from [this link in the VSCode Marketplace](https://marketplace.
2929

3030
###Requirements
3131

32-
- OS: MacOS,Linux (Windows coming soon#227)
32+
- OS: MacOS, Windows, Linux
3333
- VSCode 1.40+
3434
- Node.js 10+
3535
- Git

‎package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"coderoad",
3-
"version":"0.2.2",
3+
"version":"0.2.3",
44
"description":"Play interactive coding tutorials in your editor",
55
"keywords": [
66
"tutorial",
@@ -58,7 +58,7 @@
5858
"vscode-test":"^1.3.0"
5959
},
6060
"engines": {
61-
"vscode":"^1.40.0"
61+
"vscode":"^1.44.0"
6262
},
6363
"activationEvents": [
6464
"onCommand:coderoad.start"

‎src/actions/utils/openFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const openFiles = async (files: string[]) => {
88
}
99
for(constfilePathoffiles){
1010
try{
11-
constworkspaceFolders:vscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
11+
constworkspaceFolders:readonlyvscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
1212
if(!workspaceFolders||!workspaceFolders.length){
1313
thrownewError('No workspace directory. Open a workspace directory and try again')
1414
}

‎src/services/dependencies/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import{satisfies}from'semver'
22
import{exec}from'../node'
33

4-
constsemverRegex=/(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/gi
4+
constsemverRegex=/(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(\.windows.[0-9]+)?(?=$|\s)/gi
55

66
exportconstversion=async(name:string):Promise<string|null>=>{
77
try{
88
const{ stdout, stderr}=awaitexec(`${name} --version`)
99
if(!stderr){
1010
constmatch=stdout.match(semverRegex)
1111
if(match){
12-
returnmatch[0]
12+
constparsedVersion=match[0].split('.').slice(0,3).join('.')
13+
returnparsedVersion
1314
}
1415
}
1516
returnnull

‎src/services/workspace/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asvscodefrom'vscode'
22
import*asfsfrom'fs'
33
import{promisify}from'util'
4-
import{WORKSPACE_ROOT}from'../../environment'
4+
import*asenvfrom'../../environment'
55

66
constreadDir=promisify(fs.readdir)
77

@@ -13,7 +13,7 @@ export const openWorkspace = () => {
1313
exportconstcheckWorkspaceEmpty=async()=>{
1414
letfiles
1515
try{
16-
files=awaitreadDir(WORKSPACE_ROOT)
16+
files=awaitreadDir(env.WORKSPACE_ROOT,{encoding:'utf8'})
1717
}catch(error){
1818
thrownewError('Failed to check workspace')
1919
}
@@ -22,13 +22,14 @@ export const checkWorkspaceEmpty = async () => {
2222

2323
// capture the workspace root to use the users dirname in processes
2424
exportconstgetWorkspaceRoot=():string=>{
25-
constworkspaceRoots:vscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
25+
constworkspaceRoots:readonlyvscode.WorkspaceFolder[]|undefined=vscode.workspace.workspaceFolders
2626
if(!workspaceRoots||!workspaceRoots.length){
2727
// no workspace root
2828
return''
2929
}
3030
// a user may have multiple workspace folders
3131
// for simplicity, assume the first is the active workspace
3232
constworkspaceRoot:vscode.WorkspaceFolder=workspaceRoots[0]
33-
returnworkspaceRoot.uri.path
33+
34+
returnworkspaceRoot.uri.fsPath
3435
}

‎src/webview/render.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
2020

2121
// set base href
2222
constbase:HTMLBaseElement=document.createElement('base')
23-
base.href=`vscode-resource:${rootPath}/`
23+
base.href=`${vscode.Uri.file(path.join(rootPath,'build')).with({scheme:'vscode-resource'})}`
2424

2525
document.head.appendChild(base)
2626

2727
// used for CSP
2828
constnonces:string[]=[]
2929

3030
// generate vscode-resource build path uri
31-
constcreateUri=(filePath:string):any=>{
32-
return(
33-
panel.webview
34-
//@ts-ignore
35-
.asWebviewUri(vscode.Uri.file(filePath))
36-
.toString()
37-
.replace(/^\/+/g,'')// remove leading '/'
38-
.replace('/vscode-resource%3A',rootPath)
39-
)// replace mangled resource path with root
31+
constcreateUri=(_filePath:string):any=>{
32+
constfilePath=(_filePath.startsWith('vscode') ?_filePath.substr(16) :_filePath).replace('///','\\')
33+
34+
returnpanel.webview.asWebviewUri(vscode.Uri.file(path.join(rootPath,filePath)))
4035
}
4136

4237
// fix paths for scripts
@@ -55,7 +50,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
5550
runTimeScript.nonce=getNonce()
5651
nonces.push(runTimeScript.nonce)
5752
constmanifest=awaitimport(path.join(rootPath,'asset-manifest.json'))
58-
runTimeScript.src=createUri(path.join(rootPath,manifest.files['runtime-main.js']))
53+
runTimeScript.src=createUri(manifest.files['runtime-main.js'])
5954
document.body.appendChild(runTimeScript)
6055

6156
// fix paths for links

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp