@simple-auth-kit/cli 1.4.0 → 1.4.2

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/lib/copy.ts CHANGED
@@ -1,15 +1,40 @@
1
1
  import { createHash } from "node:crypto";
2
- import { mkdir, readdir, readFile, rm, rmdir, writeFile } from "node:fs/promises";
2
+ import {
3
+ mkdir,
4
+ readdir,
5
+ readFile,
6
+ rm,
7
+ rmdir,
8
+ writeFile,
9
+ } from "node:fs/promises";
3
10
  import { dirname, join, relative, resolve, sep } from "node:path";
4
11
 
5
12
  // Never copied out of the registry: build output, the registry's own package/tsconfig wiring,
6
13
  // and the per-variant test harness. A consumer gets source, not this repo's scaffolding.
7
- export const NEVER_COPY = new Set(["node_modules", "dist", "generated", "test", "scripts", ".variant", "package.json", "tsconfig.json", ".env"]);
14
+ export const NEVER_COPY = new Set([
15
+ "node_modules",
16
+ "dist",
17
+ "generated",
18
+ "test",
19
+ "scripts",
20
+ ".variant",
21
+ "package.json",
22
+ "tsconfig.json",
23
+ ".env",
24
+ ]);
8
25
 
9
26
  // For "scaffold" installs (admin/mobile apps materialized as whole standalone projects, not
10
27
  // merged into an existing one): package.json/tsconfig.json are real, consumer-facing content
11
28
  // here, not the registry's own dev wiring, so they're copied like any other file.
12
- export const SCAFFOLD_NEVER_COPY = new Set(["node_modules", "dist", "generated", "test", "scripts", ".variant", ".env"]);
29
+ export const SCAFFOLD_NEVER_COPY = new Set([
30
+ "node_modules",
31
+ "dist",
32
+ "generated",
33
+ "test",
34
+ "scripts",
35
+ ".variant",
36
+ ".env",
37
+ ]);
13
38
 
14
39
  export interface CopyOptions {
15
40
  /**
@@ -79,7 +104,8 @@ export interface CopyResult {
79
104
  updated: string[];
80
105
  }
81
106
 
82
- export const sha256 = (content: string) => createHash("sha256").update(content).digest("hex");
107
+ export const sha256 = (content: string) =>
108
+ createHash("sha256").update(content).digest("hex");
83
109
  export const toPosix = (path: string) => path.split(sep).join("/");
84
110
 
85
111
  async function readIfExists(path: string): Promise<string | null> {
@@ -90,7 +116,13 @@ async function readIfExists(path: string): Promise<string | null> {
90
116
  }
91
117
  }
92
118
 
93
- export async function copyOneFile(srcPath: string, destPath: string, destRoot: string, opts: CopyOptions, result: CopyResult): Promise<void> {
119
+ export async function copyOneFile(
120
+ srcPath: string,
121
+ destPath: string,
122
+ destRoot: string,
123
+ opts: CopyOptions,
124
+ result: CopyResult,
125
+ ): Promise<void> {
94
126
  const rel = toPosix(relative(destRoot, destPath));
95
127
 
96
128
  if (opts.ignore?.includes(rel)) {
@@ -113,7 +145,12 @@ export async function copyOneFile(srcPath: string, destPath: string, destRoot: s
113
145
  const existing = await readIfExists(destPath);
114
146
  const recorded = opts.previous?.[rel];
115
147
  const forced = opts.force || opts.forcePaths?.has(rel);
116
- if (!forced && existing !== null && recorded !== undefined && sha256(existing) !== recorded) {
148
+ if (
149
+ !forced &&
150
+ existing !== null &&
151
+ recorded !== undefined &&
152
+ sha256(existing) !== recorded
153
+ ) {
117
154
  result.skipped.push(rel);
118
155
  result.manifest[rel] = sha256(existing);
119
156
  return;
@@ -127,7 +164,11 @@ export async function copyOneFile(srcPath: string, destPath: string, destRoot: s
127
164
 
128
165
  result.updated.push(rel);
129
166
  result.manifest[rel] = newHash;
130
- opts.collectDiffs?.push({ path: rel, oldContent: existing, newContent: content });
167
+ opts.collectDiffs?.push({
168
+ path: rel,
169
+ oldContent: existing,
170
+ newContent: content,
171
+ });
131
172
  if (opts.dryRun) return;
132
173
 
133
174
  await mkdir(dirname(destPath), { recursive: true });
@@ -135,15 +176,31 @@ export async function copyOneFile(srcPath: string, destPath: string, destRoot: s
135
176
  }
136
177
 
137
178
  /** Recursively copies srcDir into destDir, rewriting the placeholder core import alias in .ts files. */
138
- export async function copyDir(srcDir: string, destDir: string, opts: CopyOptions, destRoot: string = destDir, result?: CopyResult): Promise<CopyResult> {
139
- const acc: CopyResult = result ?? { manifest: {}, skipped: [], ignored: [], updated: [] };
179
+ export async function copyDir(
180
+ srcDir: string,
181
+ destDir: string,
182
+ opts: CopyOptions,
183
+ destRoot: string = destDir,
184
+ result?: CopyResult,
185
+ ): Promise<CopyResult> {
186
+ const acc: CopyResult = result ?? {
187
+ manifest: {},
188
+ skipped: [],
189
+ ignored: [],
190
+ updated: [],
191
+ };
140
192
  const skipNames = opts.neverCopy ?? NEVER_COPY;
141
193
  const entries = await readdir(srcDir, { withFileTypes: true });
142
194
 
143
195
  for (const entry of entries) {
144
196
  if (skipNames.has(entry.name)) continue;
145
197
  const srcPath = join(srcDir, entry.name);
146
- const destPath = join(destDir, entry.name);
198
+ // Registry sources name this "gitignore" (no leading dot) because `npm publish` silently
199
+ // drops every literal `.gitignore` file from the package — a well-known npm packing quirk,
200
+ // not specific to this file. Renamed back to `.gitignore` only on the way out, so a
201
+ // consumer's scaffolded project still gets a real one.
202
+ const destName = entry.name === "gitignore" ? ".gitignore" : entry.name;
203
+ const destPath = join(destDir, destName);
147
204
 
148
205
  if (entry.isDirectory()) {
149
206
  await copyDir(srcPath, destPath, opts, destRoot, acc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-auth-kit/cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "description": "simple-auth-kit add <combo> — copies registry source (backend combos, admin consoles, mobile apps) into a consumer repo, shadcn-CLI-style. Nothing is ever installed as a runtime dependency of the consumer.",
6
6
  "bin": {
@@ -0,0 +1,11 @@
1
+ /node_modules
2
+ /.next/
3
+ /out/
4
+ .env*.local
5
+ next-env.d.ts
6
+ *.tsbuildinfo
7
+ /AGENTS.md
8
+ /CLAUDE.md
9
+
10
+ # husky-generated shim dir (recreated by the "prepare" script on install)
11
+ .husky/_
@@ -0,0 +1,17 @@
1
+ # dependencies
2
+ node_modules/
3
+
4
+ # build output
5
+ dist/
6
+
7
+ # local env files
8
+ .env*.local
9
+
10
+ # typescript
11
+ *.tsbuildinfo
12
+
13
+ # macOS
14
+ .DS_Store
15
+
16
+ # husky-generated shim dir (recreated by the "prepare" script on install)
17
+ .husky/_
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ coverage/
5
+ .env
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ coverage/
5
+ .env
6
+ generated/
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ coverage/
5
+ .env
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ coverage/
5
+ .env
6
+ generated/
@@ -0,0 +1,4 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ coverage/
@@ -0,0 +1,78 @@
1
+ # OSX
2
+ #
3
+ .DS_Store
4
+
5
+ # Xcode
6
+ #
7
+ build/
8
+ *.pbxuser
9
+ !default.pbxuser
10
+ *.mode1v3
11
+ !default.mode1v3
12
+ *.mode2v3
13
+ !default.mode2v3
14
+ *.perspectivev3
15
+ !default.perspectivev3
16
+ xcuserdata
17
+ *.xccheckout
18
+ *.moved-aside
19
+ DerivedData
20
+ *.hmap
21
+ *.ipa
22
+ *.xcuserstate
23
+ **/.xcode.env.local
24
+
25
+ # Android/IntelliJ
26
+ #
27
+ build/
28
+ .idea
29
+ .gradle
30
+ local.properties
31
+ *.iml
32
+ *.hprof
33
+ .cxx/
34
+ *.keystore
35
+ !debug.keystore
36
+ .kotlin/
37
+
38
+ # node.js
39
+ #
40
+ node_modules/
41
+ npm-debug.log
42
+ yarn-error.log
43
+
44
+ # fastlane
45
+ #
46
+ # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
+ # screenshots whenever they are needed.
48
+ # For more information about the recommended setup visit:
49
+ # https://docs.fastlane.tools/best-practices/source-control/
50
+
51
+ **/fastlane/report.xml
52
+ **/fastlane/Preview.html
53
+ **/fastlane/screenshots
54
+ **/fastlane/test_output
55
+
56
+ # Bundle artifact
57
+ *.jsbundle
58
+
59
+ # Ruby / CocoaPods
60
+ **/Pods/
61
+ /vendor/bundle/
62
+
63
+ # Temporary files created by Metro to check the health of the file watcher
64
+ .metro-health-check*
65
+
66
+ # testing
67
+ /coverage
68
+
69
+ # Yarn
70
+ .yarn/*
71
+ !.yarn/patches
72
+ !.yarn/plugins
73
+ !.yarn/releases
74
+ !.yarn/sdks
75
+ !.yarn/versions
76
+
77
+ # husky-generated shim dir (recreated by the "prepare" script on install)
78
+ .husky/_
@@ -0,0 +1,44 @@
1
+ # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2
+
3
+ # dependencies
4
+ node_modules/
5
+
6
+ # Expo
7
+ .expo/
8
+ dist/
9
+ web-build/
10
+ expo-env.d.ts
11
+
12
+ # Native
13
+ .kotlin/
14
+ *.orig.*
15
+ *.jks
16
+ *.p8
17
+ *.p12
18
+ *.key
19
+ *.mobileprovision
20
+
21
+ # Metro
22
+ .metro-health-check*
23
+
24
+ # debug
25
+ npm-debug.*
26
+ yarn-debug.*
27
+ yarn-error.*
28
+
29
+ # macOS
30
+ .DS_Store
31
+ *.pem
32
+
33
+ # local env files
34
+ .env*.local
35
+
36
+ # typescript
37
+ *.tsbuildinfo
38
+
39
+ # generated native folders
40
+ /ios
41
+ /android
42
+
43
+ # husky-generated shim dir (recreated by the "prepare" script on install)
44
+ .husky/_