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

Setup#3

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 23 commits intomasterfromxstate
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
820097a
setup level/stage tree
ShMcKMay 27, 2019
32edbcf
setup xstate machine as core
ShMcKJun 2, 2019
4be011f
setup start w/ continue or new
ShMcKJun 2, 2019
6993147
add machine loadTutorial
ShMcKJun 2, 2019
04653e2
setup tutorial initialization
ShMcKJun 2, 2019
b51dd2f
refactor files
ShMcKJun 2, 2019
89045a3
refactor files
ShMcKJun 2, 2019
9bcf64c
refactor storage into editor
ShMcKJun 2, 2019
cc176e6
update deps
ShMcKJun 2, 2019
e88651e
setup xstate with interpreter
ShMcKJun 2, 2019
f8c527e
cleanup start
ShMcKJun 2, 2019
634a6d4
Merge pull request #2 from ShMcK/feature/treeview
Jun 2, 2019
9241fef
add createWebview logic
ShMcKJun 2, 2019
563874f
initialize webview
ShMcKJun 2, 2019
54e06de
setup web-app
ShMcKJun 4, 2019
81a1041
setup react liniting & tsconfig
ShMcKJun 4, 2019
aa1a8b8
refactor out path to build
ShMcKJun 4, 2019
69b7e81
working react in vscode
ShMcKJun 8, 2019
c4a05ca
cleanup inline script
ShMcKJun 8, 2019
826f2e7
update deps
ShMcKJun 8, 2019
97cf2a1
setup storybook & components
ShMcKJun 8, 2019
567c6a6
setup concurrent build script
ShMcKJun 8, 2019
01d2669
resolve alifd/next style issues
ShMcKJun 8, 2019
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
cleanup start
  • Loading branch information
@ShMcK
ShMcK committedJun 2, 2019
commitf8c527e198f84dca34b64de5c6fdd2302bd82e3d
8 changes: 4 additions & 4 deletionssrc/editor/commands/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 start from './start'

// import runTest from './runTest'
import start from './start'
// import loadSolution from './loadSolution'
// import quit from './quit'

Expand All@@ -13,11 +13,11 @@ const COMMANDS = {
// QUIT: 'coderoad.quit',
}


export default (context: vscode.ExtensionContext): void => {
const commands = {
[COMMANDS.START](): void {
console.log('TUTORIAL_START')
start(context)
[COMMANDS.START]: async function startCommand(): Promise<void> {
return start(context)
},
// [COMMANDS.RUN_TEST]: runTest,
// [COMMANDS.LOAD_SOLUTION]: loadSolution,
Expand Down
108 changes: 108 additions & 0 deletionssrc/editor/commands/start-old.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
import * as vscode from 'vscode'
import * as CR from 'typings'

import tutorialSetup from '../../services/tutorialSetup'
import { isEmptyWorkspace, openReadme } from '../workspace'
import { setWorkspaceRoot } from '../../services/node'
import { setStorage } from '../../editor/storage'

/*
new
if current workspace is empty, use it
if not, open a new folder then start
*/

// async function continueTutorial() {
// // TODO: verify that tutorial is loaded in workspace
// // TODO: verify progress
// // TODO: verify setup
// await loadProgressPosition()
// await openReadme()
// }

async function newTutorial(tutorial: CR.Tutorial) {
// if workspace isn't empty, clear it out if given permission
const isEmpty: boolean = await isEmptyWorkspace()
if (!isEmpty) {
// eslint-disable-next-line
const options = ['Open a new folder', 'I\'ll clear the files and folders myself']
const shouldOpenFolder = await vscode.window.showQuickPick(options)
if (shouldOpenFolder === options[0]) {
await vscode.commands.executeCommand('vscode.openFolder')
}
}

await tutorialSetup(tutorial)
await openReadme()
}


export default async function start(context: vscode.ExtensionContext): Promise<void> {
console.log('start', context)


return;

// const modes = ['New']

// const canContinue = await validateCanContinue()
// if (canContinue) {
// modes.push('Continue')
// }

// const selectedMode: string | undefined = await vscode.window.showQuickPick(modes)

// if (!selectedMode) {
// throw new Error('No mode selected')
// return
// }

// interface TutorialQuickPickItem extends vscode.QuickPickItem {
// id: string
// }

// // load tutorial summaries
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await api({
// resource: 'getTutorialsSummary',
// })
// const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
// const tutorial = tutorialsData[id]
// return {
// label: tutorial.title,
// description: tutorial.description,
// // detail: '', // optional additional info
// id,
// }
// })
// const selectedTutorial: TutorialQuickPickItem | undefined = await vscode.window.showQuickPick(selectableTutorials)

// if (!selectedTutorial) {
// throw new Error('No tutorial selected')
// }

// // load specific tutorial
// const tutorial: CR.Tutorial | undefined = await fetch({
// resource: 'getTutorial',
// params: { id: selectedTutorial.id },
// })

// if (!tutorial) {
// throw new Error('No tutorial found')
// }

// switch (selectedMode) {
// // new tutorial
// case modes[0]:
// await newTutorial(tutorial)
// break
// // continue
// case modes[1]:
// await continueTutorial()
// break
// }

// // setup hook to run tests on save


// TODO: start
}
145 changes: 38 additions & 107 deletionssrc/editor/commands/start.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,45 @@
import * as vscode from 'vscode'
import * as CR from 'typings'

import tutorialSetup from '../../services/tutorialSetup'
import { isEmptyWorkspace, openReadme } from '../workspace'
import { setWorkspaceRoot } from '../../services/node'
import { setStorage } from '../../editor/storage'
import createStateMachine from '../../state'

/*
new
if current workspace is empty, use it
if not, open a new folder then start
*/

// async function continueTutorial() {
// // TODO: verify that tutorial is loaded in workspace
// // TODO: verify progress
// // TODO: verify setup
// await loadProgressPosition()
// await openReadme()
// }

async function newTutorial(tutorial: CR.Tutorial) {
// if workspace isn't empty, clear it out if given permission
const isEmpty: boolean = await isEmptyWorkspace()
if (!isEmpty) {
// eslint-disable-next-line
const options = ['Open a new folder', 'I\'ll clear the files and folders myself']
const shouldOpenFolder = await vscode.window.showQuickPick(options)
if (shouldOpenFolder === options[0]) {
await vscode.commands.executeCommand('vscode.openFolder')
}
}
import { activate as activateMachine, default as machine } from '../../state'
import * as storage from '../../services/storage'
import * as git from '../../services/git'
import * as CR from 'typings'

await tutorialSetup(tutorial)
await openReadme()
let initialTutorial: CR.Tutorial | undefined
let initialProgress: CR.Progress = {
levels: {},
stages: {},
steps: {},
complete: false,
}


export default async function start(context: vscode.ExtensionContext): Promise<void> {
console.log('start', context)

// setup connection to workspace
await setWorkspaceRoot()
// set workspace context path
await setStorage(context.workspaceState)
// initiate the state machine
createStateMachine()
return;

// const modes = ['New']

// const canContinue = await validateCanContinue()
// if (canContinue) {
// modes.push('Continue')
// }

// const selectedMode: string | undefined = await vscode.window.showQuickPick(modes)

// if (!selectedMode) {
// throw new Error('No mode selected')
// return
// }

// interface TutorialQuickPickItem extends vscode.QuickPickItem {
// id: string
// }

// // load tutorial summaries
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await api({
// resource: 'getTutorialsSummary',
// })
// const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
// const tutorial = tutorialsData[id]
// return {
// label: tutorial.title,
// description: tutorial.description,
// // detail: '', // optional additional info
// id,
// }
// })
// const selectedTutorial: TutorialQuickPickItem | undefined = await vscode.window.showQuickPick(selectableTutorials)

// if (!selectedTutorial) {
// throw new Error('No tutorial selected')
// }

// // load specific tutorial
// const tutorial: CR.Tutorial | undefined = await fetch({
// resource: 'getTutorial',
// params: { id: selectedTutorial.id },
// })

// if (!tutorial) {
// throw new Error('No tutorial found')
// }

// switch (selectedMode) {
// // new tutorial
// case modes[0]:
// await newTutorial(tutorial)
// break
// // continue
// case modes[1]:
// await continueTutorial()
// break
// }

// // setup hook to run tests on save


// TODO: start
}
console.log('TUTORIAL_START')

// setup connection to workspace
await setWorkspaceRoot()
// set workspace context path
await setStorage(context.workspaceState)

// initialize state machine
activateMachine()

console.log('ACTION: start')

// verify that the user has a tutorial & progress
// verify git is setup with a coderoad remote
const [tutorial, progress, hasGit, hasGitRemote] = await Promise.all([
storage.getTutorial(),
storage.getProgress(),
git.gitVersion(),
git.gitCheckRemoteExists(),
])
initialTutorial = tutorial
initialProgress = progress
const canContinue = !!(tutorial && progress && hasGit && hasGitRemote)
console.log('canContinue', canContinue)
// if a tutorial exists, "CONTINUE"
// otherwise start from "NEW"
machine.send(canContinue ? 'CONTINUE' : 'NEW')
}
10 changes: 5 additions & 5 deletionssrc/editor/init.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,9 +2,9 @@
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode'

import { deactivate as deactivateMachine } from '../state'
import createCommands from './commands'
import createViews from './views'
import createStateMachine from '../state'

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
Expand All@@ -14,13 +14,11 @@ export function activate(context: vscode.ExtensionContext) {
// commands
createCommands(context)

// tasks
// add tasks here

// views
createViews(context)


// tasks
// add tasks here
}

// this method is called when your extension is deactivated
Expand All@@ -30,4 +28,6 @@ export function deactivate(context: vscode.ExtensionContext): void {
for (const disposable of context.subscriptions) {
disposable.dispose()
}
// shut down state machine
deactivateMachine()
}
19 changes: 1 addition & 18 deletionssrc/state/actions/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
import { assign, send } from 'xstate'
import { assign } from 'xstate'
import * as CR from 'typings'
import * as storage from '../../services/storage'
import * as git from '../../services/git'
Expand All@@ -12,23 +12,6 @@ let initialProgress: CR.Progress = {
}

export default {
start: async () => {
console.log('ACTION: start')
// verify that the user has a tutorial & progress
// verify git is setup with a coderoad remote
const [tutorial, progress, hasGit, hasGitRemote] = await Promise.all([
storage.getTutorial(),
storage.getProgress(),
git.gitVersion(),
git.gitCheckRemoteExists(),
])
initialTutorial = tutorial
initialProgress = progress
const canContinue = !!(tutorial && progress && hasGit && hasGitRemote)
// if a tutorial exists, "CONTINUE"
// otherwise start from "NEW"
send(canContinue ? 'CONTINUE' : 'NEW')
},
tutorialLoad: assign({
// load initial data, progress & position
data(): CR.TutorialData {
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp