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

Migrate to xstate as app skeleton#2

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 11 commits intoxstatefromfeature/treeview
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
refactor files
  • Loading branch information
@ShMcK
ShMcK committedJun 2, 2019
commitb51dd2f6e6c93eb3de6df89fc4249c0bfde4ffa4
11 changes: 1 addition & 10 deletionssrc/commands/tutorialLoad.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,15 +39,6 @@ async function newTutorial(tutorial: CR.Tutorial) {
awaitopenReadme()
}

functiononSaveHook(languageIds:string[]){
// trigger command on save
vscode.workspace.onDidSaveTextDocument((document:vscode.TextDocument)=>{
if(languageIds.includes(document.languageId)&&document.uri.scheme==='file'){
// do work
vscode.commands.executeCommand('coderoad.test_run')
}
})
}

asyncfunctionvalidateCanContinue():Promise<boolean>{
// validate tutorial & progress found in local storage
Expand DownExpand Up@@ -127,7 +118,7 @@ export default async function tutorialLoad(context: vscode.ExtensionContext): Pr
// }

// // setup hook to run tests on save
// onSaveHook(tutorial.meta.languages)


// TODO: start
}
2 changes: 1 addition & 1 deletionsrc/utils/fetch.ts → src/services/api/fetch.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import * as CR from 'typings'

// temporary tutorials
import basicTutorial from '../state/context/tutorials/basic'
import basicTutorial from '../../state/context/tutorials/basic'

interface Options {
resource: string
Expand Down
32 changes: 32 additions & 0 deletionssrc/services/api/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
import*asCRfrom'typings'

// temporary tutorials
importbasicTutorialfrom'../../state/context/tutorials/basic'

interfaceOptions{
resource:string
params?:any
}

consttutorialsData:{[key:string]:CR.Tutorial}={
tutorialId:basicTutorial,
}

// TODO: replace with fetch resource
exportdefaultasyncfunctionfetch(options:Options):Promise<any>{
console.log('options',options)
switch(options.resource){
case'getTutorialsSummary':
// list of ids with summaries
letdata:{[id:string]:CR.TutorialSummary}={}
for(consttutorialofObject.values(tutorialsData)){
data[tutorial.id]=tutorial.data.summary
}
returndata
case'getTutorial':
// specific tutorial by id
returntutorialsData[options.params.id]
default:
thrownewError('Resource not found')
}
}
12 changes: 0 additions & 12 deletionssrc/services/fs.ts
View file
Open in desktop

This file was deleted.

2 changes: 1 addition & 1 deletionsrc/services/git.ts → src/services/git/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import * as CR from 'typings'
import { exec, exists, openFile } from '../utils/node'
import { exec, exists, openFile } from '../node'

const gitOrigin = 'coderoad'

Expand Down
12 changes: 12 additions & 0 deletionssrc/utils/node.ts → src/services/node/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,3 +37,15 @@ export const openFile = async (relativeFilePath: string): Promise<void> => {
console.log(`Failed to open file${relativeFilePath}`,error)
}
}


// export async function clear(): Promise<void> {
// // remove all files including ignored
// // NOTE: Linux only
// const command = 'ls -A1 | xargs rm -rf'
// const { stderr } = await exec(command)
// if (stderr) {
// console.error(stderr)
// throw new Error('Error removing all files & folders')
// }
// }
File renamed without changes.
2 changes: 1 addition & 1 deletionsrc/services/position.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import * as CR from 'typings'
import * as storage from './storage'
import * as storage from './vscode/storage'

export async function getInitial(tutorial: CR.Tutorial): Promise<CR.Position> {
const { data } = tutorial
Expand Down
4 changes: 2 additions & 2 deletionssrc/services/rootSetup.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import*asvscodefrom'vscode'
import{setWorkspaceRoot}from'../utils/node'
import{setStorage}from'./storage'
import{setWorkspaceRoot}from'../services/node'
import{setStorage}from'./vscode/storage'

exportdefaultasyncfunctionsetupRoot(context:vscode.ExtensionContext){
awaitsetWorkspaceRoot()
Expand Down
2 changes: 1 addition & 1 deletionsrc/services/testResult.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import * as CR from 'typings'
import * as vscode from 'vscode'
import * as storage from './storage'
import * as storage from './vscode/storage'


export async function onSuccess(position: CR.Position) {
Expand Down
4 changes: 2 additions & 2 deletionssrc/services/tutorialSetup.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import*asCRfrom'typings'
import*aspositionfrom'../services/position'
import*asstoragefrom'../services/storage'
import{isEmptyWorkspace}from'../utils/workspace'
import*asstoragefrom'../services/vscode/storage'
import{isEmptyWorkspace}from'../services/vscode/workspace'
import{gitLoadCommits,gitInitIfNotExists,gitSetupRemote}from'../services/git'

consttestRepo='https://github.com/ShMcK/coderoad-tutorial-basic.git'
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletionssrc/services/vscode/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
import * as CR from 'typings'
import onSaveHook from './save'

const vscodeAction = (action: CR.Action) => {
switch (action.type) {
case 'ON_FILE_SAVE_RUN_TEST': {
onSaveHook(action.payload.languages)
}
}
}
13 changes: 13 additions & 0 deletionssrc/services/vscode/save.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
import * as vscode from 'vscode'

function onSaveHook(languageIds: string[]) {
// trigger command on save
vscode.workspace.onDidSaveTextDocument((document: vscode.TextDocument) => {
if (languageIds.includes(document.languageId) && document.uri.scheme === 'file') {
// do work
vscode.commands.executeCommand('coderoad.test_run')
}
})
}

export default onSaveHook
File renamed without changes.
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs'
import * as path from 'path'
import * as vscode from 'vscode'
import { exec, exists } from './node'
import { exec, exists } from '../node'

export async function isEmptyWorkspace(): Promise<boolean> {
const { stdout, stderr } = await exec('ls')
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp