mirror of
https://github.com/primer/css.git
synced 2024-12-23 06:01:54 +03:00
Adding a test to check for the current year in the license and source header
This commit is contained in:
parent
07b2ae0503
commit
4df2cf43f8
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 GitHub Inc.
|
||||
Copyright (c) 2017 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Primer-core
|
||||
* http://primercss.io
|
||||
*
|
||||
* Released under MIT license. Copyright 2015 GitHub, Inc.
|
||||
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
|
||||
*/
|
||||
|
||||
// Primer master file
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Primer
|
||||
* http://primercss.io
|
||||
*
|
||||
* Released under MIT license. Copyright 2015 GitHub, Inc.
|
||||
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
|
||||
*/
|
||||
|
||||
// Primer master file
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Primer-marketing
|
||||
* http://primercss.io
|
||||
*
|
||||
* Released under MIT license. Copyright 2015 GitHub, Inc.
|
||||
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
|
||||
*/
|
||||
|
||||
// Primer master file
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Primer-product
|
||||
* http://primercss.io
|
||||
*
|
||||
* Released under MIT license. Copyright 2015 GitHub, Inc.
|
||||
* Released under MIT license. Copyright (c) 2017 GitHub Inc.
|
||||
*/
|
||||
|
||||
// Primer master file
|
||||
|
@ -16,7 +16,8 @@
|
||||
"release": "script/release",
|
||||
"bump": "lerna publish --exact --skip-npm --since \"v$(npm info primer-css version)\"",
|
||||
"new-module": "script/new-module",
|
||||
"test": "lerna run test"
|
||||
"test": "npm run test-all-modules && lerna run test",
|
||||
"test-all-modules": "ava --verbose tests/test-*.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@storybook/addon-options": "^3.2.6",
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-*.js
|
||||
$(dirname $0)/npm-run ava --verbose $(dirname $0)/../tests/modules/test-document-styles.js
|
||||
|
31
tests/test-for-current-year.js
Normal file
31
tests/test-for-current-year.js
Normal file
@ -0,0 +1,31 @@
|
||||
const test = require("ava")
|
||||
const fs = require("fs-extra")
|
||||
const globby = require("globby")
|
||||
|
||||
const year = (new Date()).getFullYear()
|
||||
|
||||
test(`LICENSE files have the current year ${year}`, t => {
|
||||
return globby(["**/LICENSE", "!**/node_modules/**/LICENSE"])
|
||||
.then(paths => {
|
||||
t.plan(paths.length)
|
||||
return paths.map(path => {
|
||||
const license = fs.readFileSync(path, "utf8")
|
||||
return t.regex(license, new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`), `The license "${path}" does not include the current year ${year}`)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test(`Source header copyrights have the current year ${year}`, t => {
|
||||
return globby(["**/*.css", "**/*.scss", "!**/node_modules/**", "!**/build/**"])
|
||||
.then(paths => {
|
||||
t.plan(paths.length)
|
||||
return paths.map(path => {
|
||||
const source = fs.readFileSync(path, "utf8")
|
||||
if (source.match(/Copyright \(c\)/)) {
|
||||
return t.regex(source, new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`), `The source's header "${path}" does not include the current year ${year}`)
|
||||
} else {
|
||||
return t.true(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 GitHub Inc.
|
||||
Copyright (c) 2017 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 GitHub Inc.
|
||||
Copyright (c) 2017 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 GitHub Inc.
|
||||
Copyright (c) 2017 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
Loading…
Reference in New Issue
Block a user