Skip to content

Commit

Permalink
make uploading to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Oct 27, 2024
1 parent 46cbba9 commit 19b2057
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 115 deletions.
23 changes: 1 addition & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,4 @@ jobs:
- name: Install dependencies
run: npm i
- name: Run ESLint
run: npm run lint
build:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Set up NodeJS LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: npm i
- name: Build
run: npm run build
- name: Detect changes are applied
run: |
! git diff --stat | grep -E " [A-Za-z0-9-]+\.user\.js"
shell: bash
needs: [eslint]
run: npm run lint
41 changes: 41 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Publish to npm'
on:
release:
types: [published]

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Set up NodeJS LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
- name : Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
purge:
name: Purge jsdelivr cache
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Purge jsdelivr cache
uses: List-KR/[email protected]
with:
package: '@list-kr/namulink'
disttag: 'latest'
needs: [publish]
80 changes: 0 additions & 80 deletions .github/workflows/workflow.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
dist
8 changes: 3 additions & 5 deletions NamuLink.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "namulink",
"version": "4.0.11",
"name": "@list-kr/namulink",
"version": "4.0.13",
"description": "",
"type": "module",
"scripts": {
"build": "pnpm bundle",
"bundle": "esbuild sources/src/index.ts --bundle --minify --define:global=window --inject:./sources/esbuild.inject.ts --banner:js=\"$(cat ./sources/banner.txt)\" --target=es2022,chrome109,safari16,firefox115 --outfile=./NamuLink.user.js",
"debug": "esbuild sources/src/index.ts --bundle --define:global=window --inject:./sources/esbuild.inject.ts --banner:js=\"$(cat ./sources/banner.txt)\" --target=es2022,chrome109,safari16,firefox115 --outfile=./NamuLink-debug.user.js",
"bundle": "esbuild sources/src/index.ts --bundle --minify --define:global=window --inject:./sources/esbuild.inject.ts --banner:js=\"$(cat ./sources/banner.txt)\" --target=es2022,chrome109,safari16,firefox115 --outfile=./dist/NamuLink.user.js",
"debug": "esbuild sources/src/index.ts --bundle --define:global=window --inject:./sources/esbuild.inject.ts --banner:js=\"$(cat ./sources/banner.txt)\" --target=es2022,chrome109,safari16,firefox115 --outfile=./dist/NamuLink-debug.user.js",
"lint": "tsc && eslint sources --ext .ts"
},
"keywords": [],
Expand Down
6 changes: 3 additions & 3 deletions sources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// @namespace https://github.com/List-KR/NamuLink
// @homepageURL https://github.com/List-KR/NamuLink
// @supportURL https://github.com/List-KR/NamuLink/issues
// @updateURL https://cdn.jsdelivr.net/gh/List-KR/NamuLink@latest/NamuLink.user.js
// @downloadURL https://cdn.jsdelivr.net/gh/List-KR/NamuLink@latest/NamuLink.user.js
// @updateURL https://cdn.jsdelivr.net/npm/@list-kr/namulink@latest/dist/NamuLink.user.js
// @downloadURL https://cdn.jsdelivr.net/npm/@list-kr/namulink@latest/dist/NamuLink.user.js
// @license MIT
//
// @version 4.0.11
// @version 4.0.13
// @author PiQuark6046 and contributors
//
// @match https://namu.wiki/*
Expand Down

0 comments on commit 19b2057

Please sign in to comment.