@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.
- package/README.md +58 -70
- package/dist/bin/init.d.ts +4 -3
- package/dist/bin/init.d.ts.map +1 -1
- package/dist/bin/init.js +619 -117
- package/dist/bin/init.js.map +1 -1
- package/dist/src/auth/index.d.ts +17 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/index.js +18 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/stacks/Dns.d.ts +24 -14
- package/dist/stacks/Dns.d.ts.map +1 -1
- package/dist/stacks/Dns.js +69 -18
- package/dist/stacks/Dns.js.map +1 -1
- package/dist/stacks/Pipeline.d.ts +7 -0
- package/dist/stacks/Pipeline.d.ts.map +1 -1
- package/dist/stacks/Pipeline.js +60 -7
- package/dist/stacks/Pipeline.js.map +1 -1
- package/docs/CLI.md +58 -15
- package/docs/CONFIGURATION.md +73 -30
- package/docs/EXAMPLES.md +5 -1
- package/examples/delegated-subdomain/infra.config.ts +102 -0
- package/examples/next-and-expo/infra.config.ts +33 -28
- package/examples/next-only/infra.config.ts +35 -22
- package/package.json +10 -4
- package/scripts/ensure-pipelines.sh +151 -43
- package/scripts/postdeploy-update-dns.sh +42 -11
- package/scripts/predeploy-checks.sh +38 -5
- package/templates/buildspec.yml +23 -0
- package/templates/ensure-pipelines.sh +157 -22
- package/templates/env.example +15 -0
- package/templates/infra.config.expo-web.ts +153 -0
- package/templates/infra.config.next-only.ts +159 -0
- package/templates/infra.config.ts +21 -4
- package/templates/pipelines.example.json +19 -0
- package/templates/private.example.json +13 -0
- package/templates/scaffold.gitignore +29 -0
- package/templates/scaffold.package.json +25 -0
- package/templates/scaffold.tsconfig.json +22 -0
- 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
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@lsts_tech/infra)
|
|
4
|
+
[](https://www.npmjs.com/package/@lsts_tech/infra)
|
|
5
|
+
[](https://github.com/lstechnologysolutions/lstech.solutions/actions/workflows/publish-infra.yml)
|
|
6
|
+
[](https://github.com/lstechnologysolutions/infra)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Reusable, white-label SST v3 infrastructure primitives for AWS monorepo deployments.
|
|
6
9
|
|
|
7
|
-
|
|
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
|
-
##
|
|
12
|
+
## What It Supports
|
|
14
13
|
|
|
15
|
-
|
|
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
|
-
--
|
|
40
|
+
--profile next-expo \
|
|
41
|
+
--pipelines production,dev,mobile
|
|
35
42
|
```
|
|
36
43
|
|
|
37
|
-
|
|
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/
|
|
44
|
-
--
|
|
45
|
-
--
|
|
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
|
-
|
|
76
|
+
```bash
|
|
77
|
+
cp .env.example .env
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Set minimum SST secrets for Next.js profiles:
|
|
61
81
|
|
|
62
|
-
|
|
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
|
|
66
|
-
npx sst secrets set AuthSecret "replace-me" --stage dev
|
|
90
|
+
npx @lsts_tech/infra doctor --target .
|
|
67
91
|
```
|
|
68
92
|
|
|
69
|
-
###
|
|
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
|
-
###
|
|
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
|
|
109
|
+
npx @lsts_tech/infra <command> [options]
|
|
88
110
|
```
|
|
89
111
|
|
|
90
|
-
|
|
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
|
-
|
|
114
|
+
- `init` — scaffold infra project files
|
|
115
|
+
- `doctor` — validate Route53/ACM/CodeStar/branch/domain config before deploy
|
|
123
116
|
|
|
124
|
-
|
|
117
|
+
Full reference: [docs/CLI.md](./docs/CLI.md)
|
|
125
118
|
|
|
126
|
-
##
|
|
119
|
+
## API
|
|
127
120
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
##
|
|
126
|
+
## Docs and Examples
|
|
140
127
|
|
|
141
128
|
- Configuration guide: [docs/CONFIGURATION.md](./docs/CONFIGURATION.md)
|
|
142
|
-
- CLI
|
|
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
|
|
142
|
+
4. Verify tarball contains no private state/secrets (`.env`, `.sst`, Pulumi state)
|
|
155
143
|
|
|
156
144
|
## License
|
|
157
145
|
|
package/dist/bin/init.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @lsts_tech/infra — CLI
|
|
3
|
+
* @lsts_tech/infra — CLI
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
package/dist/bin/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../bin/init.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../bin/init.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG"}
|