|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Generate a ./extensions directory with names based on text files containing |
| 3 | +# randomly generated words. |
| 4 | + |
| 5 | +set -Eeuo pipefail |
| 6 | + |
| 7 | +dir=$(dirname "$0") |
| 8 | + |
| 9 | +# Pretty arbitrary but try to ensure we have a variety of extension kinds. |
| 10 | +kinds=("workspace", "ui,web", "workspace,web", "ui") |
| 11 | + |
| 12 | +while read -r publisher ; do |
| 13 | + i=0 |
| 14 | + while read -r name ; do |
| 15 | + kind=${kinds[$i]-workspace} |
| 16 | + ((++i)) |
| 17 | + while read -r version ; do |
| 18 | + dest="./extensions/$publisher/$name/$version" |
| 19 | + mkdir -p "$dest/extension/images" |
| 20 | + cat<<EOF > "$dest/extension.vsixmanifest" |
| 21 | +<?xml version="1.0" encoding="utf-8"?> |
| 22 | + <PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> |
| 23 | + <Metadata> |
| 24 | + <Identity Language="en-US" Id="$name" Version="$version" Publisher="$publisher" /> |
| 25 | + <DisplayName>$name</DisplayName> |
| 26 | + <Description xml:space="preserve">Mock extension for Visual Studio Code</Description> |
| 27 | + <Tags>$name,mock,tag1</Tags> |
| 28 | + <Categories>category1,category2</Categories> |
| 29 | + <GalleryFlags>Public</GalleryFlags> |
| 30 | +
|
| 31 | + <Properties> |
| 32 | + <Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.57.0" /> |
| 33 | + <Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" /> |
| 34 | + <Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" /> |
| 35 | + <Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="$kind" /> |
| 36 | + <Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" /> |
| 37 | +
|
| 38 | + <Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/coder/code-marketplace.git" /> |
| 39 | + <Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/coder/code-marketplace.git" /> |
| 40 | + <Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/coder/code-marketplace.git" /> |
| 41 | + <Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/coder/code-marketplace/issues" /> |
| 42 | + <Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://github.com/coder/code-marketplace" /> |
| 43 | + <Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="#e3f4ff" /> |
| 44 | + <Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="light" /> |
| 45 | + <Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" /> |
| 46 | +
|
| 47 | + <Property Id="Microsoft.VisualStudio.Services.CustomerQnALink" Value="https://github.com/coder/code-marketplace" /> |
| 48 | + </Properties> |
| 49 | + <License>extension/LICENSE.txt</License> |
| 50 | + <Icon>extension/images/icon.png</Icon> |
| 51 | + </Metadata> |
| 52 | + <Installation> |
| 53 | + <InstallationTarget Id="Microsoft.VisualStudio.Code"/> |
| 54 | + </Installation> |
| 55 | + <Dependencies/> |
| 56 | + <Assets> |
| 57 | + <Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" /> |
| 58 | + <Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /> |
| 59 | + <Asset Type="Microsoft.VisualStudio.Services.Content.Changelog" Path="extension/CHANGELOG.md" Addressable="true" /> |
| 60 | + <Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" /> |
| 61 | + <Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/images/icon.png" Addressable="true" /> |
| 62 | + </Assets> |
| 63 | + </PackageManifest> |
| 64 | +EOF |
| 65 | + cat<<EOF > "$dest/extension/package.json" |
| 66 | +{ |
| 67 | + "name": "$name", |
| 68 | + "displayName": "$name", |
| 69 | + "description": "Mock extension for Visual Studio Code", |
| 70 | + "version": "$version", |
| 71 | + "publisher": "$publisher", |
| 72 | + "author": { |
| 73 | + "name": "Coder" |
| 74 | + }, |
| 75 | + "license": "MIT", |
| 76 | + "homepage": "https://github.com/coder/code-marketplace", |
| 77 | + "repository": { |
| 78 | + "type": "git", |
| 79 | + "url": "https://github.com/coder/code-marketplace" |
| 80 | + }, |
| 81 | + "bugs": { |
| 82 | + "url": "https://github.com/coder/code-marketplace/issues" |
| 83 | + }, |
| 84 | + "qna": "https://github.com/coder/code-marketplace", |
| 85 | + "icon": "icon.png", |
| 86 | + "engines": { |
| 87 | + "vscode": "^1.57.0" |
| 88 | + }, |
| 89 | + "keywords": [ |
| 90 | + "$name", |
| 91 | + "mock", |
| 92 | + "coder", |
| 93 | + ], |
| 94 | + "categories": [ |
| 95 | + "Category1", |
| 96 | + "Category2" |
| 97 | + ], |
| 98 | + "activationEvents": [ |
| 99 | + "onStartupFinished" |
| 100 | + ], |
| 101 | + "main": "./extension", |
| 102 | + "browser": "./extension.browser.js" |
| 103 | +} |
| 104 | +EOF |
| 105 | + cat<<EOF > "$dest/extension/extension.js" |
| 106 | +const vscode = require("vscode"); |
| 107 | +function activate(context) { |
| 108 | + vscode.window.showInformationMessage("mock extension $publisher.$name-$version loaded"); |
| 109 | +} |
| 110 | +exports.activate = activate; |
| 111 | +EOF |
| 112 | + cp "$dest/extension/extension.js" "$dest/extension/extension.browser.js" |
| 113 | + cat<<EOF > "$dest/extension/LICENSE.txt" |
| 114 | +mock license |
| 115 | +EOF |
| 116 | + cat<<EOF > "$dest/extension/README.md" |
| 117 | +mock readme |
| 118 | +EOF |
| 119 | + cat<<EOF > "$dest/extension/CHANGELOG.md" |
| 120 | +mock changelog |
| 121 | +EOF |
| 122 | + cp "$dir/icon.png" "$dest/extension/images/icon.png" |
| 123 | + pushd "$dest" >/dev/null |
| 124 | + rm "$publisher.$name-$version.vsix" |
| 125 | + zip -r "$publisher.$name-$version.vsix" * -q |
| 126 | + popd >/dev/null |
| 127 | + done < "$dir/versions" |
| 128 | + done < "$dir/names" |
| 129 | +done < "$dir/publishers" |
0 commit comments