@springmicro/cli 0.1.6 → 0.1.8

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.6 win32-x64 node-v18.17.1
29
+ @springmicro/cli/0.1.8 win32-x64 node-v18.17.1
30
30
  $ springmicro --help [COMMAND]
31
31
  USAGE
32
32
  $ springmicro COMMAND
@@ -51,6 +51,7 @@ USAGE
51
51
  # Commands
52
52
 
53
53
  <!-- commands -->
54
+ * [`springmicro add auth`](#springmicro-add-auth)
54
55
  * [`springmicro help [COMMAND]`](#springmicro-help-command)
55
56
  * [`springmicro init PROJECTTYPE`](#springmicro-init-projecttype)
56
57
  * [`springmicro init astro`](#springmicro-init-astro)
@@ -65,6 +66,23 @@ USAGE
65
66
  * [`springmicro plugins unlink [PLUGIN]`](#springmicro-plugins-unlink-plugin)
66
67
  * [`springmicro plugins update`](#springmicro-plugins-update)
67
68
 
69
+ ## `springmicro add auth`
70
+
71
+ describe the command here
72
+
73
+ ```
74
+ USAGE
75
+ $ springmicro add auth
76
+
77
+ DESCRIPTION
78
+ describe the command here
79
+
80
+ EXAMPLES
81
+ $ springmicro add auth
82
+ ```
83
+
84
+ _See code: [src/commands/add/auth.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/add/auth.ts)_
85
+
68
86
  ## `springmicro help [COMMAND]`
69
87
 
70
88
  Display help for springmicro.
@@ -106,7 +124,7 @@ EXAMPLES
106
124
  $ springmicro init astro -n example
107
125
  ```
108
126
 
109
- _See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.6/src/commands/init/index.ts)_
127
+ _See code: [src/commands/init/index.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/init/index.ts)_
110
128
 
111
129
  ## `springmicro init astro`
112
130
 
@@ -126,7 +144,7 @@ EXAMPLES
126
144
  $ springmicro init astro -n <project-name>
127
145
  ```
128
146
 
129
- _See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.6/src/commands/init/astro.ts)_
147
+ _See code: [src/commands/init/astro.ts](https://github.com/SpringMicro1/springmicrohost-js/blob/v0.1.8/src/commands/init/astro.ts)_
130
148
 
131
149
  ## `springmicro plugins`
132
150
 
@@ -0,0 +1,7 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Auth extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ writeAuthConfig(): void;
6
+ run(): Promise<void>;
7
+ }
@@ -0,0 +1,28 @@
1
+ import { Command } from '@oclif/core';
2
+ import { checkUnixShellAndSpawn } from '../../utils/shell.js';
3
+ import path from 'node:path';
4
+ import { authConfigTs } from '../../data/astro/index.js';
5
+ import fs from 'node:fs';
6
+ import chalk from 'chalk';
7
+ export default class Auth extends Command {
8
+ // static override args = {
9
+ // file: Args.string({description: 'file to read'}),
10
+ // }
11
+ static description = 'describe the command here';
12
+ static examples = ['<%= config.bin %> <%= command.id %>'];
13
+ // static override flags = {
14
+ // // flag with no value (-f, --force)
15
+ // force: Flags.boolean({char: 'f'}),
16
+ // // flag with a value (-n, --name=VALUE)
17
+ // name: Flags.string({char: 'n', description: 'name to print'}),
18
+ // }
19
+ writeAuthConfig() {
20
+ fs.writeFileSync('auth.config.ts', authConfigTs);
21
+ this.log('');
22
+ this.log(chalk.bgCyan.black('FINISHED!'));
23
+ }
24
+ async run() {
25
+ // const {args, flags} = await this.parse(Auth)
26
+ await checkUnixShellAndSpawn('sh', [path.posix.join(this.config.root, 'dist', 'scripts', 'auth.sh')], path.join(this.config.root, 'dist', 'scripts', 'auth.bat'), [], () => this.writeAuthConfig());
27
+ }
28
+ }
@@ -26,7 +26,7 @@ export default class Astro extends Command {
26
26
  this.exit(1);
27
27
  }
28
28
  Astro.step = logStep('Initializing Astro project...', Astro.step, Astro.totalSteps);
29
- await checkUnixShellAndSpawn('sh', [path.posix.join('dist', 'scripts', 'astro.sh'), name], path.join('dist', 'scripts', 'astro.bat'), [name], () => this.astroFileManip(args, flags));
29
+ await checkUnixShellAndSpawn('sh', [path.posix.join(this.config.root, 'dist', 'scripts', 'astro.sh'), name], path.join(this.config.root, 'dist', 'scripts', 'astro.bat'), [name], () => this.astroFileManip(args, flags));
30
30
  }
31
31
  astroFileManip(args, flags) {
32
32
  const { name } = flags;
@@ -67,6 +67,7 @@ export default class Astro extends Command {
67
67
  force: true,
68
68
  recursive: true,
69
69
  });
70
+ this.finished(args, flags);
70
71
  }
71
72
  finished(args, flags) {
72
73
  const { name } = flags;
@@ -80,6 +81,5 @@ export default class Astro extends Command {
80
81
  const { args, flags } = await this.parse(Astro);
81
82
  // const {name} = flags;
82
83
  await this.astroCreate(args, flags);
83
- this.finished(args, flags);
84
84
  }
85
85
  }
@@ -6,3 +6,4 @@ export declare const libUtils = "import { clsx, type ClassValue } from \"clsx\"\
6
6
  * only change is globals.css => global.css
7
7
  */
8
8
  export declare const componentsJSON = "{\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"default\",\n \"rsc\": false,\n \"tsx\": true,\n \"tailwind\": {\n \"config\": \"tailwind.config.mjs\",\n \"css\": \"./src/styles/global.css\",\n \"baseColor\": \"slate\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": {\n \"components\": \"@/components\",\n \"utils\": \"@/lib/utils\"\n }\n}";
9
+ export declare const authConfigTs = "import { getAuthConfig } from \"@springmicro/auth\";\n\nexport default getAuthConfig({\n casdoorEndpoint: import.meta.env.PUBLIC_CASDOOR_ENDPOINT,\n clientId: import.meta.env.PUBLIC_CASDOOR_CLIENT_ID,\n clientSecret: import.meta.env.CASDOOR_CLIENT_SECRET,\n});";
@@ -200,3 +200,10 @@ export const componentsJSON = `{
200
200
  "utils": "@/lib/utils"
201
201
  }
202
202
  }`;
203
+ export const authConfigTs = `import { getAuthConfig } from "@springmicro/auth";
204
+
205
+ export default getAuthConfig({
206
+ casdoorEndpoint: import.meta.env.PUBLIC_CASDOOR_ENDPOINT,
207
+ clientId: import.meta.env.PUBLIC_CASDOOR_CLIENT_ID,
208
+ clientSecret: import.meta.env.CASDOOR_CLIENT_SECRET,
209
+ });`;
@@ -0,0 +1,5 @@
1
+ @echo off
2
+
3
+ REM Use PowerShell to simulate yes command and pipe to pnpm
4
+ powershell -Command "while ($true) { Write-Output 'y' }" | pnpm run astro add auth-astro
5
+ pnpm add @springmicro/auth
@@ -0,0 +1,4 @@
1
+ # https://github.com/nowaythatworked/auth-astro?tab=readme-ov-file#installation
2
+ # https://unix.stackexchange.com/a/512368
3
+ yes | pnpm run astro add auth-astro
4
+ pnpm add @springmicro/auth
@@ -1,5 +1,29 @@
1
1
  {
2
2
  "commands": {
3
+ "add:auth": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "describe the command here",
7
+ "examples": [
8
+ "<%= config.bin %> <%= command.id %>"
9
+ ],
10
+ "flags": {},
11
+ "hasDynamicHelp": false,
12
+ "hiddenAliases": [],
13
+ "id": "add:auth",
14
+ "pluginAlias": "@springmicro/cli",
15
+ "pluginName": "@springmicro/cli",
16
+ "pluginType": "core",
17
+ "strict": true,
18
+ "enableJsonFlag": false,
19
+ "isESM": true,
20
+ "relativePath": [
21
+ "dist",
22
+ "commands",
23
+ "add",
24
+ "auth.js"
25
+ ]
26
+ },
3
27
  "init:astro": {
4
28
  "aliases": [],
5
29
  "args": {},
@@ -77,5 +101,5 @@
77
101
  ]
78
102
  }
79
103
  },
80
- "version": "0.1.6"
104
+ "version": "0.1.8"
81
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.6",
4
+ "version": "0.1.8",
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": "5b3b9598d14078814db999b63a68e7cffaecfdf2"
79
+ "gitHead": "7f7d9ece4d987ffceb47b504a95b973544862086"
80
80
  }