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

Validate app versions#278

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 3 commits intomasterfromvalidate-app-versions
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes fromall 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
6 changes: 5 additions & 1 deletionCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,4 +48,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

##[0.2.4]

- Support VSCode 1.39.2
- Support VSCode 1.39.2

##[0.3.0]

- Validate the extension version against the tutorial config version. This should allow us to manage breaking changes in tutorial schema in upcoming versions
6 changes: 3 additions & 3 deletionserrors/GitProjectAlreadyExists.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
### GitProject Already Exists
### GitRemote Already Exists

CodeRoad requires an emptyGitproject.
Have you started this tutorial before in this workspace? TheGitremote already exists.

Open a new workspace to start a tutorial.
Consider deleting your `.git` folder and restarting.
5 changes: 5 additions & 0 deletionserrors/GitRemoteAlreadyExists.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
### Git Project Already Exists

CodeRoad requires an empty Git project.

Open a new workspace to start a tutorial.
3 changes: 3 additions & 0 deletionserrors/UnmetExtensionVersion.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
### Unmet Tutorial Dependency

This tutorial requires a different version of CodeRoad.
2 changes: 0 additions & 2 deletionserrors/UnmetTutorialDependency.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
### Unmet Tutorial Dependency

### Unmet Tutorial Dependency

Tutorial cannot reun because a dependency version doesn't match. Install the correct dependency and click "Check Again".
2 changes: 1 addition & 1 deletionpackage-lock.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

4 changes: 2 additions & 2 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name":"coderoad",
"version":"0.2.4",
"version":"0.3.0",
"description":"Play interactive coding tutorials in your editor",
"keywords": [
"tutorial",
Expand DownExpand Up@@ -82,4 +82,4 @@
},
"preview":true,
"publisher":"CodeRoad"
}
}
26 changes: 23 additions & 3 deletionssrc/channel/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ import * as T from 'typings'
import * as TT from 'typings/tutorial'
import * as E from 'typings/error'
import * as vscode from 'vscode'
import { satisfies } from 'semver'
import saveCommit from '../actions/saveCommit'
import setupActions from '../actions/setupActions'
import solutionActions from '../actions/solutionActions'
Expand DownExpand Up@@ -110,6 +111,25 @@ class Channel implements Channel {
case 'EDITOR_TUTORIAL_CONFIG':
try {
const data: TT.Tutorial = action.payload.tutorial

// validate extension version
const expectedAppVersion = data.config?.appVersions?.vscode
if (expectedAppVersion) {
const extension = vscode.extensions.getExtension('coderoad.coderoad')
if (extension) {
const currentAppVersion = extension.packageJSON.version
const satisfied = satisfies(currentAppVersion, expectedAppVersion)
if (!satisfied) {
const error: E.ErrorMessage = {
type: 'UnmetExtensionVersion',
message: `Expected CodeRoad v${expectedAppVersion}, but found v${currentAppVersion}`,
}
this.send({ type: 'TUTORIAL_CONFIGURE_FAIL', payload: { error } })
return
}
}
}

// setup tutorial config (save watcher, test runner, etc)
await this.context.setTutorial(this.workspaceState, data)

Expand All@@ -121,7 +141,7 @@ class Channel implements Channel {
const currentVersion: string | null = await version(dep.name)
if (!currentVersion) {
// use a custom error message
const error = {
const error: E.ErrorMessage = {
type: 'MissingTutorialDependency',
message:
dep.message || `Process "${dep.name}" is required but not found. It may need to be installed`,
Expand All@@ -140,7 +160,7 @@ class Channel implements Channel {
const satisfiedDependency = await compareVersions(currentVersion, dep.version)

if (!satisfiedDependency) {
const error = {
const error: E.ErrorMessage = {
type: 'UnmetTutorialDependency',
message: `Expected ${dep.name} to have version ${dep.version}, but found version ${currentVersion}`,
actions: [
Expand All@@ -155,7 +175,7 @@ class Channel implements Channel {
}

if (satisfiedDependency !== true) {
const error = satisfiedDependency || {
const error: E.ErrorMessage = satisfiedDependency || {
type: 'UnknownError',
message: `Something went wrong comparing dependency for ${name}`,
actions: [
Expand Down
11 changes: 7 additions & 4 deletionstypings/error.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
export type ErrorMessageView = 'FULL_PAGE' | 'NOTIFY' | 'NONE'

export type ErrorMessageType =
| 'UnknownError'
| 'NoWorkspaceFound'
| 'GitNotFound'
| 'WorkspaceNotEmpty'
| 'FailedToConnectToGitRepo'
| 'GitNotFound'
| 'GitProjectAlreadyExists'
| 'GitRemoteAlreadyExists'
| 'MissingTutorialDependency'
| 'NoWorkspaceFound'
| 'UnknownError'
| 'UnmetExtensionVersion'
| 'UnmetTutorialDependency'
| 'WorkspaceNotEmpty'

export type ErrorAction = {
label: string
Expand Down
5 changes: 5 additions & 0 deletionstypings/tutorial.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
export type Maybe<T> = T | null

export type TutorialConfig = {
appVersions: TutorialAppVersions
testRunner: TutorialTestRunner
repo: TutorialRepo
dependencies?: TutorialDependency[]
Expand DownExpand Up@@ -64,3 +65,7 @@ export interface TutorialDependency {
version: string
message?: string
}

export interface TutorialAppVersions {
vscode: string
}
2 changes: 1 addition & 1 deletionweb-app/package-lock.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

4 changes: 2 additions & 2 deletionsweb-app/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
{
"name":"coderoad-app",
"version":"0.2.4",
"version":"0.3.0",
"private":true,
"scripts": {
"build":"react-app-rewired build",
Expand DownExpand Up@@ -73,4 +73,4 @@
"typescript":"^3.8.3",
"typescript-eslint-parser":"^22.0.0"
}
}
}

[8]ページ先頭

©2009-2025 Movatter.jp