@daiyam/artifact-vsx-ts 0.8.3 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ name: Preview
2
+ on:
3
+ workflow_dispatch: null
4
+ jobs:
5
+ publish:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Checkout code
9
+ uses: actions/checkout@v6
10
+ with:
11
+ fetch-depth: 0
12
+ - name: Get Version
13
+ run: |
14
+ # Get the latest tag
15
+ LATEST_TAG=$(git tag --sort=-v:refname | head -n1)
16
+ LATEST_TAG=${LATEST_TAG%-*}
17
+ if [ -z "$LATEST_TAG" ]; then
18
+ echo "No tags found in the repository"
19
+ exit 1
20
+ fi
21
+ echo "VERSION=$LATEST_TAG" >> $GITHUB_ENV
22
+ echo "Using version: $LATEST_TAG"
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v6
25
+ with:
26
+ node-version-file: '.nvmrc'
27
+ - name: Update package.json
28
+ run: |
29
+ TIME_PATCH="$(date +%-y)$(printf "%04d" $(($(date +%-j) * 24 + $(date +%-H))))"
30
+ VERSION="${VERSION#v}-$TIME_PATCH"
31
+ echo "Using version: $VERSION"
32
+
33
+ jq --arg version "$VERSION" '.version = $version | .preview = true' package.json > package.json.tmp
34
+ mv package.json.tmp package.json
35
+
36
+ jq -r '"version: \(.version)\npreview: \(.preview)"' package.json
37
+
38
+ echo "RELEASE_TAG=v$VERSION" >> $GITHUB_ENV
39
+ - name: Build
40
+ run: |
41
+ npm ci
42
+ npm install -g @vscode/vsce
43
+ npm run package
44
+ VSIX_NAME=$(ls *.vsix)
45
+ CHECKSUM=$(sha256sum $VSIX_NAME | cut -d ' ' -f 1)
46
+ echo "VSIX_NAME=$VSIX_NAME" >> $GITHUB_ENV
47
+ echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
48
+ echo "$CHECKSUM" > "$VSIX_NAME.sha256"
49
+ - name: Release
50
+ uses: softprops/action-gh-release@v2
51
+ with:
52
+ files: |
53
+ ${{ env.VSIX_NAME }}
54
+ ${{ env.VSIX_NAME }}.sha256
55
+ name: ${{ env.RELEASE_TAG }}
56
+ tag_name: ${{ env.RELEASE_TAG }}
57
+ prerelease: true
58
+ body: |
59
+ Release ${{ env.RELEASE_TAG }}
60
+
61
+ ## What's Changed
62
+
63
+ ## Installation
64
+ 1. [Download the .vsix file](${{ github.server_url }}/${{ github.repository }}/releases/download/${{ env.VERSION }}/${{ env.VSIX_NAME }})
65
+ 2. In your editor, open the Command Palette (<kbd>Meta</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
66
+ 3. Type `Install from VSIX` and select the downloaded file
67
+
68
+ ## Checksum (SHA-256)
69
+ ```
70
+ ${{ env.CHECKSUM }}
71
+ ```
@@ -12,6 +12,11 @@
12
12
  "vscode:prepublish": "npm run compile:src && npm run bundle",
13
13
  "watch:src": "tsc-watch -p src --onSuccess 'npm run bundle'"
14
14
  },
15
+ "dependencies": {
16
+ "@zokugun/fs-extra-plus": "^0.3.3",
17
+ "@zokugun/is-it-type": "^0.5.2",
18
+ "@zokugun/xtry": "^0.10.1"
19
+ },
15
20
  "devDependencies": {
16
21
  "@types/vscode": "^1.23.0",
17
22
  "release-it": "^19.2.4",
@@ -1,4 +1,4 @@
1
- import { getDebugChannel } from '../utils/settings.js';
1
+ import { getDebugChannel } from '../settings.js';
2
2
 
3
3
  export async function hello(): Promise<void> {
4
4
  const channel = getDebugChannel(true)!;
@@ -1,6 +1,6 @@
1
1
  import * as vscode from 'vscode';
2
2
  import { Disposable } from './utils/disposable.js';
3
- import { CONFIG_KEY, getDebugChannel } from './utils/settings.js';
3
+ import { CONFIG_KEY, getDebugChannel } from './settings.js';
4
4
 
5
5
  export class DocumentManager implements vscode.Disposable {
6
6
  private readonly disposable: Disposable = new Disposable();
@@ -1,7 +1,7 @@
1
1
  import vscode from 'vscode';
2
2
  import pkg from '../package.json';
3
3
  import { DocumentManager } from './document-manager.js';
4
- import { CONFIG_KEY, setupSettings } from './utils/settings.js';
4
+ import { CONFIG_KEY, setupSettings } from './settings.js';
5
5
  import { hello } from './commands/hello.js';
6
6
 
7
7
  const VERSION_KEY = 'version';
@@ -0,0 +1,33 @@
1
+ import path from 'path';
2
+ import fse from '@zokugun/fs-extra-plus/async';
3
+ import { err, OK, type Result } from '@zokugun/xtry';
4
+ import type vscode from 'vscode';
5
+
6
+ export const CONFIG_KEY = 'EXT_CFG_KEY';
7
+
8
+ /* eslint-disable import/no-mutable-exports, @typescript-eslint/naming-convention */
9
+ export let EXTENSION_ID: string = '';
10
+ export let EXTENSION_NAME: string = '';
11
+ export let GLOBAL_STORAGE: string = '';
12
+ export let TEMPORARY_DIR: string = '';
13
+ export let WORKSPACE_STORAGE: string | undefined;
14
+ /* eslint-enable */
15
+
16
+ let $context: vscode.ExtensionContext | null = null;
17
+
18
+ export async function setupSettings(context: vscode.ExtensionContext): Promise<Result<void, string>> {
19
+ EXTENSION_NAME = context.extension.packageJSON.displayName as string;
20
+ EXTENSION_ID = context.extension.id;
21
+ GLOBAL_STORAGE = context.globalStorageUri.fsPath;
22
+ TEMPORARY_DIR = path.join(GLOBAL_STORAGE, 'temp');
23
+ WORKSPACE_STORAGE = context.storageUri?.fsPath;
24
+
25
+ $context = context;
26
+
27
+ const result = await fse.ensureDir(TEMPORARY_DIR);
28
+ if(result.fails) {
29
+ return err(`Cannot ensure the directory ${TEMPORARY_DIR}`);
30
+ }
31
+
32
+ return OK;
33
+ }
@@ -0,0 +1,60 @@
1
+ import { inspect } from 'node:util';
2
+ import { isPrimitive } from '@zokugun/is-it-type';
3
+ import vscode, { window } from 'vscode';
4
+ import { CONFIG_KEY } from '../settings.js';
5
+
6
+ let $channel: vscode.OutputChannel | null = null;
7
+
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
9
+ export const Logger = {
10
+ debug(...args: unknown[]): void {
11
+ if($channel) {
12
+ $channel.appendLine(`[debug] ${args.map(toString).join(' ')}`);
13
+ }
14
+ },
15
+ error(...args: unknown[]): void {
16
+ const config = vscode.workspace.getConfiguration(CONFIG_KEY);
17
+ const showErrorAlert = config.get<boolean>('showErrorAlert') ?? true;
18
+
19
+ if(Boolean($channel) || showErrorAlert) {
20
+ const output = args.map(toString).join(' ');
21
+
22
+ if($channel) {
23
+ $channel.appendLine(`[error] ${output}`);
24
+ }
25
+
26
+ if(showErrorAlert) {
27
+ void window.showErrorMessage(`VSIX Manager: ${output}`);
28
+ }
29
+ }
30
+ },
31
+ info(...args: unknown[]): void {
32
+ if($channel) {
33
+ $channel.appendLine(`[info] ${args.map(toString).join(' ')}`);
34
+ }
35
+ },
36
+ setup(show: boolean = false): void {
37
+ const config = vscode.workspace.getConfiguration(CONFIG_KEY);
38
+ const debug = config.get<boolean>('debug') ?? false;
39
+
40
+ if(debug) {
41
+ $channel ||= vscode.window.createOutputChannel('VSIX Manager');
42
+ }
43
+
44
+ if(show) {
45
+ $channel?.show();
46
+ }
47
+ },
48
+ show(): void {
49
+ $channel?.show();
50
+ },
51
+ };
52
+
53
+ function toString(value: unknown): string {
54
+ if(isPrimitive(value)) {
55
+ return `${value}`;
56
+ }
57
+ else {
58
+ return inspect(value, { depth: null, compact: true, breakLength: Infinity });
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daiyam/artifact-vsx-ts",
3
- "version": "0.8.3",
3
+ "version": "0.9.1",
4
4
  "description": "The configuration to create Visual Studio extensions and publish them on Visual Studio Marketplace and Open VSX Registry.",
5
5
  "author": {
6
6
  "name": "Baptiste Augrain",
@@ -31,5 +31,5 @@
31
31
  "project-template",
32
32
  "scaffold"
33
33
  ],
34
- "gitHead": "3bdcf904838be4240bcc98ce8c9fdd64ab8a733b"
34
+ "gitHead": "27569be7b62dee76c9ddc5b8a563bd5dc5028ba4"
35
35
  }
@@ -1,30 +0,0 @@
1
- import vscode from 'vscode';
2
-
3
- export const CONFIG_KEY = 'EXT_CFG_KEY';
4
-
5
- /* eslint-disable import/no-mutable-exports, @typescript-eslint/naming-convention */
6
- export let EXTENSION_NAME: string = '';
7
- /* eslint-enable */
8
-
9
- let $channel: vscode.OutputChannel | null = null;
10
- let $context: vscode.ExtensionContext | null = null;
11
-
12
- export function getContext(): vscode.ExtensionContext {
13
- return $context!;
14
- }
15
-
16
- export function getDebugChannel(debug: boolean): vscode.OutputChannel | undefined { // {{{
17
- if(debug) {
18
- $channel ??= vscode.window.createOutputChannel(EXTENSION_NAME);
19
-
20
- return $channel;
21
- }
22
-
23
- return undefined;
24
- } // }}}
25
-
26
- export async function setupSettings(context: vscode.ExtensionContext) {
27
- EXTENSION_NAME = context.extension.packageJSON.displayName as string;
28
-
29
- $context = context;
30
- }