-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fddb1d5
commit 38df7e7
Showing
17 changed files
with
352 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
aix/ppc64 | ||
android/386 | ||
android/amd64 | ||
android/arm | ||
android/arm64 | ||
darwin/amd64 | ||
darwin/arm64 | ||
dragonfly/amd64 | ||
freebsd/386 | ||
freebsd/amd64 | ||
freebsd/arm | ||
freebsd/arm64 | ||
freebsd/riscv64 | ||
illumos/amd64 | ||
ios/amd64 | ||
ios/arm64 | ||
js/wasm | ||
linux/386 | ||
linux/amd64 | ||
linux/arm | ||
linux/arm64 | ||
linux/loong64 | ||
linux/mips | ||
linux/mips64 | ||
linux/mips64le | ||
linux/mipsle | ||
linux/ppc64 | ||
linux/ppc64le | ||
linux/riscv64 | ||
linux/s390x | ||
netbsd/386 | ||
netbsd/amd64 | ||
netbsd/arm | ||
netbsd/arm64 | ||
openbsd/386 | ||
openbsd/amd64 | ||
openbsd/arm | ||
openbsd/arm64 | ||
openbsd/mips64 | ||
plan9/386 | ||
plan9/amd64 | ||
plan9/arm | ||
solaris/amd64 | ||
windows/386 | ||
windows/amd64 | ||
windows/arm | ||
windows/arm64 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import https from 'https' | ||
|
||
function installUsingNPM(pkg, subpath, binPath) { | ||
const env = { ...process.env, npm_config_global: void 0 } | ||
const esbuildLibDir = path2.dirname(require.resolve('esbuild')) | ||
const installDir = path2.join(esbuildLibDir, 'npm-install') | ||
fs2.mkdirSync(installDir) | ||
try { | ||
fs2.writeFileSync(path2.join(installDir, 'package.json'), '{}') | ||
child_process.execSync( | ||
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`, | ||
{ cwd: installDir, stdio: 'pipe', env }, | ||
) | ||
const installedBinPath = path2.join(installDir, 'node_modules', pkg, subpath) | ||
fs2.renameSync(installedBinPath, binPath) | ||
} finally { | ||
try { | ||
removeRecursive(installDir) | ||
} catch {} | ||
} | ||
} | ||
|
||
function removeRecursive(dir) { | ||
for (const entry of fs2.readdirSync(dir)) { | ||
const entryPath = path2.join(dir, entry) | ||
let stats | ||
try { | ||
stats = fs2.lstatSync(entryPath) | ||
} catch { | ||
continue | ||
} | ||
if (stats.isDirectory()) removeRecursive(entryPath) | ||
else fs2.unlinkSync(entryPath) | ||
} | ||
fs2.rmdirSync(dir) | ||
} | ||
|
||
async function downloadDirectlyFromNPM(pkg, subpath, binPath) { | ||
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace( | ||
'@esbuild/', | ||
'', | ||
)}-${versionFromPackageJSON}.tgz` | ||
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`) | ||
try { | ||
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath)) | ||
fs2.chmodSync(binPath, 493) | ||
} catch (e) { | ||
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${(e && e.message) || e}`) | ||
throw e | ||
} | ||
} | ||
|
||
async function checkAndPreparePackage() { | ||
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { | ||
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) { | ||
console.warn( | ||
`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`, | ||
) | ||
} else { | ||
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH) | ||
return | ||
} | ||
} | ||
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform() | ||
let binPath | ||
try { | ||
binPath = require.resolve(`${pkg}/${subpath}`) | ||
} catch (e) { | ||
console.error(`[esbuild] Failed to find package "${pkg}" on the file system | ||
This can happen if you use the "--no-optional" flag. The "optionalDependencies" | ||
package.json feature is used by esbuild to install the correct binary executable | ||
for your current platform. This install script will now attempt to work around | ||
this. If that fails, you need to remove the "--no-optional" flag to use esbuild. | ||
`) | ||
binPath = downloadedBinPath(pkg, subpath) | ||
try { | ||
console.error(`[esbuild] Trying to install package "${pkg}" using npm`) | ||
installUsingNPM(pkg, subpath, binPath) | ||
} catch (e2) { | ||
console.error( | ||
`[esbuild] Failed to install package "${pkg}" using npm: ${(e2 && e2.message) || e2}`, | ||
) | ||
try { | ||
await downloadDirectlyFromNPM(pkg, subpath, binPath) | ||
} catch (e3) { | ||
throw new Error(`Failed to install package "${pkg}"`) | ||
} | ||
} | ||
} | ||
maybeOptimizePackage(binPath) | ||
} | ||
checkAndPreparePackage().then(() => { | ||
if (isToPathJS) { | ||
validateBinaryVersion(process.execPath, toPath) | ||
} else { | ||
validateBinaryVersion(toPath) | ||
} | ||
}) |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@grprogress/darwin-amd64", | ||
"version": "0.0.0", | ||
"description": "a gradient progress for cli", | ||
"main": "grprogress-darwin-amd64", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/shaobeichen/grprogress.git" | ||
}, | ||
"keywords": [ | ||
"github", | ||
"go", | ||
"cli", | ||
"gradient", | ||
"progress", | ||
"gradient", | ||
"bubbletea", | ||
"bubble" | ||
], | ||
"homepage": "https://github.com/shaobeichen/grprogress#readme", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"grprogress-darwin-amd64" | ||
], | ||
"os": [ | ||
"darwin" | ||
], | ||
"cpu": [ | ||
"amd64" | ||
] | ||
} |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@grprogress/darwin-arm64", | ||
"version": "0.0.0", | ||
"description": "a gradient progress for cli", | ||
"main": "grprogress-darwin-arm64", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/shaobeichen/grprogress.git" | ||
}, | ||
"keywords": [ | ||
"github", | ||
"go", | ||
"cli", | ||
"gradient", | ||
"progress", | ||
"gradient", | ||
"bubbletea", | ||
"bubble" | ||
], | ||
"homepage": "https://github.com/shaobeichen/grprogress#readme", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"grprogress-darwin-arm64" | ||
], | ||
"os": [ | ||
"darwin" | ||
], | ||
"cpu": [ | ||
"arm64" | ||
] | ||
} |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@grprogress/linux-amd64", | ||
"version": "0.0.0", | ||
"description": "a gradient progress for cli", | ||
"main": "grprogress-linux-amd64", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/shaobeichen/grprogress.git" | ||
}, | ||
"keywords": [ | ||
"github", | ||
"go", | ||
"cli", | ||
"gradient", | ||
"progress", | ||
"gradient", | ||
"bubbletea", | ||
"bubble" | ||
], | ||
"homepage": "https://github.com/shaobeichen/grprogress#readme", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"grprogress-linux-amd64" | ||
], | ||
"os": [ | ||
"linux" | ||
], | ||
"cpu": [ | ||
"amd64" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@grprogress/windows-amd64", | ||
"version": "0.0.0", | ||
"description": "a gradient progress for cli", | ||
"main": "grprogress-windows-amd64.exe", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/shaobeichen/grprogress.git" | ||
}, | ||
"keywords": [ | ||
"github", | ||
"go", | ||
"cli", | ||
"gradient", | ||
"progress", | ||
"gradient", | ||
"bubbletea", | ||
"bubble" | ||
], | ||
"homepage": "https://github.com/shaobeichen/grprogress#readme", | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
"grprogress-windows-amd64.exe" | ||
], | ||
"os": [ | ||
"windows" | ||
], | ||
"cpu": [ | ||
"amd64" | ||
] | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { exec } from 'child_process' | ||
|
||
const platforms = ['darwin/arm64', 'darwin/amd64', 'linux/amd64', 'windows/amd64'] | ||
|
||
platforms.forEach((platform) => { | ||
const [os, arch] = platform.split('/') | ||
let output = `npm/${os}-${arch}/grprogress-${os}-${arch}` | ||
|
||
if (os === 'windows') output += '.exe' | ||
|
||
const command = `go build -o ${output} main.go` | ||
|
||
exec( | ||
command, | ||
{ | ||
env: { | ||
...process.env, | ||
GOOS: os, | ||
GOARCH: arch, | ||
}, | ||
}, | ||
(error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`error ${platform}: ${error.message}`) | ||
return | ||
} | ||
if (stderr) { | ||
console.error(`stderr: ${stderr}`) | ||
return | ||
} | ||
console.log(`success ${platform}: ${stdout}`) | ||
}, | ||
) | ||
}) |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
import { update } from './index.js' | ||
|
||
update(0.5) | ||
|
||
setTimeout(() => { | ||
update(1) | ||
}, 2000) | ||
update(1) |
Oops, something went wrong.