@daiyam/artifact-vsx-ts 0.8.2 → 0.9.0

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,70 @@
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
+ if [ -z "$LATEST_TAG" ]; then
17
+ echo "No tags found in the repository"
18
+ exit 1
19
+ fi
20
+ echo "VERSION=$LATEST_TAG" >> $GITHUB_ENV
21
+ echo "Using version: $LATEST_TAG"
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v6
24
+ with:
25
+ node-version-file: '.nvmrc'
26
+ - name: Update package.json
27
+ run: |
28
+ TIME_PATCH="$(date +%-y)$(printf "%04d" $(($(date +%-j) * 24 + $(date +%-H))))"
29
+ VERSION="${VERSION#v}-$TIME_PATCH"
30
+ echo "Using version: $VERSION"
31
+
32
+ jq --arg version "$VERSION" '.version = $version | .preview = true' package.json > package.json.tmp
33
+ mv package.json.tmp package.json
34
+
35
+ jq -r '"version: \(.version)\npreview: \(.preview)"' package.json
36
+
37
+ echo "RELEASE_TAG=v$VERSION" >> $GITHUB_ENV
38
+ - name: Build
39
+ run: |
40
+ npm ci
41
+ npm install -g @vscode/vsce
42
+ npm run package
43
+ VSIX_NAME=$(ls *.vsix)
44
+ CHECKSUM=$(sha256sum $VSIX_NAME | cut -d ' ' -f 1)
45
+ echo "VSIX_NAME=$VSIX_NAME" >> $GITHUB_ENV
46
+ echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
47
+ echo "$CHECKSUM" > "$VSIX_NAME.sha256"
48
+ - name: Release
49
+ uses: softprops/action-gh-release@v2
50
+ with:
51
+ files: |
52
+ ${{ env.VSIX_NAME }}
53
+ ${{ env.VSIX_NAME }}.sha256
54
+ name: ${{ env.RELEASE_TAG }}
55
+ tag_name: ${{ env.RELEASE_TAG }}
56
+ prerelease: true
57
+ body: |
58
+ Release ${{ env.RELEASE_TAG }}
59
+
60
+ ## What's Changed
61
+
62
+ ## Installation
63
+ 1. [Download the .vsix file](${{ github.server_url }}/${{ github.repository }}/releases/download/${{ env.VERSION }}/${{ env.VSIX_NAME }})
64
+ 2. In your editor, open the Command Palette (<kbd>Meta</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
65
+ 3. Type `Install from VSIX` and select the downloaded file
66
+
67
+ ## Checksum (SHA-256)
68
+ ```
69
+ ${{ env.CHECKSUM }}
70
+ ```
package/configs/gitignore CHANGED
@@ -1,4 +1,4 @@
1
- lib
2
- out
3
- .vscode-test/
4
- *.vsix
1
+ /lib/
2
+ /out/
3
+ /.vscode-test/
4
+ /*.vsix
@@ -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.2",
3
+ "version": "0.9.0",
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": "23c10e38663fb3db36447d806495b23d74f7cc65"
34
+ "gitHead": "5bfb6ad591ff26ab3580a41607822157aebcf2b5"
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
- }