setup monorepo

This commit is contained in:
Robin Malfait
2020-09-16 18:19:33 +02:00
parent cf289e443a
commit 672afbe9f8
13 changed files with 11649 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
/dist
/packages/**/dist
/node_modules
/packages/**/node_modules
+44
View File
@@ -0,0 +1,44 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Begin CI...
uses: actions/checkout@v2
- name: Use Node 12
uses: actions/setup-node@v1
with:
node-version: 12.x
# - name: Use cached node_modules
# id: cache
# uses: actions/cache@v1
# with:
# path: node_modules
# key: nodeModules-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# nodeModules-
- name: Install dependencies
# if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
env:
CI: true
- name: Lint
run: yarn lint
env:
CI: true
- name: Test
run: yarn test
env:
CI: true
- name: Build
run: yarn build
env:
CI: true
+44
View File
@@ -0,0 +1,44 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/packages/**/node_modules
# testing
/coverage
/packages/**/coverage
# logs
*.log
/packages/**/*.log
# next.js
/.next/
/packages/**/.next/
/out/
/packages/**/out/
# production
/build
/packages/**/dist
/dist
/packages/**/dist
# misc
.DS_Store
*.pem
.cache
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Tailwind Labs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+15
View File
@@ -0,0 +1,15 @@
const path = require('path')
function relativeToPackage(configPath) {
return path.resolve(process.cwd(), process.env.npm_package_repository_directory, configPath)
}
module.exports = {
setupFilesAfterEnv: ['<rootDir>/jest/custom-matchers.ts'],
globals: {
'ts-jest': {
isolatedModules: true,
tsConfig: relativeToPackage('./tsconfig.tsdx.json'),
},
},
}
+31
View File
@@ -0,0 +1,31 @@
// Assuming requestAnimationFrame is roughly 60 frames per second
const frame = 1000 / 60
const formatter = new Intl.NumberFormat('en')
expect.extend({
toBeWithinRenderFrame(actual, expected) {
const min = expected - frame
const max = expected + frame
const pass = actual >= min && actual <= max
if (pass) {
return {
message: () =>
`expected ${actual} not to be within range of a frame ${formatter.format(
min
)} - ${formatter.format(max)}`,
pass: true,
}
} else {
return {
message: () =>
`expected ${actual} to be within range of a frame ${formatter.format(
min
)} - ${formatter.format(max)}`,
pass: false,
}
}
},
})
+40
View File
@@ -0,0 +1,40 @@
{
"name": "headlessui",
"version": "0.0.1",
"description": "Headless UI components for various libraries like React and Vue",
"main": "index.js",
"repository": "https://github.com/tailwindlabs/headlessui",
"license": "MIT",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"react": "yarn workspace @headlessui/react",
"vue": "yarn workspace @headlessui/vue",
"shared": "yarn workspace @headlessui/shared",
"build": "yarn workspaces run build",
"test": "yarn workspaces run test",
"lint": "./scripts/lint.sh"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"prettier": {
"printWidth": 100,
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
},
"devDependencies": {
"@types/node": "^14.10.1",
"babel-jest": "^26.3.0",
"husky": "^4.3.0",
"jest": "^26.4.2",
"tsdx": "^0.13.3",
"tslib": "^2.0.1",
"typescript": "^3.9.7"
}
}
+6
View File
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
set -e
TARGET_DIR="$(pwd)"
# INFO: This script is always run from the individual package.
node="yarn node"
tsdxArgs=()
# Add script name
tsdxArgs+=("build" "--name" "headlessui" "--tsconfig" "./tsconfig.tsdx.json")
# Passthrough arguments and flags
tsdxArgs+=($@)
# Execute
$node "$(yarn bin tsdx)" "${tsdxArgs[@]}"
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
set -e
SCRIPTS_DIR="$(dirname "${BASH_SOURCE[0]}")"
ROOT_DIR="$(realpath $SCRIPTS_DIR/..)/"
TARGET_DIR="$(pwd)"
RELATIVE_TARGET_DIR="${TARGET_DIR/$ROOT_DIR/}"
# INFO: This script is always run from the root of the repository. If we execute this script from a
# package then the filters (in this case a path to $RELATIVE_TARGET_DIR) will be applied.
pushd $ROOT_DIR > /dev/null
node="yarn node"
tsdxArgs=()
# Add script name
tsdxArgs+=("lint")
# Add default arguments
tsdxArgs+=($RELATIVE_TARGET_DIR)
# Passthrough arguments and flags
tsdxArgs+=($@)
# Execute
$node "$(yarn bin tsdx)" "${tsdxArgs[@]}"
popd > /dev/null
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
set -e
SCRIPTS_DIR="$(dirname "${BASH_SOURCE[0]}")"
ROOT_DIR="$(realpath $SCRIPTS_DIR/..)/"
TARGET_DIR="$(pwd)"
RELATIVE_TARGET_DIR="${TARGET_DIR/$ROOT_DIR/}"
# INFO: This script is always run from the root of the repository. If we execute this script from a
# package then the filters (in this case a path to $RELATIVE_TARGET_DIR) will be applied.
pushd $ROOT_DIR > /dev/null
node="yarn node"
tsdxArgs=()
# Add script name
tsdxArgs+=("test")
# Add default arguments
tsdxArgs+=("--passWithNoTests" $RELATIVE_TARGET_DIR)
# Add arguments based on environment variabls
if [ -n "$CI" ]; then
jestArgs+=("--maxWorkers=4")
jestArgs+=("--ci")
fi
# Passthrough arguments and flags
tsdxArgs+=($@)
# Execute
$node "$(yarn bin tsdx)" "${tsdxArgs[@]}"
popd > /dev/null
+17
View File
@@ -0,0 +1,17 @@
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
purge: [],
theme: {
container: {
center: true,
},
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
},
},
variants: {},
plugins: [require('@tailwindcss/ui')],
}
+11345
View File
File diff suppressed because it is too large Load Diff