Skip to content

Commit 9b83288

Browse files
authored
Add sample project for experimentations and testing (#6)
We are using a sample project created with `npx create-next-app` for testing the plugin code during the development. The project uses all the default files created by the mentioned command except, the `className` values on each JSX element in `app/page.tsx` have been updated to use simple strings. The plugin code transforms the string classnames (`className="my-class"`) into object notations (`className={style.myClass}`) seamlessly 😉};
1 parent d6cae22 commit 9b83288

22 files changed

+1242
-47
lines changed

.gitignore

Lines changed: 135 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,137 @@
1-
**/node_modules/
2-
dev/
1+
.vscode/**
2+
!.vscode/launch.json
3+
!.vscode/tasks.json
4+
!.vscode/settings.json
35

4-
# test projects for testing and prototyping
5-
test-projects/
6+
dev
67

7-
.vscode/
8-
**/coverage/
9-
dist/
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
lerna-debug.log*
15+
.pnpm-debug.log*
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
19+
20+
# Runtime data
21+
pids
22+
*.pid
23+
*.seed
24+
*.pid.lock
25+
26+
# Directory for instrumented libs generated by jscoverage/JSCover
27+
lib-cov
28+
29+
# Coverage directory used by tools like istanbul
30+
coverage
31+
*.lcov
32+
33+
# nyc test coverage
34+
.nyc_output
35+
36+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
37+
.grunt
38+
39+
# Bower dependency directory (https://bower.io/)
40+
bower_components
41+
42+
# node-waf configuration
43+
.lock-wscript
44+
45+
# Compiled binary addons (https://nodejs.org/api/addons.html)
46+
build/Release
47+
48+
# Dependency directories
49+
node_modules/
50+
jspm_packages/
51+
52+
# Snowpack dependency directory (https://snowpack.dev/)
53+
web_modules/
54+
55+
# TypeScript cache
56+
*.tsbuildinfo
57+
58+
# Optional npm cache directory
59+
.npm
60+
61+
# Optional eslint cache
62+
.eslintcache
63+
64+
# Optional stylelint cache
65+
.stylelintcache
66+
67+
# Microbundle cache
68+
.rpt2_cache/
69+
.rts2_cache_cjs/
70+
.rts2_cache_es/
71+
.rts2_cache_umd/
72+
73+
# Optional REPL history
74+
.node_repl_history
75+
76+
# Output of 'npm pack'
77+
*.tgz
78+
79+
# Yarn Integrity file
80+
.yarn-integrity
81+
82+
# dotenv environment variable files
83+
.env
84+
.env.development.local
85+
.env.test.local
86+
.env.production.local
87+
.env.local
88+
89+
# parcel-bundler cache (https://parceljs.org/)
90+
.cache
91+
.parcel-cache
92+
93+
# Next.js build output
94+
.next
95+
out
96+
97+
# Nuxt.js build / generate output
98+
.nuxt
99+
dist
100+
101+
# Gatsby files
102+
.cache/
103+
# Comment in the public line in if your project uses Gatsby and not Next.js
104+
# https://nextjs.org/blog/next-9-1#public-directory-support
105+
# public
106+
107+
# vuepress build output
108+
.vuepress/dist
109+
110+
# vuepress v2.x temp and cache directory
111+
.temp
112+
.cache
113+
114+
# Docusaurus cache and generated files
115+
.docusaurus
116+
117+
# Serverless directories
118+
.serverless/
119+
120+
# FuseBox cache
121+
.fusebox/
122+
123+
# DynamoDB Local files
124+
.dynamodb/
125+
126+
# TernJS port file
127+
.tern-port
128+
129+
# Stores VSCode versions used for testing VSCode extensions
130+
.vscode-test
131+
132+
# yarn v2
133+
.yarn/cache
134+
.yarn/unplugged
135+
.yarn/build-state.yml
136+
.yarn/install-state.gz
137+
.pnp.*

.vscode/launch.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"preLaunchTask": "Build",
7+
"type": "node",
8+
"env": {
9+
"NODE_OPTIONS": "--inspect",
10+
},
11+
"request": "launch",
12+
"cwd": "${workspaceFolder}/test-projects/nextjs",
13+
"program": "${workspaceFolder}/test-projects/nextjs/node_modules/next/dist/bin/next",
14+
"args": [
15+
"dev"
16+
],
17+
},
18+
{
19+
"name": "Next.js: debug client-side",
20+
"preLaunchTask": "Build",
21+
"type": "chrome",
22+
"request": "launch",
23+
"cwd": "${workspaceFolder}/test-projects/nextjs",
24+
"url": "http://localhost:3000"
25+
},
26+
{
27+
"name": "Next.js: debug full stack",
28+
"preLaunchTask": "Build",
29+
"type": "node",
30+
"request": "launch",
31+
"env": {
32+
"NODE_OPTIONS": "--inspect"
33+
},
34+
"program": "${workspaceFolder}/test-projects/nextjs/node_modules/next/dist/bin/next",
35+
"args": [
36+
"dev",
37+
],
38+
"cwd": "${workspaceFolder}/test-projects/nextjs",
39+
"serverReadyAction": {
40+
"pattern": "- Local:.+(https?://.+)",
41+
"uriFormat": "%s",
42+
"action": "debugWithChrome"
43+
},
44+
}
45+
]
46+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"search.exclude": {
4+
"**/node_modules": true,
5+
"**/dist": true,
6+
"**/dev": true,
7+
}
8+
}

.vscode/tasks.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "build:nowatch",
7+
"label": "Build"
8+
},
9+
]
10+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import type { Config } from "jest";
2-
3-
const config: Config = {
1+
/**
2+
* @type {import("ts-jest").JestConfigWithTsJest}
3+
*/
4+
let config = {
45
preset: "ts-jest/presets/default-esm",
56
testEnvironment: "node",
67
extensionsToTreatAsEsm: [".ts"],
8+
verbose: true,
79
};
810

911
export default config;

package-lock.json

Lines changed: 13 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"repository": "github:tusharsnn/jsx-css-module-transforms",
88
"type": "module",
99
"module": "dist/index.js",
10-
"types": "dist/index.d.ts",
10+
"types": "dist/index.d.cts",
1111
"main": "dist/index.cjs",
1212
"exports": {
1313
".": {
@@ -23,19 +23,22 @@
2323
"module-classname-transforms"
2424
],
2525
"scripts": {
26-
"build": "NODE_ENV=production npx tsup-node --config tsup.build.config.ts",
26+
"release": "npx tsup-node --config tsup.build.config.ts",
27+
"build": "npx tsup-node --config tsup.build.config.ts --sourcemap --watch",
28+
"build:nowatch": "npx tsup-node --config tsup.build.config.ts --sourcemap",
2729
"dev": "npx tsup-node --watch",
2830
"dev:nowatch": "npx tsup-node",
29-
"test": "npm run dev:nowatch && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --verbose",
30-
"test:cov": "npm run dev:nowatch && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --verbose --coverage"
31+
"test": "npm run dev:nowatch && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
32+
"test:cov": "npm run dev:nowatch && NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --coverage"
3133
},
3234
"dependencies": {
3335
"@babel/core": "^7.24.3",
36+
"@babel/plugin-syntax-jsx": "^7.24.7",
37+
"@babel/plugin-syntax-typescript": "^7.24.7",
3438
"chalk": "^4.1.2",
3539
"unplugin": "^1.10.1"
3640
},
3741
"peerDependencies": {
38-
"@babel/plugin-syntax-jsx": "^7.24.1",
3942
"webpack": "^5.91.0"
4043
},
4144
"peerDependenciesMeta": {
@@ -44,7 +47,6 @@
4447
}
4548
},
4649
"devDependencies": {
47-
"@babel/plugin-syntax-jsx": "^7.17.12",
4850
"@types/babel__core": "^7.20.5",
4951
"@types/jest": "^29.5.12",
5052
"@types/node": "^20.14.2",

0 commit comments

Comments
 (0)