Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with current Cookiecutter template #28

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ indent_size = 2
indent_size = 2
trim_trailing_whitespace = false

[*.ts]
[*.{mjs,ts}]
indent_size = 2

[*.yml]
[*.{yaml,yml}]
indent_size = 2
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

*.json text eol=lf
*.md text eol=lf
*.mjs text eol=lf
*.ts text eol=lf
*.txt text eol=lf
*.yaml text eol=lf
*.yml text eol=lf

# No need to diff or patch these
/.yarn/plugins/** binary
/.yarn/releases/*.cjs binary
/.yarn/sdks/** binary
/.yarn/plugins/** binary
38 changes: 38 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run unit tests

on: [push]

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Install yarn if not present
run: |-
if which yarn; then
exit
fi
curl -fsSL --create-dirs -o ~/bin/yarn \
https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js
chmod +x ~/bin/yarn
echo ~/bin >> "${GITHUB_PATH}"

- name: Use specified Node.js version
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn

- name: Install dependencies
run: yarn install

- name: Compile
run: yarn compile

- name: Run linter
run: yarn lint

- name: Run unit tests
run: yarn test
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/extension/build/
/extension/dist/
/extension/examples/
/extension/work/
/.pnp.*
/.yarn/*
!/.yarn/patches/
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"henrynguyen5-vsc.vsc-nvm",
"orta.vscode-jest",
"redhat.vscode-yaml"
]
}
5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/extension"
"--extensionDevelopmentPath=${workspaceFolder}/extension/build"
],
"outFiles": [
"${workspaceFolder}/extension/build/**/*.js"
"${workspaceFolder}/extension/build/**/*.js",
"${workspaceFolder}/extension/build/**/*.js.map"
],
"preLaunchTask": "Compile"
}
Expand Down
559 changes: 280 additions & 279 deletions .yarn/releases/yarn-3.5.0.cjs → .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions .yarn/sdks/eslint/bin/eslint.js

This file was deleted.

20 changes: 0 additions & 20 deletions .yarn/sdks/eslint/lib/api.js

This file was deleted.

6 changes: 0 additions & 6 deletions .yarn/sdks/eslint/package.json

This file was deleted.

2 changes: 2 additions & 0 deletions .yarn/sdks/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
2 changes: 2 additions & 0 deletions .yarn/sdks/typescript/lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion .yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript",
"version": "5.0.2-sdk",
"version": "5.1.6-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}
4 changes: 1 addition & 3 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
enableGlobalCache: true

nodeLinker: pnp

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
yarnPath: .yarn/releases/yarn-3.6.1.cjs
48 changes: 28 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,21 @@ the following numbering scheme:

### Publishing to the Marketplace

After deciding on a target version, run:
1. Check out the `main` branch and make sure it is pristine.

- `git checkout main`
- `yarn login`
- `yarn publish-vsce [--pre-release] [version]`
2. Decide on a new version number under which to publish the package.

The `yarn publish-vsce` command first updates the version number in
[extension/package.json](./extension/package.json) to the given
version. Then it packages and publishes the extension to the VS Code
Extension Marketplace.
3. Edit the `extension/share/dist/package.json` manifest to reflect
the new version number.

4. Run: `yarn package`

5. If necessary, run: `yarn workspace extension login`

6. Run: `yarn workspace extension publish-vsce`

The final `yarn […] publish-vsce` command packages and publishes the
extension to the VS Code Extension Marketplace.

### Publishing to the Open VSX Registry

Expand All @@ -96,13 +101,16 @@ Follow these steps to publish the extension to the Open VSX Registry:

2. Make sure you have published the extension to the VS Code
Extension Marketplace. This ensures that the version number has
been updated and that a `.vsix` file has been generated.
been updated.

3. Run `yarn package` to generate a `.vsix` package.

3. Run the `yarn ovsx publish` command with the correct
`extension/[…].vsix` file as the sole argument. Example in Bash:
4. Run the `yarn […] ovsx publish` command with the correct
`extension/dist/[…].vsix` file as the sole argument.
Example in Bash:

```bash
yarn ovsx publish "extension/ifm-$(jq -r .version extension/package.json).vsix"
yarn workspace extension ovsx publish "dist/ifm-$(jq -r .version extension/share/dist/package.json).vsix"
```

### Committing, tagging and creating a GitHub prerelease and PR
Expand All @@ -111,17 +119,17 @@ With the extension now published on the Marketplace, commit the
change, create a tag, push, cut a GitHub (pre-)release, and create a
pull request against `main`:

```
```bash
(
set -eux
git checkout -b publish
tag="$(jq -r '"v" + .version' extension/package.json)"
tag="$(jq -r '"v" + .version' extension/share/dist/package.json)"
echo "New tag: ${tag}"
git add -u
git commit --edit -m "Release ${tag}"
git tag "${tag}"
git push --tags
gh release create --generate-notes --prerelease "${tag}"
gh release create --draft --generate-notes "${tag}"
gh pr create --fill --web
)
```
Expand Down Expand Up @@ -168,7 +176,7 @@ dependencies. That includes the `@types`, `@typescript-eslint`, and
`yarn upgrade-yarn-itself` section).

Also excluded is the `@types/vscode` package. For details, see
section _Upgrading the VS Code API_.
section _Upgrading the VS Code API version_.

### yarn upgrade-yarn-itself

Expand Down Expand Up @@ -217,13 +225,13 @@ To start editing a dependency, run `yarn patch <dependency>`.
For example, to start editing the `vsce` executable, run:

```shell
yarn patch @vscode/vsce@npm:2.18.0
yarn patch @vscode/vsce@npm:2.19.0
```

Since this project is already patching this dependency, you may want to apply the existing patch to the temporary working directory:

```shell
patch < path/to/this/project/.yarn/patches/@vscode-vsce-npm-2.18.0-c171711221.patch
patch < path/to/this/project/.yarn/patches/@vscode-vsce-npm-2.19.0-c171711221.patch
```

### Committing a patch for the first time
Expand All @@ -247,7 +255,7 @@ Note: `yarn repatch` is a custom script. It serves to work around two issues in
- It may also use an incorrect key in the resolution entry it writes to `package.json`.
The key should match the dependency’s semver expression, not the resolved version.
Using the latter as a key causes the resolution to never apply.
Example for a correct key: `"@vscode/vsce@^2.18.0"`
Example for a correct key: `"@vscode/vsce@^2.19.0"`

## Handling vulnerable dependencies

Expand Down Expand Up @@ -329,7 +337,7 @@ source code repository:
| `.` | This directory | Apache-2.0 | [License](./LICENSE)<br>with License header below |
| `./.yarn/releases` | The `yarn` package manager | BSD-2-Clause | [License](./.yarn/releases/LICENSE) |
| `./.yarn/sdks` | SDK files for `yarn` | BSD-2-Clause | [License](./.yarn/sdks/LICENSE) |
| `./extension` | The source code for this VS Code extension | Apache-2.0 | [License](./extension/LICENSE.txt)<br>with [License header](./extension/README.md#license) |
| `./extension` | Front-end source code for this VS Code extension | Apache-2.0 | [License](./extension/LICENSE.txt)<br>with [License header](./extension/README.md#license) |

In each of the directories the table mentions, you will find one
license file, named `LICENSE` or `LICENSE.txt`.
Expand Down
23 changes: 13 additions & 10 deletions .eslintrc.yaml → extension/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ env:
node: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:@typescript-eslint/recommended-type-checked
- plugin:@typescript-eslint/stylistic-type-checked
ignorePatterns:
- build/
- work/
parser: "@typescript-eslint/parser"
parserOptions:
ecmaFeatures:
impliedStrict: true
ecmaVersion: 2022
project:
- extension/tsconfig.json
- tsconfig.json
plugins:
- "@typescript-eslint"
root: true
Expand All @@ -30,7 +34,10 @@ rules:
default-case-last: 1
default-case: 2
dot-location: [1, property]
dot-notation: [1, { allowKeywords: false }]

# For compatibility with typescript-eslint
dot-notation: 0

eqeqeq: 1
func-call-spacing: 1
generator-star-spacing: [1, before]
Expand Down Expand Up @@ -64,17 +71,13 @@ rules:
no-octal-escape: 2
no-return-assign: 1
no-self-compare: 1

# For compatibility with typescript-eslint
no-shadow: 0

no-shadow: 1
no-tabs: 2
no-template-curly-in-string: 1
no-throw-literal: 2
no-trailing-spaces: 1
no-undefined: 1
no-unexpected-multiline: 1
no-unreachable: 1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really part of recommended-type-checked or stylistic-type-checked?

no-unused-expressions: 1

# For compatibility with typescript-eslint
Expand Down Expand Up @@ -115,16 +118,16 @@ rules:
yoda: 1

"@typescript-eslint/array-type": 1
"@typescript-eslint/dot-notation": 1

# In VS Code, this allows developers to manually specify
# inferrable types so the distracting inline hints go away
"@typescript-eslint/no-inferrable-types": 0

"@typescript-eslint/no-shadow": 1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a mistake.


# https://github.com/typescript-eslint/typescript-eslint/issues/4912
"@typescript-eslint/no-unsafe-argument": 0
"@typescript-eslint/no-unsafe-assignment": 0
"@typescript-eslint/no-unsafe-member-access": 0

"@typescript-eslint/no-unused-vars": [1, { argsIgnorePattern: ^_, varsIgnorePattern: ^_ }]
"@typescript-eslint/unbound-method": 0
5 changes: 5 additions & 0 deletions extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/build/
/dist/
/examples/
/types/
/work/
4 changes: 0 additions & 4 deletions extension/.vscodeignore

This file was deleted.

Loading
Loading