-
Notifications
You must be signed in to change notification settings - Fork 211
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
Showing
149 changed files
with
5,359 additions
and
634 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,31 @@ | ||
name: Node.js CI | ||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
jobs: | ||
build: | ||
name: "Fmt, Lint, & Test" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: | ||
- 20.x | ||
- latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: "Webi: Install 'shfmt' and 'shellcheck', and update PATH" | ||
run: | | ||
sh ./_scripts/install-ci-deps | ||
echo "${HOME}/.local/bin" >> $GITHUB_PATH | ||
- run: shfmt --version | ||
- run: shellcheck -V | ||
- run: node --version | ||
- run: npm run fmt | ||
- run: npm ci | ||
- run: npm run lint | ||
- run: npm run test |
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 @@ | ||
DELETEMEnode_modules/**/* |
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,4 @@ | ||
node_modules | ||
jsconfig.json | ||
package.json | ||
package-lock.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"bracketSpacing": true, | ||
"printWidth": 80, | ||
"proseWrap": "always", | ||
"singleQuote": true, | ||
"proseWrap": "always" | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"semi": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
atomicparsley |
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
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,57 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var Fs = require('node:fs/promises'); | ||
var Path = require('node:path'); | ||
|
||
async function copyScripts() { | ||
var pkgDir = Path.join(__dirname, '..'); | ||
var scriptsDir = Path.join(pkgDir, '_scripts'); | ||
var gitFile = Path.join(pkgDir, '.git'); | ||
|
||
// if this is a submodule, '.git' will be a file with a | ||
// path to the actual git module directory | ||
var gitDir = await Fs.readFile(gitFile, 'utf8') | ||
.catch(function (e) { | ||
// console.error(e); | ||
//return 'gitdir: ../.git/modules/installers'; | ||
return 'gitdir: ./.git'; | ||
}) | ||
.then(function (str) { | ||
var parts = str.split(': '); | ||
str = parts[1]; | ||
str = str.trim(); | ||
|
||
return Path.resolve(pkgDir, str); | ||
}); | ||
|
||
var gitHooksDir = Path.join(gitDir, 'hooks'); | ||
|
||
var src = Path.join(scriptsDir, 'git-hooks-pre-commit.js'); | ||
var dst = Path.join(gitHooksDir, 'pre-commit'); | ||
|
||
console.info(`[git-hooks] Checking for pre-commit hooks...`); | ||
var relSrc = Path.relative(pkgDir, src); | ||
var relDst = Path.relative(pkgDir, dst); | ||
await Fs.access(dst) | ||
.then(function () { | ||
console.info(`[git-hooks] Found ${relDst}`); | ||
}) | ||
.catch(async function (e) { | ||
// ignore e | ||
await Fs.mkdir(gitHooksDir, { recursive: true }); | ||
await Fs.copyFile(src, dst); | ||
await Fs.chmod(dst, 0o755); | ||
console.info(`[git-hooks] Found template ${relSrc}`); | ||
console.info(`[git-hooks] Initialized ${relDst}`); | ||
}); | ||
} | ||
|
||
copyScripts() | ||
.then(function () { | ||
process.exit(0); | ||
}) | ||
.catch(function (e) { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
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,7 @@ | ||
#!/bin/sh | ||
set -e | ||
set -u | ||
|
||
npm run fmt | ||
npm run lint | ||
npm run test |
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,12 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var Process = require('child_process'); | ||
|
||
var procOpts = { stdio: 'inherit' }; | ||
var commands = ['npm run fmt', 'npm run lint', 'npm run test']; | ||
|
||
for (let cmd of commands) { | ||
console.info(`[pre-commit] exec: ${cmd}`); | ||
Process.execSync(cmd, procOpts); | ||
} |
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,9 @@ | ||
#!/bin/sh | ||
set -e | ||
set -u | ||
|
||
# Install 'shfmt 3.7.x' | ||
curl -fsS https://webi.sh/[email protected] | sh | ||
|
||
# Install 'shellcheck v0.9.x' | ||
curl -fsS https://webi.sh/[email protected] | sh |
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,32 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var Cmd = require('node:child_process'); | ||
var Os = require('node:os'); | ||
|
||
var procOpts = { stdio: 'inherit' }; | ||
var commands = ['shfmt --version', 'shellcheck --version']; | ||
|
||
for (let cmd of commands) { | ||
console.info(`[tooling-init] checking for '${cmd}':`); | ||
try { | ||
Cmd.execSync(cmd, procOpts); | ||
} catch (e) { | ||
// ignore e | ||
printInstallHelp(cmd); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
function printInstallHelp(cmd) { | ||
console.error(''); | ||
console.error('ERROR'); | ||
console.error(` could not run '${cmd}'`); | ||
console.error('POSSIBLE FIX'); | ||
if (/^win/i.test(Os.platform())) { | ||
console.error(` curl.exe https://webi.ms/${cmd} | powershell`); | ||
} else { | ||
console.error(` curl -fsS https://webi.sh/${cmd} | sh`); | ||
} | ||
console.error(''); | ||
} |
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
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
Oops, something went wrong.