@gesslar/muddy 0.3.0 → 0.4.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Muddy.js +25 -1
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "gesslar",
6
6
  "url": "https://gesslar.dev"
7
7
  },
8
- "version": "0.3.0",
8
+ "version": "0.4.0",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/gesslar/muddy.git"
package/src/Muddy.js CHANGED
@@ -128,12 +128,28 @@ export default class Muddy {
128
128
  const mfile = await mfileObject.loadData()
129
129
 
130
130
  glog.table(mfile)
131
+
131
132
  if(mfile.outputFile === true)
132
133
  glog.info(
133
134
  c`Will write {other}.output{/} file at root of project with json `+
134
135
  `object containing package name and file location at build end.`
135
136
  )
136
137
 
138
+ mfile.description = mfile.description ?? ""
139
+
140
+ if(!mfile.description) {
141
+ const readme = projectDirectory.getFile("README.md")
142
+
143
+ if(await readme.exists) {
144
+ const content = await readme.read()
145
+ mfile.description = append(content, "\n")
146
+
147
+ glog.info(`No description in 'mfile', will use content from existing README.md`)
148
+ } else {
149
+ glog.info(`No description in 'mfile' and no README.md`)
150
+ }
151
+ }
152
+
137
153
  return Object.assign(ctx, {mfile})
138
154
  }
139
155
 
@@ -632,7 +648,7 @@ export default class Muddy {
632
648
  * @returns {Promise<GeneratedContext>} The context object
633
649
  */
634
650
  #closeTheBarnDoor = async ctx => {
635
- const {mfile, projectDirectory, workDirectory} = ctx
651
+ const {mfile, projectDirectory, workDirectory, xmlFile} = ctx
636
652
 
637
653
  const mpackage = new AdmZip()
638
654
 
@@ -652,6 +668,14 @@ export default class Muddy {
652
668
 
653
669
  glog.info(c`{<B}${mpackageFile.path}{B>} written to disk (${size.toLocaleString()} bytes)`)
654
670
 
671
+ const destXmlFile = buildDirectory.getFile(xmlFile.name)
672
+ if(await destXmlFile.exists)
673
+ await destXmlFile.delete()
674
+
675
+ await xmlFile.copy(destXmlFile.path)
676
+ const xmlSize = await xmlFile.size()
677
+ glog.info(c`{<B}${destXmlFile.path}{B>} written to disk (${xmlSize.toLocaleString()} bytes)`)
678
+
655
679
  return Object.assign(ctx, {mpackageFile})
656
680
  }
657
681