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

feat(core): Setup @sugarform/core #8

Merged
merged 25 commits into from
Dec 17, 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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
indent_style = space
indent_size = 2
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
ignorePatterns: ["apps/**", "packages/**"],
extends: ["@repo/eslint-config/library.js"],
parser: "@typescript-eslint/parser",
ignorePatterns: ['configs/**', 'packages/**', 'tests/**'],
extends: ['@repo/eslint-config/library.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
},
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-turbo/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- name: Launch Turbo Remote Cache Server
uses: dtinth/setup-github-actions-caching-for-turbo@v1.1.0
with:
cache-prefix: turbogha_${{ runner.os }}_${{ inputs.turbo-cache-key }}_node${{ inputs.node-version }}
cache-prefix: turbogha-${{ runner.os }}-${{ inputs.turbo-cache-key }}-node${{ inputs.node-version }}_
- name: Setup node
uses: ./.github/actions/setup-node
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build-and-test

on:
push:
branches: [main]
pull_request_target:

permissions: read-all

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v3
- if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup turbo
uses: ./.github/actions/setup-turbo
with:
turbo-cache-key: build-and-test
- name: Run Build
run: pnpm build

3 changes: 1 addition & 2 deletions .github/workflows/format-and-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: ./.github/actions/setup-node
- name: Run Prettier
run: pnpm run format:check

eslint:
runs-on: ubuntu-latest
steps:
Expand All @@ -37,4 +37,3 @@ jobs:
turbo-cache-key: lint
- name: Run ESLint
run: pnpm run lint

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vite-inspect/

# Misc
.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trailingComma = "es5"
semi = true
singleQuote = true
18 changes: 9 additions & 9 deletions configs/eslint-config/library.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { resolve } = require("node:path");
const { resolve } = require('node:path');

const project = resolve(process.cwd(), "tsconfig.json");
const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "eslint-config-turbo"],
plugins: ["only-warn"],
extends: ['eslint:recommended', 'prettier', 'eslint-config-turbo'],
plugins: ['only-warn'],
globals: {
React: true,
JSX: true,
Expand All @@ -14,21 +14,21 @@ module.exports = {
node: true,
},
settings: {
"import/resolver": {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
'.*.js',
'node_modules/',
'dist/',
],
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
files: ['*.js?(x)', '*.ts?(x)'],
},
],
};
2 changes: 1 addition & 1 deletion configs/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"eslint-config-prettier": "^9.0.0",
"eslint-config-turbo": "^1.10.12",
"eslint-plugin-only-warn": "^1.1.0",
"typescript": "^5.2.2"
"typescript": "^5.3.3"
}
}
18 changes: 9 additions & 9 deletions configs/eslint-config/react-internal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { resolve } = require("node:path");
const { resolve } = require('node:path');

const project = resolve(process.cwd(), "tsconfig.json");
const project = resolve(process.cwd(), 'tsconfig.json');

/*
* This is a custom ESLint configuration for use with
Expand All @@ -14,8 +14,8 @@ const project = resolve(process.cwd(), "tsconfig.json");

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "eslint-config-turbo"],
plugins: ["only-warn"],
extends: ['eslint:recommended', 'prettier', 'eslint-config-turbo'],
plugins: ['only-warn'],
globals: {
React: true,
JSX: true,
Expand All @@ -24,20 +24,20 @@ module.exports = {
browser: true,
},
settings: {
"import/resolver": {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
'.*.js',
'node_modules/',
'dist/',
],
overrides: [
// Force ESLint to detect .tsx files
{ files: ["*.js?(x)", "*.ts?(x)"] },
{ files: ['*.js?(x)', '*.ts?(x)'] },
],
};
6 changes: 3 additions & 3 deletions configs/typescript-config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"moduleResolution": "bundler",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"skipLibCheck": false,
"strict": true,
"target": "ES2022"
}
Expand Down
5 changes: 4 additions & 1 deletion configs/typescript-config/react-library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"jsx": "react-jsx"
"jsx": "react-jsx",
"declaration": true,
"declarationMap": true,
"incremental": true
}
}
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{
"name": "sugarform",
"private": true,
"type": "module",
"scripts": {
"build": "turbo build",
"lint": "turbo lint -- --max-warnings=0",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,md}\""
"typecheck": "turbo typecheck",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,json}\"",
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,json}\""
},
"devDependencies": {
"@manypkg/cli": "^0.21.1",
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@swc/core": "^1.3.100",
"@types/multi-stage-sourcemap": "^0.3.4",
"@types/node": "^20.10.4",
"consola": "^3.2.3",
"esbuild": "^0.19.9",
"esbuild-node-externals": "^1.11.0",
"execa": "^8.0.1",
"multi-stage-sourcemap": "^0.3.1",
"prettier": "^3.1.0",
"turbo": "latest"
"source-map": "^0.7.4",
"tsx": "^4.6.2",
"turbo": "latest",
"typescript": "^5.3.3"
},
"packageManager": "pnpm@8.9.0",
"engines": {
Expand All @@ -21,7 +34,8 @@
"manypkg": {
"ignoredRules": [
"INTERNAL_MISMATCH",
"ROOT_HAS_DEV_DEPENDENCIES"
"ROOT_HAS_DEV_DEPENDENCIES",
"INVALID_DEV_AND_PEER_DEPENDENCY_RELATIONSHIP"
]
}
}
9 changes: 9 additions & 0 deletions packages/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ['@repo/eslint-config/library.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
};
Loading