igniteui-live-editing 3.3.0 → 3.4.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.
|
@@ -36,6 +36,7 @@ const SampleDefinitionFile_1 = require("./misc/SampleDefinitionFile");
|
|
|
36
36
|
const APP_MODULE_TEMPLATE_PATH = path.join(__dirname, "../templates/app.module.ts.template");
|
|
37
37
|
const APP_CONFIG_TEMPLATE_PATH = path.join(__dirname, "../templates/app.config.ts.template");
|
|
38
38
|
const APP_COMPONENT_TEMPLATE_PATH = path.join(__dirname, "../templates/app.component.ts.template");
|
|
39
|
+
const POSTCSSRC_FILE_PATH = path.join(__dirname, "../templates/postcssrc.json.template");
|
|
39
40
|
const COMPONENT_STYLE_FILE_EXTENSION = "scss";
|
|
40
41
|
const ROOT_MODULE_PATHS = ["grid-crm/grid-crm"];
|
|
41
42
|
const COMPONENT_FILE_EXTENSIONS = ["ts", "html", COMPONENT_STYLE_FILE_EXTENSION];
|
|
@@ -50,7 +51,9 @@ const WEB_CONTAINER_DEPS = [
|
|
|
50
51
|
'@juggle/resize-observer',
|
|
51
52
|
'@microsoft/signalr',
|
|
52
53
|
'igniteui-dockmanager',
|
|
53
|
-
'igniteui-webcomponents'
|
|
54
|
+
'igniteui-webcomponents',
|
|
55
|
+
'tailwindcss',
|
|
56
|
+
'@tailwindcss/postcss',
|
|
54
57
|
];
|
|
55
58
|
class SampleAssetsGenerator {
|
|
56
59
|
constructor(options) {
|
|
@@ -145,7 +148,9 @@ class SampleAssetsGenerator {
|
|
|
145
148
|
let dependencies = this._dependencyResolver.resolveSampleDependencies(config.dependenciesType, config.additionalDependencies);
|
|
146
149
|
const modifiedPackages = this.addCustomDependencies(config.additionalDependencies || [], dependencies);
|
|
147
150
|
if (this.options.platform === 'angular') {
|
|
148
|
-
const
|
|
151
|
+
const packageJsonString = this.removeRedundantDependencies(config.additionalDependencies || [], modifiedPackages);
|
|
152
|
+
const packageJson = JSON.parse(packageJsonString);
|
|
153
|
+
const packageJsonFile = JSON.stringify(packageJson, null, 2);
|
|
149
154
|
sampleFiles.push(new LiveEditingFile_1.LiveEditingFile("package.json", packageJsonFile));
|
|
150
155
|
}
|
|
151
156
|
let sampleDef = new SampleDefinitionFile_1.SampleDefinitionFile(sampleFiles, dependencies, config.useIvy);
|
|
@@ -213,11 +218,17 @@ class SampleAssetsGenerator {
|
|
|
213
218
|
_getAdditionalFiles(config) {
|
|
214
219
|
let additionalFiles = new Array();
|
|
215
220
|
for (let i = 0; i < config.additionalFiles.length; i++) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
if (config.additionalFiles[i] === ".postcssrc.json") {
|
|
222
|
+
let postCssRcFile = fs.readFileSync(POSTCSSRC_FILE_PATH, "utf8");
|
|
223
|
+
additionalFiles.push(new LiveEditingFile_1.LiveEditingFile(".postcssrc.json", postCssRcFile));
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
let fileContent = fs.readFileSync(path.join(process.cwd(), config.additionalFiles[i]), "utf8");
|
|
227
|
+
config.additionalFiles[i] = config.additionalFiles[i].substring(config.additionalFiles[i].indexOf(LiveEditingFile_1.SAMPLE_SRC_FOLDER));
|
|
228
|
+
let file = new LiveEditingFile_1.LiveEditingFile(config.additionalFiles[i], fileContent);
|
|
229
|
+
this._shortenComponentPath(config, file);
|
|
230
|
+
additionalFiles.push(file);
|
|
231
|
+
}
|
|
221
232
|
}
|
|
222
233
|
return additionalFiles;
|
|
223
234
|
}
|
|
@@ -461,12 +472,22 @@ class SampleAssetsGenerator {
|
|
|
461
472
|
const PACKAGE_JSON_FILE_PATH = path.join(__dirname, "../templates/package.json.template");
|
|
462
473
|
let packageJsonFile = fs.readFileSync(PACKAGE_JSON_FILE_PATH, "utf8");
|
|
463
474
|
let dependenciesString = "";
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
475
|
+
// Update existing packages or add new ones with resolved versions
|
|
476
|
+
for (const pkg in withVersions) {
|
|
477
|
+
const escapedPkg = pkg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
478
|
+
const versionPattern = new RegExp(`"${escapedPkg}": "[^"]*"`, 'g');
|
|
479
|
+
const replacement = `"${pkg}": "${withVersions[pkg]}"`;
|
|
480
|
+
if (packageJsonFile.match(versionPattern)) {
|
|
481
|
+
packageJsonFile = packageJsonFile.replace(versionPattern, replacement);
|
|
467
482
|
}
|
|
468
483
|
else {
|
|
469
|
-
dependenciesString += `,\n
|
|
484
|
+
dependenciesString += `,\n ${replacement}`;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
// Add packages without resolved versions
|
|
488
|
+
for (const dep of dependencies) {
|
|
489
|
+
if (!withVersions[dep]) {
|
|
490
|
+
dependenciesString += `,\n "${dep}": "*"`;
|
|
470
491
|
}
|
|
471
492
|
}
|
|
472
493
|
packageJsonFile = packageJsonFile.replace("{dependencies}", dependenciesString);
|
package/package.json
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
],
|
|
9
9
|
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
|
|
10
10
|
"tasks": {
|
|
11
|
-
"node node_modules/@angular/cli/bin/ng serve": {
|
|
11
|
+
"node node_modules/@angular/cli/bin/ng serve -o --disable-host-check": {
|
|
12
12
|
"name": "Start Project",
|
|
13
|
-
"command": "node --max_old_space_size=12192 node_modules/@angular/cli/bin/ng serve",
|
|
13
|
+
"command": "node --max_old_space_size=12192 node_modules/@angular/cli/bin/ng serve -o --disable-host-check",
|
|
14
14
|
"runAtStart": true
|
|
15
15
|
}
|
|
16
16
|
}
|