generator-nitro 6.0.2 → 6.0.3

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.
@@ -33,6 +33,7 @@ module.exports = class extends Generator {
33
33
 
34
34
  this._git = {
35
35
  root: false,
36
+ projet: false,
36
37
  }
37
38
 
38
39
  this.option('name', {
@@ -102,17 +103,21 @@ module.exports = class extends Generator {
102
103
  const dest = this.destinationPath();
103
104
  const gitRoot = findGitRoot(dest).replace('.git', '');
104
105
  let gitPath = false;
106
+ let projectPath = false;
105
107
 
106
108
  if (gitRoot) {
107
- const relative = path.relative(dest, gitRoot);
108
- if (relative) {
109
- gitPath = `${relative.replace(/\\/g, '/')}/`;
109
+ const relativeGitRoot = path.relative(dest, gitRoot);
110
+ const relativeProjectRoot = path.relative(gitRoot, dest);
111
+ if (relativeGitRoot) {
112
+ gitPath = `${relativeGitRoot.replace(/\\/g, '/')}/`;
113
+ projectPath = `./${relativeProjectRoot.replace(/\\/g, '/')}`;
110
114
  } else {
111
115
  gitPath = './';
112
116
  }
113
117
  }
114
118
 
115
119
  this._git.root = gitPath;
120
+ this._git.project = projectPath;
116
121
  } catch (e) {
117
122
  this.log(chalk.red(e.message));
118
123
  }
@@ -279,6 +284,7 @@ module.exports = class extends Generator {
279
284
 
280
285
  const tplFiles = [
281
286
  // files to process with copyTpl
287
+ '.husky/pre-commit',
282
288
  'config/default.js',
283
289
  'config/default/exporter.js',
284
290
  'config/default/gulp.js',
@@ -417,6 +423,7 @@ module.exports = class extends Generator {
417
423
  options: this.options,
418
424
  git: {
419
425
  root: this._git.root,
426
+ project: this._git.project,
420
427
  }
421
428
  };
422
429
 
@@ -1,6 +1,7 @@
1
1
  #!/bin/sh
2
2
  . "$(dirname "$0")/_/husky.sh"
3
3
 
4
- # if husky config is not in git root
5
- # cd ./
4
+ # if husky config is not in git root<% if (git.project) { %>
5
+ cd <%= git.project %> || return<% } else { %>
6
+ # cd ./... || return<% } %>
6
7
  npx lint-staged
@@ -20,7 +20,7 @@
20
20
  "nitro:update": "npm uninstall generator-nitro && npm install generator-nitro@latest --save-dev --save-exact && yo nitro",
21
21
  "update-dependencies": "npm-check-updates -u",
22
22
  "\n# MISC ------- ": "",
23
- "postinstall": "<% if (git.root) { %>cd <%= git.root %> && husky install && <% } %><% if (options.themes) { %>npm rebuild node-sass && <% } %>env-linter<% if (git.root) { %> --hooksInstalled<% } %> --saveExact --dependenciesExactVersion --lts",
23
+ "postinstall": "<% if (git.root) { %>cd <%= git.root %> && husky install <% if (git.project) { %><%= git.project %>/.husky <% } %>&& <% } %><% if (options.themes) { %>npm rebuild node-sass && <% } %>env-linter<% if (git.root) { %> --hooksInstalled<% } %> --saveExact --dependenciesExactVersion --lts",
24
24
  "\n# LINT/TEST ------- ": "",
25
25
  "check-node-version": "check-node-version --print --package",
26
26
  "cypress-test": "npm run build && cross-env PORT=8888 NITRO_MODE=test npm-run-all --parallel --race test:cypress:serve cypress-test:open",
@@ -130,7 +130,7 @@
130
130
  "npm-check-updates": "12.0.2",
131
131
  "npm-run-all": "4.1.5",
132
132
  "opener": "1.5.2",
133
- "prettier": "2.4.1",
133
+ "prettier": "2.5.0",
134
134
  "rimraf": "3.0.2",
135
135
  "stylelint": "13.13.1",<% if (options.jsCompiler === 'ts') { %>
136
136
  "typescript": "4.5.2",<% } %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-nitro",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Yeoman generator for the nitro frontend framework",
5
5
  "license": "MIT",
6
6
  "repository": "merkle-open/generator-nitro",