Skip to content

Commit

Permalink
feat(2.1.0): auto-start if workspace contains config file (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunSHamilton authored Jan 17, 2024
1 parent cecabd7 commit e5cc8ae
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 48 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Released]

##[2.1.0](#v2.1.0) (2024-01-18)

### Added

- `workspace.autoStart` configuration option
- Extension activates and auto-starts if `workspace.autoStart` is `true`

##[2.0.0](#v2.0.0) (2023-09-28)

### Removed
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

91 changes: 47 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
{
"name": "freecodecamp-courses",
"displayName": "freeCodeCamp - Courses",
"description": "Provides tooling for quick and easy selection of courses offered by freeCodeCamp",
"version": "2.0.0",
"activationEvents": [
"workspaceContains:**/freecodecamp.conf.json"
],
"author": "freeCodeCamp",
"publisher": "freeCodeCamp",
"galleryBanner": {
"color": "#0a0a23",
"theme": "dark"
},
"icon": "images/logo-128X128.png",
"engines": {
"vscode": "^1.82.0",
"node": "^20.0.0"
"bugs": {
"url": "https://github.com/freeCodeCamp/courses-vscode-extension/issues"
},
"categories": [
"Education"
],
"keywords": [
"freecodecamp",
"courses",
"web3",
"rust",
"backend"
],
"main": "./dist/extension.js",
"contributes": {
"jsonValidation": [
{
"fileMatch": "**/freecodecamp.conf.json",
"url": "./schema.json"
}
],
"commands": [
{
"command": "freecodecamp-courses.openCourse",
Expand All @@ -57,20 +35,18 @@
"command": "freecodecamp-courses.shutdownCourse",
"title": "freeCodeCamp: Shutdown Course"
}
],
"jsonValidation": [
{
"fileMatch": "**/freecodecamp.conf.json",
"url": "./schema.json"
}
]
},
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "webpack",
"watch": "webpack --watch",
"package": "webpack --mode production --devtool hidden-source-map",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"pack": "vsce package",
"deploy": "vsce publish",
"vsce": "vsce",
"test:pack": "npm run pack -- --no-git-tag-version --no-update-package-json 1.0.0 -o freecodecamp-courses-test.vsix"
"dependencies": {
"node-fetch": "3.3.2"
},
"description": "Provides tooling for quick and easy selection of courses offered by freeCodeCamp",
"devDependencies": {
"@types/node": "20.10.5",
"@types/vscode": "1.85.0",
Expand All @@ -83,15 +59,42 @@
"webpack": "5.89.0",
"webpack-cli": "5.1.4"
},
"displayName": "freeCodeCamp - Courses",
"engines": {
"node": "^20.0.0",
"vscode": "^1.85.0"
},
"galleryBanner": {
"color": "#0a0a23",
"theme": "dark"
},
"icon": "images/logo-128X128.png",
"keywords": [
"freecodecamp",
"courses",
"web3",
"rust",
"backend"
],
"license": "BSD-3-Clause",
"main": "./dist/extension.js",
"name": "freecodecamp-courses",
"publisher": "freeCodeCamp",
"repository": {
"type": "git",
"url": "https://github.com/freeCodeCamp/courses-vscode-extension"
},
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/freeCodeCamp/courses-vscode-extension/issues"
"scripts": {
"compile": "webpack",
"deploy": "vsce publish",
"lint": "eslint src --ext ts",
"pack": "vsce package",
"package": "webpack --mode production --devtool hidden-source-map",
"pretest": "npm run compile-tests && npm run compile && npm run lint",
"test:pack": "npm run pack -- --no-git-tag-version --no-update-package-json 1.0.0 -o freecodecamp-courses-test.vsix",
"vsce": "vsce",
"vscode:prepublish": "npm run package",
"watch": "webpack --watch"
},
"dependencies": {
"node-fetch": "3.3.2"
}
"version": "2.1.0"
}
12 changes: 11 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ import runCourse from "./commands/run-course";
import developCourse from "./commands/develop-course";
import createNewCourse from "./commands/create-new-course";
import collapse from "./commands/collapse";
import { getConfig } from "./usefuls";

export function activate(context: ExtensionContext) {
export async function activate(context: ExtensionContext) {
console.log("freeCodeCamp Courses extension is now active!");

try {
const config = await getConfig();
if (config.workspace?.autoStart) {
runCourse();
}
} catch (e) {
console.debug(e);
}

context.subscriptions.push(
commands.registerCommand("freecodecamp-courses.openCourse", async () => {
openCourse();
Expand Down
1 change: 1 addition & 0 deletions src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const exampleConfig: Config = {
},
workspace: {
// Workspace settings
autoStart: false, // Whether or not to automatically start course on open of VSCode
files: [
// Files to be opened in workspace
{
Expand Down
1 change: 1 addition & 0 deletions src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface Config {
"run-course": string;
};
workspace?: {
autoStart?: boolean;
files?: File[];
previews?: Preview[];
terminals?: Terminal[];
Expand Down

0 comments on commit e5cc8ae

Please sign in to comment.