@pipelab/plugin-netlify 1.0.0-beta.14 → 1.0.0-beta.16

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/index.mjs CHANGED
@@ -4,11 +4,11 @@ import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
5
  import path, { basename, delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { constants, tmpdir } from "node:os";
7
+ import { constants } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
9
+ import { chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
9
10
  import http from "node:http";
10
11
  import { webcrypto } from "node:crypto";
11
- import { chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
12
12
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
13
13
  import { StringDecoder } from "node:string_decoder";
14
14
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -20,6 +20,7 @@ import { serialize } from "node:v8";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
22
22
  import { Buffer as Buffer$1 } from "node:buffer";
23
+ import dns from "node:dns/promises";
23
24
  //#region ../../packages/migration/src/models/createMigration.ts
24
25
  function createMigration$1(migration) {
25
26
  return {
@@ -1595,6 +1596,56 @@ function literal(literal_, message) {
1595
1596
  }
1596
1597
  };
1597
1598
  }
1599
+ function looseObject(entries, message) {
1600
+ return {
1601
+ kind: "schema",
1602
+ type: "loose_object",
1603
+ reference: looseObject,
1604
+ expects: "Object",
1605
+ async: false,
1606
+ entries,
1607
+ message,
1608
+ _run(dataset, config2) {
1609
+ const input = dataset.value;
1610
+ if (input && typeof input === "object") {
1611
+ dataset.typed = true;
1612
+ dataset.value = {};
1613
+ for (const key in this.entries) {
1614
+ const value2 = input[key];
1615
+ const valueDataset = this.entries[key]._run({
1616
+ typed: false,
1617
+ value: value2
1618
+ }, config2);
1619
+ if (valueDataset.issues) {
1620
+ const pathItem = {
1621
+ type: "object",
1622
+ origin: "value",
1623
+ input,
1624
+ key,
1625
+ value: value2
1626
+ };
1627
+ for (const issue of valueDataset.issues) {
1628
+ if (issue.path) issue.path.unshift(pathItem);
1629
+ else issue.path = [pathItem];
1630
+ dataset.issues?.push(issue);
1631
+ }
1632
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1633
+ if (config2.abortEarly) {
1634
+ dataset.typed = false;
1635
+ break;
1636
+ }
1637
+ }
1638
+ if (!valueDataset.typed) dataset.typed = false;
1639
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1640
+ }
1641
+ if (!dataset.issues || !config2.abortEarly) {
1642
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1643
+ }
1644
+ } else _addIssue(this, "type", dataset, config2);
1645
+ return dataset;
1646
+ }
1647
+ };
1648
+ }
1598
1649
  function number(message) {
1599
1650
  return {
1600
1651
  kind: "schema",
@@ -2132,6 +2183,18 @@ settingsMigratorInternal.createMigrations({
2132
2183
  })
2133
2184
  ]
2134
2185
  });
2186
+ const connectionsMigratorInternal = createMigrator();
2187
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2188
+ version: "1.0.0",
2189
+ connections: []
2190
+ });
2191
+ connectionsMigratorInternal.createMigrations({
2192
+ defaultValue: defaultConnections,
2193
+ migrations: [createMigration({
2194
+ version: "1.0.0",
2195
+ up: finalVersion
2196
+ })]
2197
+ });
2135
2198
  const fileRepoMigratorInternal = createMigrator();
2136
2199
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2137
2200
  version: "2.0.0",
@@ -2293,11 +2356,51 @@ const LEGACY_ID_MAP = {
2293
2356
  };
2294
2357
  const getStrictPluginId = (pluginId) => {
2295
2358
  if (!pluginId) return pluginId;
2296
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2297
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2298
- const prefixed = `@pipelab/plugin-${pluginId}`;
2299
- return LEGACY_ID_MAP[prefixed] || prefixed;
2359
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2300
2360
  };
2361
+ //#endregion
2362
+ //#region ../../packages/shared/src/save-location.ts
2363
+ const SaveLocationInternalValidator = object({
2364
+ id: string(),
2365
+ project: string(),
2366
+ lastModified: string(),
2367
+ type: literal("internal"),
2368
+ configName: string()
2369
+ });
2370
+ const SaveLocationValidator = union([
2371
+ object({
2372
+ id: string(),
2373
+ project: string(),
2374
+ path: string(),
2375
+ lastModified: string(),
2376
+ type: literal("external"),
2377
+ summary: object({
2378
+ plugins: array(string()),
2379
+ name: string(),
2380
+ description: string()
2381
+ })
2382
+ }),
2383
+ SaveLocationInternalValidator,
2384
+ object({
2385
+ id: string(),
2386
+ project: string(),
2387
+ type: literal("pipelab-cloud")
2388
+ })
2389
+ ]);
2390
+ object({
2391
+ version: literal("1.0.0"),
2392
+ data: optional(record(string(), SaveLocationValidator), {})
2393
+ });
2394
+ const FileRepoProjectValidatorV2$1 = object({
2395
+ id: string(),
2396
+ name: string(),
2397
+ description: string()
2398
+ });
2399
+ object({
2400
+ version: literal("2.0.0"),
2401
+ projects: array(FileRepoProjectValidatorV2$1),
2402
+ pipelines: optional(array(SaveLocationValidator), [])
2403
+ });
2301
2404
  object({
2302
2405
  cacheFolder: string(),
2303
2406
  theme: union([literal("light"), literal("dark")]),
@@ -2449,6 +2552,17 @@ object({
2449
2552
  })),
2450
2553
  isInternalMigrationBannerClosed: optional(boolean(), false)
2451
2554
  });
2555
+ const ConnectionValidator = looseObject({
2556
+ id: string(),
2557
+ pluginName: string(),
2558
+ name: string(),
2559
+ createdAt: string(),
2560
+ isDefault: boolean()
2561
+ });
2562
+ object({
2563
+ version: literal("1.0.0"),
2564
+ connections: array(ConnectionValidator)
2565
+ });
2452
2566
  //#endregion
2453
2567
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2454
2568
  const prettyLogStyles = {
@@ -2969,7 +3083,7 @@ const useLogger = () => {
2969
3083
  const OriginValidator = object({
2970
3084
  pluginId: string(),
2971
3085
  nodeId: string(),
2972
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3086
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2973
3087
  });
2974
3088
  const BlockActionValidatorV1 = object({
2975
3089
  type: literal("action"),
@@ -2982,7 +3096,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2982
3096
  const BlockActionValidatorV3 = object({
2983
3097
  type: literal("action"),
2984
3098
  uid: string(),
2985
- name: pipe(optional(string()), description("A custom name provided by the user")),
3099
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2986
3100
  disabled: optional(boolean()),
2987
3101
  params: record(string(), object({
2988
3102
  editor: EditorParamValidatorV3,
@@ -45296,35 +45410,6 @@ const createNetlifySiteParam = (value, tokenKey, definition) => {
45296
45410
  };
45297
45411
  };
45298
45412
  //#endregion
45299
- //#region ../../packages/shared/src/save-location.ts
45300
- const SaveLocationInternalValidator = object({
45301
- id: string(),
45302
- project: string(),
45303
- lastModified: string(),
45304
- type: literal("internal"),
45305
- configName: string()
45306
- });
45307
- const SaveLocationValidator = union([
45308
- object({
45309
- id: string(),
45310
- project: string(),
45311
- path: string(),
45312
- lastModified: string(),
45313
- type: literal("external"),
45314
- summary: object({
45315
- plugins: array(string()),
45316
- name: string(),
45317
- description: string()
45318
- })
45319
- }),
45320
- SaveLocationInternalValidator,
45321
- object({
45322
- id: string(),
45323
- project: string(),
45324
- type: literal("pipelab-cloud")
45325
- })
45326
- ]);
45327
- //#endregion
45328
45413
  //#region ../../packages/shared/src/websocket.types.ts
45329
45414
  var WebSocketError = class extends Error {
45330
45415
  constructor(message, code, requestId) {
@@ -45341,20 +45426,6 @@ object({
45341
45426
  version: literal("1.0.0"),
45342
45427
  data: optional(record(string(), SaveLocationValidator), {})
45343
45428
  });
45344
- const FileRepoProjectValidatorV2$1 = object({
45345
- id: string(),
45346
- name: string(),
45347
- description: string()
45348
- });
45349
- object({
45350
- version: literal("2.0.0"),
45351
- projects: array(FileRepoProjectValidatorV2$1),
45352
- pipelines: optional(array(SaveLocationValidator), [])
45353
- });
45354
- object({
45355
- version: literal("1.0.0"),
45356
- data: optional(record(string(), SaveLocationValidator), {})
45357
- });
45358
45429
  const FileRepoProjectValidatorV2 = object({
45359
45430
  id: string(),
45360
45431
  name: string(),
@@ -45374,9 +45445,15 @@ var init_esm_shims = __esmMin((() => {
45374
45445
  __dirname = /* @__PURE__ */ getDirname();
45375
45446
  }));
45376
45447
  //#endregion
45377
- //#region ../../packages/core-node/src/context.ts
45448
+ //#region ../../packages/constants/src/index.ts
45378
45449
  init_esm_shims();
45379
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45450
+ const websocketPort = 33753;
45451
+ const DEFAULT_NODE_VERSION = "24.14.1";
45452
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45453
+ //#endregion
45454
+ //#region ../../packages/core-node/src/context.ts
45455
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45456
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45380
45457
  const isDev = process.env.NODE_ENV === "development";
45381
45458
  /**
45382
45459
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48948,9 +49025,6 @@ const useAPI = () => {
48948
49025
  };
48949
49026
  };
48950
49027
  //#endregion
48951
- //#region ../../packages/constants/src/index.ts
48952
- const websocketPort = 33753;
48953
- //#endregion
48954
49028
  //#region ../../packages/core-node/src/websocket-server.ts
48955
49029
  var WebSocketServer = class {
48956
49030
  wss = null;
@@ -89355,14 +89429,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89355
89429
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89356
89430
  require_archiver();
89357
89431
  /**
89358
- * Generates a unique temporary folder.
89359
- */
89360
- const generateTempFolder = async (base) => {
89361
- const targetBase = base || tmpdir();
89362
- await mkdir(targetBase, { recursive: true });
89363
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89364
- };
89365
- /**
89366
89432
  * Extracts a .tar.gz archive.
89367
89433
  */
89368
89434
  async function extractTarGz(archivePath, destinationDir) {
@@ -100913,11 +100979,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100913
100979
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100914
100980
  const { join: join$5, sep: sep$1 } = __require("path");
100915
100981
  const getOptions = require_get_options();
100916
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
100982
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100917
100983
  const withTempDir = async (root, fn, opts) => {
100918
100984
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100919
100985
  await mkdir$4(root, { recursive: true });
100920
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100986
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100921
100987
  let err;
100922
100988
  let result;
100923
100989
  try {
@@ -110516,9 +110582,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110516
110582
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110517
110583
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110518
110584
  const { resolve: resolve$6 } = __require("node:path");
110519
- const { tmpdir: tmpdir$1, homedir } = __require("node:os");
110585
+ const { tmpdir, homedir } = __require("node:os");
110520
110586
  module.exports = (fakePlatform = false) => {
110521
- const temp = tmpdir$1();
110587
+ const temp = tmpdir();
110522
110588
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110523
110589
  const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110524
110590
  const platform = fakePlatform || process.platform;
@@ -123769,7 +123835,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123769
123835
  //#endregion
123770
123836
  //#region ../../node_modules/make-fetch-happen/lib/options.js
123771
123837
  var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123772
- const dns$2 = __require("dns");
123838
+ const dns$3 = __require("dns");
123773
123839
  const conditionalHeaders = [
123774
123840
  "if-modified-since",
123775
123841
  "if-none-match",
@@ -123794,7 +123860,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123794
123860
  };
123795
123861
  options.dns = {
123796
123862
  ttl: 300 * 1e3,
123797
- lookup: dns$2.lookup,
123863
+ lookup: dns$3.lookup,
123798
123864
  ...options.dns
123799
123865
  };
123800
123866
  options.cache = options.cache || "default";
@@ -125211,9 +125277,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125211
125277
  //#region ../../node_modules/@npmcli/agent/lib/dns.js
125212
125278
  var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125213
125279
  const { LRUCache } = require_index_min$5();
125214
- const dns$1 = __require("dns");
125280
+ const dns$2 = __require("dns");
125215
125281
  const cache = new LRUCache({ max: 50 });
125216
- const getOptions = ({ family = 0, hints = dns$1.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$1.lookup }) => ({
125282
+ const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
125217
125283
  hints,
125218
125284
  lookup: (hostname, ...args) => {
125219
125285
  const callback = args.pop();
@@ -130252,7 +130318,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130252
130318
  const socks_1 = require_build$1();
130253
130319
  const agent_base_1 = require_dist$12();
130254
130320
  const debug_1 = __importDefault(require_src$1());
130255
- const dns = __importStar(__require("dns"));
130321
+ const dns$1 = __importStar(__require("dns"));
130256
130322
  const net$1 = __importStar(__require("net"));
130257
130323
  const tls$1 = __importStar(__require("tls"));
130258
130324
  const url_1$1 = __require("url");
@@ -130324,7 +130390,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130324
130390
  const { shouldLookup, proxy, timeout } = this;
130325
130391
  if (!opts.host) throw new Error("No `host` defined!");
130326
130392
  let { host } = opts;
130327
- const { port, lookup: lookupFn = dns.lookup } = opts;
130393
+ const { port, lookup: lookupFn = dns$1.lookup } = opts;
130328
130394
  if (shouldLookup) host = await new Promise((resolve, reject) => {
130329
130395
  lookupFn(host, {}, (err, res) => {
130330
130396
  if (err) reject(err);
@@ -150591,7 +150657,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150591
150657
  const { promisify: promisify$1 } = __require("util");
150592
150658
  const path$1 = __require("path");
150593
150659
  const { createHash } = __require("crypto");
150594
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150660
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150595
150661
  const url = __require("url");
150596
150662
  const slasher = require_glob_slash();
150597
150663
  const minimatch = require_minimatch();
@@ -150914,7 +150980,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150914
150980
  };
150915
150981
  const getHandlers = (methods) => Object.assign({
150916
150982
  lstat: promisify$1(lstat),
150917
- realpath: promisify$1(realpath$1),
150983
+ realpath: promisify$1(realpath),
150918
150984
  createReadStream: createReadStream$1,
150919
150985
  readdir: promisify$1(readdir$1),
150920
150986
  sendError
@@ -151053,8 +151119,6 @@ const sendStartupProgress = (message) => {
151053
151119
  };
151054
151120
  //#endregion
151055
151121
  //#region ../../packages/core-node/src/utils/remote.ts
151056
- const DEFAULT_NODE_VERSION = "24.14.1";
151057
- const DEFAULT_PNPM_VERSION = "10.12.0";
151058
151122
  function isPackageComplete(packageDir) {
151059
151123
  return existsSync(join(packageDir, "package.json"));
151060
151124
  }
@@ -151095,6 +151159,20 @@ async function withLock(key, fn) {
151095
151159
  activeOperations.set(key, promise);
151096
151160
  return promise;
151097
151161
  }
151162
+ let isOnlineCached = null;
151163
+ let lastCheckTime = 0;
151164
+ async function isOnline() {
151165
+ const now = Date.now();
151166
+ if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
151167
+ try {
151168
+ await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
151169
+ isOnlineCached = true;
151170
+ } catch {
151171
+ isOnlineCached = false;
151172
+ }
151173
+ lastCheckTime = now;
151174
+ return isOnlineCached;
151175
+ }
151098
151176
  /**
151099
151177
  * Robust utility to fetch, cache, and resolve an NPM package.
151100
151178
  * Centralized in core-node to avoid circular dependencies.
@@ -151121,7 +151199,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
151121
151199
  if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
151122
151200
  console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
151123
151201
  const resolveStart = Date.now();
151124
- try {
151202
+ if (!await isOnline()) {
151203
+ console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
151204
+ const fallbackStart = Date.now();
151205
+ const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
151206
+ if (fallbackVersion) {
151207
+ resolvedVersion = fallbackVersion;
151208
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
151209
+ } else throw new Error(`Offline and no local fallback version available for ${packageName}`);
151210
+ } else try {
151125
151211
  const cachePath = join(ctx.userDataPath, "cache", "pacote");
151126
151212
  let packumentPromise = packumentRequests.get(packageName);
151127
151213
  if (!packumentPromise) {
@@ -151131,7 +151217,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
151131
151217
  const packument = await packumentPromise;
151132
151218
  const versions = Object.keys(packument.versions);
151133
151219
  const range = resolvedVersionOrRange || "latest";
151134
- const foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151220
+ let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151221
+ if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
151222
+ const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
151223
+ if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
151224
+ if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
151225
+ console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
151226
+ foundVersion = releaseTagVersion;
151227
+ } else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
151228
+ }
151229
+ }
151135
151230
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
151136
151231
  resolvedVersion = foundVersion;
151137
151232
  console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
@@ -151246,7 +151341,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151246
151341
  const extension = isWindows ? "zip" : "tar.gz";
151247
151342
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151248
151343
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151249
- const tempDir = await generateTempFolder(tmpdir());
151344
+ const tempDir = await context.createTempFolder("node-download-");
151250
151345
  const archivePath = join(tempDir, fileName);
151251
151346
  sendStartupProgress(`Downloading Node.js v${version}...`);
151252
151347
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151568,72 +151663,83 @@ const uploadToNetlifyRunner = createActionRunner(async ({ log, inputs, cwd, abor
151568
151663
  });
151569
151664
  //#endregion
151570
151665
  //#region src/index.ts
151571
- var src_default = createNodeDefinition({ nodes: [{
151572
- node: createAction({
151573
- id: "netlify-build",
151574
- name: "Build Netlify site",
151575
- description: "",
151576
- icon: "",
151577
- displayString: "`Build ${fmt.param(params['input-folder'], 'primary', 'No path selected')}`",
151578
- meta: {},
151579
- params: {
151580
- "input-folder": createPathParam("", {
151581
- required: true,
151582
- label: "Path to the folder to upload to netlify",
151583
- control: {
151584
- type: "path",
151585
- options: { properties: ["openDirectory"] }
151586
- }
151587
- }),
151588
- token: createStringParam("", {
151589
- required: true,
151590
- label: "Token"
151591
- })
151592
- },
151593
- outputs: {}
151594
- }),
151595
- runner: createActionRunner(async ({ log, inputs, cwd, abortSignal, paths }) => {
151596
- log("Building netlify site");
151597
- const { node } = paths;
151598
- const buildDir = join(cwd, "build");
151599
- const inputFolder = inputs["input-folder"];
151600
- if (!await fileExists(join(inputFolder, "package.json"))) throw new Error("No package.json found in input folder");
151601
- await cp(inputs["input-folder"], buildDir, { recursive: true });
151602
- const netlifyDir = join(buildDir, ".netlify");
151603
- const netlifyState = join(netlifyDir, "state.json");
151604
- await mkdir(netlifyDir, { recursive: true });
151605
- await writeFile(netlifyState, `{ "siteId": "${inputs.site}" }`, "utf-8");
151606
- const { all: buildOut } = await runPnpm(buildDir, {
151607
- args: [
151608
- "--package",
151609
- "netlify-cli",
151610
- "dlx",
151611
- "netlify",
151612
- "build"
151613
- ],
151614
- extraEnv: { NETLIFY_AUTH_TOKEN: inputs.token },
151615
- signal: abortSignal
151616
- });
151617
- if (buildOut) log(buildOut);
151618
- const { all: deployOut } = await runPnpm(buildDir, {
151619
- args: [
151620
- "--package",
151621
- "netlify-cli",
151622
- "dlx",
151623
- "netlify",
151624
- "deploy",
151625
- "--prod"
151626
- ],
151627
- extraEnv: { NETLIFY_AUTH_TOKEN: inputs.token },
151628
- signal: abortSignal
151629
- });
151630
- if (deployOut) log(deployOut);
151631
- log("Uploaded to netlify");
151632
- })
151633
- }, {
151634
- node: uploadToNetlify,
151635
- runner: uploadToNetlifyRunner
151636
- }] });
151666
+ var src_default = createNodeDefinition({
151667
+ nodes: [{
151668
+ node: createAction({
151669
+ id: "netlify-build",
151670
+ name: "Build Netlify site",
151671
+ description: "",
151672
+ icon: "",
151673
+ displayString: "`Build ${fmt.param(params['input-folder'], 'primary', 'No path selected')}`",
151674
+ meta: {},
151675
+ params: {
151676
+ "input-folder": createPathParam("", {
151677
+ required: true,
151678
+ label: "Path to the folder to upload to netlify",
151679
+ control: {
151680
+ type: "path",
151681
+ options: { properties: ["openDirectory"] }
151682
+ }
151683
+ }),
151684
+ token: createStringParam("", {
151685
+ required: true,
151686
+ label: "Token"
151687
+ })
151688
+ },
151689
+ outputs: {}
151690
+ }),
151691
+ runner: createActionRunner(async ({ log, inputs, cwd, abortSignal, paths }) => {
151692
+ log("Building netlify site");
151693
+ const { node } = paths;
151694
+ const buildDir = join(cwd, "build");
151695
+ const inputFolder = inputs["input-folder"];
151696
+ if (!await fileExists(join(inputFolder, "package.json"))) throw new Error("No package.json found in input folder");
151697
+ await cp(inputs["input-folder"], buildDir, { recursive: true });
151698
+ const netlifyDir = join(buildDir, ".netlify");
151699
+ const netlifyState = join(netlifyDir, "state.json");
151700
+ await mkdir(netlifyDir, { recursive: true });
151701
+ await writeFile(netlifyState, `{ "siteId": "${inputs.site}" }`, "utf-8");
151702
+ const { all: buildOut } = await runPnpm(buildDir, {
151703
+ args: [
151704
+ "--package",
151705
+ "netlify-cli",
151706
+ "dlx",
151707
+ "netlify",
151708
+ "build"
151709
+ ],
151710
+ extraEnv: { NETLIFY_AUTH_TOKEN: inputs.token },
151711
+ signal: abortSignal
151712
+ });
151713
+ if (buildOut) log(buildOut);
151714
+ const { all: deployOut } = await runPnpm(buildDir, {
151715
+ args: [
151716
+ "--package",
151717
+ "netlify-cli",
151718
+ "dlx",
151719
+ "netlify",
151720
+ "deploy",
151721
+ "--prod"
151722
+ ],
151723
+ extraEnv: { NETLIFY_AUTH_TOKEN: inputs.token },
151724
+ signal: abortSignal
151725
+ });
151726
+ if (deployOut) log(deployOut);
151727
+ log("Uploaded to netlify");
151728
+ })
151729
+ }, {
151730
+ node: uploadToNetlify,
151731
+ runner: uploadToNetlifyRunner
151732
+ }],
151733
+ integrations: [{
151734
+ name: "Netlify Account",
151735
+ fields: [{
151736
+ key: "apiKey",
151737
+ label: "Personal Access Token",
151738
+ type: "password",
151739
+ placeholder: "netlify API token"
151740
+ }]
151741
+ }]
151742
+ });
151637
151743
  //#endregion
151638
151744
  export { src_default as default };
151639
151745