@lsts_tech/infra 1.0.0 → 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 +58 -70
  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
@@ -1,18 +1,24 @@
1
1
  # @lsts_tech/infra
2
2
 
3
- Reusable, white-label SST v3 infrastructure primitives for AWS deployments from monorepos.
3
+ [![npm version](https://img.shields.io/npm/v/%40lsts_tech%2Finfra?label=npm&color=cb3837)](https://www.npmjs.com/package/@lsts_tech/infra)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40lsts_tech%2Finfra?label=downloads)](https://www.npmjs.com/package/@lsts_tech/infra)
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
+ [![Public repository](https://img.shields.io/badge/public%20repo-lstechnologysolutions%2Finfra-181717?logo=github)](https://github.com/lstechnologysolutions/infra)
4
7
 
5
- `@lsts_tech/infra` focuses on portability:
8
+ Reusable, white-label SST v3 infrastructure primitives for AWS monorepo deployments.
6
9
 
7
- - No hardcoded project domains/repos in package code
8
- - Environment-driven scaffolding for public repositories
9
- - CLI bootstrap for consistent setup (`npx @lsts_tech/infra init`)
10
- - Next.js (`sst.aws.Nextjs`) and Expo Web (`sst.aws.StaticSite`) support
11
- - AWS CodePipeline + CodeBuild CI/CD helpers
10
+ Public repository: [https://github.com/lstechnologysolutions/infra](https://github.com/lstechnologysolutions/infra)
12
11
 
13
- ## Version Scope
12
+ ## What It Supports
14
13
 
15
- `v1.0.0` 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
16
22
 
17
23
  ## Install
18
24
 
@@ -31,18 +37,19 @@ npx @lsts_tech/infra init \
31
37
  --project myapp \
32
38
  --domain example.com \
33
39
  --repo myorg/myrepo \
34
- --pipelines production,dev
40
+ --profile next-expo \
41
+ --pipelines production,dev,mobile
35
42
  ```
36
43
 
37
- Optional Expo support:
44
+ Expo-only setup:
38
45
 
39
46
  ```bash
40
47
  npx @lsts_tech/infra init \
41
48
  --project myapp \
42
49
  --domain example.com \
43
- --repo myorg/myrepo \
44
- --pipelines production,dev,mobile \
45
- --with-expo
50
+ --repo myorg/mobile \
51
+ --profile expo-web \
52
+ --pipelines production,mobile
46
53
  ```
47
54
 
48
55
  ### 2. Review generated files
@@ -50,30 +57,47 @@ npx @lsts_tech/infra init \
50
57
  - `sst.config.ts`
51
58
  - `sst-env.d.ts`
52
59
  - `infra.config.ts`
60
+ - `package.json`
61
+ - `tsconfig.json`
62
+ - `.gitignore`
53
63
  - `.env.example`
54
64
  - `buildspec.yml`
55
65
  - `schemas/secrets.schema.json`
56
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`
57
73
 
58
74
  ### 3. Configure environment and secrets
59
75
 
60
- 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:
61
81
 
62
- Set minimum SST secrets:
82
+ ```bash
83
+ npx sst secret set DatabaseUrl "postgresql://..." --stage dev
84
+ npx sst secret set AuthSecret "replace-me" --stage dev
85
+ ```
86
+
87
+ ### 4. Validate setup
63
88
 
64
89
  ```bash
65
- npx sst secrets set DatabaseUrl "postgresql://..." --stage dev
66
- npx sst secrets set AuthSecret "replace-me" --stage dev
90
+ npx @lsts_tech/infra doctor --target .
67
91
  ```
68
92
 
69
- ### 4. Deploy
93
+ ### 5. Deploy app infrastructure
70
94
 
71
95
  ```bash
72
96
  npx sst deploy --stage dev
73
97
  npx sst deploy --stage production
74
98
  ```
75
99
 
76
- ### 5. Ensure pipelines
100
+ ### 6. Create/update pipelines explicitly
77
101
 
78
102
  ```bash
79
103
  APPROVE=true bash scripts/ensure-pipelines.sh
@@ -81,68 +105,32 @@ APPROVE=true bash scripts/ensure-pipelines.sh
81
105
 
82
106
  ## CLI
83
107
 
84
- ### `init`
85
-
86
108
  ```bash
87
- npx @lsts_tech/infra init [options]
109
+ npx @lsts_tech/infra <command> [options]
88
110
  ```
89
111
 
90
- | Option | Description | Default |
91
- |---|---|---|
92
- | `--provider <name>` | Cloud provider (`aws`) | `aws` |
93
- | `--project <slug>` | Project/app prefix | `myapp` |
94
- | `--app-name <name>` | SST app name | `--project` |
95
- | `--domain <domain>` | Root domain | `example.com` |
96
- | `--repo <owner/repo>` | GitHub repo for pipeline source | `myorg/myrepo` |
97
- | `--pipelines <list>` | `production,dev,mobile` CSV or `none` | `production,dev` |
98
- | `--branch-prod <branch>` | Production branch | `main` |
99
- | `--branch-dev <branch>` | Dev branch | `develop` |
100
- | `--branch-mobile <branch>` | Mobile branch | `mobile` |
101
- | `--with-expo` | Enable Expo scaffold defaults | `false` |
102
- | `--infra-path <path>` | Infra path from monorepo root | `packages/infra` |
103
- | `--target <path>` | Output directory | `.` |
104
- | `--force` | Overwrite existing files | `false` |
105
-
106
- Full CLI docs: [docs/CLI.md](./docs/CLI.md)
107
-
108
- ## API Reference
109
-
110
- ### `resolveDomain(config: DnsConfig): DomainResult`
111
-
112
- Stage-aware domain resolution.
113
-
114
- ### `createNextSite(config: NextSiteConfig): { site, url }`
115
-
116
- Creates an SST `aws.Nextjs` deployment.
117
-
118
- ### `createExpoSite(config: ExpoSiteConfig): { site, url }`
119
-
120
- Creates an SST `aws.StaticSite` deployment for Expo web exports.
112
+ Commands:
121
113
 
122
- ### `createPipeline(config: PipelineConfig): PipelineResult`
114
+ - `init` scaffold infra project files
115
+ - `doctor` — validate Route53/ACM/CodeStar/branch/domain config before deploy
123
116
 
124
- Creates an AWS CodePipeline + CodeBuild deployment pipeline.
117
+ Full reference: [docs/CLI.md](./docs/CLI.md)
125
118
 
126
- ## Scripts Included
119
+ ## API
127
120
 
128
- | Script | Purpose |
129
- |---|---|
130
- | `scripts/predeploy-checks.sh` | DNS/CloudFront/ACM pre-deploy checks |
131
- | `scripts/postdeploy-update-dns.sh` | Route53 alias synchronization |
132
- | `scripts/ensure-secrets.sh` | SST secret provisioning from schema |
133
- | `scripts/sst-deploy.sh` | CI-safe SST deploy wrapper |
134
- | `scripts/ensure-pipelines.sh` | Ensure configured pipelines exist |
135
- | `scripts/pulumi-deploy.sh` | CI-safe Pulumi deploy wrapper |
136
- | `scripts/cleanup-orphan-lambdas.sh` | Cleanup stale Lambda functions |
137
- | `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`
138
125
 
139
- ## Examples and Docs
126
+ ## Docs and Examples
140
127
 
141
128
  - Configuration guide: [docs/CONFIGURATION.md](./docs/CONFIGURATION.md)
142
- - CLI guide: [docs/CLI.md](./docs/CLI.md)
129
+ - CLI reference: [docs/CLI.md](./docs/CLI.md)
143
130
  - Example index: [docs/EXAMPLES.md](./docs/EXAMPLES.md)
144
131
  - Next-only example: [examples/next-only/infra.config.ts](./examples/next-only/infra.config.ts)
145
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)
146
134
 
147
135
  ## Publish Checklist
148
136
 
@@ -151,7 +139,7 @@ Before publishing to npm:
151
139
  1. `npm run build`
152
140
  2. `npm run check-types`
153
141
  3. `npm pack --dry-run`
154
- 4. Verify tarball has no project-private infra/state files
142
+ 4. Verify tarball contains no private state/secrets (`.env`, `.sst`, Pulumi state)
155
143
 
156
144
  ## License
157
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"}