Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 BUMP: 12 files changed, 458(+), 348(-) #4

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/cron/job1.ts

This file was deleted.

30 changes: 0 additions & 30 deletions .github/cron/job2.ts

This file was deleted.

3 changes: 1 addition & 2 deletions .github/scripts/ciutil
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ download() {
preinstall-binaries() {
cp .github/scripts/ciutil ~/.local/bin/

for url in $(jq .preinstallBinaries package.json | jq -r .[]); do
for url in $(jq .preinstallBinaries bin/package.json | jq -r .[]); do
download "$url" &
done

Expand Down Expand Up @@ -49,7 +49,6 @@ git-commit-to-repository() {
git add . --verbose
stats=$(git diff --cached --shortstat | sed -E 's/ (insertion|insertions|deletion|deletions)//g')
git commit -m "⚡️ CI: $stats [skip ci]" -a || true
git push
}

set-env-variables() {
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/setup
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ timestamp
# =============================================================================
# Install node_modules
# =============================================================================
if cat $GITROOT/package.json | jq -e .dependencies &>/dev/null; then
if cat $GITROOT/bin/package.json | jq -e .dependencies &>/dev/null; then
✨ "pnpm install"

cd $GITROOT
cd $GITROOT/bin

# Applying dirty fix for *not* including @types/* in the production ci
cp pnpm-lock.yaml $RUNNER_TEMPDIR/
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ jobs:
- name: Cron ❯❯ Job1
# if: github.event.schedule != '*/5 * * * *'
run: |
pstats memo --ttl=300s -- 'deno run -A .github/cron/job1.ts'
pstats memo --ttl=300s -- 'deno run -A bin/job1.ts'

# ─────────────────────────────────────────────────────
- name: Post hooks ❯❯ Commit to repository
if: github.ref == 'refs/heads/main'
run: |
.github/scripts/ciutil git-commit-to-repository
git push

# ─────────────────────────────────────────────────────
- name: "Debug ❯❯ Context Information"
Expand Down
12 changes: 10 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"json.schemaDownload.enable": true,
"deno.enable": true,
"deno.importMap": "./deno.json",
"deno.cacheOnSave": true,
"deno.lint": false,
"deno.importMap": "./bin/deno.json",
"deno.config": "./bin/deno.json",
"editor.defaultFormatter": "denoland.vscode-deno",
"deno.suggest.autoImports": true,
"deno.suggest.completeFunctionCalls": true,
"deno.suggest.imports.autoDiscover": true,
Expand All @@ -10,11 +15,14 @@
"deno.suggest.names": true,
"deno.suggest.paths": true,
"deno.unstable": true,
"editor.formatOnSaveMode": "file",
"editor.formatOnType": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": false,
"eslint.useESLintClass": true,
"eslint.enable": true,
"eslint.validate": [
"javascript",
"javascriptreact",
Expand Down
6 changes: 2 additions & 4 deletions deno.json → bin/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"deno/": "https://cdn.jsdelivr.net/gh/blend/promise-utils/src/"
},
"fmt": {
"options": {
"semiColons": false,
"singleQuote": true
}
"semiColons": false,
"singleQuote": true
},
"tasks": {
"update:lockfile": "fd .ts . -tf --threads=1 -X deno cache --import-map=deno.json --unstable --lock=deno.lock --lock-write"
Expand Down
6 changes: 5 additions & 1 deletion deno.lock → bin/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions bin/deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import _chalk from 'npm:chalk@5'

export { $ } from 'dax/mod.ts'
export { colors } from 'dax/src/deps.ts'
export * as uuid from 'std/uuid/mod.ts'
export const { log } = console
export * as p from 'npm:blend-promise-utils'
export * as dax from 'dax/src/deps.ts'
export const chalk = _chalk
39 changes: 39 additions & 0 deletions bin/job1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env -S deno run -A

import process from 'node:process'
import { $, chalk, dax, log, p, uuid } from './deps.ts'

process.env.FORCE_COLOR = 'true'

log(uuid.v1.generate())
log('test')

await $ `echo 5`
await $ `echo ---------`
await $ `git rev-parse --show-toplevel`

const branch = await $ `git rev-parse --abbrev-ref HEAD`.text()
log(branch)

await $ `echo ---------`

await p.mapLimit(
[
'11',
'22',
'33',
'44',
],
2,
async (x, i) => {
log(i, x)
await $ `sleep 0.5`
},
)

const bar = chalk.reset.inverse(' ')

log(bar)

log(chalk.bgBlue.red('hello world '))
log(dax.colors.red(dax.colors.bgBlue('hello world')))
28 changes: 28 additions & 0 deletions bin/job2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env -S deno run -A

import process from 'node:process'
import { $, log, p } from './deps.ts'

process.env.FORCE_COLOR = 'true'

$.cd(await Deno.makeTempDir())

await p.mapLimit(
[
'http://speedtest.tele2.net/1MB.zip',
'http://speedtest.tele2.net/100MB_.zip',
'http://speedtest.tele2.net/10MB.zip',
'http://speedtest.tele2.net/10MB.zip',
'http://speedtest.tele2.net/10MB.zip',
],
4,
async (x, _i) => {
log('Downloading:', x)
const result = await $ `timeout 1s wget -q ${x}`.noThrow().captureCombined()

if (result?.code)
log(`❌ ${x}`, result.combined, result?.code)
else
log(`✅ ${x}`, result?.code)
},
)
12 changes: 7 additions & 5 deletions package.json → bin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
},
"devDependencies": {
"@antfu/eslint-config": "^0.29.4",
"@tsconfig/deno": "^1.0.7",
"@types/node": "^18.16.7",
"eslint": "^8.40.0",
"@tsconfig/deno": "^1.0.8",
"@types/node": "^18.17.1",
"eslint": "^8.46.0",
"eslint-plugin-unicorn": "^44.0.2"
},
"preinstallBinaries": [
Expand All @@ -33,9 +33,9 @@
"deno.json*"
],
"parserOptions": {
"ecmaVersion": 2023,
"ecmaVersion": "latest",
"sourceType": "module",
"project": "tsconfig.json"
"project": "./bin/tsconfig.json"
},
"plugins": [
"unicorn"
Expand All @@ -62,7 +62,9 @@
"*.mjs"
],
"rules": {
"template-tag-spacing": ["error", "always"],
"no-console": "off",
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/require-await": [
"error"
],
Expand Down
Loading