@airfleet/generator-init 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +2 -0
  2. package/generators/block/templates/barebones.blade.php.ejs +1 -1
  3. package/generators/block/templates/building-block.blade.php.ejs +1 -1
  4. package/generators/block/templates/building-repeater-block.blade.php.ejs +1 -1
  5. package/generators/npm/index.js +116 -0
  6. package/generators/npm/templates/.airfleet-release +1 -0
  7. package/generators/npm/templates/.editorconfig +18 -0
  8. package/generators/npm/templates/.gitattributes +11 -0
  9. package/generators/npm/templates/.gitlab-ci.yml +8 -0
  10. package/generators/npm/templates/CHANGELOG.md +10 -0
  11. package/generators/npm/templates/LICENSE.ejs +2 -0
  12. package/generators/npm/templates/README.md.ejs +20 -0
  13. package/generators/npm/templates/gitignore +3 -0
  14. package/generators/npm/templates/package.json.ejs +27 -0
  15. package/generators/plugin/index.js +148 -0
  16. package/generators/plugin/templates/.airfleet-release +1 -0
  17. package/generators/plugin/templates/.editorconfig +18 -0
  18. package/generators/plugin/templates/.gitattributes +11 -0
  19. package/generators/plugin/templates/.gitlab-ci.yml +8 -0
  20. package/generators/plugin/templates/CHANGELOG.md +10 -0
  21. package/generators/plugin/templates/LICENSE.ejs +2 -0
  22. package/generators/plugin/templates/README.md.ejs +20 -0
  23. package/generators/plugin/templates/composer.json.ejs +19 -0
  24. package/generators/plugin/templates/gitignore +4 -0
  25. package/generators/plugin/templates/index.php +1 -0
  26. package/generators/plugin/templates/package.json.ejs +27 -0
  27. package/generators/plugin/templates/plugin-name.php.ejs +44 -0
  28. package/generators/plugin/templates/src/Plugin.php.ejs +45 -0
  29. package/package.json +1 -5
  30. package/utils/mapFilesToTemplates.js +13 -0
  31. package/utils/nameCases.js +6 -1
package/README.md CHANGED
@@ -22,6 +22,8 @@ npm install -g @airfleet/generator-init
22
22
  | --------- | ------------------------------------- | ----------------------------------------- |
23
23
  | Block | `yo @airfleet/init:block --force` | Create a block for the Airfleet Theme |
24
24
  | Component | `yo @airfleet/init:component --force` | Create a component for the Airfleet Theme |
25
+ | npm | `yo @airfleet/init:npm` | Generate an npm package for publishing |
26
+ | Plugin | `yo @airfleet/init:plugin` | Create a WP plugin |
25
27
 
26
28
  ## Documentation
27
29
 
@@ -1,7 +1,7 @@
1
1
  {{--
2
2
  Title: <%= name.title %>
3
3
  Description: <%= answers.blockDescription %>
4
- Keywords: <%= name.noCase %>
4
+ Keywords: airfleet <%= name.noCase %>
5
5
  --}}
6
6
  @block([ 'block' => $block ])
7
7
 
@@ -1,7 +1,7 @@
1
1
  {{--
2
2
  Title: <%= name.title %>
3
3
  Description: <%= answers.blockDescription %>
4
- Keywords: <%= name.noCase %>
4
+ Keywords: airfleet <%= name.noCase %>
5
5
  --}}
6
6
  @block([ 'block' => $block ])
7
7
  @background( $background )
@@ -1,7 +1,7 @@
1
1
  {{--
2
2
  Title: <%= name.title %>
3
3
  Description: <%= answers.blockDescription %>
4
- Keywords: <%= name.noCase %>
4
+ Keywords: airfleet <%= name.noCase %>
5
5
  --}}
6
6
  @block([ 'block' => $block ])
7
7
  @background( $background )
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ import Generator from "yeoman-generator";
3
+
4
+ import nameCases from "../../utils/nameCases.js";
5
+ import copyTemplates from "../../utils/copyTemplates.js";
6
+ import mapFilesToTemplates from "../../utils/mapFilesToTemplates.js";
7
+ import requiredText from "../../utils/validation/requiredText.js";
8
+ import title from "../../utils/log/title.js";
9
+ import highlightText from "../../utils/log/text/highlightText.js";
10
+ import lines from "../../utils/log/text/lines.js";
11
+ import brandText from "../../utils/log/text/brandText.js";
12
+ import dangerText from "../../utils/log/text/dangerText.js";
13
+ import infoBox from "../../utils/log/boxes/infoBox.js";
14
+
15
+ export default class extends Generator {
16
+ async prompting() {
17
+ this.log(
18
+ lines([
19
+ title(`Let's generate an ${highlightText("npm package")}!`),
20
+ infoBox(
21
+ lines([
22
+ "This will create an npm package that will be",
23
+ `published to npm under the ${brandText("airfleet")} scope`,
24
+ "as soon as the changes are pushed to the main",
25
+ "branch.",
26
+ "",
27
+ dangerText("Make sure to add a feature in code and update"),
28
+ dangerText("change log before merging to main branch!"),
29
+ "",
30
+ "Before starting you should have:",
31
+ " - Created a repository",
32
+ " - Created the Notion page (can start empty)",
33
+ "",
34
+ "All the files will be created in the current",
35
+ "folder. Make sure to navigate to repo folder",
36
+ "first.",
37
+ ])
38
+ ),
39
+ "",
40
+ ])
41
+ );
42
+
43
+ const prompts = [
44
+ {
45
+ type: "input",
46
+ name: "npmName",
47
+ message: "What is the name of the npm package? (will be prescoped with \"@airfleet\")",
48
+ validate: requiredText("Please enter a name"),
49
+ },
50
+ {
51
+ type: "input",
52
+ name: "npmTitle",
53
+ message: "What is the title of the npm package?",
54
+ validate: requiredText("Please enter a title"),
55
+ },
56
+ {
57
+ type: "input",
58
+ name: "npmDescription",
59
+ message: "How would you describe the npm package?",
60
+ validate: requiredText("Please enter a description"),
61
+ },
62
+ {
63
+ type: "input",
64
+ name: "npmRepository",
65
+ message: "What's the repository URL? (start with https and end with .git)",
66
+ validate: requiredText("Please enter the repository URL"),
67
+ },
68
+ {
69
+ type: "input",
70
+ name: "npmDocumentationUrl",
71
+ message: "What's the documentation URL? (Notion page)",
72
+ validate: requiredText("Please enter the documentation URL"),
73
+ },
74
+ {
75
+ type: "input",
76
+ name: "npmNodeVersion",
77
+ message: "What's the required Node version?",
78
+ validate: requiredText("Please enter the Node version"),
79
+ default: ">=14",
80
+ },
81
+ ];
82
+
83
+ this.answers = await this.prompt(prompts);
84
+ this.name = nameCases(this.answers.npmName);
85
+ this.data = {
86
+ answers: this.answers,
87
+ name: this.name,
88
+ packageName: `@airfleet/${this.name.slug}`,
89
+ repositoryBase: this.answers.npmRepository.replace(/\.git$/, ""),
90
+ year: new Date().getFullYear(),
91
+ };
92
+ }
93
+
94
+ writing() {
95
+ const files = [
96
+ ".airfleet-release",
97
+ ".editorconfig",
98
+ ".gitattributes",
99
+ ".gitlab-ci.yml",
100
+ "CHANGELOG.md",
101
+ "LICENSE.ejs",
102
+ "package.json.ejs",
103
+ "README.md.ejs",
104
+ ];
105
+ const templates = [
106
+ ...mapFilesToTemplates(files),
107
+ {
108
+ template: "gitignore",
109
+ destination: `.gitignore`,
110
+ isEnabled: true,
111
+ },
112
+ ];
113
+
114
+ copyTemplates(this, templates, this.data);
115
+ }
116
+ }
@@ -0,0 +1 @@
1
+ minor
@@ -0,0 +1,18 @@
1
+ # editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ indent_style = space
9
+ indent_size = 2
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
12
+
13
+ [*.md]
14
+ trim_trailing_whitespace = false
15
+
16
+ [*.php]
17
+ indent_style = tab
18
+ indent_size = 4
@@ -0,0 +1,11 @@
1
+ *.js eol=lf
2
+ *.jsx eol=lf
3
+ *.ts eol=lf
4
+ *.tsx eol=lf
5
+ *.json eol=lf
6
+ *.md eol=lf
7
+ *.yml eol=lf
8
+ *.yaml eol=lf
9
+ *.css eol=lf
10
+ *.scss eol=lf
11
+ *.php eol=lf
@@ -0,0 +1,8 @@
1
+ stages:
2
+ - release
3
+
4
+ include:
5
+ # Release process
6
+ - project: 'codersclan/tools/gitlab-ci-templates'
7
+ ref: main
8
+ file: '/release/npm.yaml'
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
@@ -0,0 +1,2 @@
1
+ Copyright (c) <%= year %> Airfleet <dev@airfleet.co> (https://www.airfleet.co/)
2
+ All rights reserved.
@@ -0,0 +1,20 @@
1
+ # <%= answers.npmTitle %>
2
+
3
+ ![npm](https://img.shields.io/npm/v/<%= packageName %>)
4
+ [![pipeline status](<%= repositoryBase %>/badges/main/pipeline.svg)](<%= repositoryBase %>/-/commits/main)
5
+
6
+ <%= answers.npmDescription %>
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install --save-dev <%= packageName %>
12
+ ```
13
+
14
+ ## Documentation
15
+
16
+ - [Documentation](<%= answers.npmDocumentationUrl %>).
17
+
18
+ ## License
19
+
20
+ © [Airfleet](https://www.airfleet.co/)
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ coverage
3
+ .npmrc
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "<%= packageName %>",
3
+ "description": "<%= answers.npmDescription %>",
4
+ "version": "0.0.0",
5
+ "scripts": {},
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "keywords": [
10
+ "airfleet"
11
+ ],
12
+ "homepage": "https://www.airfleet.co",
13
+ "author": {
14
+ "name": "Airfleet",
15
+ "email": "dev@airfleet.co",
16
+ "url": "https://www.airfleet.co/"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "<%= answers.npmRepository %>"
21
+ },
22
+ "type": "module",
23
+ "engines": {
24
+ "node": "<%- answers.npmNodeVersion %>"
25
+ },
26
+ "dependencies": {}
27
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ import Generator from "yeoman-generator";
3
+
4
+ import nameCases from "../../utils/nameCases.js";
5
+ import copyTemplates from "../../utils/copyTemplates.js";
6
+ import mapFilesToTemplates from "../../utils/mapFilesToTemplates.js";
7
+ import requiredText from "../../utils/validation/requiredText.js";
8
+ import title from "../../utils/log/title.js";
9
+ import highlightText from "../../utils/log/text/highlightText.js";
10
+ import lines from "../../utils/log/text/lines.js";
11
+ import brandText from "../../utils/log/text/brandText.js";
12
+ import dangerText from "../../utils/log/text/dangerText.js";
13
+ import infoBox from "../../utils/log/boxes/infoBox.js";
14
+
15
+ export default class extends Generator {
16
+ async prompting() {
17
+ this.log(
18
+ lines([
19
+ title(`Let's generate a ${highlightText("WordPress plugin")}!`),
20
+ infoBox(
21
+ lines([
22
+ "This will create the files for a WP plugin.",
23
+ "",
24
+ "Before starting you should have:",
25
+ " - Created a repository",
26
+ " - Created the Notion page (can start empty)",
27
+ "",
28
+ "All the files will be created in the current",
29
+ "folder. Make sure to navigate to repo folder",
30
+ "first.",
31
+ ])
32
+ ),
33
+ "",
34
+ ])
35
+ );
36
+
37
+ const prompts = [
38
+ {
39
+ type: "input",
40
+ name: "pluginName",
41
+ message: 'What is the name of the plugin? (start with "Airfleet")',
42
+ validate: requiredText("Please enter a name"),
43
+ },
44
+ {
45
+ type: "input",
46
+ name: "pluginDescription",
47
+ message: "How would you describe the plugin?",
48
+ validate: requiredText("Please enter a description"),
49
+ },
50
+ {
51
+ type: "input",
52
+ name: "pluginRepository",
53
+ message:
54
+ "What's the repository URL? (start with https and end with .git)",
55
+ validate: requiredText("Please enter the repository URL"),
56
+ },
57
+ {
58
+ type: "input",
59
+ name: "pluginDocumentationUrl",
60
+ message: "What's the documentation URL? (Notion page)",
61
+ validate: requiredText("Please enter the documentation URL"),
62
+ },
63
+ {
64
+ type: "confirm",
65
+ name: "pluginCreateOptions",
66
+ message: "Create theme options page?",
67
+ default: true,
68
+ },
69
+ {
70
+ type: "input",
71
+ name: "pluginVersion",
72
+ message: "What's the starting version for the plugin?",
73
+ validate: requiredText("Please enter the starting version"),
74
+ default: "0.0.0",
75
+ },
76
+ {
77
+ type: "input",
78
+ name: "pluginPhpVersion",
79
+ message: "What's the required PHP version?",
80
+ validate: requiredText("Please enter the PHP version"),
81
+ default: ">=7.4",
82
+ },
83
+ {
84
+ type: "input",
85
+ name: "pluginNodeVersion",
86
+ message: "What's the required Node version?",
87
+ validate: requiredText("Please enter the Node version"),
88
+ default: ">=14",
89
+ },
90
+ ];
91
+
92
+ this.answers = await this.prompt(prompts);
93
+ this.name = nameCases(this.answers.pluginName);
94
+
95
+ const nameNoAirfleet = this.answers.pluginName
96
+ .replace(/^airfleet/i, "")
97
+ .trim();
98
+ this.nameNoAirfleet = nameCases(nameNoAirfleet);
99
+ this.data = {
100
+ answers: this.answers,
101
+ name: this.name,
102
+ nameNoAirfleet: this.nameNoAirfleet,
103
+ repositoryBase: this.answers.pluginRepository.replace(/\.git$/, ""),
104
+ packageName: `@airfleet/${this.nameNoAirfleet.slug}-wp-plugin`,
105
+ mainBranch: "main",
106
+ year: new Date().getFullYear(),
107
+ };
108
+ }
109
+
110
+ writing() {
111
+ const files = [
112
+ ".airfleet-release",
113
+ ".editorconfig",
114
+ ".gitattributes",
115
+ ".gitlab-ci.yml",
116
+ "CHANGELOG.md",
117
+ "composer.json.ejs",
118
+ "index.php",
119
+ "LICENSE.ejs",
120
+ "package.json.ejs",
121
+ "README.md.ejs",
122
+ ];
123
+ const templates = [
124
+ ...mapFilesToTemplates(files),
125
+ {
126
+ template: "gitignore",
127
+ destination: `.gitignore`,
128
+ isEnabled: true,
129
+ },
130
+ {
131
+ template: "plugin-name.php.ejs",
132
+ destination: `${this.name.slug}.php`,
133
+ isEnabled: true,
134
+ },
135
+ {
136
+ template: "src/Plugin.php.ejs",
137
+ destination: `src/${this.nameNoAirfleet.pascal}.php`,
138
+ isEnabled: true,
139
+ },
140
+ ];
141
+
142
+ copyTemplates(this, templates, this.data);
143
+ }
144
+
145
+ install() {
146
+ this.spawnCommand("composer", ["install"]);
147
+ }
148
+ }
@@ -0,0 +1,18 @@
1
+ # editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ indent_style = space
9
+ indent_size = 2
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
12
+
13
+ [*.md]
14
+ trim_trailing_whitespace = false
15
+
16
+ [*.php]
17
+ indent_style = tab
18
+ indent_size = 4
@@ -0,0 +1,11 @@
1
+ *.js eol=lf
2
+ *.jsx eol=lf
3
+ *.ts eol=lf
4
+ *.tsx eol=lf
5
+ *.json eol=lf
6
+ *.md eol=lf
7
+ *.yml eol=lf
8
+ *.yaml eol=lf
9
+ *.css eol=lf
10
+ *.scss eol=lf
11
+ *.php eol=lf
@@ -0,0 +1,8 @@
1
+ stages:
2
+ - release
3
+
4
+ include:
5
+ # Release process
6
+ - project: 'codersclan/tools/gitlab-ci-templates'
7
+ ref: main
8
+ file: '/release/wp-plugin.yaml'
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
@@ -0,0 +1,2 @@
1
+ Copyright (c) <%= year %> Airfleet <dev@airfleet.co> (https://www.airfleet.co/)
2
+ All rights reserved.
@@ -0,0 +1,20 @@
1
+ # <%= name.title %> WordPress Plugin
2
+
3
+ [![pipeline status](<%= repositoryBase %>/badges/main/pipeline.svg)](<%= repositoryBase %>/-/commits/main)
4
+
5
+ <%= answers.pluginDescription %>
6
+
7
+ ## Getting Started
8
+
9
+ ```bash
10
+ composer install
11
+ npm install
12
+ ```
13
+
14
+ ## Documentation
15
+
16
+ - [Documentation](<%= answers.pluginDocumentationUrl %>).
17
+
18
+ ## License
19
+
20
+ © [Airfleet](https://www.airfleet.co/)
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "airfleet/<%= name.slug %>",
3
+ "type": "wordpress-plugin",
4
+ "authors": [
5
+ {
6
+ "name": "Airfleet",
7
+ "email": "dev@airfleet.co"
8
+ }
9
+ ],
10
+ "require": {
11
+ "php": "<%- answers.pluginPhpVersion %>",
12
+ "composer/installers": "^2.0"
13
+ },
14
+ "autoload": {
15
+ "psr-4": {
16
+ "Airfleet\\Plugins\\": "src/"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ coverage
3
+ .npmrc
4
+ vendor
@@ -0,0 +1 @@
1
+ <?php // Silence is golden
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "<%= packageName %>",
3
+ "description": "<%= answers.pluginDescription %>",
4
+ "version": "<%= answers.pluginVersion %>",
5
+ "scripts": {
6
+ "build": "echo Done"
7
+ },
8
+ "private": true,
9
+ "keywords": [
10
+ "airfleet"
11
+ ],
12
+ "homepage": "https://www.airfleet.co",
13
+ "author": {
14
+ "name": "Airfleet",
15
+ "email": "dev@airfleet.co",
16
+ "url": "https://www.airfleet.co/"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "<%= answers.pluginRepository %>"
21
+ },
22
+ "type": "module",
23
+ "engines": {
24
+ "node": "<%- answers.pluginNodeVersion %>"
25
+ },
26
+ "dependencies": {}
27
+ }
@@ -0,0 +1,44 @@
1
+ <?php
2
+
3
+ /**
4
+ * <%= name.title %>
5
+ *
6
+ * @package Airfleet\Plugins\<%= nameNoAirfleet.pascal %>
7
+ * @version <%= answers.pluginVersion %>
8
+ * @author Airfleet
9
+ * @link https://www.airfleet.co/
10
+ *
11
+ * @wordpress-plugin
12
+ * Plugin Name: <%= name.title %>
13
+ * Plugin URI: <%= answers.pluginDocumentationUrl %>
14
+ * Description: <%= answers.pluginDescription %>
15
+ * Version: <%= answers.pluginVersion %>
16
+ * Author: Airfleet
17
+ * Author URI: https://www.airfleet.co/
18
+ * Text Domain: <%= name.slug %>
19
+ * GitLab Plugin URI: <%= repositoryBase %>
20
+ * Primary Branch: <%= mainBranch %>
21
+ * Release Asset: true
22
+ */
23
+
24
+ // Exit if accessed directly.
25
+ if ( ! defined( 'ABSPATH' ) ) {
26
+ die;
27
+ }
28
+
29
+ // Plugin version.
30
+ define( '<%= name.constant %>_VERSION', '<%= answers.pluginVersion %>' );
31
+
32
+ // Autoload classes.
33
+ require_once __DIR__ . '/vendor/autoload.php';
34
+
35
+ // Initialize plugin.
36
+ $plugin = new \Airfleet\Plugins\<%= nameNoAirfleet.pascal %>();
37
+ $plugin->initialize();
38
+
39
+ /**
40
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41
+ * ! Do not make changes to this file.
42
+ * ! Edit the plugin class in folder src/.
43
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
44
+ */
@@ -0,0 +1,45 @@
1
+ <?php
2
+
3
+ namespace Airfleet\Plugins;
4
+
5
+ class <%= nameNoAirfleet.pascal %>
6
+ {
7
+ /**
8
+ * Setup the plugin.
9
+ *
10
+ * @return void
11
+ */
12
+ public function initialize()
13
+ {
14
+ <%_ if (answers.pluginCreateOptions) { _%>
15
+ add_action( 'acf/init', array( $this,'add_option_pages' ) );
16
+ <%_ } _%>
17
+ }
18
+ <%_ if (answers.pluginCreateOptions) {%>
19
+ /**
20
+ * Add theme options pages.
21
+ *
22
+ * @return void
23
+ */
24
+ public function add_option_pages()
25
+ {
26
+ if ( ! function_exists( 'acf_add_options_page' ) ) {
27
+ return;
28
+ }
29
+ acf_add_options_page(
30
+ array(
31
+ 'page_title' => __( 'Airfleet Theme Settings', 'airfleet' ),
32
+ 'menu_title' => __( 'Airfleet', 'airfleet' ),
33
+ 'menu_slug' => 'airfleet-settings',
34
+ )
35
+ );
36
+ acf_add_options_sub_page(
37
+ array(
38
+ 'page_title' => __( '<%= name.title %> Settings', '<%= name.slug %>' ),
39
+ 'menu_title' => __( '<%= nameNoAirfleet.title %>', '<%= name.slug %>' ),
40
+ 'parent_slug' => 'airfleet-settings',
41
+ )
42
+ );
43
+ }
44
+ <% } _%>
45
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airfleet/generator-init",
3
3
  "description": "A Yeoman generator to scaffold common Airfleet features",
4
- "version": "0.3.0",
4
+ "version": "0.5.1",
5
5
  "scripts": {},
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -38,9 +38,5 @@
38
38
  "title-case": "^3.0.3",
39
39
  "yeoman-generator": "^5.4.2",
40
40
  "yosay": "^2.0.2"
41
- },
42
- "devDependencies": {
43
- "@release-it/keep-a-changelog": "^2.3.0",
44
- "release-it": "^14.11.7"
45
41
  }
46
42
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Take a list of strings and create objects to be passed to `copyTemplates`.
3
+ * Assumes all files/templates will be copied to the same directory.
4
+ *
5
+ * @param {string[]} files Template files.
6
+ */
7
+ export default function mapFilesToTemplates(files) {
8
+ return files.map((file) => ({
9
+ template: file,
10
+ destination: file.replace(/\.ejs$/, ""),
11
+ isEnabled: true,
12
+ }));
13
+ }
@@ -1,4 +1,4 @@
1
- import { camelCase, noCase, paramCase, pascalCase } from "change-case";
1
+ import { camelCase, constantCase, noCase, paramCase, pascalCase } from "change-case";
2
2
  import { titleCase } from "title-case";
3
3
 
4
4
  export default function nameCases(name) {
@@ -20,5 +20,10 @@ export default function nameCases(name) {
20
20
 
21
21
  // "test string"
22
22
  noCase: noCase(name),
23
+
24
+ // "TEST_STRING"
25
+ constant: constantCase(name),
26
+
27
+ // For more utilities see https://github.com/blakeembrey/change-case
23
28
  };
24
29
  }