@idevconn/create-icore 0.5.1 → 0.5.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.
Files changed (23) hide show
  1. package/package.json +3 -1
  2. package/templates/libs/auth-strategies/firebase/src/lib/__tests__/firebase-auth.contract.unit.test.ts +1 -1
  3. package/templates/libs/auth-strategies/supabase/src/lib/__tests__/supabase-auth.contract.unit.test.ts +1 -1
  4. package/templates/libs/db-strategies/firestore/src/lib/__tests__/firestore-db.contract.unit.test.ts +1 -1
  5. package/templates/libs/db-strategies/supabase/src/lib/__tests__/supabase-db.contract.unit.test.ts +1 -1
  6. package/templates/libs/firebase-admin/tsconfig.json +2 -1
  7. package/templates/libs/jobs-client/tsconfig.json +2 -1
  8. package/templates/libs/notes-client/tsconfig.json +2 -1
  9. package/templates/libs/payment-client/tsconfig.json +2 -1
  10. package/templates/libs/shared/src/strategies/__tests__/fake-auth.contract.unit.test.ts +1 -1
  11. package/templates/libs/shared/src/strategies/__tests__/fake-db.contract.unit.test.ts +1 -1
  12. package/templates/libs/shared/src/strategies/__tests__/fake-storage.contract.unit.test.ts +1 -1
  13. package/templates/libs/shared/src/strategies/index.ts +3 -3
  14. package/templates/libs/shared/src/testing.ts +14 -0
  15. package/templates/libs/shared/tsconfig.lib.json +3 -1
  16. package/templates/libs/shared/vitest.config.mts +11 -1
  17. package/templates/libs/storage-strategies/cloudinary/src/lib/__tests__/cloudinary-storage.contract.unit.test.ts +1 -1
  18. package/templates/libs/storage-strategies/firebase/src/lib/__tests__/firebase-storage.contract.unit.test.ts +1 -1
  19. package/templates/libs/storage-strategies/supabase/src/lib/__tests__/supabase-storage.contract.unit.test.ts +1 -1
  20. package/templates/tsconfig.base.json +1 -0
  21. /package/templates/libs/shared/src/strategies/{contract/auth-contract.ts → __tests__/auth.contract.unit.test.ts} +0 -0
  22. /package/templates/libs/shared/src/strategies/{contract/db-contract.ts → __tests__/db.contract.unit.test.ts} +0 -0
  23. /package/templates/libs/shared/src/strategies/{contract/storage-contract.ts → __tests__/storage.contract.unit.test.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idevconn/create-icore",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Bootstrap a new project from the iCore scaffold (Nx + NestJS + React + Vite + shadcn/Tailwind, swappable auth + storage providers).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "iDEVconn",
@@ -56,6 +56,8 @@
56
56
  "test:watch": "vitest",
57
57
  "lint": "eslint src",
58
58
  "typecheck": "tsc --noEmit",
59
+ "smoke": "npm run build && node scripts/snapshot-templates.mjs && node scripts/smoke-scaffold.mjs --mode=link --projects=shared,firebase-admin,auth,upload,notes,api",
60
+ "smoke:run": "npm run build && node scripts/snapshot-templates.mjs && node scripts/smoke-scaffold.mjs --mode=install --run --projects=shared,firebase-admin,auth,upload,notes,api --services=api,auth,upload,notes",
59
61
  "prepublishOnly": "node scripts/snapshot-templates.mjs && npm run typecheck && npm run test && npm run build"
60
62
  },
61
63
  "dependencies": {
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { runAuthContract } from '@icore/shared';
2
+ import { runAuthContract } from '@icore/shared/testing';
3
3
  import { FirebaseAuthStrategy } from '../firebase-auth.strategy';
4
4
  import { createMockIdentityToolkit, type MockHandle } from '../testing/mock-identity-toolkit';
5
5
  import { createMockAdminAuth } from '../testing/mock-admin-auth';
@@ -1,4 +1,4 @@
1
- import { runAuthContract } from '@icore/shared';
1
+ import { runAuthContract } from '@icore/shared/testing';
2
2
  import { SupabaseAuthStrategy } from '../supabase-auth.strategy';
3
3
  import { createMockSupabaseClient, type MockSupabaseClient } from '../testing/mock-supabase';
4
4
 
@@ -1,4 +1,4 @@
1
- import { runDBContract } from '@icore/shared';
1
+ import { runDBContract } from '@icore/shared/testing';
2
2
  import { FirestoreDBStrategy } from '../firestore-db.strategy';
3
3
  import { createMockFirestore } from '../testing/mock-firestore';
4
4
 
@@ -1,4 +1,4 @@
1
- import { runDBContract } from '@icore/shared';
1
+ import { runDBContract } from '@icore/shared/testing';
2
2
  import { SupabaseDBStrategy } from '../supabase-db.strategy';
3
3
  import { createMockSupabaseDB } from '../testing/mock-supabase-postgres';
4
4
 
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
4
+ "module": "node16",
5
+ "moduleResolution": "node16",
5
6
  "forceConsistentCasingInFileNames": true,
6
7
  "strict": true,
7
8
  "importHelpers": true,
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
4
+ "module": "node16",
5
+ "moduleResolution": "node16",
5
6
  "forceConsistentCasingInFileNames": true,
6
7
  "strict": true,
7
8
  "importHelpers": true,
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
4
+ "module": "node16",
5
+ "moduleResolution": "node16",
5
6
  "forceConsistentCasingInFileNames": true,
6
7
  "strict": true,
7
8
  "importHelpers": true,
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "module": "commonjs",
4
+ "module": "node16",
5
+ "moduleResolution": "node16",
5
6
  "forceConsistentCasingInFileNames": true,
6
7
  "strict": true,
7
8
  "importHelpers": true,
@@ -1,5 +1,5 @@
1
1
  import { FakeAuthStrategy } from '../fakes/fake-auth';
2
- import { runAuthContract } from '../contract/auth-contract';
2
+ import { runAuthContract } from './auth.contract.unit.test';
3
3
 
4
4
  runAuthContract('FakeAuthStrategy', () => new FakeAuthStrategy(), {
5
5
  getMagicLinkToken: (strategy, email) =>
@@ -1,4 +1,4 @@
1
1
  import { FakeDBStrategy } from '../fakes/fake-db';
2
- import { runDBContract } from '../contract/db-contract';
2
+ import { runDBContract } from './db.contract.unit.test';
3
3
 
4
4
  runDBContract('FakeDBStrategy', () => new FakeDBStrategy());
@@ -1,4 +1,4 @@
1
1
  import { FakeStorageStrategy } from '../fakes/fake-storage';
2
- import { runStorageContract } from '../contract/storage-contract';
2
+ import { runStorageContract } from './storage.contract.unit.test';
3
3
 
4
4
  runStorageContract('FakeStorageStrategy', () => new FakeStorageStrategy());
@@ -1,7 +1,7 @@
1
1
  export * from './auth';
2
2
  export * from './storage';
3
3
  export * from './db';
4
- export * from './contract/auth-contract';
5
- export * from './contract/storage-contract';
6
- export * from './contract/db-contract';
7
4
  export * from './fakes';
5
+ // NOTE: the strategy contract harness (runAuthContract / runStorageContract /
6
+ // runDBContract) is intentionally NOT exported here — it is test-only code and
7
+ // lives behind the '@icore/shared/testing' entry. See ../testing.ts.
@@ -0,0 +1,14 @@
1
+ // Test-only surface of @icore/shared.
2
+ //
3
+ // The strategy CONTRACT HARNESS lives here, NOT in the production `index.ts`:
4
+ // it uses Vitest globals (describe/it/expect) and must never compile into the
5
+ // shipped library. Import it from test files via '@icore/shared/testing'.
6
+ //
7
+ // The harness implementation sits under `strategies/__tests__/` so the prod
8
+ // build (tsconfig.lib.json excludes `__tests__`) skips it entirely.
9
+ export {
10
+ runAuthContract,
11
+ type AuthContractHelpers,
12
+ } from './strategies/__tests__/auth.contract.unit.test';
13
+ export { runStorageContract } from './strategies/__tests__/storage.contract.unit.test';
14
+ export { runDBContract } from './strategies/__tests__/db.contract.unit.test';
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "outDir": "../../dist/out-tsc",
5
5
  "declaration": true,
6
- "types": ["node", "vitest/globals"]
6
+ "types": ["node"]
7
7
  },
8
8
  "include": ["src/**/*.ts"],
9
9
  "exclude": [
@@ -11,6 +11,8 @@
11
11
  "vite.config.mts",
12
12
  "vitest.config.ts",
13
13
  "vitest.config.mts",
14
+ "src/testing.ts",
15
+ "src/**/__tests__/**",
14
16
  "src/**/*.test.ts",
15
17
  "src/**/*.spec.ts",
16
18
  "src/**/*.test.tsx",
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'vitest/config';
1
+ import { defineConfig, configDefaults } from 'vitest/config';
2
2
  import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
3
3
  import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
4
4
 
@@ -12,6 +12,16 @@ export default defineConfig(() => ({
12
12
  globals: true,
13
13
  environment: 'node',
14
14
  include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
15
+ // The strategy contract harness files only EXPORT reusable suites
16
+ // (runAuthContract / runStorageContract / runDBContract) — they hold no
17
+ // top-level tests, so Vitest must not try to run them directly. They follow
18
+ // the *.unit.test.ts naming so the prod build excludes them; the concrete
19
+ // `fake-*.contract.unit.test.ts` files (and the per-provider libs) invoke
20
+ // the harness.
21
+ exclude: [
22
+ ...configDefaults.exclude,
23
+ '**/strategies/__tests__/{auth,storage,db}.contract.unit.test.ts',
24
+ ],
15
25
  reporters: ['default'],
16
26
  coverage: {
17
27
  reportsDirectory: '../../coverage/libs/shared',
@@ -1,4 +1,4 @@
1
- import { runStorageContract } from '@icore/shared';
1
+ import { runStorageContract } from '@icore/shared/testing';
2
2
  import { CloudinaryStorageStrategy } from '../cloudinary-storage.strategy.js';
3
3
  import { createMockCloudinary } from '../testing/mock-cloudinary.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { runStorageContract } from '@icore/shared';
1
+ import { runStorageContract } from '@icore/shared/testing';
2
2
  import { FirebaseStorageStrategy } from '../firebase-storage.strategy.js';
3
3
  import { createMockFirebaseBucket } from '../testing/mock-firebase-storage.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { runStorageContract } from '@icore/shared';
1
+ import { runStorageContract } from '@icore/shared/testing';
2
2
  import { SupabaseStorageStrategy } from '../supabase-storage.strategy';
3
3
  import { createMockSupabaseStorageClient } from '../testing/mock-supabase-storage';
4
4
 
@@ -14,6 +14,7 @@
14
14
  "paths": {
15
15
  "@icore/shared": ["./libs/shared/src/index.ts"],
16
16
  "@icore/shared/client": ["./libs/shared/src/client.ts"],
17
+ "@icore/shared/testing": ["./libs/shared/src/testing.ts"],
17
18
  "@icore/auth-supabase": ["./libs/auth-strategies/supabase/src/index.ts"],
18
19
  "@icore/auth-client": ["./libs/auth-client/src/index.ts"],
19
20
  "@icore/package.json": ["./package.json"],