@citolab/tspci 2.5.5 → 2.5.15

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/CHANGELOG.md CHANGED
@@ -3,6 +3,86 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 2.5.15 (2024-10-11)
7
+
8
+ **Note:** Version bump only for package @citolab/tspci
9
+
10
+
11
+
12
+
13
+
14
+ ## 2.5.14 (2024-10-11)
15
+
16
+ **Note:** Version bump only for package @citolab/tspci
17
+
18
+
19
+
20
+
21
+
22
+ ## 2.5.13 (2024-10-11)
23
+
24
+ **Note:** Version bump only for package @citolab/tspci
25
+
26
+
27
+
28
+
29
+
30
+ ## 2.5.12 (2024-10-11)
31
+
32
+ **Note:** Version bump only for package @citolab/tspci
33
+
34
+
35
+
36
+
37
+
38
+ ## 2.5.11 (2024-10-11)
39
+
40
+ **Note:** Version bump only for package @citolab/tspci
41
+
42
+
43
+
44
+
45
+
46
+ ## 2.5.10 (2024-10-11)
47
+
48
+ **Note:** Version bump only for package @citolab/tspci
49
+
50
+
51
+
52
+
53
+
54
+ ## 2.5.9 (2024-10-11)
55
+
56
+ **Note:** Version bump only for package @citolab/tspci
57
+
58
+
59
+
60
+
61
+
62
+ ## 2.5.8 (2024-10-10)
63
+
64
+ **Note:** Version bump only for package @citolab/tspci
65
+
66
+
67
+
68
+
69
+
70
+ ## 2.5.7 (2024-10-10)
71
+
72
+ **Note:** Version bump only for package @citolab/tspci
73
+
74
+
75
+
76
+
77
+
78
+ ## [2.5.6](/compare/v2.5.5...v2.5.6) (2024-10-10)
79
+
80
+ **Note:** Version bump only for package @citolab/tspci
81
+
82
+
83
+
84
+
85
+
6
86
  ## [2.5.5](/compare/v2.5.4...v2.5.5) (2024-10-10)
7
87
 
8
88
  **Note:** Version bump only for package @citolab/tspci
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citolab/tspci",
3
- "version": "2.5.5",
3
+ "version": "2.5.15",
4
4
  "description": "an opiniated typescript ims-pci builder with tao integration",
5
5
  "author": "patrick <patrick.deklein@cito.nl>",
6
6
  "repository": "@citolab/tspci",
@@ -46,5 +46,5 @@
46
46
  "rollup-plugin-watch-assets": "^1.0.1",
47
47
  "tailwindcss": "^3.4.11"
48
48
  },
49
- "gitHead": "107b2fde32e7e09f6ac2cac98a6018bce51539c0"
49
+ "gitHead": "1970a9a73da54053545f3b9a470dcad44c8abd21"
50
50
  }
package/readme.md CHANGED
@@ -173,7 +173,8 @@ Available Commands
173
173
  --dev -d Start development server
174
174
  --watch -w Only watch changes
175
175
  --help -h Help about commandos
176
- --target -t Build production for platform, could be @citolab/tscpi-${target} or a fully qualified specified npm package name.
176
+ --target -t Build production for platform, could be @citolab/tscpi-${target}
177
+ --targetExt -tx Same as -target but reffering to a fully qualified package (not in @citolab)
177
178
  init Init PCI development environment.
178
179
  add --target Add specific implementation to the PCI.
179
180
 
package/src/cli.js CHANGED
@@ -34,7 +34,6 @@ const watchBuild = (devServer = false, target = "IMS") => {
34
34
  if (!fs.existsSync(PACKAGE_DIST_PATH)) {
35
35
  fs.mkdirSync(PACKAGE_DIST_PATH);
36
36
  }
37
-
38
37
  if (devServer) {
39
38
  try {
40
39
  if (fs.existsSync(path.join(PACKAGE_ROOT_PATH, "src/index.html"))) {
@@ -186,8 +185,10 @@ const run = async () => {
186
185
  const help = args.indexOf("--help") >= 0 || args.indexOf("-h") >= 0;
187
186
  const watch = args.indexOf("--watch") >= 0 || args.indexOf("-w") >= 0;
188
187
  const dev = args.indexOf("--dev") >= 0 || args.indexOf("-d") >= 0;
189
- const target = args.indexOf("--target") >= 0 || args.indexOf("-t") >= 0;
188
+ const t = args.indexOf("--target") >= 0 || args.indexOf("-t") >= 0;
189
+ const tExt = args.indexOf("--targetExt") >= 0 || args.indexOf("-tx") >= 0;
190
190
  const init = args.indexOf("init") >= 0;
191
+ const targetName = t !== -1 ? `@citolab/tspci-${t}` : tExt !== -1 ? tExt : null;
191
192
 
192
193
  if (help) {
193
194
  console.log(`•\t${chalk.blueBright("--help -h")} list these commands`);
@@ -346,6 +347,9 @@ const run = async () => {
346
347
  pciName
347
348
  );
348
349
  // point to the javascript file
350
+ const packageJson = path.join(destinationFolder, "package.json");
351
+ const packageJsonContent = fs.readFileSync(packageJson, "utf8");
352
+ let packageJsonContentJson = JSON.parse(packageJsonContent);
349
353
  packageJsonContentJson.source = "src/index.js";
350
354
  const newPackageJsonContent = JSON.stringify(packageJsonContentJson, null, 2);
351
355
  fs.writeFileSync(packageJson, newPackageJsonContent);
@@ -373,42 +377,31 @@ const run = async () => {
373
377
  return;
374
378
  }
375
379
  const version = args.indexOf("--next") !== -1 ? "next" : "latest";
376
- const targetname = args[targetIndex + 1];
377
380
  const packageFileContent = fs.readFileSync(path.join(PACKAGE_ROOT_PATH, "package.json"), "utf8");
378
381
  const packageJson = JSON.parse(packageFileContent);
379
382
 
380
383
  const modifyPci = () => {
381
- let scriptFile = path.join(
382
- path.join(path.join(path.join(NODE_MODULES, `@citolab`), `tspci-${targetname}`), "src"),
383
- `init.mjs`
384
- );
385
- if (!fs.existsSync(scriptFile)) {
386
- scriptFile = path.join(path.join(path.join(NODE_MODULES, targetname), "src"), `init.mjs`);
387
- }
384
+ const scriptFile = path.join(path.join(path.join(NODE_MODULES, `${targetName}`), "src"), `init.mjs`);
388
385
  let init = false;
389
386
  if (fs.existsSync(scriptFile)) {
390
387
  // run init() script
391
388
  import(`file:///${scriptFile}`).then((script) => {
392
389
  if (script.init) {
393
390
  init = true;
394
- console.log(chalk.green(`Running init script for @citolab/tspci-${targetname}`));
391
+ console.log(chalk.green(`Running init script for ${targetName}`));
395
392
  script.init();
396
393
  } else {
397
394
  if (!init) {
398
- console.log(chalk.red(`No init script found for @citolab/tspci-${targetname}`));
395
+ console.log(chalk.red(`No init script found for ${targetName}`));
399
396
  }
400
397
  }
401
398
  });
402
- } else {
403
- console.log(chalk.red(`No init script found. Searched for ${scriptFile}`));
404
399
  }
405
400
  };
406
-
407
- // check if `@citolab/tspci-${targetname}]}` is already in devDependencies
408
- if (!packageJson.devDependencies || !packageJson.devDependencies[`@citolab/tspci-${targetname}`]) {
409
- console.log(chalk.white(`Adding @citolab/tspci-${targetname}`));
401
+ if (!packageJson.devDependencies || !packageJson.devDependencies[targetName]) {
402
+ console.log(chalk.white(`Adding ${targetName}`));
410
403
  // install @citolab/tspci-${targetname} to devDepencies
411
- execSync(`npm install @citolab/tspci-${targetname}@${version} --save-dev`, {
404
+ execSync(`npm install ${targetName}@${version} --save-dev`, {
412
405
  cwd: PACKAGE_ROOT_PATH,
413
406
  stdio: [0, 1, 2],
414
407
  });
@@ -436,16 +429,11 @@ const run = async () => {
436
429
  }
437
430
 
438
431
  prodBuild().then(() => {
439
- if (target) {
440
- const targetIndex = args.indexOf("--target");
441
- if (args.length <= targetIndex + 1) {
442
- console.error("Missing target name. Use tspci --target target");
432
+ if (t) {
433
+ if (!targetName) {
434
+ console.error("Missing target name. Use tspci --target target or tspci --targetExt target");
443
435
  }
444
- const targetname = args[targetIndex + 1];
445
- const scriptFile = path.join(
446
- path.join(path.join(path.join(NODE_MODULES, `@citolab`), `tspci-${targetname}`), "src"),
447
- `createPackage.mjs`
448
- );
436
+ const scriptFile = path.join(path.join(path.join(NODE_MODULES, `${targetName}`), "src"), `createPackage.mjs`);
449
437
  import(`file:///${scriptFile}`).then((script) => {
450
438
  script.bundle();
451
439
  });