@travetto/scaffold 5.0.21 → 5.0.22

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ArcSine Technologies
3
+ Copyright (c) 2020 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,22 +1,25 @@
1
1
  #!/usr/bin/env node
2
+ // @ts-check
2
3
 
3
4
  async function getScaffoldCwd() {
4
- let cwd = process.cwd();
5
5
  if (process.env.npm_lifecycle_script === 'trv-scaffold') { // Is npx run
6
6
  const { delimiter } = await import('node:path');
7
- const parts = process.env.PATH.split(delimiter);
7
+ const parts = process.env.PATH?.split(delimiter) ?? [];
8
8
  const loc = parts.find(p => p.includes('npx') && p.includes('.bin'));
9
9
  if (loc) {
10
- cwd = loc.split('/node_modules')[0];
10
+ return loc.split('/node_modules')[0];
11
11
  }
12
12
  }
13
- return cwd;
13
+ return process.cwd();
14
14
  }
15
15
 
16
+ /**
17
+ * @param {string} cwd
18
+ */
16
19
  async function getVersion(cwd) {
17
20
  const fs = await import('node:fs/promises');
18
21
  const pkg = JSON.parse(await fs.readFile(`${cwd}/package.json`, 'utf8'));
19
- const version = pkg.dependencies['@travetto/scaffold'].replace(/[^~]?(\d+[.]\d+)[.]\d+/, (_, v) => `${v}.0`).replace(/-([a-z]+)[.]\d+$/, (_, v) => `${v}.0`);
22
+ const version = `${pkg.dependencies['@travetto/scaffold']}`.replace(/\d+$/, '0');
20
23
  return version;
21
24
  }
22
25
 
@@ -26,7 +29,7 @@ async function getVersion(cwd) {
26
29
 
27
30
  const { spawn, execSync } = await import('node:child_process');
28
31
  // Ensure we install the compiler first
29
- execSync(`npm i @travetto/compiler@^${version}`, { stdio: 'pipe', cwd: scaffoldCwd });
32
+ execSync(`npm i @travetto/compiler@${version}`, { stdio: 'pipe', cwd: scaffoldCwd });
30
33
 
31
34
  spawn('npx', [
32
35
  'trvc', 'exec',
@@ -39,7 +42,7 @@ async function getVersion(cwd) {
39
42
  cwd: scaffoldCwd,
40
43
  env: {
41
44
  ...process.env,
42
- TRV_QUIET: 1,
45
+ TRV_QUIET: '1',
43
46
  }
44
47
  });
45
48
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/scaffold",
3
- "version": "5.0.21",
3
+ "version": "5.0.22",
4
4
  "description": "App Scaffold for the Travetto framework",
5
5
  "keywords": [
6
6
  "generator",
@@ -27,13 +27,13 @@
27
27
  "trv-scaffold": "./bin/trv-scaffold.js"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/cli": "^5.0.16",
31
- "@travetto/runtime": "^5.0.13",
30
+ "@travetto/cli": "^5.0.17",
31
+ "@travetto/runtime": "^5.0.14",
32
32
  "enquirer": "^2.4.1",
33
33
  "mustache": "^4.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@travetto/model": "^5.0.14",
36
+ "@travetto/model": "^5.0.15",
37
37
  "@types/mustache": "^4.2.5"
38
38
  },
39
39
  "travetto": {