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

Fix TSC nodenext compatibility and add GH test workflow #2

Merged
merged 4 commits into from
Feb 19, 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
31 changes: 31 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Node.js CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run build

- name: unit
run: npm test

- name: test-packages
run: npm run test-packages
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
node_modules
.eslintcache
tsconfig.tsbuildinfo
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<img alt="docs" src="https://img.shields.io/badge/Docs-better--docs-informational">
</a>

<a href="https://github.com/ssangervasi/narrow-minded/actions?query=branch%3Amain+">
<img alt="test status" src="https://github.com/ssangervasi/narrow-minded/actions/workflows/tests.yaml/badge.svg">
</a>

## Easy `typeof` validations with sophisticated TypeScript inference

This package exists to make type safety easy for unstructured data. This includes runtime access if you're only using JavaScript, but gets even nicer with TypeScript.
Expand Down
44 changes: 20 additions & 24 deletions base.tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
]
},
// Syntax
"lib": [
"dom",
"dom.iterable",
"esnext"
],
// Output
"outDir": "dist",
// General
// Type Checking
"allowJs": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"inlineSourceMap": true,
Expand All @@ -33,10 +15,24 @@
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,

// Env
"lib": ["dom", "dom.iterable", "esnext"],
"target": "ES6",
"resolveJsonModule": true
"resolveJsonModule": true,

// Modules
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"]
},

// Emit
"declaration": true,
"declarationMap": true,
"outDir": "dist"
},
"include": [
"src"
]
}
"include": ["src"]
}
15 changes: 15 additions & 0 deletions bin/test-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# set -x
set -e

ls -1 ./package-examples | while read PACKAGE; do
echo "
---------------------------------
"./package-examples/$PACKAGE"
---------------------------------
"
pushd "./package-examples/$PACKAGE"
npm install
npm run test
popd
done
133 changes: 133 additions & 0 deletions docs/index.ts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@


<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> index.ts</title>

<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="./build/entry.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
<link type="text/css" rel="stylesheet" href="">
<script async defer src="https://buttons.github.io/buttons.js"></script>


</head>



<body class="layout small-header">
<div id="stickyNavbarOverlay"></div>


<div class="top-nav">
<div class="inner">
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
<div class="logo">


</div>
<div class="menu">

<div class="navigation">
<a
href="index.html"
class="link"
>
Documentation
</a>



</div>
</div>
</div>
</div>
<div id="main">
<div
class="sidebar "
id="sidebarNav"
>

<div class="search-wrapper">
<input id="search" type="text" placeholder="Search docs..." class="input">
</div>

<nav>

<h2><a href="index.html">Documentation</a></h2><div class="category"><h3>Classes</h3><ul><li><a href="Guard.html">Guard</a></li></ul><h3>Global</h3><ul><li><a href="global.html#narrow">narrow</a></li><li><a href="global.html#satisfier">satisfier</a></li><li><a href="global.html#some">some</a></li><li><a href="global.html#unknown">unknown</a></li></ul></div>

</nav>
</div>
<div class="core" id="main-content-wrapper">
<div class="content">
<header class="page-title">
<p>Source</p>
<h1>index.ts</h1>
</header>





<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* Ongoing TS hassle: https://github.com/microsoft/TypeScript/issues/50152]
*
* > TypeScript will impose Node’s much stricter ESM resolution algorithm on those files, disabling
* index-file resolution and extensionless lookups—in fact, the extension the user has to write is
* .js, which will be nonsensical for the context, where the runtime module resolver (the bundler)
* only ever sees .ts files.
*/
export * from './narrow.js'
export * from './guard.js'
</code></pre>
</article>
</section>




</div>

<footer class="footer">
<div class="content has-text-centered">
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a></p>
<p class="sidebar-created-by">
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
</p>
</div>
</footer>

</div>
<div id="side-nav" class="side-nav">
</div>
</div>
<script src="scripts/app.min.js"></script>
<script>PR.prettyPrint();</script>
<script src="scripts/linenumber.js"> </script>

<script src="scripts/search.js"> </script>


</body>
</html>
File renamed without changes.
Loading