Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a test to check for the current year in the license and source… #384

Merged
merged 2 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/primer-core/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/primer-css/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/primer-marketing/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/primer-product/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion script/test-docs
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions tests/test-for-current-year.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const test = require("ava")
const fs = require("fs-extra")
const globby = require("globby")

const year = (new Date()).getFullYear()
const yearRegex = new RegExp(`Copyright \\(c\\) ${year} GitHub Inc\\.`)

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, yearRegex, `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, yearRegex, `The source's header "${path}" does not include the current year ${year}`)
} else {
return t.true(true)
}
})
})
})
2 changes: 1 addition & 1 deletion tools/generator-primer-module/app/templates/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/stylelint-config-primer/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/stylelint-selector-no-utility/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down