Skip to content

Commit

Permalink
feat: ✨ update dependencies, improve warning messages, and add test c…
Browse files Browse the repository at this point in the history
…onfiguration
  • Loading branch information
ManuelGil committed Jan 8, 2025
1 parent 14654e7 commit edfe0a9
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.10.0
v22.10.0
5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.17.0] - 2025-01-08

### Added

- Add VS Code test configuration and update test scripts.

### Changed

- Improve the warning messages in the `FileController` class when the file is not found.
- Upgrade dependencies to the latest versions available.

## [1.16.1] - 2025-01-06

### Fixed
Expand Down Expand Up @@ -166,7 +177,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add basic functionality for generating barrel files.
- Add support for TypeScript and JavaScript projects.

[Unreleased]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.16.1...HEAD
[Unreleased]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.17.0...HEAD
[1.17.0]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.16.1...v1.17.0
[1.16.1]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.16.0...v1.16.1
[1.16.0]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.15.0...v1.16.0
[1.15.0]: https://github.com/ManuelGil/vscode-auto-barrel/compare/v1.14.0...v1.15.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ This extension is inspired by the [auto-barrel](https://github.com/mike-hanson/a

## Requirements

- VSCode 1.76.0 or later
- VSCode 1.90.0 or later

## Features

Expand Down
3 changes: 2 additions & 1 deletion l10n/bundle.l10n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
"Welcome to {0} version {1}! The extension is now active": "¡Bienvenido a {0} versión {1}! La extensión ahora está activa",
"New version of {0} is available. Check out the release notes for version {1}": "Hay disponible una nueva versión de {0}. Consulte las notas de la versión {1}",
"Release Notes": "Notas de la versión",
"Close": "Cerrar",
"The folder is not valid!": "¡La carpeta no es válida!",
"The folder is not in the workspace!": "¡La carpeta no está en el espacio de trabajo!",
"Remember to update the barrel file": "Recuerda actualizar el archivo barrel",
"The file does not exist!": "¡El archivo no existe!",
"No files found in the folder!": "¡No se encontraron archivos en la carpeta!",
"The {0} folder is empty!": "¡La carpeta {0} está vacía!",
"No files found matching the specified patterns!": "¡No se encontraron archivos que coincidan con los patrones especificados!",
"No files found matching the specified patterns in the {0} folder! Please check the include and exclude files in the settings": "¡No se encontraron archivos que coincidan con los patrones especificados en la carpeta {0}! Compruebe los archivos incluidos y excluidos en la configuración",
"The file has not been created!": "¡El archivo no ha sido creado!",
"File created successfully!": "¡Archivo creado con éxito!",
"File successfully updated!": "¡Archivo actualizado con éxito!",
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-auto-barrel",
"displayName": "Auto Barrel for VSCode",
"description": "🛢️ Automatically generate index files for your project.",
"version": "1.16.1",
"version": "1.17.0",
"icon": "icon.png",
"license": "MIT",
"publisher": "imgildev",
Expand All @@ -11,7 +11,7 @@
"url": "https://github.com/sponsors/ManuelGil"
},
"engines": {
"vscode": "^1.76.0"
"vscode": "^1.90.0"
},
"categories": [
"Other"
Expand Down Expand Up @@ -280,7 +280,7 @@
"format": "biome format --write",
"lint": "biome lint --write",
"lint:check": "biome check --write",
"test": "node ./out/test/runTest.js",
"test": "vscode-test",
"compodoc": "npx compodoc -p tsconfig.doc.json -d compodoc --theme readthedocs -s",
"prepare": "husky"
},
Expand All @@ -291,12 +291,12 @@
"@compodoc/compodoc": "^1.1.26",
"@types/mocha": "^10.0.10",
"@types/node": "^22.10.0",
"@types/vscode": "^1.76.0",
"@types/vscode": "^1.90.0",
"@vscode/l10n-dev": "^0.0.35",
"globals": "^15.12.0",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.4.1",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"mocha": "^10.8.2",
"rimraf": "^6.0.1",
"typescript": "^5.7.2",
"vscode-test": "^1.6.1"
Expand Down
12 changes: 12 additions & 0 deletions src/app/configs/constants.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ export const EXTENSION_DISPLAY_NAME: string = 'Auto Barrel';
*/
export const USER_NAME: string = 'ManuelGil';

/**
* USER_PUBLISHER: The publisher of the extension.
* @type {string}
* @public
* @memberof Constants
* @example
* console.log(USER_PUBLISHER);
*
* @returns {string} - The publisher of the extension
*/
export const USER_PUBLISHER: string = 'imgildev';

/**
* REPOSITORY_URL: The documentation URL of the extension.
* @type {string}
Expand Down
13 changes: 7 additions & 6 deletions src/app/controllers/files.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fg from 'fast-glob';
import * as fastGlob from 'fast-glob';
import {
access,
existsSync,
Expand Down Expand Up @@ -264,11 +264,12 @@ export class FilesController {
);

if (allFilesInFolder.length === 0) {
const message = l10n.t('The {0} folder is empty!', [folderPath]);
const message = l10n.t('The {0} folder is empty!', [relativePath]);
window.showWarningMessage(message);
} else {
const message = l10n.t(
'No files found matching the specified patterns!',
'No files found matching the specified patterns in the {0} folder! Please check the include and exclude files in the settings',
[relativePath],
);
window.showWarningMessage(message);
}
Expand Down Expand Up @@ -549,18 +550,18 @@ export class FilesController {

try {
// Use fast-glob to find matching files
let filePaths = await fg(include, options);
let foundFilePaths = await fastGlob(include, options);

if (gitignore) {
// Filter out files that are ignored by .gitignore
filePaths = filePaths.filter((filePath) => {
foundFilePaths = foundFilePaths.filter((filePath) => {
const relativePath = relative(baseDir, filePath); // Convert to relative paths
return !gitignore.ignores(relativePath);
});
}

// Convert file paths to VS Code Uri objects
return filePaths.sort().map((filePath) => Uri.file(filePath));
return foundFilePaths.sort().map((filePath) => Uri.file(filePath));
} catch (error) {
const message = l10n.t('Error while finding files: {0}', [error]);
window.showErrorMessage(message);
Expand Down
17 changes: 15 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import * as vscode from 'vscode';
import {
EXTENSION_DISPLAY_NAME,
EXTENSION_ID,
EXTENSION_NAME,
ExtensionConfig,
REPOSITORY_URL,
USER_PUBLISHER,
} from './app/configs';
import { FilesController } from './app/controllers';

Expand Down Expand Up @@ -109,20 +110,32 @@ export async function activate(context: vscode.ExtensionContext) {
{
title: vscode.l10n.t('Release Notes'),
},
{
title: vscode.l10n.t('Close'),
},
];

const message = vscode.l10n.t(
'New version of {0} is available. Check out the release notes for version {1}',
[EXTENSION_DISPLAY_NAME, currentVersion],
);
vscode.window.showInformationMessage(message, ...actions).then((option) => {
if (!option) {
return;
}

// Handle the actions
switch (option?.title) {
case actions[0].title:
vscode.env.openExternal(
vscode.Uri.parse(`${REPOSITORY_URL}/blob/main/CHANGELOG.md`),
vscode.Uri.parse(
`https://marketplace.visualstudio.com/items/${USER_PUBLISHER}.${EXTENSION_NAME}/changelog`,
),
);
break;

default:
break;
}
});

Expand Down
File renamed without changes.
23 changes: 0 additions & 23 deletions src/test/runTest.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/test/suite/index.ts

This file was deleted.

0 comments on commit edfe0a9

Please sign in to comment.