Skip to content

Commit

Permalink
Merge 48cfb4f into 1ab632b
Browse files Browse the repository at this point in the history
  • Loading branch information
benduran committed Jul 1, 2021
2 parents 1ab632b + 48cfb4f commit 1162b37
Show file tree
Hide file tree
Showing 15 changed files with 1,771 additions and 4,848 deletions.
27 changes: 1 addition & 26 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"extends": ["airbnb-base"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"arrow-parens": ["error", "as-needed", { "requireForBlockBody": true }],
"max-len": ["error", 180],
"no-unused-vars": ["off"],
"import/no-unresolved": ["off"],
"import/extensions": ["off"],
"no-restricted-syntax": ["off"],
"no-loop-func": ["off"]
}
"extends": "eslint-config-react-yas"
}
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# simplestyle-js [![Build Status](https://travis-ci.org/benduran/simplestyle.svg?branch=master)](https://travis-ci.org/benduran/simplestyle) [![Coverage Status](https://coveralls.io/repos/github/benduran/simplestyle/badge.svg?branch=master)](https://coveralls.io/github/benduran/simplestyle?branch=master)
A super simple CSS-in-JS solution with friendly TypeScript support and **zero runtime dependencies**
A super simple CSS-in-JS solution with friendly TypeScript support and a small file size

## Bundle Size
- `~4.4kB` minified
- `~1.7kB` gzipped
- `~5.5kB` minified
- `~2.2kB` gzipped
- Courtesy of [Bundle Phobia](https://bundlephobia.com/result?p=simplestyle-js)

## Installation
`npm install simplestyle-js --save`

## Live Demo
[Checkout this Codesandbox](https://codesandbox.io/s/nice-franklin-485wi?file=/src/App.tsx)

## Basic Usage
```javascript
import { createStyles } from 'simplestyle-js';
Expand Down Expand Up @@ -218,8 +221,7 @@ In order to use a plugin, you need to **register** each plugin you'd like to use

## What this library isn't
This library isn't trying to make grandiose assumption about how your styles should be rendered. Its goal is to simply provide a typed way of
easily creating reusable styles close to your JavaScript / TypeScript components. Eventually a plugin system will be introduced so that you can stub out
additional behaviors you might desire, but in the meantime, it is a zero-runtime-dependency way of creating CSS in JS and assumes that you're wise enough to know
easily creating reusable styles close to your JavaScript / TypeScript components. It is a super compact, small file size way of creating CSS in JS and assumes that you're wise enough to know
whether you've made a styling mistake (wrong property, wrong unit, invalid rule format, etc)

## License
Expand Down
9 changes: 9 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
testPathIgnorePatterns: ['./dist'],
preset: 'ts-jest',
testEnvironment: 'jsdom',
};

export default config;
58 changes: 28 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{
"name": "simplestyle-js",
"version": "2.6.0",
"version": "3.0.0-beta.4",
"description": "An incredibly straightforward and simple CSS-in-JS solution with zero runtime dependencies, and out-of-the-box TypeScript support",
"main": "dist/index.js",
"module": "dist/simplestyle-js.esm.js",
"esnext": "dist/simplestyle-js.esm.js",
"typings": "dist/index.d.ts",
"types": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/benduran/simplestyle.git"
},
"scripts": {
"build": "tsdx build",
"build": "yarn clean && yarn build:esm && yarn build:commonjs && yarn prepare:dist",
"build:esm": "tsc --project ./tsconfig.build.json -m es6 --outDir ./dist/esm",
"build:commonjs": "tsc --project ./tsconfig.build.json -m commonjs --outDir ./dist/commonjs",
"clean": "rm -rf ./dist",
"coveralls": "run-s test:coverage coverage:pipe",
"coverage:pipe": "cat ./coverage/lcov.info | coveralls",
"lint": "eslint './src/**/*.ts'",
"lint:fixall": "eslint './src/**/*.ts' --fix",
"test:coverage": "tsdx test --coverage",
"test": "tsdx test",
"test:watch": "tsdx test --watch",
"prepublishOnly": "tsdx build",
"prepare:dist": "./scripts/preparePackageJson.js",
"test:coverage": "jest test --coverage",
"test": "jest test",
"test:watch": "jest test --watch",
"git-pre-commit": "yarn lint && yarn test"
},
"keywords": [
Expand All @@ -33,28 +31,28 @@
"author": "Benjamin Duran <stratodyne@gmail.com>",
"license": "MIT",
"devDependencies": {
"@types/autoprefixer": "^9.7.2",
"@types/jest": "^26.0.20",
"@types/jsdom": "^16.2.6",
"@typescript-eslint/eslint-plugin": "^4.15.2",
"@typescript-eslint/parser": "^4.15.2",
"@jest/types": "^27.0.6",
"@types/autoprefixer": "^10.2.0",
"@types/jest": "^26.0.23",
"@types/jsdom": "^16.2.12",
"@zeit/git-hooks": "^0.1.4",
"autoprefixer": "^10.2.4",
"babel-jest": "^26.6.3",
"coveralls": "^3.1.0",
"eslint": "^7.21.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"jest": "^26.6.3",
"jsdom": "^16.4.0",
"autoprefixer": "^10.2.6",
"babel-jest": "^27.0.6",
"coveralls": "^3.1.1",
"eslint-config-react-yas": "^1.3.0",
"jest": "^27.0.6",
"jsdom": "^16.6.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.2.6",
"ts-jest": "^26.5.2",
"ts-node": "^9.1.1",
"tsdx": "^0.14.1",
"typescript": "^4.2.2"
"postcss": "^8.3.5",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0",
"typescript": "^4.3.5"
},
"dependencies": {
"csstype": "^3.0.7"
"csstype": "^3.0.8",
"deepmerge": "^4.2.2"
},
"resolutions": {
"eslint": "7.29.0"
}
}
14 changes: 14 additions & 0 deletions scripts/preparePackageJson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');

const pjsonPath = path.join(__dirname, '../package.json');
const pjson = JSON.parse(fs.readFileSync(pjsonPath, 'utf8'));

pjson.main = './commonjs/index.js';
pjson.module = './esm/index.js';
pjson.esnext = './esm/index.js';
pjson.typings = './esm/index.d.ts';
pjson.types = './esm/index.d.ts';

fs.writeFileSync(path.join(__dirname, '../dist', 'package.json'), JSON.stringify(pjson, null, 2), 'utf8');

0 comments on commit 1162b37

Please sign in to comment.