Skip to content

Commit

Permalink
chore: separate repo
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Nov 23, 2022
1 parent 19e04fb commit 073a789
Show file tree
Hide file tree
Showing 26 changed files with 10,186 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .czrc
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
; editorconfig.org
root = true
charset= utf8

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .eslintignore
@@ -1 +1 @@
/dist
dist
59 changes: 59 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,59 @@
'use strict'

module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['import', 'jsx-a11y', 'react', 'react-hooks', '@typescript-eslint', 'prettier'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: true,
order: 'asc',
},
},
],
'no-console': 'error',
'no-warning-comments': ['warn', {location: 'start', terms: ['todo', '@todo', 'fixme']}],
'padding-line-between-statements': [
'warn',
{blankLine: 'always', prev: '*', next: 'block'},
{blankLine: 'always', prev: '*', next: 'block-like'},
{blankLine: 'always', prev: 'const', next: 'expression'},
{blankLine: 'always', prev: 'let', next: 'expression'},
{blankLine: 'always', prev: 'var', next: 'expression'},
{blankLine: 'always', prev: 'block', next: '*'},
{blankLine: 'always', prev: 'block-like', next: '*'},
{blankLine: 'always', prev: '*', next: 'return'},
],
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react/no-unescaped-entities': 'off',
},
settings: {react: {version: 'detect'}},
}
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,50 @@
name: CI & Release

on:
push:
pull_request:
branches:
- main
- beta
- alpha

jobs:
test:
runs-on: ${{ matrix.platform }}
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
node-version: [lts/*, current]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm i pnpm@latest -g
- run: pnpm install
- run: pnpm build
- run: pnpm lint
- run: pnpm test

release:
name: 'Semantic release'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: lts/*
- run: npm i pnpm@latest -g
- run: pnpm install
# Branches that will release new versions are defined in .releaserc.json
- run: pnpm exec semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
6 changes: 4 additions & 2 deletions .gitignore
@@ -1,2 +1,4 @@
/dist
/node_modules
.DS_Store
.workshop
dist
node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec commitlint --edit $1
6 changes: 6 additions & 0 deletions .prettierrc
@@ -0,0 +1,6 @@
{
"semi": false,
"printWidth": 100,
"bracketSpacing": false,
"singleQuote": true
}
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Sanity.io

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.
14 changes: 14 additions & 0 deletions babel.config.js
@@ -0,0 +1,14 @@
'use strict'

//
// NOTE: this file is only here to make Jest tests run on CI
// This should be removed (along with babel dependencies) when possible
//

module.exports = {
presets: [
['@babel/preset-env', {modules: 'commonjs'}],
['@babel/preset-react', {runtime: 'automatic'}],
'@babel/preset-typescript',
],
}
20 changes: 13 additions & 7 deletions jest.config.js
@@ -1,10 +1,16 @@
/* eslint-disable @typescript-eslint/no-var-requires */

'use strict'

const {createJestConfig} = require('../../../test/jestConfig')

/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = createJestConfig({
displayName: require('./package.json').name,
})
module.exports = {
moduleFileExtensions: ['cjs', 'js', 'jsx', 'mjs', 'ts', 'tsx'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
setupFilesAfterEnv: ['<rootDir>/test/setupFilesAfterEnv.ts'],
testRegex: '(/__tests__/.*|\\.test)\\.[jt]sx?$',
transform: {
'\\.[jt]sx?$': [
'babel-jest',
// rootMode upwards makes use of the global babel.config.js
{rootMode: 'upward'},
],
},
}
11 changes: 9 additions & 2 deletions package.config.ts
@@ -1,4 +1,11 @@
import {defineConfig} from '@sanity/pkg-utils'
import baseConfig from '../../../package.config'

export default defineConfig({...baseConfig})
export default defineConfig({
extract: {
rules: {
'ae-internal-missing-underscore': 'off',
},
},
minify: false,
tsconfig: 'tsconfig.dist.json',
})
122 changes: 101 additions & 21 deletions package.json
Expand Up @@ -3,52 +3,106 @@
"version": "1.3.9-beta.3",
"description": "The Sanity icons.",
"sideEffects": false,
"types": "./dist/types/src/index.d.ts",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"module": "./dist/sanity-icons.esm.js",
"main": "./dist/sanity-icons.js",
"module": "./dist/index.esm.js",
"main": "./dist/index.js",
"exports": {
".": {
"types": "./dist/types/src/index.d.ts",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"import": "./dist/sanity-icons.esm.js",
"require": "./dist/sanity-icons.js",
"default": "./dist/sanity-icons.esm.js"
}
"import": "./dist/index.esm.js",
"require": "./dist/index.js",
"default": "./dist/index.esm.js"
},
"./package.json": "./package.json"
},
"files": [
"dist",
"src"
],
"license": "MIT",
"scripts": {
"build": "pkg build",
"check:package": "pkg --strict",
"clean": "rimraf dist",
"generate": "node -r esbuild-register scripts/generate.ts",
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx --quiet",
"postbuild": "run-s check:package",
"prebuild": "run-s clean",
"pregenerate": "rimraf src/icons",
"build": "run-s clean generate build:pkg check:pkg",
"build:pkg": "pkg build --strict",
"check:pkg": "pkg --strict",
"check:types": "tsc",
"clean": "rimraf .workshop dist",
"commit": "cz",
"dev": "workshop dev",
"format": "prettier --write --cache --ignore-unknown .",
"generate": "rimraf src/icons && node -r esbuild-register scripts/generate.ts",
"lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
"prepare": "husky install",
"prepublishOnly": "pnpm build",
"release": "semantic-release",
"test": "jest",
"type-check": "tsc --build",
"watch": "pkg watch"
"watch": "pkg watch --strict"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@sanity/icons": "^1.3.6",
"@sanity/pkg-utils": "^1.18.0",
"@sanity/semantic-release-preset": "^2.0.2",
"@sanity/ui": "1.0.0-beta.32",
"@sanity/ui-workshop": "1.0.0-beta.5",
"@svgr/core": "^6.4.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.2.3",
"@types/mkdirp": "^1.0.2",
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/styled-components": "^5.1.26",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"camelcase": "^6.3.0",
"react": "^18.2.0"
"commitizen": "^4.2.5",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.15.15",
"esbuild-register": "^3.4.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"globby": "^11.1.0",
"husky": "^8.0.2",
"jest": "^29.3.1",
"jest-axe": "^7.0.0",
"jest-environment-jsdom": "^29.3.1",
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"rimraf": "^3.0.2",
"semantic-release": "^19.0.5",
"styled-components": "^5.3.6",
"typescript": "^4.9.3"
},
"peerDependencies": {
"react": "^18"
},
"engines": {
"node": ">=14.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sanity-io/design.git"
"url": "git+https://github.com/sanity-io/icons.git"
},
"bugs": {
"url": "https://github.com/sanity-io/design/issues"
"url": "https://github.com/sanity-io/icons/issues"
},
"keywords": [
"sanity",
Expand All @@ -57,7 +111,33 @@
],
"author": "Sanity.io <hello@sanity.io>",
"homepage": "https://www.sanity.io/",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*": [
"prettier --write --cache --ignore-unknown"
]
},
"packageManager": "pnpm@7.12.2",
"publishConfig": {
"access": "public"
},
"release": {
"extends": "@sanity/semantic-release-preset",
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
]
}
}

0 comments on commit 073a789

Please sign in to comment.