generator-easy-ui5 3.5.0 → 3.5.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-easy-ui5",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "Generator for UI5-based project",
5
5
  "main": "generators/app/index.js",
6
6
  "files": [
@@ -10,18 +10,21 @@
10
10
  "node": ">=14.0.0"
11
11
  },
12
12
  "scripts": {
13
- "test": "mocha",
14
- "postinstall": "node generators/app/postinstall",
15
- "lint": "eslint . --fix",
16
- "prettier": "prettier --write .",
13
+ "prepublishOnly": "npx yo ./ project --embed",
17
14
  "start": "yo easy-ui5 project",
18
- "listSubGen": "yo easy-ui5 project --list",
19
- "startSubGen": "yo easy-ui5 project app",
20
- "workaround": "find . -name '.DS_Store' -delete",
21
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
22
- "postversion": "npm run changelog && git commit --all --amend --no-edit",
23
- "prepare": "husky install",
24
- "hooks:commit-msg": "commitlint -e"
15
+ "test": "mocha",
16
+ "test:subgen:list": "yo easy-ui5 project --list",
17
+ "test:subgen:start": "yo easy-ui5 project app",
18
+ "release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
19
+ "postversion": "npm run release:changelog && git commit --all --amend --no-edit",
20
+ "lint": "eslint .",
21
+ "lint:fix": "eslint . --fix",
22
+ "lint:staged": "lint-staged",
23
+ "format": "prettier --write .",
24
+ "format:staged": "pretty-quick --staged --verbose",
25
+ "prepare": "node ./.husky/skip.js || husky install",
26
+ "hooks:commit-msg": "commitlint -e",
27
+ "hooks:pre-commit": "npm-run-all --sequential format:staged lint:staged"
25
28
  },
26
29
  "repository": {
27
30
  "type": "git",
@@ -43,20 +46,17 @@
43
46
  },
44
47
  "homepage": "https://github.com/SAP/generator-easy-ui5#readme",
45
48
  "dependencies": {
46
- "@octokit/plugin-throttling": "^4.1.0",
47
- "@octokit/rest": "^19.0.3",
49
+ "@octokit/plugin-throttling": "^4.2.0",
50
+ "@octokit/rest": "^19.0.4",
48
51
  "adm-zip": "^0.5.9",
49
52
  "chalk": "^4.1.2",
50
53
  "colors": "1.4.0",
51
54
  "glob": "^7.2.0",
52
55
  "libnpmconfig": "^1.2.1",
53
- "mocha": "^10.0.0",
54
56
  "rimraf": "^3.0.2",
55
57
  "yarn-or-npm": "^3.0.1",
56
- "yeoman-assert": "^3.1.1",
57
- "yeoman-environment": "^3.9.1",
58
- "yeoman-generator": "^5.6.1",
59
- "yeoman-test": "^6.3.0",
58
+ "yeoman-environment": "^3.10.0",
59
+ "yeoman-generator": "^5.7.0",
60
60
  "yosay": "^2.0.2"
61
61
  },
62
62
  "devDependencies": {
@@ -64,8 +64,15 @@
64
64
  "@commitlint/config-conventional": "17.0.3",
65
65
  "conventional-changelog-cli": "^2.2.2",
66
66
  "cz-conventional-changelog": "3.3.0",
67
+ "eslint": "^8.18.0",
67
68
  "husky": "^8.0.1",
68
- "prettier": "2.7.1"
69
+ "lint-staged": "^13.0.3",
70
+ "mocha": "^10.0.0",
71
+ "npm-run-all": "^4.1.5",
72
+ "prettier": "2.7.1",
73
+ "pretty-quick": "^3.1.3",
74
+ "yeoman-assert": "^3.1.1",
75
+ "yeoman-test": "^6.3.0"
69
76
  },
70
77
  "config": {
71
78
  "commitizen": {
@@ -1,155 +0,0 @@
1
- "use strict";
2
- const spawn = require("cross-spawn");
3
- const fs = require("fs");
4
- const { rm } = require("fs").promises;
5
- const path = require("path");
6
- const { hasYarn } = require("yarn-or-npm");
7
- const { Octokit } = require("@octokit/rest");
8
- const { throttling } = require("@octokit/plugin-throttling");
9
- const MyOctokit = Octokit.plugin(throttling);
10
- const AdmZip = require("adm-zip");
11
-
12
- // helper to retrieve config entries from npm
13
- // --> npm config set easy-ui5_addGhOrg XYZ
14
- const NPM_CONFIG_PREFIX = "easy-ui5_";
15
- let npmConfig;
16
- const getNPMConfig = (configName) => {
17
- if (!npmConfig) {
18
- npmConfig = require("libnpmconfig").read();
19
- }
20
- return npmConfig && npmConfig[`${NPM_CONFIG_PREFIX}${configName}`]
21
- }
22
-
23
- const ghOrg = "ui5-community",
24
- repoName = "generator-ui5-project",
25
- branch = "main",
26
- ghAuthToken = getNPMConfig("ghAuthToken");
27
-
28
- (async () => {
29
-
30
- let _busy;
31
-
32
- function showBusy(statusText) {
33
- clearBusy();
34
- const progressChars = ["\\", "|", "/", "-"];
35
- let i = 0;
36
- process.stdout.write(`\r${statusText} `);
37
- _busy = {
38
- text: statusText,
39
- timer: setInterval(() => {
40
- process.stdout.write(`\r${statusText} ${progressChars[i++]}`);
41
- i %= progressChars.length;
42
- }, 250),
43
- };
44
- }
45
-
46
- function clearBusy(newLine) {
47
- if (_busy) {
48
- clearInterval(_busy.timer);
49
- process.stdout.write("\r".padEnd(_busy.text.length + 3) + (newLine ? "\n" : ""));
50
- _busy = null;
51
- }
52
- }
53
-
54
- const pkg = require(path.join(__dirname, "../../package.json"));
55
- console.log(`${pkg.name}:${pkg.version} - ${ghAuthToken}`);
56
- const octokit = new MyOctokit({
57
- userAgent: `${pkg.name}:${pkg.version}`,
58
- auth: ghAuthToken,
59
- throttle: {
60
- onRateLimit: (retryAfter, options) => {
61
- console.log(`Hit the GitHub API limit! Request quota exhausted for this request.`);
62
- if (options.request.retryCount === 0) {
63
- // only retries once
64
- this.log(`Retrying after ${retryAfter} seconds. Alternatively, you can cancel this operation and supply an auth token with "npm config set easy-ui5_ghAuthToken ghp_xxxx".`);
65
- return true;
66
- }
67
- },
68
- onAbuseLimit: () => {
69
- // does not retry, only logs a warning
70
- console.error(`Hit the GitHub API limit again! Please supply an auth token with with "npm config set easy-ui5_ghAuthToken ghp_xxxx".`);
71
- },
72
- }
73
- });
74
-
75
- const reqBranch = await octokit.repos.getBranch({
76
- owner: ghOrg,
77
- repo: repoName,
78
- branch,
79
- });
80
-
81
- const commitSHA = reqBranch.data.commit.sha;
82
-
83
- // eslint-disable-next-line
84
- console.log(
85
- `Using commit ${commitSHA} from @${ghOrg}/${repoName}#${branch}...`
86
- );
87
- const generatorPath = path.join(
88
- __dirname,
89
- "../../plugin-generators",
90
- repoName
91
- );
92
- const shaMarker = path.join(generatorPath, `.${commitSHA}`);
93
-
94
- if (fs.existsSync(generatorPath)) {
95
- // check if the SHA marker exists to know whether the generator is up-to-date or not
96
- if (!fs.existsSync(shaMarker)) {
97
- // eslint-disable-next-line
98
- console.log(
99
- `Fetching new ZIP as the default generator is outdated...`
100
- );
101
- // remove if the SHA marker doesn't exist => outdated!
102
- showBusy(" Removing old default templates");
103
- await rm(generatorPath, { recursive: true });
104
- }
105
- }
106
-
107
-
108
- // re-fetch the generator and extract into local plugin folder
109
- if (!fs.existsSync(generatorPath)) {
110
- console.log("Extracting default templates...");
111
- showBusy(" Downloading and extracting default templates");
112
- const reqZIPArchive = await octokit.repos.downloadZipballArchive({
113
- owner: ghOrg,
114
- repo: repoName,
115
- ref: commitSHA,
116
- });
117
- const buffer = Buffer.from(new Uint8Array(reqZIPArchive.data));
118
- const zip = new AdmZip(buffer);
119
- const zipEntries = zip.getEntries();
120
- zipEntries.forEach((entry) => {
121
- const match =
122
- !entry.isDirectory && entry.entryName.match(/[^\/]+\/(.+)/);
123
- if (match) {
124
- const entryPath = match[1].slice(0, entry.name.length * -1);
125
- zip.extractEntryTo(
126
- entry,
127
- path.join(generatorPath, entryPath),
128
- false,
129
- true
130
- );
131
- }
132
- });
133
- fs.writeFileSync(shaMarker, commitSHA);
134
-
135
- // run yarn/npm install
136
- console.log("Installing the plugin dependencies...");
137
- showBusy(" Preparing the default templates");
138
- await new Promise(function (resolve, reject) {
139
- spawn((hasYarn() ? "yarn" : "npm"), ["install", "--no-progress", "--ignore-engines"], {
140
- stdio: "inherit",
141
- cwd: generatorPath,
142
- env: {
143
- ...process.env,
144
- "NO_UPDATE_NOTIFIER": true
145
- }
146
- }).on("exit", function (code) {
147
- resolve(code);
148
- }).on("error", function (err) {
149
- reject(err);
150
- });
151
- }.bind(this));
152
- }
153
-
154
- clearBusy(true);
155
- })();