-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🔧 add extension configuration and settings validation
- Loading branch information
Showing
5 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"properties": {} | ||
"properties": { | ||
"extension-starter-kit.files.includes": { | ||
"type": "array", | ||
"default": [ | ||
"**/*" | ||
], | ||
"scope": "resource", | ||
"description": "Glob patterns to include in the package. The default is all files." | ||
}, | ||
"extension-starter-kit.files.excludes": { | ||
"type": "array", | ||
"default": [ | ||
"**/node_modules/**" | ||
], | ||
"scope": "resource", | ||
"description": "Glob patterns to exclude from the package. The default is node_modules." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { WorkspaceConfiguration } from 'vscode'; | ||
import { EXCLUDE, INCLUDE } from './constants'; | ||
|
||
/** | ||
* The Config class. | ||
* | ||
* @class | ||
* @classdesc The class that represents the configuration of the extension. | ||
* @export | ||
* @public | ||
* @property {string[]} include - The files to include | ||
* @property {string[]} exclude - The files to exclude | ||
* @example | ||
* const config = new Config(workspace.getConfiguration()); | ||
* console.log(config.include); | ||
* console.log(config.exclude); | ||
*/ | ||
export class Config { | ||
// Public properties | ||
/** | ||
* The files to include. | ||
* @type {string[]} | ||
* @public | ||
* @memberof Config | ||
* @example | ||
* const config = new Config(workspace.getConfiguration()); | ||
* console.log(config.include); | ||
*/ | ||
include: string[]; | ||
|
||
/** | ||
* The files to exclude. | ||
* @type {string[]} | ||
* @public | ||
* @memberof Config | ||
* @example | ||
* const config = new Config(workspace.getConfiguration()); | ||
* console.log(config.exclude); | ||
*/ | ||
exclude: string[]; | ||
|
||
/** | ||
* Constructor for the Config class. | ||
* | ||
* @param {WorkspaceConfiguration} config - The workspace configuration | ||
*/ | ||
constructor(config: WorkspaceConfiguration) { | ||
this.include = config.get<string[]>('files.include') ?? INCLUDE; | ||
this.exclude = config.get<string[]>('files.exclude') ?? EXCLUDE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* EXTENSION_ID: The unique identifier of the extension. | ||
* @type {string} | ||
* @public | ||
* @memberof Constants | ||
* @example | ||
* console.log(EXTENSION_ID); | ||
* | ||
* @returns {string} - The unique identifier of the extension | ||
*/ | ||
export const EXTENSION_ID = 'extension-starter-kit'; | ||
|
||
/** | ||
* INCLUDE: The files to include. | ||
* @type {string[]} | ||
* @public | ||
* @memberof Constants | ||
* @example | ||
* console.log(INCLUDE); | ||
* | ||
* @returns {string[]} - The files to include | ||
*/ | ||
export const INCLUDE = ['**/*']; | ||
/** | ||
* EXCLUDE: The files to exclude. | ||
* @type {string[]} | ||
* @public | ||
* @memberof Constants | ||
* @example | ||
* console.log(EXCLUDE); | ||
* | ||
* @returns {string[]} - The files to exclude | ||
*/ | ||
export const EXCLUDE = ['**/node_modules/**']; |