Skip to content

Commit

Permalink
Set up publishing to the VSCode marketplace (#26)
Browse files Browse the repository at this point in the history
* Add properties to package.json for publishing

* Remove unnecessary files for now

Changelog will be reported in readme for now

* Ran bundling instructions

https://code.visualstudio.com/api/working-with-extensions/bundling-extension

* Add back changelog because its mentioned in vcse docs

* Ignore readme-dark.png in package for smaller size

* Compress images for better file size

* Add more documentation

* Add sponsor and keyword info

* Change author name to single property

* Add link to the marketplace
  • Loading branch information
sander1095 authored Oct 15, 2024
1 parent ee1348e commit 19be391
Show file tree
Hide file tree
Showing 18 changed files with 2,164 additions and 144 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#VsCode extension files
out
dist
node_modules
.vscode-test/
*.vsix

# Logs
logs
*.log
Expand Down
15 changes: 8 additions & 7 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.extension-test-runner"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"connor4312.esbuild-problem-matchers",
"ms-vscode.extension-test-runner"
]
}
5 changes: 2 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions", // Disabling extensions makes debugging faster
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
}
Expand Down
20 changes: 11 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
78 changes: 61 additions & 17 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,64 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
"version": "2.0.0",
"tasks": [
{
"label": "watch",
"dependsOn": [
"npm: watch:tsc",
"npm: watch:esbuild"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "watch:esbuild",
"group": "build",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"label": "npm: watch:esbuild",
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"type": "npm",
"script": "watch:tsc",
"group": "build",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"label": "npm: watch:tsc",
"presentation": {
"group": "watch",
"reveal": "never"
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
esbuild.js
vsc-extension-quickstart.md
**/tsconfig.json
**/eslint.config.mjs
**/*.map
**/*.ts
**/.vscode-test.*

resources/readme-dark.png
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

All notable changes to the "readme-auto-open" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [1.0.0] - 2024-10-15

## [Unreleased]

- Initial release
- Initial release
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# README Auto Open: Help your team onboard!

A VSCode plug-in that automatically opens the project's README when you open a project for the first time, ensuring people read it. Once opened, this plug-in will not activate again until you reset the state.
A [VSCode plug-in](https://marketplace.visualstudio.com/items?itemName=sandertenbrinke.readme-auto-open) that automatically opens the project's README when you open a project for the first time, ensuring people read it. Once opened, this plug-in will not activate again until you reset the state.

![An image of a README](https://media.githubusercontent.com/media/sander1095/vscode-readme-auto-open/main/resources/readme-dark.png)

## Why should you use this?
A (good) README is critical for understanding how to use a project, and this extension ensures that it's the first thing people see when they open a project.

💡 Add this to your workspace's [recommended extensions](https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions) to ensure all contributors will read the README!

## Features

- Automatically opens the README when you open a project for the first time.
- This plug-in will case-insensitively look for a `README` file in the root of your project, with or without any file extension.
- If the file is in markdown format (`.md`), it will open it in preview mode.
- You can reset the state of this plug-in so it will be re-opened next time you open your project by using the `Readme Auto Open: Reset State` command.

### 1.0.0

Initial release
26 changes: 26 additions & 0 deletions RELEASE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Release instructions

This extension is released on the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=sandertenbrinke.readme-auto-open). This document contains the release process

❗ This will [need to be automated](https://github.com/sander1095/vscode-readme-auto-open/issues/2) at some point, but for now it's a manual process.

```bash
# Install the Visual Studio Code Extension Manager
npm install -g @vscode/vsce

# Login to the Visual Studio Code Marketplace
# The PAT (Marketplace, Manage) can be created on Azure DevOps (https://dev.azure.com/stenbrinke/_usersSettings/tokens) and is stored in GitHub Secrets.
vsce login sandertenbrinke

# Package the extension
# This calls the vscode:prepublish script in package.json
vsce package

# Test the package
code --install-extension readme-auto-open-1.0.0.vsix

# Publish the package
# This can be done by uploading the .vsix file in the Visual Studio Code Marketplace (https://marketplace.visualstudio.com/manage/publishers/sandertenbrinke)
# Or by running the following command:
vsce publish
```
13 changes: 13 additions & 0 deletions SUPPORT.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Support

Thank you for using **Readme Auto Open**! If you need help or have any questions, please use the following resources:

## Issues

If you encounter any bugs or have feature requests, please open an issue on our [GitHub Issues page](https://github.com/sander1095/vscode-readme-auto-open/issues).

## Discussions

For general questions or discussions, please visit the [GitHub Discussions page](https://github.com/sander1095/vscode-readme-auto-open/discussions).

Your feedback is appreciated! Thanks for your support!
56 changes: 56 additions & 0 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const esbuild = require("esbuild");

const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');

/**
* @type {import('esbuild').Plugin}
*/
const esbuildProblemMatcherPlugin = {
name: 'esbuild-problem-matcher',

setup(build) {
build.onStart(() => {
console.log('[watch] build started');
});
build.onEnd((result) => {
result.errors.forEach(({ text, location }) => {
console.error(`✘ [ERROR] ${text}`);
console.error(` ${location.file}:${location.line}:${location.column}:`);
});
console.log('[watch] build finished');
});
},
};

async function main() {
const ctx = await esbuild.context({
entryPoints: [
'src/extension.ts'
],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
logLevel: 'silent',
plugins: [
/* add to the end of plugins array */
esbuildProblemMatcherPlugin,
],
});
if (watch) {
await ctx.watch();
} else {
await ctx.rebuild();
await ctx.dispose();
}
}

main().catch(e => {
console.error(e);
process.exit(1);
});
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ export default [{
"no-throw-literal": "warn",
semi: "warn",
},
}];
}];
Loading

0 comments on commit 19be391

Please sign in to comment.