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

Feature/v2 #14

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6e7c802
fix(CHANGELOG): day of release 1.1.2
RodrigoTomeES Nov 5, 2023
0e7e648
refactor(matchClasses): class renaming regex to be safer
RodrigoTomeES Nov 5, 2023
ba3fa16
feat(test): added to utilities
RodrigoTomeES Nov 5, 2023
525fe48
ci(test): execute test in every pr
RodrigoTomeES Nov 5, 2023
64a9656
ci(test): now test are executed in node 18 and 20 in all SOs
RodrigoTomeES Nov 5, 2023
0ee6b30
ci(test): now execute only one time test
RodrigoTomeES Nov 5, 2023
0b1972c
feat(husky): run test in every commit
RodrigoTomeES Nov 5, 2023
2d5c3d3
fix: missin script
RodrigoTomeES Nov 5, 2023
156cb31
fix: types
RodrigoTomeES Nov 5, 2023
bbfdad0
ci: fix mac-os and windows
RodrigoTomeES Nov 5, 2023
e736a68
fix(ci): version of node in macos an windows
RodrigoTomeES Nov 5, 2023
3aaaa58
ci: added to matrix windows and macos
RodrigoTomeES Nov 5, 2023
9e9d270
chore: updated vscode config
RodrigoTomeES Mar 21, 2024
43f612c
feat: enable support to compress CSS vars
RodrigoTomeES Mar 21, 2024
28204c0
chore: bump package version to 2.0.0-alpha1
RodrigoTomeES Mar 21, 2024
fbac26e
fix(package): repository url
RodrigoTomeES Mar 21, 2024
9a0d1d1
docs(CHANGELOG): updated with 2.0.0-aplha1 content
RodrigoTomeES Mar 21, 2024
2ef3da6
Update package.json
florian-lefebvre Mar 21, 2024
676940f
fix(package.json): export types folder
RodrigoTomeES Mar 22, 2024
8ed182e
chore: bumped to 2.0.0-alpha3
RodrigoTomeES Mar 22, 2024
ce32688
docs(README): update availability of features
RodrigoTomeES Mar 22, 2024
53a965b
docs(CHANGELOG): updated with latest fixes
RodrigoTomeES Mar 22, 2024
9d3efd5
chore: updated packages
RodrigoTomeES Mar 22, 2024
3449e2e
fix(regex): prevent match with <link /> tag
RodrigoTomeES Apr 8, 2024
c0c78d5
fix(regex): escape the & character in hexadecimal
RodrigoTomeES Apr 8, 2024
d2aea91
chore: bump version from 2.0.0-alpha3 to 2.0.0-alpha4
RodrigoTomeES Apr 8, 2024
40ee394
feat(ssr): poc
Jun 8, 2024
748dd91
feat(ssr): using babel to update template literals
Jun 10, 2024
f9b79fd
fix(eslint): throw error in build
RodrigoTomeES Jun 13, 2024
8217c1b
fix: build not generate types
RodrigoTomeES Jun 13, 2024
881ccb8
fix: error when astro is in static because server folder doesn't exists
RodrigoTomeES Jun 13, 2024
5d559b8
chore: added TODO to get dynamicatlly dist folder
RodrigoTomeES Jun 13, 2024
9ae2759
fix(ci): now use npm instead of yarn
RodrigoTomeES Jun 13, 2024
943f8a6
docs: update README.md
allcontributors[bot] Jun 20, 2024
e671a0f
docs: update .all-contributorsrc
allcontributors[bot] Jun 20, 2024
1150c82
chore: updated dependencies
RodrigoTomeES Jun 20, 2024
a0a645f
chore: bump version from 2.0.0-alpha4 to 2.0.0-alpha5
RodrigoTomeES Jun 20, 2024
9ccdf2b
fix: types in distribution package
RodrigoTomeES Jun 20, 2024
76454ca
chore: bump version from 2.0.0-alpha5 to 2.0.0-alpha6
RodrigoTomeES Jun 20, 2024
0687f33
docs(README): added SSR and hybrid support
RodrigoTomeES Jun 20, 2024
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
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
"contributions": [
"bug"
]
},
{
"login": "gabrielperales",
"name": "Gabriel",
"avatar_url": "https://avatars.githubusercontent.com/u/1859128?v=4",
"profile": "http://gabriel.perales.me",
"contributions": [
"code"
]
}
]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.yarn
node_modules
dist
Target
yarn.lock
4 changes: 2 additions & 2 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
- run: yarn
- run: yarn build
- run: npm i
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PUBLISH_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn build
- run: npm i
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test on push
on:
workflow_dispatch:
pull_request:

jobs:
test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})'
runs-on: ${{ matrix.os }}
strategy:
matrix:
OS: [ubuntu-latest, macos-latest, windows-latest]
NODE_VERSION: [18, 20]
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: 'npm'

- name: Install dependencies
run: npm i

- name: Test
run: npm run test:ci
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# build output
dist/

Target/

# generated types
.astro/

Expand Down
3 changes: 1 addition & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn commitlint --edit $1
npx commitlint --edit $1
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn lint-staged
npx lint-staged
npm run test:ci
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.9.0
v20.11.1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.yarn
node_modules
dist
Target
yarn.lock
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
11 changes: 0 additions & 11 deletions .yarnrc.yml

This file was deleted.

15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.2] - 2023-10-21
### Added

- Support for compressing CSS variables.
- Support SSR and hybrid mode.

### Changed

- Regular expresion to match class names now is more strict, avoiding matches with incomplete class names.

### Fixed

- Config types are now correctly exported, so now the plugin has suggestion in options.

## [1.1.2] - 2023-11-04

### Changed

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Astro-Rename is an Astro integration that brings [postcss-rename](https://github

- [x] Compress CSS classes
- [ ] Compress CSS IDs
- [ ] Compress CSS Variables
- [x] Compress CSS Variables
- [x] Replace CSS classes in HTML, JS, and other files

## Installation
Expand Down Expand Up @@ -94,7 +94,7 @@ type RenameOptions = {
* The default is to match the name with word boundaries on either side, but you can change this to match only the start or end of the name, or to match more or less than a whole word.
*
* @default ```js
* (key: string) => `(:^|[^-&;:_])(${key})(?![a-zA-Z0-9_-])(:$|[^-&;:_\./])`
* (key: string) => `(:^|[^&;:_/\[\\]a-zA-Z0-9_.-])(${key})(?=$|[^&;:_/\[\\]a-zA-Z0-9_.-])`
* ```
*/
matchClasses?: (key: string) => string;
Expand Down Expand Up @@ -204,11 +204,11 @@ Here's an example of the plugin in action in my [awa-db](https://github.com/Rodr

Here's a list of tasks I plan to work on:

- [ ] Fix error types
- [ ] Add test coverage
- [x] Fix error types
- [x] Add test coverage
- [ ] Add support for IDs
- [ ] Enable handling of multiple CSS files
- [ ] Implement support for CSS variables
- [x] Implement support for CSS variables
- [ ] Include server-side rendering support
- [ ] Move temporal files to a temporary directory instead of the root of the project
- [ ] Improve stadistics of file size reduction
Expand Down Expand Up @@ -241,6 +241,7 @@ Special thanks to the following individuals and projects:
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://jakebolam.com"><img src="https://avatars.githubusercontent.com/u/3534236?v=4?s=100" width="100px;" alt="Jake Bolam"/><br /><sub><b>Jake Bolam</b></sub></a><br /><a href="#bug-jakebolam" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://kenchandev.com"><img src="https://avatars.githubusercontent.com/u/4991363?v=4?s=100" width="100px;" alt="Ken Chan"/><br /><sub><b>Ken Chan</b></sub></a><br /><a href="#bug-kenchandev" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://gabriel.perales.me"><img src="https://avatars.githubusercontent.com/u/1859128?v=4?s=100" width="100px;" alt="Gabriel"/><br /><sub><b>Gabriel</b></sub></a><br /><a href="#code-gabrielperales" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 4 additions & 4 deletions lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const config = {
'**/*.(ts|js|cjs|mjs)': (filenames) => [
'yarn tsc',
`yarn lint --fix ${filenames.join(' ')}`,
`yarn prettier --write ${filenames.join(' ')}`,
'npm run tsc',
`npm run lint --fix ${filenames.join(' ')}`,
`npx prettier --write ${filenames.join(' ')}`,
],

'**/*.(md|json)': (filenames) =>
`yarn prettier --write ${filenames.join(' ')}`,
`npx prettier --write ${filenames.join(' ')}`,
};

module.exports = config;
Loading
Loading