Skip to content

Commit f058417

Browse files
committed
⬆️ dependency update
1 parent fae7eb2 commit f058417

File tree

8 files changed

+3621
-11524
lines changed

8 files changed

+3621
-11524
lines changed

.eslintrc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"root": true,
33
"parser": "@typescript-eslint/parser",
4-
"plugins": ["@typescript-eslint"],
4+
"plugins": [
5+
"@typescript-eslint"
6+
],
57
"extends": [
68
"eslint:recommended",
79
"plugin:@typescript-eslint/eslint-recommended",
@@ -11,16 +13,23 @@
1113
"sourceType": "module"
1214
},
1315
"rules": {
14-
"no-unused-vars": "off",
15-
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
16+
"@typescript-eslint/no-unused-vars": [
17+
"error",
18+
{
19+
"args": "none",
20+
"varsIgnorePattern": "_"
21+
}
22+
],
1623
"@typescript-eslint/ban-ts-comment": "off",
1724
"no-prototype-builtins": "off",
1825
"@typescript-eslint/no-empty-function": "off",
1926
"@typescript-eslint/no-this-alias": [
2027
"error",
2128
{
2229
"allowDestructuring": false, // Disallow `const { props, state } = this`; true by default
23-
"allowedNames": ["self"] // Allow `const self = this`; `[]` by default
30+
"allowedNames": [
31+
"self"
32+
] // Allow `const self = this`; `[]` by default
2433
}
2534
]
2635
}

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ on:
55
paths:
66
- '**.ts'
77
- '**.json'
8+
- '**.scss'
89
- '**.css'
910
pull_request:
1011
branches: [ main ]
1112
paths:
1213
- '**.ts'
1314
- '**.json'
15+
- '**.scss'
1416
- '**.css'
1517

1618
jobs:
@@ -30,5 +32,9 @@ jobs:
3032
id: build
3133
run: |
3234
npm install
35+
36+
echo "Run build"
3337
npm run build
38+
39+
echo "Run tests"
3440
npm run test

.github/workflows/release.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@ on:
88
description: 'New version or major, minor, patch'
99
default: 'patch'
1010
required: true
11-
update-manifest:
11+
update_manifest:
1212
description: 'Update manifest.json'
13-
default: "true"
13+
default: true
1414
required: true
15+
type: boolean
16+
update_brat:
17+
description: 'Update brat manifest'
18+
default: true
19+
required: true
20+
type: boolean
21+
retry:
22+
description: "Retry release (clear created tag)"
23+
default: false
24+
required: true
25+
type: boolean
1526

1627
env:
1728
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
@@ -39,20 +50,38 @@ jobs:
3950
env:
4051
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4152
run: |
42-
echo "${{ github.event.inputs.version }}"
43-
echo "${{ github.event.inputs.update-manifest }}"
53+
echo "version: ${{ github.event.inputs.version }}"
54+
echo "retry: ${{ github.event.inputs.retry }}"
55+
echo "update_manifest: ${{ github.event.inputs.update_manifest }}"
56+
echo "update_brat: ${{ github.event.inputs.update_brat }}"
57+
4458
git config user.name ${{ env.GH_BOT_NAME }}
4559
git config user.email ${{ env.GH_BOT_EMAIL }}
4660
4761
npm install
48-
npm version ${{ github.event.inputs.version }} --no-git-tag-version
62+
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
63+
npm run preversion
64+
else
65+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
66+
fi
4967
VERSION=$(grep '^ "version"' package.json | cut -d'"' -f4)
5068
echo $VERSION
5169
52-
if [ "${{ github.event.inputs.update-manifest }}" = "true" ]; then
70+
if git rev-parse "refs/tags/$VERSION" > /dev/null 2>&1; then
71+
if [[ "${{ github.event.inputs.retry }}" = "true" ]]; then
72+
gh release delete $VERSION --cleanup-tag --yes
73+
else
74+
echo "🛑 Tag $VERSION already exists"
75+
exit 1
76+
fi
77+
fi
78+
79+
if [ "${{ github.event.inputs.update_manifest }}" = "true" ]; then
5380
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest.json
5481
fi
55-
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
82+
if [ "${{ github.event.inputs.update_brat }}" = "true"]; then
83+
sed -i 's|\(version":\) "[0-9\.]*"|\1 "'$VERSION'"|' manifest-beta.json
84+
fi
5685
5786
git add .
5887
git status
@@ -79,7 +108,7 @@ jobs:
79108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80109
run: |
81110
prerelease=true
82-
if [ "${{ github.event.inputs.update-manifest }}" = "true" ]; then
111+
if [ ${{ github.event.inputs.update_manifest }} ]; then
83112
prerelease=false
84113
fi
85114

esbuild.config.mjs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ esbuild.build({
2121
},
2222
entryPoints: ['src/main.ts', 'src/styles.scss'],
2323
bundle: true,
24-
external: ['obsidian', 'electron', ...builtins],
24+
external: [
25+
'obsidian',
26+
'electron',
27+
...builtins
28+
],
2529
format: 'cjs',
26-
watch: !prod,
30+
logLevel: 'info',
2731
target: 'es2020',
28-
logLevel: "info",
29-
sourcemap: prod ? false : 'inline',
3032
treeShaking: true,
33+
sourcemap: prod ? false : 'inline',
3134
minify: prod ? true : false,
3235
outdir: dir,
3336
loader: {
@@ -36,4 +39,16 @@ esbuild.build({
3639
plugins: [
3740
sassPlugin()
3841
]
39-
}).catch(() => process.exit(1));
42+
}).then(context => {
43+
if (!prod) {
44+
// Enable watch mode
45+
context.watch()
46+
}
47+
}).catch((x) => {
48+
if (x.errors) {
49+
console.error(x.errors);
50+
} else {
51+
console.error(x);
52+
}
53+
process.exit(1)
54+
});

0 commit comments

Comments
 (0)