@lsts_tech/infra 1.0.1 → 1.0.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 (39) hide show
  1. package/README.md +54 -73
  2. package/dist/bin/init.d.ts +4 -3
  3. package/dist/bin/init.d.ts.map +1 -1
  4. package/dist/bin/init.js +619 -117
  5. package/dist/bin/init.js.map +1 -1
  6. package/dist/src/auth/index.d.ts +17 -0
  7. package/dist/src/auth/index.d.ts.map +1 -0
  8. package/dist/src/auth/index.js +18 -0
  9. package/dist/src/auth/index.js.map +1 -0
  10. package/dist/stacks/Dns.d.ts +24 -14
  11. package/dist/stacks/Dns.d.ts.map +1 -1
  12. package/dist/stacks/Dns.js +69 -18
  13. package/dist/stacks/Dns.js.map +1 -1
  14. package/dist/stacks/Pipeline.d.ts +7 -0
  15. package/dist/stacks/Pipeline.d.ts.map +1 -1
  16. package/dist/stacks/Pipeline.js +60 -7
  17. package/dist/stacks/Pipeline.js.map +1 -1
  18. package/docs/CLI.md +58 -15
  19. package/docs/CONFIGURATION.md +73 -30
  20. package/docs/EXAMPLES.md +5 -1
  21. package/examples/delegated-subdomain/infra.config.ts +102 -0
  22. package/examples/next-and-expo/infra.config.ts +33 -28
  23. package/examples/next-only/infra.config.ts +35 -22
  24. package/package.json +10 -4
  25. package/scripts/ensure-pipelines.sh +151 -43
  26. package/scripts/postdeploy-update-dns.sh +42 -11
  27. package/scripts/predeploy-checks.sh +38 -5
  28. package/templates/buildspec.yml +23 -0
  29. package/templates/ensure-pipelines.sh +157 -22
  30. package/templates/env.example +15 -0
  31. package/templates/infra.config.expo-web.ts +153 -0
  32. package/templates/infra.config.next-only.ts +159 -0
  33. package/templates/infra.config.ts +21 -4
  34. package/templates/pipelines.example.json +19 -0
  35. package/templates/private.example.json +13 -0
  36. package/templates/scaffold.gitignore +29 -0
  37. package/templates/scaffold.package.json +25 -0
  38. package/templates/scaffold.tsconfig.json +22 -0
  39. package/templates/secrets.schema.expo-web.json +8 -0
package/README.md CHANGED
@@ -5,21 +5,20 @@
5
5
  [![Publish workflow](https://github.com/lstechnologysolutions/lstech.solutions/actions/workflows/publish-infra.yml/badge.svg)](https://github.com/lstechnologysolutions/lstech.solutions/actions/workflows/publish-infra.yml)
6
6
  [![Public repository](https://img.shields.io/badge/public%20repo-lstechnologysolutions%2Finfra-181717?logo=github)](https://github.com/lstechnologysolutions/infra)
7
7
 
8
- Reusable, white-label SST v3 infrastructure primitives for AWS deployments from monorepos.
8
+ Reusable, white-label SST v3 infrastructure primitives for AWS monorepo deployments.
9
9
 
10
- Public package repository: [https://github.com/lstechnologysolutions/infra](https://github.com/lstechnologysolutions/infra)
10
+ Public repository: [https://github.com/lstechnologysolutions/infra](https://github.com/lstechnologysolutions/infra)
11
11
 
12
- `@lsts_tech/infra` focuses on portability:
12
+ ## What It Supports
13
13
 
14
- - No hardcoded project domains/repos in package code
15
- - Environment-driven scaffolding for public repositories
16
- - CLI bootstrap for consistent setup (`npx @lsts_tech/infra init`)
17
- - Next.js (`sst.aws.Nextjs`) and Expo Web (`sst.aws.StaticSite`) support
18
- - AWS CodePipeline + CodeBuild CI/CD helpers
19
-
20
- ## Version Scope
21
-
22
- `v1.0.1` provider support: **AWS only**.
14
+ - AWS provider (v1.x)
15
+ - Next.js and Expo Web deployments
16
+ - `expo-web` scaffold mode (no Next.js resources/secrets)
17
+ - Runtime-driven pipeline definitions (env + optional `config/pipelines.json`)
18
+ - Explicit pipeline mutation gate (`INFRA_CREATE_PIPELINES=true`)
19
+ - `doctor` readiness checks (`npx @lsts_tech/infra doctor`)
20
+ - Optional pipeline IAM mode: `admin` or `least-privilege`
21
+ - Hosted-zone parent fallback support for delegated subdomains
23
22
 
24
23
  ## Install
25
24
 
@@ -38,18 +37,19 @@ npx @lsts_tech/infra init \
38
37
  --project myapp \
39
38
  --domain example.com \
40
39
  --repo myorg/myrepo \
41
- --pipelines production,dev
40
+ --profile next-expo \
41
+ --pipelines production,dev,mobile
42
42
  ```
43
43
 
44
- Optional Expo support:
44
+ Expo-only setup:
45
45
 
46
46
  ```bash
47
47
  npx @lsts_tech/infra init \
48
48
  --project myapp \
49
49
  --domain example.com \
50
- --repo myorg/myrepo \
51
- --pipelines production,dev,mobile \
52
- --with-expo
50
+ --repo myorg/mobile \
51
+ --profile expo-web \
52
+ --pipelines production,mobile
53
53
  ```
54
54
 
55
55
  ### 2. Review generated files
@@ -57,30 +57,47 @@ npx @lsts_tech/infra init \
57
57
  - `sst.config.ts`
58
58
  - `sst-env.d.ts`
59
59
  - `infra.config.ts`
60
+ - `package.json`
61
+ - `tsconfig.json`
62
+ - `.gitignore`
60
63
  - `.env.example`
61
64
  - `buildspec.yml`
62
65
  - `schemas/secrets.schema.json`
63
66
  - `scripts/ensure-pipelines.sh`
67
+ - `scripts/predeploy-checks.sh`
68
+ - `scripts/postdeploy-update-dns.sh`
69
+ - `scripts/sst-deploy.sh`
70
+ - `scripts/ensure-secrets.sh`
71
+ - `config/pipelines.example.json`
72
+ - `config/private.example.json`
64
73
 
65
74
  ### 3. Configure environment and secrets
66
75
 
67
- Use `.env.example` as the variable contract for your CI/local environment.
76
+ ```bash
77
+ cp .env.example .env
78
+ ```
79
+
80
+ Set minimum SST secrets for Next.js profiles:
81
+
82
+ ```bash
83
+ npx sst secret set DatabaseUrl "postgresql://..." --stage dev
84
+ npx sst secret set AuthSecret "replace-me" --stage dev
85
+ ```
68
86
 
69
- Set minimum SST secrets:
87
+ ### 4. Validate setup
70
88
 
71
89
  ```bash
72
- npx sst secrets set DatabaseUrl "postgresql://..." --stage dev
73
- npx sst secrets set AuthSecret "replace-me" --stage dev
90
+ npx @lsts_tech/infra doctor --target .
74
91
  ```
75
92
 
76
- ### 4. Deploy
93
+ ### 5. Deploy app infrastructure
77
94
 
78
95
  ```bash
79
96
  npx sst deploy --stage dev
80
97
  npx sst deploy --stage production
81
98
  ```
82
99
 
83
- ### 5. Ensure pipelines
100
+ ### 6. Create/update pipelines explicitly
84
101
 
85
102
  ```bash
86
103
  APPROVE=true bash scripts/ensure-pipelines.sh
@@ -88,68 +105,32 @@ APPROVE=true bash scripts/ensure-pipelines.sh
88
105
 
89
106
  ## CLI
90
107
 
91
- ### `init`
92
-
93
108
  ```bash
94
- npx @lsts_tech/infra init [options]
109
+ npx @lsts_tech/infra <command> [options]
95
110
  ```
96
111
 
97
- | Option | Description | Default |
98
- |---|---|---|
99
- | `--provider <name>` | Cloud provider (`aws`) | `aws` |
100
- | `--project <slug>` | Project/app prefix | `myapp` |
101
- | `--app-name <name>` | SST app name | `--project` |
102
- | `--domain <domain>` | Root domain | `example.com` |
103
- | `--repo <owner/repo>` | GitHub repo for pipeline source | `myorg/myrepo` |
104
- | `--pipelines <list>` | `production,dev,mobile` CSV or `none` | `production,dev` |
105
- | `--branch-prod <branch>` | Production branch | `main` |
106
- | `--branch-dev <branch>` | Dev branch | `develop` |
107
- | `--branch-mobile <branch>` | Mobile branch | `mobile` |
108
- | `--with-expo` | Enable Expo scaffold defaults | `false` |
109
- | `--infra-path <path>` | Infra path from monorepo root | `packages/infra` |
110
- | `--target <path>` | Output directory | `.` |
111
- | `--force` | Overwrite existing files | `false` |
112
-
113
- Full CLI docs: [docs/CLI.md](./docs/CLI.md)
114
-
115
- ## API Reference
116
-
117
- ### `resolveDomain(config: DnsConfig): DomainResult`
118
-
119
- Stage-aware domain resolution.
120
-
121
- ### `createNextSite(config: NextSiteConfig): { site, url }`
122
-
123
- Creates an SST `aws.Nextjs` deployment.
124
-
125
- ### `createExpoSite(config: ExpoSiteConfig): { site, url }`
126
-
127
- Creates an SST `aws.StaticSite` deployment for Expo web exports.
112
+ Commands:
128
113
 
129
- ### `createPipeline(config: PipelineConfig): PipelineResult`
114
+ - `init` scaffold infra project files
115
+ - `doctor` — validate Route53/ACM/CodeStar/branch/domain config before deploy
130
116
 
131
- Creates an AWS CodePipeline + CodeBuild deployment pipeline.
117
+ Full reference: [docs/CLI.md](./docs/CLI.md)
132
118
 
133
- ## Scripts Included
119
+ ## API
134
120
 
135
- | Script | Purpose |
136
- |---|---|
137
- | `scripts/predeploy-checks.sh` | DNS/CloudFront/ACM pre-deploy checks |
138
- | `scripts/postdeploy-update-dns.sh` | Route53 alias synchronization |
139
- | `scripts/ensure-secrets.sh` | SST secret provisioning from schema |
140
- | `scripts/sst-deploy.sh` | CI-safe SST deploy wrapper |
141
- | `scripts/ensure-pipelines.sh` | Ensure configured pipelines exist |
142
- | `scripts/pulumi-deploy.sh` | CI-safe Pulumi deploy wrapper |
143
- | `scripts/cleanup-orphan-lambdas.sh` | Cleanup stale Lambda functions |
144
- | `scripts/delete-amplify-app.sh` | Remove legacy Amplify apps |
121
+ - `resolveDomain(config: DnsConfig): DomainResult`
122
+ - `createNextSite(config: NextSiteConfig): { site, url }`
123
+ - `createExpoSite(config: ExpoSiteConfig): { site, url }`
124
+ - `createPipeline(config: PipelineConfig): PipelineResult`
145
125
 
146
- ## Examples and Docs
126
+ ## Docs and Examples
147
127
 
148
128
  - Configuration guide: [docs/CONFIGURATION.md](./docs/CONFIGURATION.md)
149
- - CLI guide: [docs/CLI.md](./docs/CLI.md)
129
+ - CLI reference: [docs/CLI.md](./docs/CLI.md)
150
130
  - Example index: [docs/EXAMPLES.md](./docs/EXAMPLES.md)
151
131
  - Next-only example: [examples/next-only/infra.config.ts](./examples/next-only/infra.config.ts)
152
132
  - Next + Expo example: [examples/next-and-expo/infra.config.ts](./examples/next-and-expo/infra.config.ts)
133
+ - Delegated subdomain example: [examples/delegated-subdomain/infra.config.ts](./examples/delegated-subdomain/infra.config.ts)
153
134
 
154
135
  ## Publish Checklist
155
136
 
@@ -158,7 +139,7 @@ Before publishing to npm:
158
139
  1. `npm run build`
159
140
  2. `npm run check-types`
160
141
  3. `npm pack --dry-run`
161
- 4. Verify tarball has no project-private infra/state files
142
+ 4. Verify tarball contains no private state/secrets (`.env`, `.sst`, Pulumi state)
162
143
 
163
144
  ## License
164
145
 
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @lsts_tech/infra — CLI Init Script
3
+ * @lsts_tech/infra — CLI
4
4
  *
5
- * Scaffolds project-specific configuration files for the infra package.
6
- * Run with: npx @lsts_tech/infra init
5
+ * Commands:
6
+ * - init: scaffold white-label infra files
7
+ * - doctor: validate AWS/domain/pipeline readiness before deploy
7
8
  */
8
9
  export {};
9
10
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../bin/init.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../bin/init.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG"}