This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
/** @type {import('axios').CancelTokenSource) | null } */ | |
export let cancelTokenSource = null | |
export function setCancelTokenSource (source) { | |
cancelTokenSource = source | |
} | |
axios.interceptors.request.use(function (config) { | |
// Do something before request is sent | |
config.cancelToken = cancelTokenSource ? cancelTokenSource.token : null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yarn add request | |
const request = { | |
get (uri, opts) { | |
// lazy require | |
const request = require('util').promisify(require('request')) | |
const reqOpts = { | |
method: 'GET', | |
timeout: 30000, | |
resolveWithFullResponse: true, | |
json: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const extraKeys = [ | |
'app', | |
'title', | |
'package', | |
'deeplink', | |
'url', | |
'logo', | |
'image', | |
'type' | |
] as const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypeScript 13 hrs 29 mins ████████████████░░░░░ 76.4% | |
JSON 1 hr 52 mins ██▏░░░░░░░░░░░░░░░░░░ 10.7% | |
JavaScript 1 hr 35 mins █▉░░░░░░░░░░░░░░░░░░░ 9.0% | |
Other 26 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.5% | |
Less 4 mins ░░░░░░░░░░░░░░░░░░░░░ 0.4% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const execa = require('execa') | |
const path = require('path') | |
const fs = require('fs') | |
async function main() { | |
const scriptPath = path.join(__dirname, 'pc.ps1'); | |
const imagePath = path.resolve(__dirname, 'clipboard.png') | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = require('path') | |
const util = require('util') | |
const exec = util.promisify(require('child_process').exec) | |
const mkdirp = require('mkdirp') | |
const outputPath = 'dist/static' | |
async function main() { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const util = require('util') | |
const childProcess = require('child_process') | |
const exec = util.promisify(childProcess.exec) | |
async function main() { | |
try { | |
const { stdout: changeFiles } = await exec( | |
'git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD' | |
) | |
if (changeFiles.includes('package.json')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const shell = require('shelljs') | |
if (!shell.which('git')) { | |
shell.echo('Sorry, this script requires git'); | |
shell.exit(1); | |
} | |
shell.exec('git diff --cached',{silent: true}, async (code, stdout, stderr) => { | |
if (code !== 0) return | |
if (!stdout.match(/console\.log/)) return |