@gloww/gloww 20.0.0-beta.49 → 20.0.0-beta.50

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.
Files changed (2) hide show
  1. package/compute-version.js +40 -25
  2. package/package.json +1 -1
@@ -13,21 +13,41 @@ const argv = yargs
13
13
  .alias('help', 'h')
14
14
  .argv;
15
15
 
16
- let packagejsonfile = `${process.cwd()}/package.json`
17
- let distPath = `${process.cwd()}/${argv.path}`;
18
- let versionFilePath = path.join(`${process.cwd()}/${argv.path}/version.json`);
19
- const appVersion = require(packagejsonfile).version;
20
-
21
- if (argv.project) {
22
- packagejsonfile = `${process.cwd()}/projects/${argv.project}/package.json`
23
- distPath = path.join(`${process.cwd()}/${argv.path}/${argv.project}`);
24
- versionFilePath = path.join(`${process.cwd()}/${argv.path}/${argv.project}/version.json`);
25
- console.log(packagejsonfile);
26
- console.log(versionFilePath);
27
- }
28
-
29
- console.log(`packagejsonfile: ${packagejsonfile}`);
30
- var appVersionPrj = appVersion;
16
+ let packagejsonfile = `${process.cwd()}/package.json`
17
+ let distPath = path.isAbsolute(argv.path) ? argv.path : path.join(process.cwd(), argv.path);
18
+ let versionFilePath = path.join(distPath, 'version.json');
19
+ const appVersion = require(packagejsonfile).version;
20
+
21
+ if (argv.project) {
22
+ packagejsonfile = `${process.cwd()}/projects/${argv.project}/package.json`
23
+ const baseDistPath = path.isAbsolute(argv.path) ? argv.path : path.join(process.cwd(), argv.path);
24
+ distPath = path.join(baseDistPath, argv.project);
25
+ versionFilePath = path.join(distPath, 'version.json');
26
+ console.log(packagejsonfile);
27
+ console.log(versionFilePath);
28
+ }
29
+
30
+ const mainBundleEs5Regexp = /^main-es5.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
31
+ const mainBundleRegexp = /^main.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
32
+ const mainRegexp = /^main.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
33
+
34
+ function getBuildOutputPath(basePath) {
35
+ const browserPath = path.join(basePath, 'browser');
36
+ if (fs.existsSync(browserPath)) {
37
+ const browserFiles = fs.readdirSync(browserPath);
38
+ if (browserFiles.some(f => mainBundleRegexp.test(f) || mainBundleEs5Regexp.test(f) || mainRegexp.test(f))) {
39
+ return browserPath;
40
+ }
41
+ }
42
+
43
+ return basePath;
44
+ }
45
+
46
+ distPath = getBuildOutputPath(distPath);
47
+ versionFilePath = path.join(distPath, 'version.json');
48
+
49
+ console.log(`packagejsonfile: ${packagejsonfile}`);
50
+ var appVersionPrj = appVersion;
31
51
  try {
32
52
  appVersionPrj = require(packagejsonfile).version;//require('./../package.json').version;
33
53
  } catch { }
@@ -43,16 +63,11 @@ console.log(`dist Path: ${distPath}`);
43
63
  // our version.json will be in the dist folder
44
64
  console.log(`versionFilePath: ${versionFilePath}`);
45
65
 
46
- let mainHash = '';
47
- let mainBundleEs5File = '';
48
-
49
- // RegExp to find main.bundle.js, even if it doesn't include a hash in it's name (dev build)
50
- let mainBundleEs5Regexp = /^main-es5.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
51
- let mainBundleRegexp = /^main.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
52
- let mainRegexp = /^main.?([A-Za-z0-9]*)?(\.bundle)?.js$/;
53
-
54
- // read the dist folder files and find the one we're looking for
55
- readDir(distPath)
66
+ let mainHash = '';
67
+ let mainBundleEs5File = '';
68
+
69
+ // read the dist folder files and find the one we're looking for
70
+ readDir(distPath)
56
71
  .then(files => {
57
72
  mainBundleFile = files.find(f => mainBundleRegexp.test(f));
58
73
  mainBundleEs5File = files.find(f => mainBundleEs5Regexp.test(f));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gloww/gloww",
3
- "version": "20.0.0-beta.49",
3
+ "version": "20.0.0-beta.50",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^20.0.0",
6
6
  "@angular/cdk": "^20.0.0",