@nuxtlib/cf-deployment 1.0.1 → 1.0.3
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/dist/module.json +1 -1
- package/dist/module.mjs +25 -44
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -131,57 +131,33 @@ function getWorkflowHeaderBlock(branches) {
|
|
|
131
131
|
return lines.join("\n");
|
|
132
132
|
}
|
|
133
133
|
function getBuildStepsBlock(packageManager, nodeVersion) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
" with:",
|
|
139
|
-
" version: 10",
|
|
140
|
-
"",
|
|
141
|
-
" - name: Setup Node",
|
|
142
|
-
" uses: actions/setup-node@v4",
|
|
143
|
-
" with:",
|
|
144
|
-
` node-version: ${nodeVersion}`,
|
|
145
|
-
" cache: pnpm",
|
|
146
|
-
" cache-dependency-path: pnpm-lock.yaml",
|
|
147
|
-
"",
|
|
148
|
-
" - name: Install deps",
|
|
149
|
-
" run: pnpm install --frozen-lockfile",
|
|
150
|
-
"",
|
|
151
|
-
" - name: Build Nuxt app",
|
|
152
|
-
" run: pnpm run build"
|
|
153
|
-
].join("\n");
|
|
154
|
-
}
|
|
155
|
-
if (packageManager === "yarn") {
|
|
156
|
-
return [
|
|
157
|
-
" - name: Setup Node",
|
|
158
|
-
" uses: actions/setup-node@v4",
|
|
159
|
-
" with:",
|
|
160
|
-
` node-version: ${nodeVersion}`,
|
|
161
|
-
" cache: yarn",
|
|
162
|
-
" cache-dependency-path: yarn.lock",
|
|
163
|
-
"",
|
|
164
|
-
" - name: Install deps",
|
|
165
|
-
" run: yarn install --frozen-lockfile",
|
|
166
|
-
"",
|
|
167
|
-
" - name: Build Nuxt app",
|
|
168
|
-
" run: yarn build"
|
|
169
|
-
].join("\n");
|
|
170
|
-
}
|
|
171
|
-
return [
|
|
134
|
+
const cacheDependencyPath = packageManager === "pnpm" ? "pnpm-lock.yaml" : packageManager === "yarn" ? "yarn.lock" : "package-lock.json";
|
|
135
|
+
const installCommand = packageManager === "pnpm" ? "pnpm install --frozen-lockfile" : packageManager === "yarn" ? "yarn install --frozen-lockfile" : "npm ci";
|
|
136
|
+
const buildCommand = packageManager === "pnpm" ? "pnpm run build" : packageManager === "yarn" ? "yarn build" : "npm run build";
|
|
137
|
+
const lines = [
|
|
172
138
|
" - name: Setup Node",
|
|
173
139
|
" uses: actions/setup-node@v4",
|
|
174
140
|
" with:",
|
|
175
141
|
` node-version: ${nodeVersion}`,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
""
|
|
142
|
+
` cache: ${packageManager}`,
|
|
143
|
+
` cache-dependency-path: ${cacheDependencyPath}`,
|
|
144
|
+
""
|
|
145
|
+
];
|
|
146
|
+
if (packageManager !== "npm") {
|
|
147
|
+
lines.push(
|
|
148
|
+
" - name: Enable Corepack",
|
|
149
|
+
" run: corepack enable",
|
|
150
|
+
""
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
lines.push(
|
|
179
154
|
" - name: Install deps",
|
|
180
|
-
|
|
155
|
+
` run: ${installCommand}`,
|
|
181
156
|
"",
|
|
182
157
|
" - name: Build Nuxt app",
|
|
183
|
-
|
|
184
|
-
|
|
158
|
+
` run: ${buildCommand}`
|
|
159
|
+
);
|
|
160
|
+
return lines.join("\n");
|
|
185
161
|
}
|
|
186
162
|
function getDeployCommand(packageManager) {
|
|
187
163
|
if (packageManager === "pnpm") {
|
|
@@ -257,6 +233,9 @@ function getHeaderBlock(appName) {
|
|
|
257
233
|
name = "${escapeTomlString(appName)}"
|
|
258
234
|
main = ".output/server/index.mjs"
|
|
259
235
|
compatibility_date = "${DEFAULT_COMPATIBILITY_DATE}"
|
|
236
|
+
|
|
237
|
+
[assets]
|
|
238
|
+
directory = ".output/public"
|
|
260
239
|
`.trim();
|
|
261
240
|
}
|
|
262
241
|
|
|
@@ -294,6 +273,8 @@ const module$1 = defineNuxtModule({
|
|
|
294
273
|
// We need this so deploy settings stay in sync with app config every time setup runs.
|
|
295
274
|
async setup(options, nuxt) {
|
|
296
275
|
const logger = useLogger("@nuxtlib/cf-deployment");
|
|
276
|
+
nuxt.options.nitro ||= {};
|
|
277
|
+
nuxt.options.nitro.preset ||= "cloudflare_module";
|
|
297
278
|
const wranglerPath = resolve(nuxt.options.rootDir, "wrangler.toml");
|
|
298
279
|
const workflowPath = resolve(nuxt.options.rootDir, DEFAULT_WORKFLOW_PATH);
|
|
299
280
|
const wranglerContent = renderWranglerToml(options);
|
package/package.json
CHANGED