Replace yarn with npm for all scripts
Signed-off-by: Sebastian Malton <sebastian@malton.name>
10
.eslintrc.js
@ -31,7 +31,6 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
"**/*.js",
|
"**/*.js",
|
||||||
"**/*.mjs",
|
|
||||||
],
|
],
|
||||||
extends: [
|
extends: [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
@ -97,6 +96,15 @@ module.exports = {
|
|||||||
"no-template-curly-in-string": "error",
|
"no-template-curly-in-string": "error",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
"scripts/*.ts",
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
node: false,
|
||||||
|
es2022: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
|
|||||||
6
.github/workflows/check-docs.yml
vendored
@ -23,9 +23,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate Extensions API Reference using typedocs
|
- name: Generate Extensions API Reference using typedocs
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
npm install
|
||||||
yarn typedocs-extensions-api
|
npm run typedocs-extensions-api
|
||||||
|
|
||||||
- name: Verify that the markdown is valid
|
- name: Verify that the markdown is valid
|
||||||
run: |
|
run: |
|
||||||
yarn run verify-docs
|
npm run verify-docs
|
||||||
|
|||||||
4
.github/workflows/linter.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: yarn install
|
run: npm clean-install
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: yarn run lint
|
run: npm run lint
|
||||||
|
|||||||
10
.github/workflows/main.yml
vendored
@ -34,12 +34,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate Extensions API Reference using typedocs
|
- name: Generate Extensions API Reference using typedocs
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
npm clean-install
|
||||||
yarn typedocs-extensions-api
|
npm run typedocs-extensions-api
|
||||||
|
|
||||||
- name: Verify that the markdown is valid
|
- name: Verify that the markdown is valid
|
||||||
run: |
|
run: |
|
||||||
yarn run verify-docs
|
npm run verify-docs
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Deploy docs
|
name: Deploy docs
|
||||||
@ -77,8 +77,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate Extensions API Reference using typedocs
|
- name: Generate Extensions API Reference using typedocs
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
npm clean-install
|
||||||
yarn typedocs-extensions-api
|
npm run typedocs-extensions-api
|
||||||
|
|
||||||
- name: mkdocs deploy master
|
- name: mkdocs deploy master
|
||||||
if: contains(github.ref, 'refs/heads/master')
|
if: contains(github.ref, 'refs/heads/master')
|
||||||
|
|||||||
4
.github/workflows/mkdocs-manual.yml
vendored
@ -37,8 +37,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate Extensions API Reference using typedocs
|
- name: Generate Extensions API Reference using typedocs
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
npm clean-install
|
||||||
yarn typedocs-extensions-api
|
npm run typedocs-extensions-api
|
||||||
|
|
||||||
- name: Checkout master branch from lens
|
- name: Checkout master branch from lens
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
14
.github/workflows/test.yml
vendored
@ -32,18 +32,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
- name: Get npm cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: npm-cache-dir-path
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
id: npm-cache # use this to check for `cache-hit` (`steps.npm-cache.outputs.cache-hit != 'true'`)
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-npm-
|
||||||
|
|
||||||
- uses: nick-fields/retry@v2
|
- uses: nick-fields/retry@v2
|
||||||
name: Install dependencies
|
name: Install dependencies
|
||||||
|
|||||||
3
.gitignore
vendored
@ -1,7 +1,6 @@
|
|||||||
dist/
|
dist/
|
||||||
node_modules/
|
node_modules/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
yarn-error.log
|
|
||||||
coverage/
|
coverage/
|
||||||
tmp/
|
tmp/
|
||||||
locales/**/**.js
|
locales/**/**.js
|
||||||
@ -12,4 +11,4 @@ binaries/client/
|
|||||||
binaries/server/
|
binaries/server/
|
||||||
docs/extensions/api
|
docs/extensions/api
|
||||||
site/
|
site/
|
||||||
build/webpack/
|
build/webpack/
|
||||||
5
.vscode/tasks.json
vendored
@ -6,8 +6,9 @@
|
|||||||
{
|
{
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"command": "yarn",
|
"command": "npm",
|
||||||
"args": [
|
"args": [
|
||||||
|
"run",
|
||||||
"debug-build"
|
"debug-build"
|
||||||
],
|
],
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
@ -15,4 +16,4 @@
|
|||||||
"detail": "Compiles main and extension types"
|
"detail": "Compiles main and extension types"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
38
Makefile
@ -12,16 +12,16 @@ else
|
|||||||
DETECTED_OS := $(shell uname)
|
DETECTED_OS := $(shell uname)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
node_modules: yarn.lock
|
node_modules: package-lock.json
|
||||||
yarn install --check-files --frozen-lockfile --network-timeout=100000
|
npm clean-install
|
||||||
|
|
||||||
binaries/client: node_modules
|
binaries/client: node_modules
|
||||||
yarn download:binaries
|
npm run download:binaries
|
||||||
|
|
||||||
.PHONY: compile-dev
|
.PHONY: compile-dev
|
||||||
compile-dev: node_modules
|
compile-dev: node_modules
|
||||||
yarn compile:main --cache
|
npm run compile:main -- --cache
|
||||||
yarn compile:renderer --cache
|
npm run compile:renderer -- --cache
|
||||||
|
|
||||||
.PHONY: validate-dev
|
.PHONY: validate-dev
|
||||||
ci-validate-dev: binaries/client compile-dev
|
ci-validate-dev: binaries/client compile-dev
|
||||||
@ -29,12 +29,12 @@ ci-validate-dev: binaries/client compile-dev
|
|||||||
.PHONY: dev
|
.PHONY: dev
|
||||||
dev: binaries/client
|
dev: binaries/client
|
||||||
rm -rf static/build/
|
rm -rf static/build/
|
||||||
yarn run build:tray-icons
|
npm run build:tray-icons
|
||||||
yarn dev
|
npm run dev
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: node_modules
|
lint: node_modules
|
||||||
yarn lint
|
npm run lint
|
||||||
|
|
||||||
.PHONY: tag-release
|
.PHONY: tag-release
|
||||||
tag-release:
|
tag-release:
|
||||||
@ -42,22 +42,22 @@ tag-release:
|
|||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: node_modules binaries/client
|
test: node_modules binaries/client
|
||||||
yarn run jest $(or $(CMD_ARGS), "src")
|
npm exec -- jest $(or $(CMD_ARGS), "src")
|
||||||
|
|
||||||
.PHONY: integration
|
.PHONY: integration
|
||||||
integration: build
|
integration: build
|
||||||
yarn integration
|
npm run integration
|
||||||
|
|
||||||
.PHONY: build-impl
|
.PHONY: build-impl
|
||||||
build-impl:
|
build-impl:
|
||||||
yarn run download:binaries
|
npm run download:binaries
|
||||||
yarn run build:tray-icons
|
npm run build:tray-icons
|
||||||
yarn run compile
|
npm run compile
|
||||||
ifeq "$(DETECTED_OS)" "Windows"
|
ifeq "$(DETECTED_OS)" "Windows"
|
||||||
# https://github.com/ukoloff/win-ca#clear-pem-folder-on-publish
|
# https://github.com/ukoloff/win-ca#clear-pem-folder-on-publish
|
||||||
rm -rf node_modules/win-ca/pem
|
rm -rf node_modules/win-ca/pem
|
||||||
endif
|
endif
|
||||||
yarn run electron-builder --publish onTag $(ELECTRON_BUILDER_EXTRA_ARGS)
|
npm exec -- electron-builder --publish onTag $(ELECTRON_BUILDER_EXTRA_ARGS)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: node_modules binaries/client build-impl
|
build: node_modules binaries/client build-impl
|
||||||
@ -66,18 +66,18 @@ src/extensions/npm/extensions/__mocks__:
|
|||||||
cp -r __mocks__ src/extensions/npm/extensions/
|
cp -r __mocks__ src/extensions/npm/extensions/
|
||||||
|
|
||||||
packages/extensions/dist: packages/extensions/node_modules
|
packages/extensions/dist: packages/extensions/node_modules
|
||||||
yarn compile:extension-types
|
npm run compile:extension-types
|
||||||
|
|
||||||
packages/extensions/node_modules: packages/extensions/package.json
|
packages/extensions/node_modules: packages/extensions/package.json
|
||||||
cd packages/extensions/ && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
cd packages/extensions/ && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
||||||
|
|
||||||
.PHONY: build-extensions-npm
|
.PHONY: build-extensions-npm
|
||||||
build-extensions-npm: build-extension-types packages/extensions/__mocks__
|
build-extensions-npm: build-extension-types packages/extensions/__mocks__
|
||||||
yarn npm:fix-extensions-package-version
|
npm run npm:fix-extensions-package-version
|
||||||
|
|
||||||
.PHONY: build-library-npm
|
.PHONY: build-library-npm
|
||||||
build-library-npm:
|
build-library-npm:
|
||||||
yarn compile-library
|
npm run compile-library
|
||||||
|
|
||||||
.PHONY: build-extension-types
|
.PHONY: build-extension-types
|
||||||
build-extension-types: node_modules packages/extensions/dist
|
build-extension-types: node_modules packages/extensions/dist
|
||||||
@ -94,11 +94,11 @@ publish-library-npm: node_modules build-library-npm
|
|||||||
|
|
||||||
.PHONY: build-docs
|
.PHONY: build-docs
|
||||||
build-docs:
|
build-docs:
|
||||||
yarn typedocs-extensions-api
|
npm run typedocs-extensions-api
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: build-docs
|
docs: build-docs
|
||||||
yarn mkdocs-serve-local
|
npm run mkdocs-serve-local
|
||||||
|
|
||||||
.PHONY: clean-npm
|
.PHONY: clean-npm
|
||||||
clean-npm:
|
clean-npm:
|
||||||
|
|||||||
@ -5,15 +5,15 @@ All releases will be made by creating a PR which bumps the version field in the
|
|||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- `yarn`
|
- `npm`
|
||||||
- Running `yarn` (to install all dependencies)
|
- Running `npm install`
|
||||||
- `gh` (Github's CLI) with a version at least 2.15.0
|
- `gh` (Github's CLI) with a version at least 2.15.0
|
||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
|
|
||||||
1. If you are making a minor or major release (or prereleases for one) make sure you are on the `master` branch.
|
1. If you are making a minor or major release (or prereleases for one) make sure you are on the `master` branch.
|
||||||
1. If you are making a patch release (or a prerelease for one) make sure you are on the `release/v<MAJOR>.<MINOR>` branch.
|
1. If you are making a patch release (or a prerelease for one) make sure you are on the `release/v<MAJOR>.<MINOR>` branch.
|
||||||
1. Run `yarn create-release-pr <release-type>`. If you are making a subsequent prerelease release, provide the `--check-commits` flag.
|
1. Run `npm run create-release-pr <release-type>`. If you are making a subsequent prerelease release, provide the `--check-commits` flag.
|
||||||
1. If you are checking the commits, type `y<ENTER>` to pick a commit, and `n<ENTER>` to skip it. You will want to skip the commits that were part of previous prerelease releases.
|
1. If you are checking the commits, type `y<ENTER>` to pick a commit, and `n<ENTER>` to skip it. You will want to skip the commits that were part of previous prerelease releases.
|
||||||
1. Once the PR is created, approved, and then merged the `Release Open Lens` workflow will create a tag and release for you.
|
1. Once the PR is created, approved, and then merged the `Release Open Lens` workflow will create a tag and release for you.
|
||||||
1. If you are making a major or minor release, create a `release/v<MAJOR>.<MINOR>` branch and push it to `origin` so that future patch releases can be made from it.
|
1. If you are making a major or minor release, create a `release/v<MAJOR>.<MINOR>` branch and push it to `origin` so that future patch releases can be made from it.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 392 B |
|
Before Width: | Height: | Size: 724 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 397 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
@ -62,7 +62,7 @@ Some of the most-important fields include:
|
|||||||
"renderer": "dist/renderer.js",
|
"renderer": "dist/renderer.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --config webpack.config.js",
|
"build": "webpack --config webpack.config.js",
|
||||||
"dev": "npm run build --watch"
|
"dev": "npm run build -- --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react-open-doodles": "^1.0.5"
|
"react-open-doodles": "^1.0.5"
|
||||||
|
|||||||
26754
package-lock.json
generated
Normal file
56
package.json
@ -51,39 +51,40 @@
|
|||||||
"adr:change-status": "echo \"Decision number?:\"; read decision; adr status $decision",
|
"adr:change-status": "echo \"Decision number?:\"; read decision; adr status $decision",
|
||||||
"adr:update-readme": "adr update",
|
"adr:update-readme": "adr update",
|
||||||
"adr:list": "adr list",
|
"adr:list": "adr list",
|
||||||
"dev": "concurrently -i -k \"yarn run dev-run -C\" yarn:dev:*",
|
"dev": "concurrently -i -k \"npm run dev-run -- -C\" npm:dev:*",
|
||||||
"dev-build": "concurrently yarn:compile:*",
|
"dev-build": "concurrently npm:compile:*",
|
||||||
"debug-build": "concurrently yarn:compile:main yarn:compile:extension-types",
|
"debug-build": "concurrently npm:compile:main npm:compile:extension-types",
|
||||||
"dev-run": "nodemon --watch ./static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
|
"dev-run": "nodemon --watch ./static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
|
||||||
"dev:main": "yarn run compile:main --watch --progress",
|
"dev:main": "npm run compile:main -- --watch --progress",
|
||||||
"dev:renderer": "yarn run ts-node webpack/dev-server.ts",
|
"dev:renderer": "ts-node webpack/dev-server.ts",
|
||||||
"compile-library": "env NODE_ENV=production yarn run webpack --config webpack/library-bundle.ts",
|
"compile-library": "env NODE_ENV=production webpack --config webpack/library-bundle.ts",
|
||||||
"compile": "env NODE_ENV=production concurrently yarn:compile:*",
|
"compile": "env NODE_ENV=production concurrently npm:compile:*",
|
||||||
"compile:main": "yarn run webpack --config webpack/main.ts",
|
"compile:main": "webpack --config webpack/main.ts",
|
||||||
"compile:renderer": "yarn run webpack --config webpack/renderer.ts",
|
"compile:renderer": "webpack --config webpack/renderer.ts",
|
||||||
"compile:extension-types": "yarn run webpack --config webpack/extensions.ts",
|
"compile:extension-types": "webpack --config webpack/extensions.ts",
|
||||||
"compile:node-fetch": "yarn run webpack --config webpack/node-fetch.ts",
|
"compile:node-fetch": "webpack --config webpack/node-fetch.ts",
|
||||||
"prepare": "yarn run compile:node-fetch",
|
"postinstall": "npm run compile:node-fetch",
|
||||||
"npm:fix-extensions-package-version": "yarn run ts-node build/set_extensions_npm_version.ts",
|
"npm:fix-package-version": "ts-node build/set_npm_version.ts",
|
||||||
"build:linux": "yarn run compile && electron-builder --linux --dir",
|
"build:linux": "npm run compile && electron-builder --linux --dir",
|
||||||
"build:mac": "yarn run compile && electron-builder --mac --dir",
|
"build:mac": "npm run compile && electron-builder --mac --dir",
|
||||||
"build:win": "yarn run compile && electron-builder --win --dir",
|
"build:win": "npm run compile && electron-builder --win --dir",
|
||||||
"integration": "jest --runInBand --detectOpenHandles --forceExit integration",
|
"integration": "jest --runInBand --detectOpenHandles --forceExit integration",
|
||||||
"test:unit": "func() { jest ${1} --watch --testPathIgnorePatterns integration; }; func",
|
"test:unit": "func() { jest ${1} --watch --testPathIgnorePatterns integration; }; func",
|
||||||
"test:integration": "func() { jest ${1:-xyz} --watch --runInBand --detectOpenHandles --forceExit --modulePaths=[\"<rootDir>/integration/\"]; }; func",
|
"test:integration": "func() { jest ${1:-xyz} --watch --runInBand --detectOpenHandles --forceExit --modulePaths=[\"<rootDir>/integration/\"]; }; func",
|
||||||
"dist": "yarn run compile && electron-builder --publish onTag",
|
"dist": "npm run compile && electron-builder --publish onTag",
|
||||||
"dist:dir": "yarn run dist --dir -c.compression=store -c.mac.identity=null",
|
"dist:dir": "npm run dist -- --dir -c.compression=store -c.mac.identity=null",
|
||||||
"download:binaries": "yarn run ts-node build/download_binaries.ts",
|
"download:binaries": "ts-node build/download_binaries.ts",
|
||||||
"build:tray-icons": "yarn run ts-node build/generate-tray-icons.ts",
|
"prebuild:tray-icons": "swc ./scripts/generate-tray-icons.ts -o ./scripts/generate-tray-icons.mjs",
|
||||||
"build:theme-vars": "yarn run ts-node build/build_theme_vars.ts",
|
"build:tray-icons": "node ./scripts/generate-tray-icons.mjs",
|
||||||
"lint": "PROD=true yarn run eslint --ext js,ts,tsx --max-warnings=0 .",
|
"build:theme-vars": "ts-node build/build_theme_vars.ts",
|
||||||
"lint:fix": "yarn run lint --fix",
|
"lint": "PROD=true eslint --ext js,ts,tsx --max-warnings=0 .",
|
||||||
|
"lint:fix": "npm run lint -- --fix",
|
||||||
"mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest",
|
"mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest",
|
||||||
"verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict",
|
"verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict",
|
||||||
"typedocs-extensions-api": "yarn run typedoc src/extensions/extension-api.ts",
|
"typedocs-extensions-api": "typedoc src/extensions/extension-api.ts",
|
||||||
"version-checkout": "cat package.json | jq '.version' -r | xargs printf \"release/v%s\" | xargs git checkout -b",
|
"version-checkout": "cat package.json | jq '.version' -r | xargs printf \"release/v%s\" | xargs git checkout -b",
|
||||||
"version-commit": "cat package.json | jq '.version' -r | xargs printf \"release v%s\" | git commit --no-edit -s -F -",
|
"version-commit": "cat package.json | jq '.version' -r | xargs printf \"release v%s\" | git commit --no-edit -s -F -",
|
||||||
"version": "yarn run version-checkout && git add package.json && yarn run version-commit",
|
"version": "npm run version-checkout && git add package.json && npm run version-commit",
|
||||||
"postversion": "git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version",
|
"postversion": "git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version",
|
||||||
"precreate-release-pr": "npx swc ./scripts/create-release-pr.ts -o ./scripts/create-release-pr.mjs",
|
"precreate-release-pr": "npx swc ./scripts/create-release-pr.ts -o ./scripts/create-release-pr.mjs",
|
||||||
"create-release-pr": "node ./scripts/create-release-pr.mjs"
|
"create-release-pr": "node ./scripts/create-release-pr.mjs"
|
||||||
@ -470,5 +471,10 @@
|
|||||||
"react-select": "^5.7.0",
|
"react-select": "^5.7.0",
|
||||||
"typed-emitter": "^1.4.0",
|
"typed-emitter": "^1.4.0",
|
||||||
"xterm-addon-fit": "^0.5.0"
|
"xterm-addon-fit": "^0.5.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@swc/core-darwin-x64": "^1.3.24",
|
||||||
|
"@swc/core-linux-x64-gnu": "^1.3.24",
|
||||||
|
"@swc/core-win32": "^1.2.42"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,19 +3,25 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ensureDir, readFile } from "fs-extra";
|
import { writeFile, mkdir, readFile } from "fs/promises";
|
||||||
import { JSDOM } from "jsdom";
|
import { JSDOM } from "jsdom";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
const size = Number(process.env.OUTPUT_SIZE || "16");
|
const size = Number(process.env.OUTPUT_SIZE || "16");
|
||||||
const outputFolder = process.env.OUTPUT_DIR || "./static/build/tray";
|
const outputFolder = path.resolve(process.env.OUTPUT_DIR || "./static/build/tray");
|
||||||
const inputFile = process.env.INPUT_SVG_PATH || path.resolve(__dirname, "../src/renderer/components/icon/logo-lens.svg");
|
const inputFile = path.resolve(__dirname, process.env.INPUT_SVG_PATH || "../src/renderer/components/icon/logo-lens.svg");
|
||||||
const noticeFile = process.env.NOTICE_SVG_PATH || path.resolve(__dirname, "../src/renderer/components/icon/notice.svg");
|
const noticeFile = path.resolve(__dirname, process.env.NOTICE_SVG_PATH || "../src/renderer/components/icon/notice.svg");
|
||||||
const spinnerFile = process.env.SPINNER_SVG_PATH || path.resolve(__dirname, "../src/renderer/components/icon/arrow-spinner.svg");
|
const spinnerFile = path.resolve(__dirname, process.env.SPINNER_SVG_PATH || "../src/renderer/components/icon/arrow-spinner.svg");
|
||||||
|
|
||||||
async function ensureOutputFoler() {
|
async function ensureOutputFoler() {
|
||||||
await ensureDir(outputFolder);
|
await mkdir(outputFolder, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSvgStyling(colouring: "dark" | "light"): string {
|
function getSvgStyling(colouring: "dark" | "light"): string {
|
||||||
@ -44,10 +50,14 @@ async function getBaseIconImage(system: TargetSystems) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function generateImage(image: Buffer, size: number, namePrefix: string) {
|
async function generateImage(image: Buffer, size: number, namePrefix: string) {
|
||||||
sharp(image)
|
const filePath = path.join(outputFolder, `${namePrefix}.png`);
|
||||||
|
|
||||||
|
const buffer = await sharp(image)
|
||||||
.resize({ width: size, height: size })
|
.resize({ width: size, height: size })
|
||||||
.png()
|
.png()
|
||||||
.toFile(path.join(outputFolder, `${namePrefix}.png`));
|
.toBuffer();
|
||||||
|
|
||||||
|
await writeFile(filePath, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateImages(image: Buffer, size: number, name: string) {
|
async function generateImages(image: Buffer, size: number, name: string) {
|
||||||
@ -103,37 +113,33 @@ async function getIconImage(system: TargetSystems, filePath: string) {
|
|||||||
return Buffer.from(root.outerHTML);
|
return Buffer.from(root.outerHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateTrayIcons() {
|
try {
|
||||||
try {
|
console.log("Generating tray icon pngs");
|
||||||
console.log("Generating tray icon pngs");
|
await ensureOutputFoler();
|
||||||
await ensureOutputFoler();
|
|
||||||
|
|
||||||
const baseIconTemplateImage = await getBaseIconImage("macos");
|
const baseIconTemplateImage = await getBaseIconImage("macos");
|
||||||
const baseIconImage = await getBaseIconImage("windows-or-linux");
|
const baseIconImage = await getBaseIconImage("windows-or-linux");
|
||||||
|
|
||||||
const updateAvailableTemplateImage = await generateImageWithSvg(baseIconTemplateImage, "macos", noticeFile);
|
const updateAvailableTemplateImage = await generateImageWithSvg(baseIconTemplateImage, "macos", noticeFile);
|
||||||
const updateAvailableImage = await generateImageWithSvg(baseIconImage, "windows-or-linux", noticeFile);
|
const updateAvailableImage = await generateImageWithSvg(baseIconImage, "windows-or-linux", noticeFile);
|
||||||
|
|
||||||
const checkingForUpdatesTemplateImage = await generateImageWithSvg(baseIconTemplateImage, "macos", spinnerFile);
|
const checkingForUpdatesTemplateImage = await generateImageWithSvg(baseIconTemplateImage, "macos", spinnerFile);
|
||||||
const checkingForUpdatesImage = await generateImageWithSvg(baseIconImage, "windows-or-linux", spinnerFile);
|
const checkingForUpdatesImage = await generateImageWithSvg(baseIconImage, "windows-or-linux", spinnerFile);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
// Templates are for macOS only
|
// Templates are for macOS only
|
||||||
generateImages(baseIconTemplateImage, size, "trayIconTemplate"),
|
generateImages(baseIconTemplateImage, size, "trayIconTemplate"),
|
||||||
generateImages(updateAvailableTemplateImage, size, "trayIconUpdateAvailableTemplate"),
|
generateImages(updateAvailableTemplateImage, size, "trayIconUpdateAvailableTemplate"),
|
||||||
generateImages(updateAvailableTemplateImage, size, "trayIconUpdateAvailableTemplate"),
|
generateImages(updateAvailableTemplateImage, size, "trayIconUpdateAvailableTemplate"),
|
||||||
generateImages(checkingForUpdatesTemplateImage, size, "trayIconCheckingForUpdatesTemplate"),
|
generateImages(checkingForUpdatesTemplateImage, size, "trayIconCheckingForUpdatesTemplate"),
|
||||||
|
|
||||||
// Non-templates are for windows and linux
|
// Non-templates are for windows and linux
|
||||||
generateImages(baseIconImage, size, "trayIcon"),
|
generateImages(baseIconImage, size, "trayIcon"),
|
||||||
generateImages(updateAvailableImage, size, "trayIconUpdateAvailable"),
|
generateImages(updateAvailableImage, size, "trayIconUpdateAvailable"),
|
||||||
generateImages(checkingForUpdatesImage, size, "trayIconCheckingForUpdates"),
|
generateImages(checkingForUpdatesImage, size, "trayIconCheckingForUpdates"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.log("Generated all images");
|
console.log("Generated all images");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateTrayIcons();
|
|
||||||