Skip to content

Commit

Permalink
feat!: bring nominal-symbols to monorepo
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Correa Casablanca <[email protected]>
  • Loading branch information
castarco committed Oct 15, 2023
1 parent 3521b66 commit 6406c30
Show file tree
Hide file tree
Showing 57 changed files with 3,187 additions and 4,141 deletions.
14 changes: 12 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space

[*.{css,js,cjs,mjs,json,ts,cjs,mts,jsx,tsx,sh}]
charset = utf-8
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

[*.md]
indent_style = space
indent_size = 2

[package.json]
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
core.autocrlf=false

* text=auto
* text eol=lf
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ko_fi: coderspirit
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
issuehunt: castarco
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: https://www.paypal.com/donate?hosted_button_id=B4GAXGG68L9MG
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
7 changes: 4 additions & 3 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
- name: 'Greeting' # v1.2.0
uses: 'actions/first-interaction@1dbfe1ba5525b8257e1f259b09745bee346d62d8'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: '🥳 Thank you for opening your first issue for @coderspirit/nominal ! 😀'
pr-message: '🥳 Thank you for your first PR on @coderspirit/nominal ! 😀'
issue-message: '🥳 Thank you for opening your first issue for Coder-Spirit/nominal ! 😀'
pr-message: '🥳 Thank you for your first PR on Coder-Spirit/nominal ! 😀'
41 changes: 27 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,45 @@
name: Node.js CI
name: Tests

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
merge_group:
branches: [ main]

defaults:
run:
working-directory: ./nominal
working-directory: .

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 19.x]
node-version: [ 18, 20 ]
os: [ubuntu-22.04, ubuntu-20.04, windows-latest, macos-12, macos-11]

runs-on: ${{ matrix.os }}

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Checkout repository # v4.0.0
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
- name: Install PNPM # v2.4.0
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598
with:
version: '8.9.0'
- name: Use Node.js ${{ matrix.node-version }} # v3.8.1
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn
- run: yarn install
- run: yarn test
- run: yarn lint
cache: 'pnpm'

# All
- name: (All) Install dependencies
run: pnpm install --frozen-lockfile
- name: (All) Run All Tasks
run: pnpm turbo all
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Dependencies, Caches & Artifacts
.dccache
# Caches & Artifacts
.turbo/
coverage/
dist/
node_modules/
.eslintcache
.turbo-build.log
tsconfig.tsbuildinfo
9 changes: 4 additions & 5 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

yarn clean:deno && \
yarn build:deno && \
git add ./nominal/deno && \
yarn lint && \
yarn test
set -eu
set -o pipefail

pnpm turbo lint
6 changes: 6 additions & 0 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

set -eu
set -o pipefail

pnpm turbo all
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.18.3
20.8.1
7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

11 changes: 6 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"editorconfig.editorconfig"
]
}
19 changes: 9 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"files.autoSave": "afterDelay",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"editor.tabSize": 2,
}
"files.autoSave": "afterDelay",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
}
23 changes: 23 additions & 0 deletions @coderspirit/nominal-symbols/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

module.exports = {
root: true,
env: {
es2020: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
tsConfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
extends: [
'@coderspirit',
],
ignorePatterns: [
'.eslintrc.cjs',
'dist/**/*',
'node_modules/**/*',
]
}
3 changes: 3 additions & 0 deletions @coderspirit/nominal-symbols/.prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from '@coderspirit/eslint-config/prettier'

export default config
68 changes: 68 additions & 0 deletions @coderspirit/nominal-symbols/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "@coderspirit/nominal-symbols",
"version": "2.0.0",
"description": "Symbol objects for @coderspirit/nominal",
"keywords": [
"typescript",
"types",
"nominal",
"taint"
],
"author": "Andres Correa Casablanca <[email protected]>",
"private": false,
"license": "MIT",
"main": "./dist/symbols.cjs",
"module": "./dist/symbols.mjs",
"types": "./dist/symbols.d.cts",
"files": [
"dist"
],
"exports": {
"import": {
"types": "./dist/symbols.d.mts",
"default": "./dist/symbols.mjs"
},
"require": {
"types": "./dist/symbols.d.cts",
"default": "./dist/symbols.cjs"
}
},
"scripts": {
"build": "rollup --config rollup.config.prod.mjs",
"build:clean": "rm -rf dist && rollup --config rollup.config.prod.mjs",
"clean": "rm -rf dist",
"lint:_all": "pnpm run lint:tsc && pnpm run lint:eslint && pnpm run lint:publint",
"lint:eslint": "eslint . --ext ts,mts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:publint": "publint",
"lint:tsc": "tsc",
"prepublishOnly": "pnpm run clean && pnpm run build"
},
"peerDependencies": {
"typescript": ">=5.2"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.12.2",
"@coderspirit/eslint-config": "^1.3.0",
"@rollup/plugin-typescript": "^11.1.5",
"@types/node": "^20.8.6",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"prettier": "^3.0.3",
"publint": "^0.2.4",
"rollup": "^4.1.1",
"rollup-plugin-dts": "^6.1.0",
"tslib": "^2.6.2",
"typescript": "^5.2.2"
},
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Coder-Spirit/nominal.git"
},
"bugs": {
"url": "https://github.com/Coder-Spirit/nominal/issues"
},
"homepage": "https://github.com/Coder-Spirit/nominal#readme"
}
24 changes: 24 additions & 0 deletions @coderspirit/nominal-symbols/rollup.config.prod.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from 'rollup'
import dts from 'rollup-plugin-dts'
import pluginTs from '@rollup/plugin-typescript'

const input = 'src/symbols.ts'

export default defineConfig([
{
input,
output: [
{ format: 'cjs', file: 'dist/symbols.cjs' },
{ format: 'es', file: 'dist/symbols.mjs' },
],
plugins: [pluginTs()],
},
{
input,
output: [
{ format: 'cjs', file: 'dist/symbols.d.cts' },
{ format: 'es', file: 'dist/symbols.d.mts' },
],
plugins: [dts()],
},
])
File renamed without changes.
11 changes: 11 additions & 0 deletions @coderspirit/nominal-symbols/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./src",
},
"exclude": [
"coverage/**/*",
"dist/**/*",
"node_modules/**/*",
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions @coderspirit/nominal/src/internal/Symbols.ts.esm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const __BaseType: unique symbol = Symbol('__BaseType')
export const __Properties: unique symbol = Symbol('__Properties')
export const __Brand: unique symbol = Symbol('__Brand')

export const __PropertyName: unique symbol = Symbol('__PropertyName')
export const __PropertyValues: unique symbol = Symbol('__PropertyValues')

// Some Nominal tricks rely on the fact that this symbol and its type won't be
// exported as public to the library's users.
const __ImpossibleSymbol: unique symbol = Symbol('__Impossible')
export type __Impossible = typeof __ImpossibleSymbol
Loading

0 comments on commit 6406c30

Please sign in to comment.