Skip to content

Commit

Permalink
chore: bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed Jul 27, 2024
1 parent dda92e0 commit 2b66348
Show file tree
Hide file tree
Showing 13 changed files with 1,230 additions and 1,350 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-berries-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperse/tailwind-layer": patch
---

bump version
6 changes: 2 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
"recommendations": ["dbaeumer.vscode-eslint"]
}
16 changes: 4 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@
"request": "launch",
"name": "Debug Test File",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"test-unit"
],
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"args": [
"${relativeFile}"
],
"runtimeArgs": ["run-script", "test-unit"],
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"args": ["${relativeFile}"],
"env": {}
}
]
}
}
9 changes: 4 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.experimental.useFlatConfig": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
"editor.formatOnSave": false
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
}
"editor.formatOnSave": false
}
}
626 changes: 313 additions & 313 deletions .yarn/releases/yarn-4.2.2.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.2.2.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lint": "eslint .",
"lint-fix": "yarn lint --fix",
"test": "run-s test:unit",
"test-task": "vitest run",
"test:unit": "vitest run",
"typecheck": "tsc --project ./tsconfig.json --noEmit",
"lint-staged-files": "lint-staged --allow-empty",
Expand All @@ -43,29 +44,28 @@
},
"dependencies": {
"chokidar": "^3.6.0",
"glob": "^10.4.1",
"glob": "^11.0.0",
"postcss-js": "^4.0.1",
"sade": "^1.8.1"
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.5",
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@hyperse/eslint-config-hyperse": "^1.0.4",
"@types/node": "^20.12.12",
"@hyperse/eslint-config-hyperse": "^1.0.10",
"@types/node": "^20.14.12",
"@types/postcss-js": "^4.0.4",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^9.3.0",
"husky": "9.0.11",
"lint-staged": "15.2.5",
"eslint": "^9.8.0",
"husky": "9.1.3",
"lint-staged": "15.2.7",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.38",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.0"
"postcss": "^8.4.40",
"tsup": "^8.2.3",
"typescript": "^5.5.4",
"vitest": "^2.0.4"
},
"peerDependencies": {
"postcss": "^8.4.21",
Expand All @@ -77,5 +77,5 @@
"publishConfig": {
"access": "public"
},
"packageManager": "yarn@4.2.2"
"packageManager": "yarn@4.3.1"
}
3 changes: 2 additions & 1 deletion src/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export async function bundle(
const g = new Glob(pattern, {
nodir: true,
absolute: true,
cwd: process.cwd(),
});

for await (const file of g) {
Expand All @@ -47,7 +48,7 @@ export async function bundle(
const handlerStr = [
layers.length
? ''
: '// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function',
: '// eslint-disable-next-line @typescript-eslint/no-unused-vars',
'const handler = (api) => {',
`\t${layers.join('\n\t\t')}`,
'};',
Expand Down
32 changes: 24 additions & 8 deletions tests/tailwind.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import { Glob } from 'glob';
import { existsSync, readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'path';
import { bundle } from '../src/bundle.js';
import { bundle } from '@/bundle.js';

const getDirname = (url: string, ...paths: string[]) => {
return join(dirname(fileURLToPath(url)), ...paths);
};

test('compile tailwind layer', async () => {
const output = getDirname(import.meta.url, './tailwindcss-extend.cjs');
await bundle('**/globals.css', 'commonjs', output);
expect(existsSync(output)).toBe(true);
expect(readFileSync(output, 'utf-8')).toMatch(
"'.hyperce-head-xl': { '@apply font-extrabold text-4xl md:text-6xl'"
);
describe('tailwind', () => {
it('should correct glob files', async () => {
const pattern = '**/fixtures/**/*.css';
const g = new Glob(pattern, {
nodir: true,
absolute: true,
});
const item: string[] = [];
for await (const file of g) {
item.push(file);
}
expect(item).toHaveLength(1);
});

it('compile tailwind layer', async () => {
const output = getDirname(import.meta.url, './tailwindcss-extend.cjs');
await bundle('**/fixtures/**/*.css', 'commonjs', output);
expect(existsSync(output)).toBe(true);
expect(readFileSync(output, 'utf-8')).toMatch(
"'.hyperce-head-xl': { '@apply font-extrabold text-4xl md:text-6xl'"
);
});
});
9 changes: 2 additions & 7 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@
"incremental": false,
"paths": {}
},
"exclude": [
"**/*.stories.tsx",
"**/*.stories.mdx",
".storybook/**",
"dist"
]
}
"exclude": ["**/*.stories.tsx", "**/*.stories.mdx", ".storybook/**", "dist"]
}
17 changes: 7 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"extends": "@hyperse/eslint-config-hyperse/tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./src",
"baseUrl": "./",
"outDir": "dist",
"rootDir": ".",
"types": [
"vitest/globals"
],
"paths": {}
"types": ["vitest/globals", "node"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"**/*.ts",
"**/*.tsx"
]
}
"include": ["**/*.ts", "**/*.tsx"]
}
5 changes: 3 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { fileURLToPath } from 'url';
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
testTimeout: 100000,
exclude: [...configDefaults.exclude],
alias: {
'~/': fileURLToPath(new URL('./src/', import.meta.url)),
'@/': new URL('./src/', import.meta.url).pathname,
},
include: ['**/?(*.){test,spec}.?(c|m)[jt]s?(x)'],
},
});
Loading

0 comments on commit 2b66348

Please sign in to comment.