From f484c5829e82e329ebff36f68125f7d86d555693 Mon Sep 17 00:00:00 2001 From: wibus-wee <1596355173@qq.com> Date: Thu, 22 Dec 2022 11:51:33 +0800 Subject: [PATCH] refactor: move all templates into one dir --- .gitignore | 106 ------------ dist/index.d.ts | 2 + dist/index.mjs | 6 + {starter-vite-ts => my-jwc-app}/LICENSE | 0 {starter-vite-ts => my-jwc-app}/index.html | 0 my-jwc-app/package.json | 18 +++ .../public/index.html | 0 .../public/jwc-dark.svg | 0 .../public/jwc.svg | 0 .../public/vite.svg | 0 my-jwc-app/src/App.css | 58 +++++++ {starter-vite-ts => my-jwc-app}/src/App.tsx | 0 my-jwc-app/src/index.css | 58 +++++++ {starter-vite-ts => my-jwc-app}/src/index.ts | 0 .../src/vite-env.d.ts | 0 {starter-vite-ts => my-jwc-app}/tsconfig.json | 0 .../vite.config.ts | 0 package.json | 151 +++++++++--------- src/index.ts | 4 +- starter-vite-ts/package.json | 18 --- starter-vite-ts/src/App.css | 61 ------- starter-vite-ts/src/index.css | 62 ------- 22 files changed, 223 insertions(+), 321 deletions(-) delete mode 100644 .gitignore create mode 100644 dist/index.d.ts create mode 100644 dist/index.mjs rename {starter-vite-ts => my-jwc-app}/LICENSE (100%) rename {starter-vite-ts => my-jwc-app}/index.html (100%) create mode 100644 my-jwc-app/package.json rename {starter-vite-ts => my-jwc-app}/public/index.html (100%) rename {starter-vite-ts => my-jwc-app}/public/jwc-dark.svg (100%) rename {starter-vite-ts => my-jwc-app}/public/jwc.svg (100%) rename {starter-vite-ts => my-jwc-app}/public/vite.svg (100%) create mode 100644 my-jwc-app/src/App.css rename {starter-vite-ts => my-jwc-app}/src/App.tsx (100%) create mode 100644 my-jwc-app/src/index.css rename {starter-vite-ts => my-jwc-app}/src/index.ts (100%) rename {starter-vite-ts => my-jwc-app}/src/vite-env.d.ts (100%) rename {starter-vite-ts => my-jwc-app}/tsconfig.json (100%) rename {starter-vite-ts => my-jwc-app}/vite.config.ts (100%) delete mode 100644 starter-vite-ts/package.json delete mode 100644 starter-vite-ts/src/App.css delete mode 100644 starter-vite-ts/src/index.css diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9323a30..0000000 --- a/.gitignore +++ /dev/null @@ -1,106 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -my-jwc-app \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..993bbc1 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,2 @@ +export * from "/Users/wibus/Developer/jwcjs/create-jwcjs/src/index"; +export { default } from "/Users/wibus/Developer/jwcjs/create-jwcjs/src/index"; diff --git a/dist/index.mjs b/dist/index.mjs new file mode 100644 index 0000000..7033aff --- /dev/null +++ b/dist/index.mjs @@ -0,0 +1,6 @@ +import jiti from "file:///Users/wibus/Developer/jwcjs/create-jwcjs/node_modules/.pnpm/jiti@1.16.0/node_modules/jiti/lib/index.js"; + +/** @type {import("/Users/wibus/Developer/jwcjs/create-jwcjs/src/index")} */ +const _module = jiti(null, { interopDefault: true, esmResolve: true })("/Users/wibus/Developer/jwcjs/create-jwcjs/src/index.ts"); + +export default _module; \ No newline at end of file diff --git a/starter-vite-ts/LICENSE b/my-jwc-app/LICENSE similarity index 100% rename from starter-vite-ts/LICENSE rename to my-jwc-app/LICENSE diff --git a/starter-vite-ts/index.html b/my-jwc-app/index.html similarity index 100% rename from starter-vite-ts/index.html rename to my-jwc-app/index.html diff --git a/my-jwc-app/package.json b/my-jwc-app/package.json new file mode 100644 index 0000000..984201c --- /dev/null +++ b/my-jwc-app/package.json @@ -0,0 +1,18 @@ +{ + "name": "my-jwc-app", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "vite": "^4.0.1", + "jwcjs": "*" + } +} diff --git a/starter-vite-ts/public/index.html b/my-jwc-app/public/index.html similarity index 100% rename from starter-vite-ts/public/index.html rename to my-jwc-app/public/index.html diff --git a/starter-vite-ts/public/jwc-dark.svg b/my-jwc-app/public/jwc-dark.svg similarity index 100% rename from starter-vite-ts/public/jwc-dark.svg rename to my-jwc-app/public/jwc-dark.svg diff --git a/starter-vite-ts/public/jwc.svg b/my-jwc-app/public/jwc.svg similarity index 100% rename from starter-vite-ts/public/jwc.svg rename to my-jwc-app/public/jwc.svg diff --git a/starter-vite-ts/public/vite.svg b/my-jwc-app/public/vite.svg similarity index 100% rename from starter-vite-ts/public/vite.svg rename to my-jwc-app/public/vite.svg diff --git a/my-jwc-app/src/App.css b/my-jwc-app/src/App.css new file mode 100644 index 0000000..482d450 --- /dev/null +++ b/my-jwc-app/src/App.css @@ -0,0 +1,58 @@ +:host { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 0.25s; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.jwc:hover { + filter: drop-shadow(0 0 2em rgb(0, 0, 0)); +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} + +@media (prefers-color-scheme: dark) { + .logo.jwc:hover { + filter: drop-shadow(0 0 2em rgb(255, 255, 255)); + } +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + button { + background-color: #f9f9f9; + } +} diff --git a/starter-vite-ts/src/App.tsx b/my-jwc-app/src/App.tsx similarity index 100% rename from starter-vite-ts/src/App.tsx rename to my-jwc-app/src/App.tsx diff --git a/my-jwc-app/src/index.css b/my-jwc-app/src/index.css new file mode 100644 index 0000000..2bde3cd --- /dev/null +++ b/my-jwc-app/src/index.css @@ -0,0 +1,58 @@ +:root { + font-family: Inter, Avenir, Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 24px; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} + +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} diff --git a/starter-vite-ts/src/index.ts b/my-jwc-app/src/index.ts similarity index 100% rename from starter-vite-ts/src/index.ts rename to my-jwc-app/src/index.ts diff --git a/starter-vite-ts/src/vite-env.d.ts b/my-jwc-app/src/vite-env.d.ts similarity index 100% rename from starter-vite-ts/src/vite-env.d.ts rename to my-jwc-app/src/vite-env.d.ts diff --git a/starter-vite-ts/tsconfig.json b/my-jwc-app/tsconfig.json similarity index 100% rename from starter-vite-ts/tsconfig.json rename to my-jwc-app/tsconfig.json diff --git a/starter-vite-ts/vite.config.ts b/my-jwc-app/vite.config.ts similarity index 100% rename from starter-vite-ts/vite.config.ts rename to my-jwc-app/vite.config.ts diff --git a/package.json b/package.json index 28d8b04..8585445 100644 --- a/package.json +++ b/package.json @@ -1,74 +1,81 @@ { - "name": "create-jwcjs", - "version": "0.1.0-alpha.1", - "description": "A Command Line Tool to create jwc.js project", - "main": "index.js", - "type": "module", - "scripts": { - "dev": "unbuild --stub", - "build": "unbuild", - "typecheck": "tsc --noEmit", - "prepublishOnly": "npm run build", - "lint": "eslint .", - "lint-staged": "lint-staged", - "release": "vv" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "keywords": [ - "jwcjs" - ], - "author": "wibus-wee ", - "bugs": { - "url": "https://github.com/jwcjs/create-jwc/issues" - }, - "homepage": "https://github.com/jwcjs/create-jwc#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/jwcjs/create-jwc.git" - }, - "bin": { - "create-jwc": "index.js" - }, - "license": "MIT", - "devDependencies": { - "@innei/bump-version": "^1.5.4", - "@types/minimist": "^1.2.2", - "@types/node": "^18.11.17", - "@types/prompts": "^2.4.2", - "@typescript-eslint/eslint-plugin": "^5.47.0", - "@typescript-eslint/parser": "^5.47.0", - "cross-spawn": "^7.0.3", - "eslint": "^8.30.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", - "husky": "^8.0.2", - "kolorist": "^1.6.0", - "lint-staged": "^13.1.0", - "minimist": "^1.2.7", - "prettier": "^2.8.1", - "prompts": "^2.4.2", - "rimraf": "^3.0.2", - "ts-node": "^10.9.1", - "typescript": "^4.9.4", - "unbuild": "^1.0.2" - }, - "lint-staged": { - "*.{js,ts,css,json}": [ - "prettier --write" - ] - }, - "bump": { - "leading": [ - "git pull --rebase" - ], - "publish": true, - "changelog": true, - "allowed_branches": [ - "main" - ] - } + "name": "create-jwcjs", + "version": "0.1.0-alpha.1", + "description": "A Command Line Tool to create jwc.js project", + "main": "index.js", + "type": "module", + "files": [ + "dist", + "index.js", + "package.json", + "LICESE", + "templates" + ], + "scripts": { + "dev": "unbuild --stub", + "build": "unbuild", + "typecheck": "tsc --noEmit", + "prepublishOnly": "npm run build", + "lint": "eslint .", + "lint-staged": "lint-staged", + "release": "vv" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "keywords": [ + "jwcjs" + ], + "author": "wibus-wee ", + "bugs": { + "url": "https://github.com/jwcjs/create-jwc/issues" + }, + "homepage": "https://github.com/jwcjs/create-jwc#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/jwcjs/create-jwc.git" + }, + "bin": { + "create-jwc": "index.js" + }, + "license": "MIT", + "devDependencies": { + "@innei/bump-version": "^1.5.4", + "@types/minimist": "^1.2.2", + "@types/node": "^18.11.17", + "@types/prompts": "^2.4.2", + "@typescript-eslint/eslint-plugin": "^5.47.0", + "@typescript-eslint/parser": "^5.47.0", + "cross-spawn": "^7.0.3", + "eslint": "^8.30.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "husky": "^8.0.2", + "kolorist": "^1.6.0", + "lint-staged": "^13.1.0", + "minimist": "^1.2.7", + "prettier": "^2.8.1", + "prompts": "^2.4.2", + "rimraf": "^3.0.2", + "ts-node": "^10.9.1", + "typescript": "^4.9.4", + "unbuild": "^1.0.2" + }, + "lint-staged": { + "*.{js,ts,css,json}": [ + "prettier --write" + ] + }, + "bump": { + "leading": [ + "git pull --rebase" + ], + "publish": true, + "changelog": true, + "allowed_branches": [ + "main" + ] + } } diff --git a/src/index.ts b/src/index.ts index 7bdd279..adb8cb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -196,7 +196,7 @@ async function init() { const templateDir = path.resolve( fileURLToPath(import.meta.url), - "../../", + "../../templates", userTemplate.name ); @@ -219,7 +219,7 @@ async function init() { write("package.json", JSON.stringify(pkg, null, 2)); console.log(`${green("✔")} Created project in ${root}.`); if (root !== cwd) { - console.log(`${green("✔")} To get started:`); + console.log(`\n${green("✔")} To get started: \n`); console.log(` cd ${dir}`); } switch (packageManager) { diff --git a/starter-vite-ts/package.json b/starter-vite-ts/package.json deleted file mode 100644 index 7604924..0000000 --- a/starter-vite-ts/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "@jwcjs/starter-vite-ts", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "vite": "^4.0.1", - "jwcjs": "*" - } -} diff --git a/starter-vite-ts/src/App.css b/starter-vite-ts/src/App.css deleted file mode 100644 index 89b3189..0000000 --- a/starter-vite-ts/src/App.css +++ /dev/null @@ -1,61 +0,0 @@ - -:host { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 0.25s; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.jwc:hover { - filter: drop-shadow(0 0 2em rgb(0, 0, 0)); -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} - -@media (prefers-color-scheme: dark) { - .logo.jwc:hover { - filter: drop-shadow(0 0 2em rgb(255, 255, 255)); - } -} - - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - - -@media (prefers-color-scheme: light) { - button { - background-color: #f9f9f9; - } -} diff --git a/starter-vite-ts/src/index.css b/starter-vite-ts/src/index.css deleted file mode 100644 index 0f84ee1..0000000 --- a/starter-vite-ts/src/index.css +++ /dev/null @@ -1,62 +0,0 @@ - -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} - - -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -}