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/improve commonjs build #7

Merged
merged 2 commits into from
Mar 3, 2021
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
46 changes: 45 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
],
"scripts": {
"build": "run-p build:*",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"build:main": "ttsc -p tsconfig.json",
"build:module": "ttsc -p tsconfig.module.json",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:lint": "eslint src --ext .ts --fix",
Expand All @@ -29,7 +29,7 @@
"check-cli": "run-s test diff-integration-tests check-integration-tests",
"check-integration-tests": "run-s check-integration-test:*",
"diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'",
"watch:build": "tsc -p tsconfig.json -w",
"watch:build": "ttsc -p tsconfig.json -w",
"watch:test": "nyc --silent ava --watch",
"cov": "run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html",
"cov:html": "nyc report --reporter=html",
Expand Down Expand Up @@ -77,6 +77,8 @@
"standard-version": "^9.0.0",
"tailwindcss": "^2.0.3",
"ts-node": "^9.0.0",
"ts-transform-default-export": "^1.0.3",
"ttypescript": "^1.5.12",
"typedoc": "^0.19.0",
"typescript": "^4.0.2"
},
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import selectorParser, { Node } from 'postcss-selector-parser';
import plugin from 'tailwindcss/plugin';

export default plugin(({ theme, addVariant, prefix, e: escape }) => {
const nestedGroupPlugin = plugin(({ theme, addVariant, prefix, e: escape }) => {
const groupLevel = theme('groupLevel') || 10;
const groupScope = theme('groupScope') || 'scope';
const groupVariants = theme('groupVariants') || ['hover', 'focus'];
Expand Down Expand Up @@ -49,3 +49,5 @@ export default plugin(({ theme, addVariant, prefix, e: escape }) => {
});
});
});

export default nestedGroupPlugin;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to make ts-transform-default-export work

axtgr/ts-transform-default-export#1

7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2017",
"target": "ES3",
"outDir": "build/main",
"rootDir": "src",
"moduleResolution": "node",
Expand Down Expand Up @@ -40,7 +40,10 @@
"skipLibCheck": true,
"lib": ["es2017"],
"types": ["node"],
"typeRoots": ["node_modules/@types", "src/types"]
"typeRoots": ["node_modules/@types", "src/types"],
"plugins": [{
"transform": "ts-transform-default-export",
}]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**"],
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.module.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"target": "esnext",
"outDir": "build/module",
"module": "esnext"
"module": "esnext",
"plugins": []
},
"exclude": [
"node_modules/**"
Expand Down