]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
unicorn/prefer-top-level-await
authorXhmikosR <xhmikosr@gmail.com>
Mon, 11 Mar 2024 14:20:04 +0000 (16:20 +0200)
committerXhmikosR <xhmikosr@gmail.com>
Mon, 11 Mar 2024 14:34:07 +0000 (16:34 +0200)
.eslintrc.json
build/build-plugins.mjs
build/change-version.mjs

index 081b456514227f370ef1d06241bf4e4a520696d3..8908fc91c410df4e05181085b812d4595b1589ba 100644 (file)
         "sourceType": "module"
       },
       "rules": {
-        "no-console": "off",
-        "unicorn/prefer-top-level-await": "off"
+        "no-console": "off"
       }
     },
     {
index 252b4b4b0ae535dab53efc879a68e6656477e461..addd59dafb525c27cfacd30d6ef33b9bbbf00764 100644 (file)
@@ -87,19 +87,12 @@ const build = async plugin => {
   console.log(`Built ${plugin.className}`)
 }
 
-(async () => {
-  try {
-    const basename = path.basename(__filename)
-    const timeLabel = `[${basename}] finished`
-
-    console.log('Building individual plugins...')
-    console.time(timeLabel)
-
-    await Promise.all(Object.values(resolvedPlugins).map(plugin => build(plugin)))
-
-    console.timeEnd(timeLabel)
-  } catch (error) {
-    console.error(error)
-    process.exit(1)
-  }
-})()
+const basename = path.basename(__filename)
+const timeLabel = `[${basename}] finished`
+
+console.log('Building individual plugins...')
+console.time(timeLabel)
+
+await Promise.all(Object.values(resolvedPlugins).map(plugin => build(plugin)))
+
+console.timeEnd(timeLabel)
index 30cfcc4561f3bfb110479aa8f367c998019379dc..1b1a597afa2c88a6eafca2614e851758ffc183a2 100644 (file)
@@ -81,33 +81,25 @@ function showUsage(args) {
   process.exit(1)
 }
 
-async function main(args) {
-  let [oldVersion, newVersion] = args
+const args = process.argv.slice(2)
+let [oldVersion, newVersion] = args
 
-  if (!oldVersion || !newVersion) {
-    showUsage(args)
-  }
-
-  // Strip any leading `v` from arguments because
-  // otherwise we will end up with duplicate `v`s
-  [oldVersion, newVersion] = [oldVersion, newVersion].map(arg => {
-    return arg.startsWith('v') ? arg.slice(1) : arg
-  })
-
-  if (oldVersion === newVersion) {
-    showUsage(args)
-  }
+if (!oldVersion || !newVersion) {
+  showUsage(args)
+}
 
-  bumpNpmVersion(newVersion)
+// Strip any leading `v` from arguments because
+// otherwise we will end up with duplicate `v`s
+[oldVersion, newVersion] = [oldVersion, newVersion].map(arg => {
+  return arg.startsWith('v') ? arg.slice(1) : arg
+})
 
-  try {
-    await Promise.all(
-      FILES.map(file => replaceRecursively(file, oldVersion, newVersion))
-    )
-  } catch (error) {
-    console.error(error)
-    process.exit(1)
-  }
+if (oldVersion === newVersion) {
+  showUsage(args)
 }
 
-main(process.argv.slice(2))
+bumpNpmVersion(newVersion)
+
+await Promise.all(
+  FILES.map(file => replaceRecursively(file, oldVersion, newVersion))
+)