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

feature(license): current year for license #312

Closed
wants to merge 3 commits into from
Closed
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,4 +1,4 @@
Copyright 2017 --username-- <--usermail-->
Copyright --year-- --username-- <--usermail-->

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
24 changes: 12 additions & 12 deletions tools/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function libraryNameSuggestedAccept() {
/**
* The library name is suggested by looking at the directory name of the
* tools parent directory and converting it to kebab-case
*
*
* The regex for this looks for any non-word or non-digit character, or
* an underscore (as it's a word character), and replaces it with a dash.
* Any leading or trailing dashes are then removed, before the string is
Expand Down Expand Up @@ -160,7 +160,7 @@ function libraryNameSuggestedIsDefault() {

/**
* Calls all of the functions needed to setup the library
*
*
* @param libraryName
*/
function setupLibrary(libraryName: string) {
Expand All @@ -176,7 +176,7 @@ function setupLibrary(libraryName: string) {

removeItems()

modifyContents(libraryName, username, usermail)
modifyContents(libraryName, new Date().getUTCFullYear().toString(), username, usermail)

renameItems(libraryName)

Expand All @@ -202,20 +202,20 @@ function removeItems() {

/**
* Updates the contents of the template files with the library name or user details
*
* @param libraryName
* @param username
* @param usermail
*
* @param libraryName
* @param username
* @param usermail
*/
function modifyContents(libraryName: string, username: string, usermail: string) {
function modifyContents(libraryName: string, year: string, username: string, usermail: string) {
console.log(colors.underline.white("Modified"))

let files = modifyFiles.map(f => path.resolve(__dirname, "..", f))
try {
const changes = replace.sync({
files,
from: [/--libraryname--/g, /--username--/g, /--usermail--/g],
to: [libraryName, username, usermail]
from: [/--libraryname--/g, /--year--/g, /--username--/g, /--usermail--/g],
to: [libraryName, year, username, usermail]
})
console.log(colors.yellow(modifyFiles.join("\n")))
} catch (error) {
Expand All @@ -227,8 +227,8 @@ function modifyContents(libraryName: string, username: string, usermail: string)

/**
* Renames any template files to the new library name
*
* @param libraryName
*
* @param libraryName
*/
function renameItems(libraryName: string) {
console.log(colors.underline.white("Renamed"))
Expand Down