Skip to content

Commit

Permalink
refactor: build project by jiek
Browse files Browse the repository at this point in the history
  • Loading branch information
NWYLZW committed Oct 12, 2024
1 parent 3f80280 commit e59da3c
Show file tree
Hide file tree
Showing 47 changed files with 6,704 additions and 2,537 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.idea
tsconfig.vitest-temp.json

### Node template
# Logs
Expand Down
21 changes: 0 additions & 21 deletions .pnpmfile.cjs

This file was deleted.

128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
33 changes: 33 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"typescript": {
"quoteStyle": "preferSingle",
"semiColons": "asi",
"trailingCommas": "never",
"conditionalType.operatorPosition": "nextLine",
"exportDeclaration": {
"sortNamedExports": "maintain"
}
},
"malva": {
"ignoreCommentDirective": "dprint-ignore",
"quotes": "preferSingle",
"omitNumberLeadingZero": true
},
"json": {
},
"markdown": {
},
"toml": {
},
"excludes": [
"**/node_modules",
"**/*-lock.json"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.90.3.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
"https://plugins.dprint.dev/toml-0.6.1.wasm",
"https://plugins.dprint.dev/g-plane/malva-v0.4.0.wasm"
]
}
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import config from '@antfu/eslint-config'

export default config({
stylistic: false,
typescript: {
overrides: {
'ts/no-namespace': 'off'
}
}
})
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
{
"name": "typp-workspace",
"type": "module",
"description": "A workspace for typp project.",
"scripts": {
"lint": "eslint --cache --cache-location=node_modules/.cache/.eslintcache/ ./ --max-warnings=0",
"test": "pnpm --recursive run test",
"coverage": "pnpm --recursive run coverage",
"coverage:badge": "pnpm --recursive run coverage:badge"
},
"packageManager": "[email protected]",
"engines": {
"node": ">=18.0.0"
},
"devDependencies": {
"@types/node": "^18.19.3",
"@antfu/eslint-config": "^3.3.2",
"@types/node": "^18.19.45",
"@vitest/coverage-istanbul": "^1.1.0",
"crrc": "workspace:*",
"esbuild-register": "^3.5.0",
"pnpm-helper": "workspace:*",
"rollup-helper": "workspace:*",
"standard": "workspace:*",
"typescript": "^5.3.3",
"dprint": "^0.47.2",
"esbuild-register": "^3.6.0",
"eslint": "^9.9.1",
"jiek": "^1.0.5",
"typescript": "^5.5.4",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.1.0"
"vitest": "^2.0.5"
},
"pnpm": {
"overrides": {
Expand Down
4 changes: 0 additions & 4 deletions packages/core/.npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
rollup.config.ts
src
tests

### Node template
# Logs
logs
Expand Down
20 changes: 4 additions & 16 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,15 @@
"version": "0.1.0",
"description": "Type meta system.",
"scripts": {
"build": "crrc rollup -c",
"test": "vitest --typecheck --no-watch",
"coverage": "vitest run --coverage",
"coverage:badge": "istanbul-badges-readme"
},
"main": "./dist/index.umd.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
"unpkg": "dist/index.umd.min.js",
"jsdelivr": "dist/index.umd.min.js",
"browser": "dist/index.umd.min.js",
"typesVersions": {
"<5.0": { "*": [ "*", "dist/*", "dist/*/index.esm.d.ts" ] }
"<5.0": { "*": [ "*", "dist/*", "dist/*/index.d.ts" ] }
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.esm.js",
"default": "./dist/index.esm.js",
"require": "./dist/index.umd.js",
"inner-src": "./src/index.ts"
}
"exports": "./src/index.ts",
"devDependencies": {
"@typp/core": "workspace:^*"
}
}
3 changes: 0 additions & 3 deletions packages/core/rollup.config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/core/src/consumers/array.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual, IsNotEqual } from '../types'

declare module '../base' {
declare module '@typp/core' {
namespace t {
export type ArrayConsume<
T,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/consumers/calc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual, Stack, T2I } from '../types'

const unionSymbol = Symbol('union')
const intersectionSymbol = Symbol('intersection')

declare module '../base' {
declare module '@typp/core' {
export namespace t {
// TODO exclude
// TODO extract
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/consumers/function.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { Collect, IsEqual, IsNotEqual, Replace, Stack } from '../types'

const functionSymbol = Symbol('function')
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function (ctx: typeof tn) {
}, () => ({ implement: func => func }))
}

declare module '../base' {
declare module '@typp/core' {
namespace t {
type FunctionConsume<
T,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/consumers/map.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual, Stack } from '../types'

const mapSymbol = Symbol('map')

declare module '../base' {
declare module '@typp/core' {
namespace t {
export type MapConsume<
T,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/consumers/object.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual, IsNotEqual, Stack, Values } from '../types'

const recordSymbol = Symbol('record')

declare module '../base' {
declare module '@typp/core' {
namespace t {
export type ObjectConsume<
T,
Expand Down
18 changes: 10 additions & 8 deletions packages/core/src/consumers/primitive.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual, IsNotEqual, IsWhat, NoIndexSignature, ValueOf, Values } from '../types'

const symbols = Object.freeze({
any: Symbol('any'),
void: Symbol('void'),
unknown: Symbol('unknown'),
never: Symbol('never')
}) as {
interface Symbols {
readonly any: unique symbol
readonly void: unique symbol
readonly unknown: unique symbol
readonly never: unique symbol
}

const symbols = Object.freeze({
any: Symbol('any'),
void: Symbol('void'),
unknown: Symbol('unknown'),
never: Symbol('never')
}) as Symbols

type LiteralPlaceholder<T extends string = string> = `__DO_NOT_USE_SAME_LITERAL_${T}__IF_YOU_WANT_TO_USE_IT__`
function literalPlaceholder<T extends string>(type: T): LiteralPlaceholder<T> {
return `__DO_NOT_USE_SAME_LITERAL_${type}__IF_YOU_WANT_TO_USE_IT__`
}

declare module '../base' {
declare module '@typp/core' {
// Consumer
namespace t {
interface LiteralStringMapping {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/consumers/set.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { t as tn, Typp } from '../base'
import type { t as tn, Typp } from '@typp/core'
import type { IsEqual } from '../types'

const setSymbol = Symbol('set')
declare module '../base' {
declare module '@typp/core' {
// consumer
namespace t {
export type SetConsume<
Expand Down
Loading

0 comments on commit e59da3c

Please sign in to comment.