|
6 | 6 | flake-utils.url = "github:numtide/flake-utils"; |
7 | 7 | }; |
8 | 8 |
|
9 | | - outputs = { self, nixpkgs, flake-utils }: |
10 | | - flake-utils.lib.eachDefaultSystem (system: |
| 9 | + outputs = |
| 10 | + { |
| 11 | + self, |
| 12 | + nixpkgs, |
| 13 | + flake-utils, |
| 14 | + }: |
| 15 | + flake-utils.lib.eachDefaultSystem ( |
| 16 | + system: |
11 | 17 | let |
12 | 18 | pkgs = nixpkgs.legacyPackages.${system}; |
13 | 19 | in |
|
105 | 111 | # Nix app for updating API specification |
106 | 112 | apps.update-api = { |
107 | 113 | type = "app"; |
108 | | - program = toString (pkgs.writeScript "update-api" '' |
109 | | - #!${pkgs.bash}/bin/bash |
110 | | - set -euo pipefail |
111 | | -
|
112 | | - echo "🔄 Updating PurelyMail API specification..." |
113 | | -
|
114 | | - # Ensure we're in the project root |
115 | | - if [ ! -f package.json ]; then |
116 | | - echo "❌ Error: Must be run from the project root directory" |
117 | | - exit 1 |
118 | | - fi |
119 | | -
|
120 | | - if [ ! -d node_modules ]; then |
121 | | - echo "📦 Installing dependencies..." |
122 | | - ${pkgs.nodejs_20}/bin/npm install |
123 | | - fi |
124 | | -
|
125 | | - # Use the npm script directly (reuse package.json abstraction) |
126 | | - echo "🚀 Running update:api workflow..." |
127 | | - ${pkgs.nodejs_20}/bin/npm run update:api |
128 | | -
|
129 | | - echo "✅ API specification updated successfully!" |
130 | | - echo "" |
131 | | - echo "Next steps:" |
132 | | - echo " 1. Review changes: git diff" |
133 | | - echo " 2. Test: npm run test:mock" |
134 | | - echo " 3. Commit if satisfied: git add . && git commit -m 'Update API specification'" |
135 | | - ''); |
| 114 | + program = toString ( |
| 115 | + pkgs.writeScript "update-api" '' |
| 116 | + #!${pkgs.bash}/bin/bash |
| 117 | + set -euo pipefail |
| 118 | +
|
| 119 | + echo "🔄 Updating PurelyMail API specification..." |
| 120 | +
|
| 121 | + # Ensure we're in the project root |
| 122 | + if [ ! -f package.json ]; then |
| 123 | + echo "❌ Error: Must be run from the project root directory" |
| 124 | + exit 1 |
| 125 | + fi |
| 126 | +
|
| 127 | + if [ ! -d node_modules ]; then |
| 128 | + echo "📦 Installing dependencies..." |
| 129 | + ${pkgs.nodejs_20}/bin/npm install |
| 130 | + fi |
| 131 | +
|
| 132 | + # Use the npm script directly (reuse package.json abstraction) |
| 133 | + echo "🚀 Running update:api workflow..." |
| 134 | + ${pkgs.nodejs_20}/bin/npm run update:api |
| 135 | +
|
| 136 | + echo "✅ API specification updated successfully!" |
| 137 | + echo "" |
| 138 | + echo "Next steps:" |
| 139 | + echo " 1. Review changes: git diff" |
| 140 | + echo " 2. Test: npm run test:mock" |
| 141 | + echo " 3. Commit if satisfied: git add . && git commit -m 'Update API specification'" |
| 142 | + '' |
| 143 | + ); |
136 | 144 | }; |
137 | 145 |
|
138 | 146 | # Nix app for publishing to npm |
|
0 commit comments