create-geekron-website 0.2.6 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2197,7 +2197,7 @@ var require_figures = __commonJS((exports, module) => {
2197
2197
  var require_style = __commonJS((exports, module) => {
2198
2198
  var c = require_kleur();
2199
2199
  var figures = require_figures();
2200
- var styles = Object.freeze({
2200
+ var styles3 = Object.freeze({
2201
2201
  password: {
2202
2202
  scale: 1,
2203
2203
  render: (input) => "*".repeat(input.length)
@@ -2215,7 +2215,7 @@ var require_style = __commonJS((exports, module) => {
2215
2215
  render: (input) => `${input}`
2216
2216
  }
2217
2217
  });
2218
- var render = (type) => styles[type] || styles.default;
2218
+ var render = (type) => styles3[type] || styles3.default;
2219
2219
  var symbols = Object.freeze({
2220
2220
  aborted: c.red(figures.cross),
2221
2221
  done: c.green(figures.tick),
@@ -2226,7 +2226,7 @@ var require_style = __commonJS((exports, module) => {
2226
2226
  var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
2227
2227
  var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
2228
2228
  module.exports = {
2229
- styles,
2229
+ styles: styles3,
2230
2230
  render,
2231
2231
  symbols,
2232
2232
  symbol,
@@ -4721,13 +4721,13 @@ var require_figures2 = __commonJS((exports, module) => {
4721
4721
  var require_style2 = __commonJS((exports, module) => {
4722
4722
  var c = require_kleur();
4723
4723
  var figures = require_figures2();
4724
- var styles = Object.freeze({
4724
+ var styles3 = Object.freeze({
4725
4725
  password: { scale: 1, render: (input) => "*".repeat(input.length) },
4726
4726
  emoji: { scale: 2, render: (input) => "\uD83D\uDE03".repeat(input.length) },
4727
4727
  invisible: { scale: 0, render: (input) => "" },
4728
4728
  default: { scale: 1, render: (input) => `${input}` }
4729
4729
  });
4730
- var render = (type) => styles[type] || styles.default;
4730
+ var render = (type) => styles3[type] || styles3.default;
4731
4731
  var symbols = Object.freeze({
4732
4732
  aborted: c.red(figures.cross),
4733
4733
  done: c.green(figures.tick),
@@ -4738,7 +4738,7 @@ var require_style2 = __commonJS((exports, module) => {
4738
4738
  var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
4739
4739
  var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
4740
4740
  module.exports = {
4741
- styles,
4741
+ styles: styles3,
4742
4742
  render,
4743
4743
  symbols,
4744
4744
  symbol,
@@ -10528,9 +10528,6 @@ var {
10528
10528
  Help
10529
10529
  } = import__.default;
10530
10530
 
10531
- // src/cli.ts
10532
- var import_prompts = __toESM(require_prompts3(), 1);
10533
-
10534
10531
  // node_modules/chalk/source/vendor/ansi-styles/index.js
10535
10532
  var ANSI_BACKGROUND_OFFSET = 10;
10536
10533
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -11020,181 +11017,13 @@ var chalk = createChalk();
11020
11017
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
11021
11018
  var source_default = chalk;
11022
11019
 
11023
- // src/utils/logger.ts
11024
- var PREFIX = source_default.hex("#7C3AED")("geekron");
11025
- var logger = {
11026
- info: (message) => {
11027
- console.log(`${PREFIX} ${message}`);
11028
- },
11029
- success: (message) => {
11030
- console.log(`${PREFIX} ${source_default.green("✔")} ${message}`);
11031
- },
11032
- warn: (message) => {
11033
- console.log(`${PREFIX} ${source_default.yellow("⚠")} ${source_default.yellow(message)}`);
11034
- },
11035
- error: (message) => {
11036
- console.log(`${PREFIX} ${source_default.red("✖")} ${source_default.red(message)}`);
11037
- },
11038
- step: (step, total, message) => {
11039
- console.log(`${PREFIX} ${source_default.dim(`[${step}/${total}]`)} ${message}`);
11040
- },
11041
- newLine: () => {
11042
- console.log();
11043
- },
11044
- title: (message) => {
11045
- console.log();
11046
- console.log(`${PREFIX} ${source_default.bold(message)}`);
11047
- console.log();
11048
- },
11049
- command: (cmd) => {
11050
- console.log(` ${source_default.cyan(cmd)}`);
11051
- },
11052
- welcome: () => {
11053
- console.log();
11054
- console.log(source_default.hex("#7C3AED").bold(`
11055
- ____ _
11056
- / ___| ___ ___| | ___ __ ___ _ __
11057
- | | _ / _ \\/ _ \\ |/ / '__/ _ \\| '_ \\
11058
- | |_| | __/ __/ <| | | (_) | | | |
11059
- \\____|\\___|\\___/_|\\_\\_| \\___/|_| |_|
11060
- `));
11061
- console.log(source_default.dim(" Create your Geekron website in seconds"));
11062
- console.log();
11063
- }
11064
- };
11065
-
11066
- // src/utils/detect-pm.ts
11067
- function detectPackageManager() {
11068
- const userAgent = process.env.npm_config_user_agent;
11069
- if (!userAgent) {
11070
- return "npm";
11071
- }
11072
- if (userAgent.includes("bun")) {
11073
- return "bun";
11074
- }
11075
- if (userAgent.includes("pnpm")) {
11076
- return "pnpm";
11077
- }
11078
- if (userAgent.includes("yarn")) {
11079
- return "yarn";
11080
- }
11081
- return "npm";
11082
- }
11083
- function getRunCommand(pm) {
11084
- switch (pm) {
11085
- case "bun":
11086
- return "bun run";
11087
- case "pnpm":
11088
- return "pnpm";
11089
- case "yarn":
11090
- return "yarn";
11091
- case "npm":
11092
- default:
11093
- return "npm run";
11094
- }
11095
- }
11096
- function getPackageManagerDisplayName(pm) {
11097
- const names = {
11098
- npm: "npm",
11099
- bun: "Bun",
11100
- pnpm: "pnpm",
11101
- yarn: "Yarn"
11102
- };
11103
- return names[pm];
11104
- }
11105
-
11106
- // src/config/index.ts
11107
- var CMS_CONFIGS = {
11108
- strapi: {
11109
- name: "strapi",
11110
- displayName: "Strapi",
11111
- createCommand: (pm, serverDir) => {
11112
- const quotedPath = `"${serverDir}"`;
11113
- switch (pm) {
11114
- case "bun":
11115
- return ["bunx", "create-strapi-app@latest", quotedPath];
11116
- case "pnpm":
11117
- return ["pnpm", "dlx", "create-strapi-app@latest", quotedPath];
11118
- case "yarn":
11119
- return ["yarn", "dlx", "create-strapi-app@latest", quotedPath];
11120
- case "npm":
11121
- default:
11122
- return ["npx", "create-strapi-app@latest", quotedPath];
11123
- }
11124
- },
11125
- dependencies: {
11126
- "@geekron/strapi": "latest"
11127
- },
11128
- packagesToRemove: [
11129
- "@strapi/plugin-cloud",
11130
- "@strapi/plugin-users-permissions"
11131
- ],
11132
- filesToCopy: [
11133
- {
11134
- source: "strapi/src/admin",
11135
- destination: "src/admin",
11136
- isDirectory: true,
11137
- overwrite: false
11138
- },
11139
- {
11140
- source: "strapi/src/api",
11141
- destination: "src/api",
11142
- isDirectory: true,
11143
- overwrite: false
11144
- },
11145
- {
11146
- source: "strapi/src/components",
11147
- destination: "src/components",
11148
- isDirectory: true,
11149
- overwrite: false
11150
- },
11151
- {
11152
- source: "strapi/config/plugins.ts",
11153
- destination: "config/plugins.ts",
11154
- overwrite: true
11155
- }
11156
- ]
11157
- }
11158
- };
11159
- var RENDERER_CONFIGS = {
11160
- hono: {
11161
- name: "hono",
11162
- displayName: "Hono",
11163
- dependencies: {
11164
- hono: "latest"
11165
- }
11166
- }
11167
- };
11168
- var TEMPLATE_CONFIGS = {
11169
- blank: {
11170
- name: "blank",
11171
- displayName: "Blank (空白模板)",
11172
- path: "blank"
11173
- }
11174
- };
11175
- function getCmsChoices() {
11176
- return Object.values(CMS_CONFIGS).map((config) => ({
11177
- title: config.displayName,
11178
- value: config.name
11179
- }));
11180
- }
11181
- function getRendererChoices() {
11182
- return Object.values(RENDERER_CONFIGS).map((config) => ({
11183
- title: config.displayName,
11184
- value: config.name
11185
- }));
11186
- }
11187
- function getTemplateChoices() {
11188
- return Object.values(TEMPLATE_CONFIGS).map((config) => ({
11189
- title: config.displayName,
11190
- value: config.name
11191
- }));
11192
- }
11020
+ // src/cli.ts
11021
+ var import_prompts = __toESM(require_prompts3(), 1);
11193
11022
 
11194
11023
  // src/commands/create.ts
11024
+ import { spawn } from "node:child_process";
11025
+ import path from "node:path";
11195
11026
  var import_fs_extra = __toESM(require_lib2(), 1);
11196
- import { spawn } from "child_process";
11197
- import path from "path";
11198
11027
 
11199
11028
  // node_modules/ora/index.js
11200
11029
  import process9 from "node:process";
@@ -12006,6 +11835,180 @@ function ora(options) {
12006
11835
  return new Ora(options);
12007
11836
  }
12008
11837
 
11838
+ // src/config/index.ts
11839
+ var CMS_CONFIGS = {
11840
+ strapi: {
11841
+ name: "strapi",
11842
+ displayName: "Strapi",
11843
+ createCommand: (pm, serverDir) => {
11844
+ const quotedPath = `"${serverDir}"`;
11845
+ switch (pm) {
11846
+ case "bun":
11847
+ return ["bunx", "create-strapi-app@latest", quotedPath];
11848
+ case "pnpm":
11849
+ return ["pnpm", "dlx", "create-strapi-app@latest", quotedPath];
11850
+ case "yarn":
11851
+ return ["yarn", "dlx", "create-strapi-app@latest", quotedPath];
11852
+ default:
11853
+ return ["npx", "create-strapi-app@latest", quotedPath];
11854
+ }
11855
+ },
11856
+ dependencies: {
11857
+ "@geekron/strapi": "latest"
11858
+ },
11859
+ packagesToRemove: [
11860
+ "@strapi/plugin-cloud",
11861
+ "@strapi/plugin-users-permissions"
11862
+ ],
11863
+ filesToCopy: [
11864
+ {
11865
+ source: "strapi/src/admin",
11866
+ destination: "src/admin",
11867
+ isDirectory: true,
11868
+ overwrite: false
11869
+ },
11870
+ {
11871
+ source: "strapi/src/api",
11872
+ destination: "src/api",
11873
+ isDirectory: true,
11874
+ overwrite: false
11875
+ },
11876
+ {
11877
+ source: "strapi/src/components",
11878
+ destination: "src/components",
11879
+ isDirectory: true,
11880
+ overwrite: false
11881
+ },
11882
+ {
11883
+ source: "strapi/config/plugins.ts",
11884
+ destination: "config/plugins.ts",
11885
+ overwrite: true
11886
+ },
11887
+ {
11888
+ source: "strapi/src/admin/tsconfig.json",
11889
+ destination: "src/admin/tsconfig.json",
11890
+ overwrite: true
11891
+ }
11892
+ ]
11893
+ }
11894
+ };
11895
+ var RENDERER_CONFIGS = {
11896
+ hono: {
11897
+ name: "hono",
11898
+ displayName: "Hono",
11899
+ dependencies: {
11900
+ hono: "latest"
11901
+ }
11902
+ }
11903
+ };
11904
+ var TEMPLATE_CONFIGS = {
11905
+ blank: {
11906
+ name: "blank",
11907
+ displayName: "Blank (空白模板)",
11908
+ path: "blank"
11909
+ }
11910
+ };
11911
+ function getCmsChoices() {
11912
+ return Object.values(CMS_CONFIGS).map((config) => ({
11913
+ title: config.displayName,
11914
+ value: config.name
11915
+ }));
11916
+ }
11917
+ function getRendererChoices() {
11918
+ return Object.values(RENDERER_CONFIGS).map((config) => ({
11919
+ title: config.displayName,
11920
+ value: config.name
11921
+ }));
11922
+ }
11923
+ function getTemplateChoices() {
11924
+ return Object.values(TEMPLATE_CONFIGS).map((config) => ({
11925
+ title: config.displayName,
11926
+ value: config.name
11927
+ }));
11928
+ }
11929
+
11930
+ // src/utils/detect-pm.ts
11931
+ function detectPackageManager() {
11932
+ const userAgent = process.env.npm_config_user_agent;
11933
+ if (!userAgent) {
11934
+ return "npm";
11935
+ }
11936
+ if (userAgent.includes("bun")) {
11937
+ return "bun";
11938
+ }
11939
+ if (userAgent.includes("pnpm")) {
11940
+ return "pnpm";
11941
+ }
11942
+ if (userAgent.includes("yarn")) {
11943
+ return "yarn";
11944
+ }
11945
+ return "npm";
11946
+ }
11947
+ function getRunCommand(pm) {
11948
+ switch (pm) {
11949
+ case "bun":
11950
+ return "bun run";
11951
+ case "pnpm":
11952
+ return "pnpm";
11953
+ case "yarn":
11954
+ return "yarn";
11955
+ default:
11956
+ return "npm run";
11957
+ }
11958
+ }
11959
+ function getPackageManagerDisplayName(pm) {
11960
+ const names = {
11961
+ npm: "npm",
11962
+ bun: "Bun",
11963
+ pnpm: "pnpm",
11964
+ yarn: "Yarn"
11965
+ };
11966
+ return names[pm];
11967
+ }
11968
+
11969
+ // src/utils/logger.ts
11970
+ var PREFIX = source_default.hex("#7C3AED")("geekron");
11971
+ var logger = {
11972
+ info: (message) => {
11973
+ console.log(`${PREFIX} ${message}`);
11974
+ },
11975
+ success: (message) => {
11976
+ console.log(`${PREFIX} ${source_default.green("✔")} ${message}`);
11977
+ },
11978
+ warn: (message) => {
11979
+ console.log(`${PREFIX} ${source_default.yellow("⚠")} ${source_default.yellow(message)}`);
11980
+ },
11981
+ error: (message) => {
11982
+ console.log(`${PREFIX} ${source_default.red("✖")} ${source_default.red(message)}`);
11983
+ },
11984
+ step: (step, total, message) => {
11985
+ console.log(`${PREFIX} ${source_default.dim(`[${step}/${total}]`)} ${message}`);
11986
+ },
11987
+ newLine: () => {
11988
+ console.log();
11989
+ },
11990
+ title: (message) => {
11991
+ console.log();
11992
+ console.log(`${PREFIX} ${source_default.bold(message)}`);
11993
+ console.log();
11994
+ },
11995
+ command: (cmd) => {
11996
+ console.log(` ${source_default.cyan(cmd)}`);
11997
+ },
11998
+ welcome: () => {
11999
+ console.log();
12000
+ console.log(source_default.hex("#7C3AED").bold(`
12001
+ ____ _
12002
+ / ___| ___ ___| | ___ __ ___ _ __
12003
+ | | _ / _ \\/ _ \\ |/ / '__/ _ \\| '_ \\
12004
+ | |_| | __/ __/ <| | | (_) | | | |
12005
+ \\____|\\___|\\___/_|\\_\\_| \\___/|_| |_|
12006
+ `));
12007
+ console.log(source_default.dim(" Create your Geekron website in seconds"));
12008
+ console.log();
12009
+ }
12010
+ };
12011
+
12009
12012
  // src/commands/create.ts
12010
12013
  var __dirname = "/Users/imoyh/GithubProjects/geekron/create-geekron-website/src/commands";
12011
12014
  async function createProject(config) {
@@ -12055,6 +12058,9 @@ async function createProject(config) {
12055
12058
  }
12056
12059
  async function runCmsCreateCommand(command, cwd) {
12057
12060
  const [cmd, ...args] = command;
12061
+ if (!cmd) {
12062
+ throw new Error("Command is empty");
12063
+ }
12058
12064
  logger.info(`Running: ${source_default.cyan(command.join(" "))}`);
12059
12065
  logger.newLine();
12060
12066
  return new Promise((resolve, reject) => {
@@ -12148,7 +12154,10 @@ async function copyCmsFiles(filesToCopy, targetDir) {
12148
12154
  if (overwrite) {
12149
12155
  await import_fs_extra.default.copy(sourcePath, destPath, { overwrite: true });
12150
12156
  } else {
12151
- await import_fs_extra.default.copy(sourcePath, destPath, { overwrite: false, errorOnExist: false });
12157
+ await import_fs_extra.default.copy(sourcePath, destPath, {
12158
+ overwrite: false,
12159
+ errorOnExist: false
12160
+ });
12152
12161
  }
12153
12162
  copiedCount++;
12154
12163
  } else {
@@ -1,5 +1,6 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/latest/schema.json",
2
+ "root": false,
3
+ "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3
4
  "vcs": {
4
5
  "enabled": true,
5
6
  "clientKind": "git",
@@ -1,5 +1,5 @@
1
- import type { RouteHandler } from '@geekron/hono/route';
1
+ import type { RouteHandler } from '@geekron/hono/route'
2
2
 
3
3
  export const GET: RouteHandler = async (c) => {
4
- return c.html('<h1>Hello Geekron</h1>')
5
- }
4
+ return c.html('<h1>Hello Geekron</h1>')
5
+ }
@@ -1,6 +1,7 @@
1
1
  import type { StrapiApp } from '@strapi/strapi/admin';
2
2
  import { translations } from '@geekron/strapi/i18n'
3
3
  import { handlerBootstrap } from '@geekron/strapi/admin'
4
+ import logo from './logo.png';
4
5
 
5
6
  export default {
6
7
  config: {
@@ -34,6 +35,23 @@ export default {
34
35
  'zh-Hans',
35
36
  // 'zh',
36
37
  ],
38
+ auth: { logo },
39
+ menu: { logo },
40
+ theme: {
41
+ light: {
42
+ colors: {
43
+ primary100: '#f0f0ff',
44
+ primary200: '#d9d8ff',
45
+ primary500: '#79a8ff',
46
+ primary600: '#456aff',
47
+ primary700: '#1f4ce0',
48
+ }
49
+ },
50
+ dark: {
51
+ colors: {
52
+ }
53
+ }
54
+ },
37
55
  },
38
56
  bootstrap(app: StrapiApp) {
39
57
  handlerBootstrap(app);
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "types": ["vite/client"],
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "useDefineForClassFields": true,
8
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
9
+ "allowJs": false,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "strict": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": ["../plugins/**/admin/src/**/*", "./"],
20
+ "exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-geekron-website",
3
- "version": "0.2.6",
3
+ "version": "0.3.1",
4
4
  "description": "CLI tool to create Geekron websites",
5
5
  "author": {
6
6
  "name": "Geekron",
@@ -19,6 +19,10 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "dev": "bun run src/index.ts",
22
+ "format": "bunx biome format --write",
23
+ "lint": "bunx biome lint --write",
24
+ "check": "bunx biome check --write",
25
+ "type-check": "bunx tsc --noEmit",
22
26
  "build": "bash shell/build.sh",
23
27
  "release": "bash shell/publish.sh",
24
28
  "prepublishOnly": "bash shell/build.sh"
@@ -31,6 +35,7 @@
31
35
  "prompts": "^2.4.2"
32
36
  },
33
37
  "devDependencies": {
38
+ "@biomejs/biome": "^2.3.11",
34
39
  "@types/bun": "latest",
35
40
  "@types/fs-extra": "^11.0.4",
36
41
  "@types/prompts": "^2.4.9"
@@ -1,5 +1,6 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/latest/schema.json",
2
+ "root": false,
3
+ "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3
4
  "vcs": {
4
5
  "enabled": true,
5
6
  "clientKind": "git",
@@ -1,5 +1,5 @@
1
- import type { RouteHandler } from '@geekron/hono/route';
1
+ import type { RouteHandler } from '@geekron/hono/route'
2
2
 
3
3
  export const GET: RouteHandler = async (c) => {
4
- return c.html('<h1>Hello Geekron</h1>')
5
- }
4
+ return c.html('<h1>Hello Geekron</h1>')
5
+ }
@@ -1,6 +1,7 @@
1
1
  import type { StrapiApp } from '@strapi/strapi/admin';
2
2
  import { translations } from '@geekron/strapi/i18n'
3
3
  import { handlerBootstrap } from '@geekron/strapi/admin'
4
+ import logo from './logo.png';
4
5
 
5
6
  export default {
6
7
  config: {
@@ -34,6 +35,23 @@ export default {
34
35
  'zh-Hans',
35
36
  // 'zh',
36
37
  ],
38
+ auth: { logo },
39
+ menu: { logo },
40
+ theme: {
41
+ light: {
42
+ colors: {
43
+ primary100: '#f0f0ff',
44
+ primary200: '#d9d8ff',
45
+ primary500: '#79a8ff',
46
+ primary600: '#456aff',
47
+ primary700: '#1f4ce0',
48
+ }
49
+ },
50
+ dark: {
51
+ colors: {
52
+ }
53
+ }
54
+ },
37
55
  },
38
56
  bootstrap(app: StrapiApp) {
39
57
  handlerBootstrap(app);
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "types": ["vite/client"],
4
+ "target": "ESNext",
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "useDefineForClassFields": true,
8
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
9
+ "allowJs": false,
10
+ "skipLibCheck": true,
11
+ "esModuleInterop": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "strict": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
18
+ },
19
+ "include": ["../plugins/**/admin/src/**/*", "./"],
20
+ "exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
21
+ }