Skip to content

Commit

Permalink
Test for the redundant license comments in the UMD build inside the v…
Browse files Browse the repository at this point in the history
…erify:umd script
  • Loading branch information
sequba committed Jul 23, 2024
1 parent 59084c3 commit c4be98e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script/check-file.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { resolve } = require('path')
const assert = require('assert')
const fs = require('fs')
const htConfig = require('../ht.config')

const [ /* node bin */ , /* path to this script */ , fileToCheck] = process.argv;
Expand Down Expand Up @@ -29,6 +30,11 @@ try {
assert(valueA1 === 42)
assert(valueB1 === 44)

// Check if the file contains no redundant license comments
const fileContent = fs.readFileSync(resolve(fileToCheck), 'utf8')
const licenseComments = fileContent.match(/@license/g)
assert.equal(licenseComments.length, 2)

console.log(`Bundle check: \u001b[1;37m${fileToCheck}\u001b[0m \u001b[0;32mOK\u001b[0m`)
} catch (ex) {
console.log(`Bundle check: \u001b[1;37m${fileToCheck}\u001b[0m \u001b[0;31mERROR\u001b[0m`)
Expand Down

0 comments on commit c4be98e

Please sign in to comment.