@springmicro/cli 0.1.8 → 0.1.9

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/README.md CHANGED
@@ -26,7 +26,7 @@ $ npm install -g @springmicro/cli
26
26
  $ springmicro COMMAND
27
27
  running command...
28
28
  $ springmicro (--version)
29
- @springmicro/cli/0.1.8 win32-x64 node-v18.17.1
29
+ @springmicro/cli/0.1.9 win32-x64 node-v18.17.1
30
30
  $ springmicro --help [COMMAND]
31
31
  USAGE
32
32
  $ springmicro COMMAND
@@ -81,7 +81,7 @@ EXAMPLES
81
81
  $ springmicro add auth
82
82
  ```
83
83
 
84
- _See code: [src/commands/add/auth.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/add/auth.ts)_
84
+ _See code: [src/commands/add/auth.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.9/src/commands/add/auth.ts)_
85
85
 
86
86
  ## `springmicro help [COMMAND]`
87
87
 
@@ -124,7 +124,7 @@ EXAMPLES
124
124
  $ springmicro init astro -n example
125
125
  ```
126
126
 
127
- _See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/init/index.ts)_
127
+ _See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.9/src/commands/init/index.ts)_
128
128
 
129
129
  ## `springmicro init astro`
130
130
 
@@ -144,7 +144,7 @@ EXAMPLES
144
144
  $ springmicro init astro -n <project-name>
145
145
  ```
146
146
 
147
- _See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/init/astro.ts)_
147
+ _See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.9/src/commands/init/astro.ts)_
148
148
 
149
149
  ## `springmicro plugins`
150
150
 
@@ -5,6 +5,7 @@ import { tailwindConfigMjs, globalsCSS, libUtils, componentsJSON } from '../../d
5
5
  import chalk from 'chalk';
6
6
  import { logStep } from '../../log/index.js';
7
7
  import { checkUnixShellAndSpawn } from '../../utils/shell.js';
8
+ import { replaceHeadContents } from '../../data/astro/replace.js';
8
9
  export default class Astro extends Command {
9
10
  static step = 1;
10
11
  static totalSteps = 2;
@@ -38,6 +39,7 @@ export default class Astro extends Command {
38
39
  const libUtilsPath = path.join(name, 'src', 'lib');
39
40
  const libUtilsFilePath = path.join(libUtilsPath, 'utils.ts');
40
41
  const publicFontsDirPath = path.join(name, 'public', 'fonts');
42
+ const baseHeadPath = path.join(name, 'src', 'components', 'BaseHead.astro');
41
43
  const tsConfig = JSON.parse(fs.readFileSync(tsConfigFilePath).toString());
42
44
  // see https://ui.shadcn.com/docs/installation/manual
43
45
  // extracted 6/6/2024
@@ -45,7 +47,7 @@ export default class Astro extends Command {
45
47
  ...tsConfig['compilerOptions'],
46
48
  baseUrl: '.',
47
49
  paths: {
48
- '@/*': ['./*'],
50
+ '@/*': ['./src/*'],
49
51
  },
50
52
  };
51
53
  this.log('write to ' + chalk.cyan(tsConfigFilePath));
@@ -61,6 +63,9 @@ export default class Astro extends Command {
61
63
  fs.mkdirSync(libUtilsPath, { recursive: true });
62
64
  }
63
65
  fs.writeFileSync(libUtilsFilePath, libUtils);
66
+ // file manip
67
+ this.log('replace contents of ' + chalk.greenBright(libUtilsFilePath));
68
+ replaceHeadContents(baseHeadPath);
64
69
  // remove any extra files
65
70
  this.log('remove unused ' + chalk.red(publicFontsDirPath));
66
71
  fs.rmSync(publicFontsDirPath, {
@@ -1,5 +1,5 @@
1
- export declare const tailwindConfigMjs = "const { fontFamily } = require(\"tailwindcss/defaultTheme\")\n\n/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n darkMode: [\"class\"],\n content: [\"./src/**/*.{ts,tsx,astro}\"],\n theme: {\n container: {\n center: true,\n padding: \"2rem\",\n screens: {\n \"2xl\": \"1400px\",\n },\n },\n extend: {\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n destructive: {\n DEFAULT: \"hsl(var(--destructive))\",\n foreground: \"hsl(var(--destructive-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n card: {\n DEFAULT: \"hsl(var(--card))\",\n foreground: \"hsl(var(--card-foreground))\",\n },\n },\n borderRadius: {\n lg: `var(--radius)`,\n md: `calc(var(--radius) - 2px)`,\n sm: \"calc(var(--radius) - 4px)\",\n },\n fontFamily: {\n sans: [\"var(--font-sans)\", ...fontFamily.sans],\n },\n keyframes: {\n \"accordion-down\": {\n from: { height: \"0\" },\n to: { height: \"var(--radix-accordion-content-height)\" },\n },\n \"accordion-up\": {\n from: { height: \"var(--radix-accordion-content-height)\" },\n to: { height: \"0\" },\n },\n },\n animation: {\n \"accordion-down\": \"accordion-down 0.2s ease-out\",\n \"accordion-up\": \"accordion-up 0.2s ease-out\",\n },\n },\n },\n plugins: [require(\"tailwindcss-animate\")],\n}";
2
- export declare const globalsCSS = "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n :root {\n /* default font added */\n --font-sans: ui-sans-serif;\n\n --background: 0 0% 100%;\n --foreground: 222.2 47.4% 11.2%;\n\n --muted: 210 40% 96.1%;\n --muted-foreground: 215.4 16.3% 46.9%;\n\n --popover: 0 0% 100%;\n --popover-foreground: 222.2 47.4% 11.2%;\n\n --border: 214.3 31.8% 91.4%;\n --input: 214.3 31.8% 91.4%;\n\n --card: 0 0% 100%;\n --card-foreground: 222.2 47.4% 11.2%;\n\n --primary: 222.2 47.4% 11.2%;\n --primary-foreground: 210 40% 98%;\n\n --secondary: 210 40% 96.1%;\n --secondary-foreground: 222.2 47.4% 11.2%;\n\n --accent: 210 40% 96.1%;\n --accent-foreground: 222.2 47.4% 11.2%;\n\n --destructive: 0 100% 50%;\n --destructive-foreground: 210 40% 98%;\n\n --ring: 215 20.2% 65.1%;\n\n --radius: 0.5rem;\n }\n\n .dark {\n --background: 224 71% 4%;\n --foreground: 213 31% 91%;\n\n --muted: 223 47% 11%;\n --muted-foreground: 215.4 16.3% 56.9%;\n\n --accent: 216 34% 17%;\n --accent-foreground: 210 40% 98%;\n\n --popover: 224 71% 4%;\n --popover-foreground: 215 20.2% 65.1%;\n\n --border: 216 34% 17%;\n --input: 216 34% 17%;\n\n --card: 224 71% 4%;\n --card-foreground: 213 31% 91%;\n\n --primary: 210 40% 98%;\n --primary-foreground: 222.2 47.4% 1.2%;\n\n --secondary: 222.2 47.4% 11.2%;\n --secondary-foreground: 210 40% 98%;\n\n --destructive: 0 63% 31%;\n --destructive-foreground: 210 40% 98%;\n\n --ring: 216 34% 17%;\n\n --radius: 0.5rem;\n }\n}\n\n@layer base {\n * {\n @apply border-border;\n }\n body {\n @apply bg-background text-foreground;\n font-feature-settings: \"rlig\" 1, \"calt\" 1;\n }\n /* custom from blog astro template */\n main {\n width: 720px;\n max-width: calc(100% - 2em);\n margin: auto;\n padding: 3em 1em;\n }\n .prose p {\n\t margin-bottom: 2em;\n }\n}\n";
1
+ export declare const tailwindConfigMjs = "const { fontFamily } = require(\"tailwindcss/defaultTheme\")\n\n/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n darkMode: [\"class\"],\n content: [\"./src/**/*.{ts,tsx,astro}\"],\n theme: {\n container: {\n center: true,\n padding: \"2rem\",\n screens: {\n \"2xl\": \"1400px\",\n },\n },\n extend: {\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n destructive: {\n DEFAULT: \"hsl(var(--destructive))\",\n foreground: \"hsl(var(--destructive-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n card: {\n DEFAULT: \"hsl(var(--card))\",\n foreground: \"hsl(var(--card-foreground))\",\n },\n },\n borderRadius: {\n lg: `var(--radius)`,\n md: `calc(var(--radius) - 2px)`,\n sm: \"calc(var(--radius) - 4px)\",\n },\n fontFamily: {\n sans: [\"var(--font-sans)\", ...fontFamily.sans],\n },\n keyframes: {\n \"accordion-down\": {\n from: { height: \"0\" },\n to: { height: \"var(--radix-accordion-content-height)\" },\n },\n \"accordion-up\": {\n from: { height: \"var(--radix-accordion-content-height)\" },\n to: { height: \"0\" },\n },\n },\n animation: {\n \"accordion-down\": \"accordion-down 0.2s ease-out\",\n \"accordion-up\": \"accordion-up 0.2s ease-out\",\n },\n },\n },\n plugins: [require(\"@tailwindcss/typography\"), require(\"tailwindcss-animate\")],\n}";
2
+ export declare const globalsCSS = "@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer base {\n :root {\n /* default font added */\n --font-sans: ui-sans-serif;\n\n --background: 0 0% 100%;\n --foreground: 222.2 47.4% 11.2%;\n\n --muted: 210 40% 96.1%;\n --muted-foreground: 215.4 16.3% 46.9%;\n\n --popover: 0 0% 100%;\n --popover-foreground: 222.2 47.4% 11.2%;\n\n --border: 214.3 31.8% 91.4%;\n --input: 214.3 31.8% 91.4%;\n\n --card: 0 0% 100%;\n --card-foreground: 222.2 47.4% 11.2%;\n\n --primary: 222.2 47.4% 11.2%;\n --primary-foreground: 210 40% 98%;\n\n --secondary: 210 40% 96.1%;\n --secondary-foreground: 222.2 47.4% 11.2%;\n\n --accent: 210 40% 96.1%;\n --accent-foreground: 222.2 47.4% 11.2%;\n\n --destructive: 0 100% 50%;\n --destructive-foreground: 210 40% 98%;\n\n --ring: 215 20.2% 65.1%;\n\n --radius: 0.5rem;\n }\n\n .dark {\n --background: 224 71% 4%;\n --foreground: 213 31% 91%;\n\n --muted: 223 47% 11%;\n --muted-foreground: 215.4 16.3% 56.9%;\n\n --accent: 216 34% 17%;\n --accent-foreground: 210 40% 98%;\n\n --popover: 224 71% 4%;\n --popover-foreground: 215 20.2% 65.1%;\n\n --border: 216 34% 17%;\n --input: 216 34% 17%;\n\n --card: 224 71% 4%;\n --card-foreground: 213 31% 91%;\n\n --primary: 210 40% 98%;\n --primary-foreground: 222.2 47.4% 1.2%;\n\n --secondary: 222.2 47.4% 11.2%;\n --secondary-foreground: 210 40% 98%;\n\n --destructive: 0 63% 31%;\n --destructive-foreground: 210 40% 98%;\n\n --ring: 216 34% 17%;\n\n --radius: 0.5rem;\n }\n}\n\n@layer base {\n * {\n @apply border-border;\n }\n body {\n @apply bg-background text-foreground;\n font-feature-settings: \"rlig\" 1, \"calt\" 1;\n }\n /* custom from blog astro template */\n main {\n width: 720px;\n max-width: calc(100% - 2em);\n margin: auto;\n padding: 3em 1em;\n }\n}\n";
3
3
  export declare const libUtils = "import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n";
4
4
  /**
5
5
  * from https://ui.shadcn.com/docs/components-json
@@ -75,7 +75,7 @@ module.exports = {
75
75
  },
76
76
  },
77
77
  },
78
- plugins: [require("tailwindcss-animate")],
78
+ plugins: [require("@tailwindcss/typography"), require("tailwindcss-animate")],
79
79
  }`;
80
80
  export const globalsCSS = `@tailwind base;
81
81
  @tailwind components;
@@ -167,9 +167,6 @@ export const globalsCSS = `@tailwind base;
167
167
  margin: auto;
168
168
  padding: 3em 1em;
169
169
  }
170
- .prose p {
171
- margin-bottom: 2em;
172
- }
173
170
  }
174
171
  `;
175
172
  export const libUtils = `import { clsx, type ClassValue } from "clsx"
@@ -0,0 +1,2 @@
1
+ /** Replace any head contents that we don't need like font preloads */
2
+ export declare function replaceHeadContents(filePath: string): void;
@@ -0,0 +1,8 @@
1
+ import fs from 'node:fs';
2
+ /** Replace any head contents that we don't need like font preloads */
3
+ export function replaceHeadContents(filePath) {
4
+ const data = fs.readFileSync(filePath).toString();
5
+ const regex = /<link rel="preload" href="\/fonts\/atkinson-.*?\.woff" as="font" type="font\/woff" crossorigin \/>/g;
6
+ const result = data.replace(regex, '');
7
+ fs.writeFileSync(filePath, result);
8
+ }
@@ -23,8 +23,12 @@ if errorlevel 1 exit /b %errorlevel%
23
23
  pnpx astro add tailwind -y
24
24
  if errorlevel 1 exit /b %errorlevel%
25
25
 
26
- :: Install additional packages for shadcn-ui
27
- pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
26
+ :: Install additional packages for shadcn-ui + icon libraries
27
+ pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
28
+ if errorlevel 1 exit /b %errorlevel%
29
+
30
+ :: Install dev packages
31
+ pnpm install -D @tailwindcss/typography
28
32
  if errorlevel 1 exit /b %errorlevel%
29
33
 
30
34
  endlocal
@@ -5,4 +5,5 @@ pnpx astro add react -y
5
5
  pnpx astro add tailwind -y
6
6
  # shadcn-ui
7
7
  # https://ui.shadcn.com/docs/installation/manual
8
- pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
8
+ pnpm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react react-icons
9
+ pnpm install -D @tailwindcss/typography
@@ -101,5 +101,5 @@
101
101
  ]
102
102
  }
103
103
  },
104
- "version": "0.1.8"
104
+ "version": "0.1.9"
105
105
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@springmicro/cli",
3
3
  "description": "A new CLI generated with oclif",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "author": "David Buckley",
6
6
  "private": false,
7
7
  "publishConfig": {
@@ -76,5 +76,5 @@
76
76
  "version": "oclif readme && git add README.md"
77
77
  },
78
78
  "types": "dist/index.d.ts",
79
- "gitHead": "7f7d9ece4d987ffceb47b504a95b973544862086"
79
+ "gitHead": "68c03879e19bc3f7381bfad0663c14f85c32514b"
80
80
  }