Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 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
Prev Previous commit
Next Next commit
refactor files
  • Loading branch information
ShMcK committed Jun 2, 2019
commit 89045a36936d008763ff5b939c784741935848fc
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as CR from 'typings'
import * as storage from '../services/storage'
import { gitLoadCommits, gitClear } from '../services/git'
import * as storage from '../storage'
import { gitLoadCommits, gitClear } from '../../services/git'

export default async function loadSolution(): Promise<void> {
const [position, tutorial]: [CR.Position, CR.Tutorial | undefined] = await Promise.all([
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/commands/runTest.ts → src/editor/commands/runTest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getOutputChannel } from '../utils/channel'
import { exec } from '../utils/node'
import * as storage from '../services/storage'
import * as testResult from '../services/testResult'
import { getOutputChannel } from '../channel'
import { exec } from '../../services/node'
import * as storage from '../storage'
import * as testResult from '../../services/testResult'

// ensure only latest run_test action is taken
let currentId = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as vscode from 'vscode'
import * as CR from 'typings'

import fetch from '../utils/fetch'
import tutorialSetup from '../services/tutorialSetup'
import { loadProgressPosition } from '../services/position'
import * as storage from '../services/storage'
import rootSetup from '../services/rootSetup'
import { isEmptyWorkspace, openReadme } from '../utils/workspace'
import * as git from '../services/git'
import api from '../../services/api'
import tutorialSetup from '../../services/tutorialSetup'
import { loadProgressPosition } from '../../services/position'
import * as storage from '../storage'
import rootSetup from '../../services/rootSetup'
import { isEmptyWorkspace, openReadme } from '../workspace'
import * as git from '../../services/git'

/*
new
Expand Down Expand Up @@ -78,7 +78,7 @@ export default async function tutorialLoad(context: vscode.ExtensionContext): Pr
// }

// // load tutorial summaries
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await fetch({
// const tutorialsData: { [id: string]: CR.TutorialSummary } = await api({
// resource: 'getTutorialsSummary',
// })
// const selectableTutorials: TutorialQuickPickItem[] = Object.keys(tutorialsData).map(id => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff 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 '../services/node'

export async function isEmptyWorkspace(): Promise<boolean> {
const { stdout, stderr } = await exec('ls')
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode'

import createCommands from './commands'
import createCommands from './editor/commands'
import createViews from './views'

// this method is called when your extension is activated
Expand Down
2 changes: 1 addition & 1 deletion src/services/position.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as CR from 'typings'
import * as storage from './vscode/storage'
import * as storage from '../editor/storage'

export async function getInitial(tutorial: CR.Tutorial): Promise<CR.Position> {
const { data } = tutorial
Expand Down
2 changes: 1 addition & 1 deletion src/services/rootSetup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode'
import { setWorkspaceRoot } from '../services/node'
import { setStorage } from './vscode/storage'
import { setStorage } from '../editor/storage'

export default async function setupRoot(context: vscode.ExtensionContext) {
await setWorkspaceRoot()
Expand Down
2 changes: 1 addition & 1 deletion src/services/testResult.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as CR from 'typings'
import * as vscode from 'vscode'
import * as storage from './vscode/storage'
import * as storage from '../editor/storage'


export async function onSuccess(position: CR.Position) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/tutorialSetup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as CR from 'typings'
import * as position from '../services/position'
import * as storage from '../services/vscode/storage'
import { isEmptyWorkspace } from '../services/vscode/workspace'
import * as storage from '../editor/storage'
import { isEmptyWorkspace } from '../editor/workspace'
import { gitLoadCommits, gitInitIfNotExists, gitSetupRemote } from '../services/git'

const testRepo = 'https://github.com/ShMcK/coderoad-tutorial-basic.git'
Expand Down
2 changes: 1 addition & 1 deletion src/state/actions/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assign, send } from 'xstate'
import * as CR from 'typings'
import * as storage from '../../services/storage'
import * as storage from '../../editor/storage'
import * as git from '../../services/git'

let initialTutorial: CR.Tutorial | undefined
Expand Down