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

Windows run#259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 10 commits intomasterfromwindows-run
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,7 +58,7 @@
"vscode-test":"^1.3.0"
},
"engines": {
"vscode":"^1.40.0"
"vscode":"^1.44.0"
},
"activationEvents": [
"onCommand:coderoad.start"
Expand Down
4 changes: 3 additions & 1 deletionscripts/build.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,9 @@ tsc -p ./
cd web-app
npm run build
cd ..
cp -R ./web-app/build/ ./build/
# For Windows build: switch the next 2 lines
# cp -R ./web-app/build/ ./
cp -R ./web-app/build/ ./build
Comment on lines +18 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could we wrap these in a os platform conditional in bash?

node scripts/fixFontPaths.js

echo "Build complete!"
2 changes: 1 addition & 1 deletionsrc/actions/utils/openFiles.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@ const openFiles = async (files: string[]) => {
}
for (const filePath of files) {
try {
const workspaceFolders: vscode.WorkspaceFolder[] | undefined = vscode.workspace.workspaceFolders
const workspaceFolders:readonlyvscode.WorkspaceFolder[] | undefined = vscode.workspace.workspaceFolders
if (!workspaceFolders || !workspaceFolders.length) {
throw new Error('No workspace directory. Open a workspace directory and try again')
}
Expand Down
2 changes: 1 addition & 1 deletionsrc/environment.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,4 +25,4 @@ export const WORKSPACE_ROOT: string = getWorkspaceRoot()

// Possible values are 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', and 'win32'.
// @ts-ignore
export const OS_PLATFORM: 'win32' | 'linux' = os.platform()
export const OS_PLATFORM: 'win32' | 'linux'| 'darwin'= os.platform()
5 changes: 3 additions & 2 deletionssrc/services/dependencies/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
import { satisfies } from 'semver'
import { exec } from '../node'

const semverRegex = /(?<=^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
const semverRegex = /(?<=^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

export const version = async (name: string): Promise<string | null> => {
try {
const { stdout, stderr } = await exec(`${name} --version`)
if (!stderr) {
const match = stdout.match(semverRegex)
if (match) {
return match[0]
const parsedVersion = match[0].split('.').slice(0, 3).join('.')
return parsedVersion
}
}
return null
Expand Down
9 changes: 5 additions & 4 deletionssrc/services/workspace/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import * as vscode from 'vscode'
import * as fs from 'fs'
import { promisify } from 'util'
import{ WORKSPACE_ROOT } from '../../environment'
import* as env from '../../environment'

const readDir = promisify(fs.readdir)

Expand All@@ -13,7 +13,7 @@ export const openWorkspace = () => {
export const checkWorkspaceEmpty = async () => {
let files
try {
files = await readDir(WORKSPACE_ROOT)
files = await readDir(env.WORKSPACE_ROOT, { encoding: 'utf8' })
} catch (error) {
throw new Error('Failed to check workspace')
}
Expand All@@ -22,13 +22,14 @@ export const checkWorkspaceEmpty = async () => {

// capture the workspace root to use the users dirname in processes
export const getWorkspaceRoot = (): string => {
const workspaceRoots: vscode.WorkspaceFolder[] | undefined = vscode.workspace.workspaceFolders
const workspaceRoots:readonlyvscode.WorkspaceFolder[] | undefined = vscode.workspace.workspaceFolders
if (!workspaceRoots || !workspaceRoots.length) {
// no workspace root
return ''
}
// a user may have multiple workspace folders
// for simplicity, assume the first is the active workspace
const workspaceRoot: vscode.WorkspaceFolder = workspaceRoots[0]
return workspaceRoot.uri.path

return workspaceRoot.uri.fsPath
}
17 changes: 6 additions & 11 deletionssrc/webview/render.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,23 +20,18 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {

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

document.head.appendChild(base)

// used for CSP
const nonces: string[] = []

// generate vscode-resource build path uri
const createUri = (filePath: string): any => {
return (
panel.webview
// @ts-ignore
.asWebviewUri(vscode.Uri.file(filePath))
.toString()
.replace(/^\/+/g, '') // remove leading '/'
.replace('/vscode-resource%3A', rootPath)
) // replace mangled resource path with root
const createUri = (_filePath: string): any => {
const filePath = (_filePath.startsWith('vscode') ? _filePath.substr(16) : _filePath).replace('///', '\\')

return panel.webview.asWebviewUri(vscode.Uri.file(path.join(rootPath, filePath)))
}

// fix paths for scripts
Expand All@@ -55,7 +50,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
runTimeScript.nonce = getNonce()
nonces.push(runTimeScript.nonce)
const manifest = await import(path.join(rootPath, 'asset-manifest.json'))
runTimeScript.src = createUri(path.join(rootPath,manifest.files['runtime-main.js']))
runTimeScript.src = createUri(manifest.files['runtime-main.js'])
document.body.appendChild(runTimeScript)

// fix paths for links
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp