generator-nitro 6.0.0-rc.3 → 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.
package/generators/app/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const got = require('got');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const childProcess = require('child_process');
|
|
12
|
+
const findGitRoot = require('find-git-root')
|
|
12
13
|
const glob = require('glob');
|
|
13
14
|
const _ = require('lodash');
|
|
14
15
|
|
|
@@ -30,6 +31,11 @@ module.exports = class extends Generator {
|
|
|
30
31
|
exporter: this.options.exporter,
|
|
31
32
|
};
|
|
32
33
|
|
|
34
|
+
this._git = {
|
|
35
|
+
root: false,
|
|
36
|
+
projet: false,
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
this.option('name', {
|
|
34
40
|
desc: 'the name of your app',
|
|
35
41
|
type: String,
|
|
@@ -91,7 +97,31 @@ module.exports = class extends Generator {
|
|
|
91
97
|
this._skipQuestions = this.options.skipQuestions;
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
|
|
100
|
+
initializing() {
|
|
101
|
+
// find git root
|
|
102
|
+
try {
|
|
103
|
+
const dest = this.destinationPath();
|
|
104
|
+
const gitRoot = findGitRoot(dest).replace('.git', '');
|
|
105
|
+
let gitPath = false;
|
|
106
|
+
let projectPath = false;
|
|
107
|
+
|
|
108
|
+
if (gitRoot) {
|
|
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, '/')}`;
|
|
114
|
+
} else {
|
|
115
|
+
gitPath = './';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
this._git.root = gitPath;
|
|
120
|
+
this._git.project = projectPath;
|
|
121
|
+
} catch (e) {
|
|
122
|
+
this.log(chalk.red(e.message));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
95
125
|
|
|
96
126
|
prompting() {
|
|
97
127
|
this.log(yosay(`Welcome to the awe-inspiring ${chalk.cyan('Nitro')} generator!`));
|
|
@@ -254,6 +284,7 @@ module.exports = class extends Generator {
|
|
|
254
284
|
|
|
255
285
|
const tplFiles = [
|
|
256
286
|
// files to process with copyTpl
|
|
287
|
+
'.husky/pre-commit',
|
|
257
288
|
'config/default.js',
|
|
258
289
|
'config/default/exporter.js',
|
|
259
290
|
'config/default/gulp.js',
|
|
@@ -390,6 +421,10 @@ module.exports = class extends Generator {
|
|
|
390
421
|
name: this.options.name,
|
|
391
422
|
version: this._pkg.version,
|
|
392
423
|
options: this.options,
|
|
424
|
+
git: {
|
|
425
|
+
root: this._git.root,
|
|
426
|
+
project: this._git.project,
|
|
427
|
+
}
|
|
393
428
|
};
|
|
394
429
|
|
|
395
430
|
files.forEach((file) => {
|
|
@@ -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": "cd
|
|
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",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"handlebars": "4.7.7",
|
|
91
91
|
"jquery": "3.6.0",
|
|
92
92
|
"lazysizes": "5.3.2",
|
|
93
|
-
"lottie-web": "5.
|
|
93
|
+
"lottie-web": "5.8.1",
|
|
94
94
|
"prevent-window-opener-attacks": "0.3.0"<% } %><% if (options.jsCompiler === 'js') { %>,
|
|
95
95
|
"regenerator-runtime": "0.13.9"<% } %><% if (options.exampleCode) { %>,
|
|
96
96
|
"svg4everybody": "2.1.9"<% } %>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@nitro/gulp": "<%= version %>",
|
|
107
107
|
"@nitro/webpack": "<%= version %>",<% if (options.jsCompiler === 'ts') { %>
|
|
108
108
|
"@types/bootstrap": "5.1.6",<% if (options.exampleCode ) { %>
|
|
109
|
-
"@types/jquery": "3.5.
|
|
109
|
+
"@types/jquery": "3.5.9",<% } %>
|
|
110
110
|
"@types/svg4everybody": "2.1.2",
|
|
111
111
|
"@types/webpack-env": "1.16.3",<% } %>
|
|
112
112
|
"backstopjs": "6.0.1",
|
|
@@ -114,26 +114,26 @@
|
|
|
114
114
|
"commitizen": "4.2.4",
|
|
115
115
|
"config": "3.3.6",
|
|
116
116
|
"cross-env": "7.0.3",
|
|
117
|
-
"cypress": "9.
|
|
117
|
+
"cypress": "9.1.0",
|
|
118
118
|
"cz-conventional-changelog": "3.3.0",
|
|
119
119
|
"env-linter": "0.5.1",
|
|
120
120
|
"eslint": "7.32.0",
|
|
121
|
-
"eslint-plugin-import": "2.25.
|
|
121
|
+
"eslint-plugin-import": "2.25.3",
|
|
122
122
|
"extend": "3.0.2",
|
|
123
123
|
"generator-nitro": "<%= version %>",
|
|
124
124
|
"gulp": "4.0.2",
|
|
125
125
|
"husky": "7.0.4",
|
|
126
126
|
"license-checker": "25.0.1",
|
|
127
|
-
"lighthouse": "
|
|
128
|
-
"lint-staged": "12.
|
|
127
|
+
"lighthouse": "9.1.0",
|
|
128
|
+
"lint-staged": "12.1.2",<% if (options.themes) { %>
|
|
129
129
|
"node-sass": "6.0.1",<% } %>
|
|
130
|
-
"npm-check-updates": "12.0.
|
|
130
|
+
"npm-check-updates": "12.0.2",
|
|
131
131
|
"npm-run-all": "4.1.5",
|
|
132
132
|
"opener": "1.5.2",
|
|
133
|
-
"prettier": "2.
|
|
133
|
+
"prettier": "2.5.0",
|
|
134
134
|
"rimraf": "3.0.2",
|
|
135
135
|
"stylelint": "13.13.1",<% if (options.jsCompiler === 'ts') { %>
|
|
136
|
-
"typescript": "4.
|
|
136
|
+
"typescript": "4.5.2",<% } %>
|
|
137
137
|
"webpack-cli": "4.9.1",
|
|
138
138
|
"yo": "4.3.0"
|
|
139
139
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-nitro",
|
|
3
|
-
"version": "6.0.
|
|
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",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"chalk": "4.1.2",
|
|
37
37
|
"config": "3.3.6",
|
|
38
|
+
"find-git-root": "1.0.4",
|
|
38
39
|
"git-config": "0.0.7",
|
|
39
40
|
"glob": "7.2.0",
|
|
40
41
|
"got": "11.8.3",
|