Skip to content

Commit

Permalink
Create VSCode Extension
Browse files Browse the repository at this point in the history
* Add Extension Code
* Add Screenshots
* Add github workflows
  • Loading branch information
deniszholob committed Dec 28, 2022
1 parent 4180bfc commit bd7d1cd
Show file tree
Hide file tree
Showing 40 changed files with 8,840 additions and 88 deletions.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Editor configuration, see https://editorconfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

# Unix-style newlines with a newline ending every file
end_of_line = lf

# Typescript
[*.ts]
max_line_length = 80
quote_type = single

# HTML
[*.html]
max_line_length = 140

[*.md]
max_line_length = off
trim_trailing_whitespace = false

# JS related
# [*.{js,ts,json,yml}]
19 changes: 19 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": ["out", "dist", ".vscode-test", "**/*.d.ts"],
"extends": ["prettier"]
}
4 changes: 4 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ref:

- https://code.visualstudio.com/api/working-with-extensions/continuous-integration#github-actions
- https://docs.github.com/en/actions/security-guides/encrypted-secrets
97 changes: 97 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# CI/CD for Github Actions
# @author Denis Zholob (deniszholob.com)
# ====================================== #
name: Build/Publish

on:
push:
branches:
- main
tags:
- "[0-9]+.[0-9]+.[0-9]+"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"

- name: Install NPM Dependencies
run: npm ci

- name: Package
run: npm run package

- name: Save artifact for next step
uses: actions/upload-artifact@v3
with:
name: packaged-extension
path: "*.vsix"

# - run: xvfb-run -a npm test
# if: runner.os == 'Linux'
# - run: npm test
# if: runner.os != 'Linux'

publish:
runs-on: ubuntu-latest
needs: build
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV

- name: Download Artifact from last step
uses: actions/download-artifact@v3
with:
name: packaged-extension
path: ./

- name: Display structure of downloaded files
run: ls -R
working-directory: ./

- name: Create GH Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
# Downloads
- [Github](https://github.com/deniszholob/angular-files-generator/releases)
- [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=deniszholob.angular-files-generator)
# Support Me by
- Donating on Ko-fi: https://ko-fi.com/deniszholob
- Donating on Patreon: https://www.patreon.com/deniszholob
draft: false
prerelease: false

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./angular-files-generator-${{ env.RELEASE_VERSION }}.vsix
asset_name: angular-files-generator-${{ env.RELEASE_VERSION }}.vsix
asset_content_type: application/zip

- name: Publish artifact
run: npx vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
91 changes: 4 additions & 87 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,99 +6,16 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
# Compiled Code
out
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
.vscode-test/
*.vsix
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run pre-commit
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
legacy-peer-deps=true
save-exact=true
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore artifacts:
out
/.vscode-test

# Markdown
#*.md

#Misc
/node_modules
package-lock.json
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
}
35 changes: 35 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Place your settings in this file to overwrite default and user settings.
{
"editor.renderWhitespace": "all",
"editor.rulers": [80, 140],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"explorer.sortOrderLexicographicOptions": "lower", // Case sensitive file ordering in tree
"workbench.iconTheme": "material-icon-theme",
"explorer.autoRevealExclude": {
"**/node_modules": true
},
"files.exclude": {
"node_modules": false,
"public/": false,
"screenshots/": false,
".editorconfig": false,
".eslint*": false,
".gitignore": false,
".npmrc": false,
".prettierignore": false,
".prettierrc": false,
".vscodeignore": false,
"debug.log": false,
"package-lock.json": false,
"**/tsconfig*": false,
"**/tslint.json": false,
"FUNDING.yml": false,
"LICENSE": false,
"out": false
},
"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"
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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
}
}
]
}
23 changes: 23 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.github/**
.vscode/**
.vscode-test/**
node_modules
out/test/**
screenshots
src/**
.editorconfig
.eslintrc
.gitignore
.npmrc
.yarnrc
.prettierignore
.prettierrc
package-lock.json
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/*.svg
FUNDING.yml
LICENCE
Loading

0 comments on commit bd7d1cd

Please sign in to comment.