@silexlabs/silex 3.0.6 → 3.0.8

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.
@@ -73,13 +73,19 @@ export default class GitlabHostingConnector extends GitlabConnector implements H
73
73
  - if: '$CI_PIPELINE_SOURCE == "trigger"'
74
74
  `
75
75
  try {
76
+ job.message = `Checking if ${pathYml} needs to be created or updated...`
77
+ job.logs[0].push(job.message)
76
78
  const originalCi = await this.readFile(session, websiteId, pathYml)
77
79
  if(originalCi.toString().startsWith(SILEX_OVERWRITE_NOTICE)) {
80
+ job.message = `Updating ${pathYml}...`
81
+ job.logs[0].push(job.message)
78
82
  await this.updateFile(session, websiteId, pathYml, contentYml)
79
83
  }
80
84
  } catch (e) {
81
85
  // If the file .gitlab-ci.yml does not exist, create it, otherwise do nothing (do not overwriting existing one)
82
86
  if (e.statusCode === 404 || e.httpStatusCode === 404 || e.message.endsWith('A file with this name doesn\'t exist')) {
87
+ job.message = `Creating ${pathYml}...`
88
+ job.logs[0].push(job.message)
83
89
  await this.createFile(session, websiteId, pathYml, contentYml)
84
90
  } else {
85
91
  jobError(job.jobId, e.message)
@@ -127,12 +127,12 @@ export default function (config: ServerConfig): Router {
127
127
  const fileWithContent = file as ClientSideFileWithContent
128
128
  const fileWithSrc = file as ClientSideFileWithSrc
129
129
  if(!fileWithContent.content && !fileWithSrc.src) throw new PublicationError('Missing content or src in file', 400)
130
- const src = fileWithSrc.src
130
+ const content = fileWithContent.content ?? await storage.readAsset(session, websiteId, fileWithSrc.src)
131
131
  return {
132
132
  // Destination
133
133
  path: file.permalink ?? file.path,
134
134
  // Content
135
- content: fileWithContent.content ?? await storage.readAsset(session, websiteId, fileWithSrc.src),
135
+ content,
136
136
  }
137
137
  }))
138
138