@sap-ux/adp-tooling 0.9.27 → 0.10.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.
- package/dist/writer/index.d.ts +9 -0
- package/dist/writer/index.js +51 -14
- package/package.json +3 -3
package/dist/writer/index.d.ts
CHANGED
|
@@ -9,4 +9,13 @@ import type { AdpWriterConfig } from '../types';
|
|
|
9
9
|
* @returns the updated memfs editor instance
|
|
10
10
|
*/
|
|
11
11
|
export declare function generate(basePath: string, config: AdpWriterConfig, fs?: Editor): Promise<Editor>;
|
|
12
|
+
/**
|
|
13
|
+
* Writes the adp-project template to the mem-fs-editor instance during migration.
|
|
14
|
+
*
|
|
15
|
+
* @param basePath - the base path
|
|
16
|
+
* @param config - the writer configuration
|
|
17
|
+
* @param fs - the memfs editor instance
|
|
18
|
+
* @returns the updated memfs editor instance
|
|
19
|
+
*/
|
|
20
|
+
export declare function migrate(basePath: string, config: AdpWriterConfig, fs?: Editor): Promise<Editor>;
|
|
12
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/writer/index.js
CHANGED
|
@@ -9,12 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.generate = void 0;
|
|
12
|
+
exports.migrate = exports.generate = void 0;
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const mem_fs_1 = require("mem-fs");
|
|
15
15
|
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
16
16
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
17
17
|
const options_1 = require("./options");
|
|
18
|
+
const tmplPath = (0, path_1.join)(__dirname, '../../templates/project');
|
|
18
19
|
/**
|
|
19
20
|
* Set default values for optional properties.
|
|
20
21
|
*
|
|
@@ -38,6 +39,22 @@ function setDefaults(config) {
|
|
|
38
39
|
(_e = (_j = configWithDefaults.package).description) !== null && _e !== void 0 ? _e : (_j.description = configWithDefaults.app.title);
|
|
39
40
|
return configWithDefaults;
|
|
40
41
|
}
|
|
42
|
+
function writeUi5Yaml(basePath, config, fs) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
// ui5.yaml
|
|
45
|
+
const ui5ConfigPath = (0, path_1.join)(basePath, 'ui5.yaml');
|
|
46
|
+
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
47
|
+
const ui5Config = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
48
|
+
(0, options_1.enhanceUI5Yaml)(ui5Config, config);
|
|
49
|
+
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
50
|
+
// ui5-deploy.yaml
|
|
51
|
+
if ((0, options_1.hasDeployConfig)(config)) {
|
|
52
|
+
const ui5DeployConfig = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
53
|
+
(0, options_1.enhanceUI5DeployYaml)(ui5DeployConfig, config);
|
|
54
|
+
fs.write((0, path_1.join)(basePath, 'ui5-deploy.yaml'), ui5DeployConfig.toString());
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
41
58
|
/**
|
|
42
59
|
* Writes the adp-project template to the mem-fs-editor instance.
|
|
43
60
|
*
|
|
@@ -51,26 +68,46 @@ function generate(basePath, config, fs) {
|
|
|
51
68
|
if (!fs) {
|
|
52
69
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
53
70
|
}
|
|
54
|
-
const tmplPath = (0, path_1.join)(__dirname, '../../templates/project');
|
|
55
71
|
const fullConfig = setDefaults(config);
|
|
56
72
|
fs.copyTpl((0, path_1.join)(tmplPath, '**/*.*'), (0, path_1.join)(basePath), fullConfig, undefined, {
|
|
57
73
|
globOptions: { dot: true },
|
|
58
74
|
processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
|
|
59
75
|
});
|
|
60
|
-
|
|
61
|
-
const ui5ConfigPath = (0, path_1.join)(basePath, 'ui5.yaml');
|
|
62
|
-
const baseUi5ConfigContent = fs.read(ui5ConfigPath);
|
|
63
|
-
const ui5Config = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
64
|
-
(0, options_1.enhanceUI5Yaml)(ui5Config, fullConfig);
|
|
65
|
-
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
66
|
-
// ui5-deploy.yaml
|
|
67
|
-
if ((0, options_1.hasDeployConfig)(fullConfig)) {
|
|
68
|
-
const ui5DeployConfig = yield ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
|
|
69
|
-
(0, options_1.enhanceUI5DeployYaml)(ui5DeployConfig, fullConfig);
|
|
70
|
-
fs.write((0, path_1.join)(basePath, 'ui5-deploy.yaml'), ui5DeployConfig.toString());
|
|
71
|
-
}
|
|
76
|
+
yield writeUi5Yaml(basePath, fullConfig, fs);
|
|
72
77
|
return fs;
|
|
73
78
|
});
|
|
74
79
|
}
|
|
75
80
|
exports.generate = generate;
|
|
81
|
+
/**
|
|
82
|
+
* Writes the adp-project template to the mem-fs-editor instance during migration.
|
|
83
|
+
*
|
|
84
|
+
* @param basePath - the base path
|
|
85
|
+
* @param config - the writer configuration
|
|
86
|
+
* @param fs - the memfs editor instance
|
|
87
|
+
* @returns the updated memfs editor instance
|
|
88
|
+
*/
|
|
89
|
+
function migrate(basePath, config, fs) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
if (!fs) {
|
|
92
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
93
|
+
}
|
|
94
|
+
const fullConfig = setDefaults(config);
|
|
95
|
+
// copy all files except app discriptor
|
|
96
|
+
fs.copyTpl((0, path_1.join)(tmplPath, '**/*.*'), (0, path_1.join)(basePath), fullConfig, undefined, {
|
|
97
|
+
globOptions: { dot: true, ignore: ['manifest.appdescr_variant'] },
|
|
98
|
+
processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
|
|
99
|
+
});
|
|
100
|
+
// delete .che folder
|
|
101
|
+
if (fs.exists((0, path_1.join)(basePath, '.che/project.json'))) {
|
|
102
|
+
fs.delete((0, path_1.join)(basePath, '.che/'));
|
|
103
|
+
}
|
|
104
|
+
// delete neo-app.json
|
|
105
|
+
if (fs.exists((0, path_1.join)(basePath, 'neo-app.json'))) {
|
|
106
|
+
fs.delete((0, path_1.join)(basePath, 'neo-app.json'));
|
|
107
|
+
}
|
|
108
|
+
yield writeUi5Yaml(basePath, fullConfig, fs);
|
|
109
|
+
return fs;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
exports.migrate = migrate;
|
|
76
113
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.10.0",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"mem-fs-editor": "9.4.0",
|
|
30
30
|
"prompts": "2.4.2",
|
|
31
31
|
"adm-zip": "0.5.10",
|
|
32
|
-
"@sap-ux/axios-extension": "1.12.
|
|
32
|
+
"@sap-ux/axios-extension": "1.12.1",
|
|
33
33
|
"@sap-ux/project-access": "1.19.14",
|
|
34
34
|
"@sap-ux/logger": "0.5.1",
|
|
35
|
-
"@sap-ux/system-access": "0.3.
|
|
35
|
+
"@sap-ux/system-access": "0.3.25",
|
|
36
36
|
"@sap-ux/ui5-config": "0.22.3",
|
|
37
37
|
"@sap-ux/btp-utils": "0.14.4"
|
|
38
38
|
},
|