Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit f46d0b5

Browse files
committed
Update year in template automatically
1 parent 44722ce commit f46d0b5

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

src/init.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class Init extends Command
132132
contents = fs.readFileSync(templateChildPath).toString()
133133
contents = @replacePackageNamePlaceholders(contents, packageName)
134134
contents = @replacePackageAuthorPlaceholders(contents, packageAuthor)
135+
contents = @replaceCurrentYearPlaceholders(contents)
135136
fs.writeFileSync(sourcePath, contents)
136137

137138
replacePackageAuthorPlaceholders: (string, packageAuthor) ->
@@ -152,6 +153,9 @@ class Init extends Command
152153
else if underscore
153154
@underscore(packageName)
154155

156+
replaceCurrentYearPlaceholders: (string) ->
157+
string.replace '__current_year__', new Date().getFullYear()
158+
155159
getTemplatePath: (argv, templateType) ->
156160
if argv.template?
157161
path.resolve(argv.template)

templates/language/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 <Your name here>
1+
Copyright (c) __current_year__ <Your name here>
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

templates/package-coffeescript/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 <Your name here>
1+
Copyright (c) __current_year__ <Your name here>
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

templates/package-javascript/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 <Your name here>
1+
Copyright (c) __current_year__ <Your name here>
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

templates/theme/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 <Your name here>
1+
Copyright (c) __current_year__ <Your name here>
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

0 commit comments

Comments
 (0)