create-tateru-cli 0.2.0 → 0.3.0

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 (22) hide show
  1. package/README.md +5 -0
  2. package/lib/index.js +21 -3
  3. package/package.json +3 -2
  4. package/templates/template-gulp-vanilla/.vscode/settings.json +3 -0
  5. package/templates/template-gulp-vanilla/_gitignore +3 -0
  6. package/templates/template-gulp-vanilla/package-lock.json +27 -1
  7. package/templates/template-gulp-vanilla/package.json +1 -1
  8. package/templates/template-gulp-vanilla/public/assets/favicon/apple-touch-icon.png +0 -0
  9. package/templates/template-gulp-vanilla/public/assets/favicon/favicon-96x96.png +0 -0
  10. package/templates/template-gulp-vanilla/public/assets/favicon/favicon.ico +0 -0
  11. package/templates/template-gulp-vanilla/public/assets/favicon/favicon.svg +9 -0
  12. package/templates/template-gulp-vanilla/public/assets/favicon/web-app-manifest-192x192.png +0 -0
  13. package/templates/template-gulp-vanilla/public/assets/favicon/web-app-manifest-512x512.png +0 -0
  14. package/templates/template-gulp-vanilla/src/assets/images/share/homepage.png +0 -0
  15. package/templates/template-gulp-vanilla/src/twig/layouts/layout.html.twig +4 -4
  16. package/templates/template-gulp-vanilla/src/twig/views/site.webmanifest.twig +2 -2
  17. package/templates/template-gulp-vanilla/tasks/tateru.js +18 -21
  18. package/templates/template-gulp-vanilla/tateru.config.json +5 -3
  19. package/templates/template-gulp-vanilla/public/assets/favicon/android-chrome-192x192.png +0 -0
  20. package/templates/template-gulp-vanilla/public/assets/favicon/android-chrome-512x512.png +0 -0
  21. package/templates/template-gulp-vanilla/public/assets/favicon/favicon-16x16.png +0 -0
  22. package/templates/template-gulp-vanilla/public/assets/favicon/favicon-32x32.png +0 -0
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Create Tateru CLI project
2
2
 
3
+ [![NPM Version](https://img.shields.io/npm/v/create-tateru-cli)](https://www.npmjs.com/package/create-tateru-cli)
4
+ [![GitHub Release](https://img.shields.io/github/v/release/danielsitek/tateru-create-tateru-cli)](https://github.com/danielsitek/tateru-create-tateru-cli/releases)
5
+ [![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b3efe68fa4d4b69b2bd00c9436954cb)](https://app.codacy.com/gh/danielsitek/tateru-create-tateru-cli/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
6
+
3
7
  Simplest way to create a new project using [tateru-cli](https://github.com/danielsitek/tateru-cli).
4
8
 
5
9
  ## Usage
@@ -28,3 +32,4 @@ Currently supported templates include:
28
32
 
29
33
  - If the destination directory is not empty, the script will exit with an error.
30
34
  - Ensure the template name is valid; otherwise, the script will notify you.
35
+ - Templates should use `_gitignore` instead of `.gitignore`. The script will automatically rename `_gitignore` to `.gitignore` during the copy process.
package/lib/index.js CHANGED
@@ -16,8 +16,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  const node_path_1 = __importDefault(require("node:path"));
17
17
  const promises_1 = require("node:fs/promises");
18
18
  const node_fs_1 = require("node:fs");
19
- const cli_1 = require("./cli/cli");
20
19
  const promises_2 = __importDefault(require("node:readline/promises"));
20
+ const cli_1 = require("./cli/cli");
21
+ const renameFiles = {
22
+ _gitignore: '.gitignore',
23
+ };
21
24
  const getTemplatePath = (template) => {
22
25
  return node_path_1.default.resolve(__dirname, '..', 'templates', `template-${template}`);
23
26
  };
@@ -51,9 +54,24 @@ const ensureDirectoryEmpty = (directory) => __awaiter(void 0, void 0, void 0, fu
51
54
  yield (0, promises_1.mkdir)(directory, { recursive: true });
52
55
  }
53
56
  });
57
+ const copyTemplateFiltered = (src, dest) => __awaiter(void 0, void 0, void 0, function* () {
58
+ const stats = yield (0, promises_1.stat)(src);
59
+ if (stats.isDirectory()) {
60
+ yield (0, promises_1.mkdir)(dest, { recursive: true });
61
+ const entries = yield (0, promises_1.readdir)(src);
62
+ for (const entry of entries) {
63
+ const srcPath = node_path_1.default.join(src, entry);
64
+ const destPath = node_path_1.default.join(dest, renameFiles[entry] || entry);
65
+ yield copyTemplateFiltered(srcPath, destPath);
66
+ }
67
+ }
68
+ else {
69
+ yield (0, promises_1.copyFile)(src, dest);
70
+ }
71
+ });
54
72
  const copyTemplate = (templatePath, destinationPath) => __awaiter(void 0, void 0, void 0, function* () {
55
73
  try {
56
- yield (0, promises_1.cp)(templatePath, destinationPath, { recursive: true });
74
+ yield copyTemplateFiltered(templatePath, destinationPath);
57
75
  }
58
76
  catch (error) {
59
77
  throw new Error([
@@ -73,7 +91,7 @@ Done. Template successfully copied. Now run:
73
91
 
74
92
  cd ${directory}
75
93
  npm install
76
- npm start
94
+ npm run dev
77
95
  `;
78
96
  };
79
97
  const init = () => __awaiter(void 0, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-tateru-cli",
3
3
  "description": "Create basic Tateru CLI project from template files",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "bin": {
6
6
  "create-tateru-cli": "./lib/index.js"
7
7
  },
@@ -13,8 +13,9 @@
13
13
  "scripts": {
14
14
  "build": "tsc",
15
15
  "clean": "rm -rf lib",
16
+ "clean:templates": "rm -rf templates/**/node_modules && rm -rf templates/**/dist",
16
17
  "typecheck": "tsc --noEmit",
17
- "prepack": "npm run clean && npm run build"
18
+ "prepack": "npm run clean && npm run clean:templates && npm run build"
18
19
  },
19
20
  "keywords": [
20
21
  "tateru-cli",
@@ -0,0 +1,3 @@
1
+ {
2
+ "cSpell.words": ["tateru"]
3
+ }
@@ -0,0 +1,3 @@
1
+ node_modules
2
+
3
+ dist/
@@ -23,9 +23,9 @@
23
23
  "gulp": "^5.0.0",
24
24
  "gulp-postcss": "^10.0.0",
25
25
  "gulp-rename": "^2.0.0",
26
+ "gulp-tateru-cli": "^0.1.0",
26
27
  "postcss": "^8.5.3",
27
28
  "postcss-import": "^16.1.0",
28
- "tateru-cli": "^1.5.0",
29
29
  "webpack": "^5.98.0"
30
30
  },
31
31
  "engines": {
@@ -4774,6 +4774,22 @@
4774
4774
  "node": ">=4"
4775
4775
  }
4776
4776
  },
4777
+ "node_modules/gulp-tateru-cli": {
4778
+ "version": "0.1.0",
4779
+ "resolved": "https://registry.npmjs.org/gulp-tateru-cli/-/gulp-tateru-cli-0.1.0.tgz",
4780
+ "integrity": "sha512-Sxas8LrMChMjMReM1k9W7l37TuzdqVCqbjFdCpAZ7SbDVi6IOUFhlUv8uRfFmwU/1tTN+Khf8uqCG+22tbKQEA==",
4781
+ "dev": true,
4782
+ "license": "MIT",
4783
+ "dependencies": {
4784
+ "plugin-error": "^2.0.1",
4785
+ "tateru-cli": "^1.5.0",
4786
+ "through2": "^4.0.2",
4787
+ "vinyl": "^3.0.0"
4788
+ },
4789
+ "engines": {
4790
+ "node": ">=14"
4791
+ }
4792
+ },
4777
4793
  "node_modules/gulplog": {
4778
4794
  "version": "2.2.0",
4779
4795
  "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-2.2.0.tgz",
@@ -7873,6 +7889,16 @@
7873
7889
  "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
7874
7890
  "dev": true
7875
7891
  },
7892
+ "node_modules/through2": {
7893
+ "version": "4.0.2",
7894
+ "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
7895
+ "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==",
7896
+ "dev": true,
7897
+ "license": "MIT",
7898
+ "dependencies": {
7899
+ "readable-stream": "3"
7900
+ }
7901
+ },
7876
7902
  "node_modules/to-regex-range": {
7877
7903
  "version": "5.0.1",
7878
7904
  "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -26,9 +26,9 @@
26
26
  "gulp": "^5.0.0",
27
27
  "gulp-postcss": "^10.0.0",
28
28
  "gulp-rename": "^2.0.0",
29
+ "gulp-tateru-cli": "^0.1.0",
29
30
  "postcss": "^8.5.3",
30
31
  "postcss-import": "^16.1.0",
31
- "tateru-cli": "^1.5.0",
32
32
  "webpack": "^5.98.0"
33
33
  },
34
34
  "private": true,
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 512 512">
2
+ <mask id="a" width="512" height="512" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha">
3
+ <rect width="512" height="512" fill="#fff" rx="100"/>
4
+ </mask>
5
+ <g mask="url(#a)">
6
+ <path fill="#fff" d="M0 0h512v512H0z"/>
7
+ <path fill="#3C36EA" d="M414 213h-55l-21 87h53l-14 59h-54l-23 89h-60l22-89h-64l-22 89h-60l22-89H86l14-59h53l22-87h-54l14-59h55l22-90h60l-23 90h65l23-90h60l-23 90h54l-14 59Zm-137 87 22-87h-64l-22 87h64Z"/>
8
+ </g>
9
+ </svg>
@@ -121,10 +121,10 @@
121
121
  {%- endif -%}
122
122
  {###############################################}
123
123
 
124
- <link rel="apple-touch-icon" sizes="180x180" href="{{- app.root -}}assets/favicon/apple-touch-icon.png{{- version_suffix -}}">
125
- <link rel="icon" type="image/png" href="{{- app.root -}}assets/favicon/favicon-32x32.png{{- version_suffix -}}" sizes="32x32">
126
- <link rel="icon" type="image/png" href="{{- app.root -}}assets/favicon/favicon-16x16.png{{- version_suffix -}}" sizes="16x16">
127
- <link rel="shortcut icon" href="{{- app.root -}}assets/favicon/favicon.ico{{- version_suffix -}}">
124
+ <link rel="apple-touch-icon" sizes="180x180" href="{{- app.root -}}assets/favicon/apple-touch-icon.png{{- version_suffix -}}" />
125
+ <link rel="icon" type="image/png" href="{{- app.root -}}assets/favicon/favicon-96x96.png{{- version_suffix -}}" sizes="96x96" />
126
+ <link rel="icon" type="image/svg+xml" href="{{- app.root -}}assets/favicon/favicon.svg{{- version_suffix -}}" />
127
+ <link rel="shortcut icon" href="{{- app.root -}}assets/favicon/favicon.ico{{- version_suffix -}}" />
128
128
  <link rel="manifest" href="{{- app.root -}}site.webmanifest{{- version_suffix -}}" crossorigin="use-credentials">
129
129
  <meta name="theme-color" content="#ffffff">
130
130
 
@@ -4,12 +4,12 @@
4
4
  "description": "{{- description -}}",
5
5
  "icons": [
6
6
  {
7
- "src": "{{- app.root -}}assets/favicon/android-chrome-192x192.png",
7
+ "src": "{{- app.root -}}assets/favicon/web-app-manifest-192x192.png",
8
8
  "sizes": "192x192",
9
9
  "type": "image/png"
10
10
  },
11
11
  {
12
- "src": "{{- app.root -}}assets/favicon/android-chrome-512x512.png",
12
+ "src": "{{- app.root -}}assets/favicon/web-app-manifest-512x512.png",
13
13
  "sizes": "512x512",
14
14
  "type": "image/png"
15
15
  }
@@ -1,25 +1,22 @@
1
- const { exec } = require('child_process');
2
- const Logger = require('./helpers/logger');
1
+ const { src, dest } = require('gulp');
2
+ const { gulpTateruCli } = require('gulp-tateru-cli');
3
+ const { ENV_PRODUCTION } = require('./helpers/config');
3
4
 
4
- const log = new Logger({
5
- namespace: 'tateru',
6
- });
5
+ const TATERU_ENV_PRODUCTION = 'prod';
6
+ const TATERU_ENV_DEVELOPMENT = 'dev';
7
7
 
8
- module.exports = function tateru(cb) {
9
- return new Promise((resolve) => {
10
- exec('npm run tateru', function (error, stdout, stderr) {
11
-
12
- if (error && stdout) {
13
- log.error(stdout);
14
- } else if (stdout) {
15
- log.info(stdout);
16
- }
17
-
18
- if (stderr) {
19
- log.error(stderr);
20
- }
8
+ /** @type {import('gulp-tateru-cli').GulpTateruCliOptions} */
9
+ const options = {
10
+ env:
11
+ process.env.NODE_ENV === ENV_PRODUCTION
12
+ ? TATERU_ENV_PRODUCTION
13
+ : TATERU_ENV_DEVELOPMENT,
14
+ };
21
15
 
22
- resolve(cb);
23
- })
16
+ module.exports = function tateru() {
17
+ return src(['tateru.config.json'], {
18
+ cwd: '.',
24
19
  })
25
- }
20
+ .pipe(gulpTateruCli(options))
21
+ .pipe(dest('dist'));
22
+ };
@@ -60,7 +60,7 @@
60
60
  "full_locale": "cs_CZ"
61
61
  },
62
62
  "src": "src/twig",
63
- "ext": "dist"
63
+ "ext": ""
64
64
  },
65
65
  "translations": {
66
66
  "cs": {
@@ -76,7 +76,9 @@
76
76
  },
77
77
  "src": "views/homepage.html.twig",
78
78
  "ext": "index.html",
79
- "minify": ["prod"]
79
+ "minify": [
80
+ "prod"
81
+ ]
80
82
  },
81
83
  "humans_txt": {
82
84
  "data": {
@@ -108,4 +110,4 @@
108
110
  }
109
111
  }
110
112
  }
111
- }
113
+ }