aws-architect 6.7.57 → 6.7.58
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 +1 -0
- package/index.js +5 -5
- package/lib/lockFinder.js +18 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,7 @@ This is the changelog for [AWS Architect](readme.md).
|
|
|
5
5
|
* Fix handlers for /route and /route/ so that the index.html is always duplicated.
|
|
6
6
|
* Add support for organizational stack set deployment
|
|
7
7
|
* Remove invalid regions from organizational deployment [eu-central-2, ap-south-2, eu-south-2, me-central-1, ap-southeast-4]
|
|
8
|
+
* Support pnpm lock files
|
|
8
9
|
|
|
9
10
|
## 6.6 ##
|
|
10
11
|
* Add support to `deleteWebsiteVersion(version)`
|
package/index.js
CHANGED
|
@@ -81,9 +81,10 @@ AwsArchitect.prototype.publishLambdaArtifactPromise = AwsArchitect.prototype.Pub
|
|
|
81
81
|
|
|
82
82
|
// (default: true) If set to true, will attempt to copy and install packages related to deployment (i.e. package.json for node)
|
|
83
83
|
if (options.autoHandleCompileOfSourceDirectory !== false) {
|
|
84
|
-
await new LockFinder().findLockFile(this.SourceDirectory)
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const lockFile = await new LockFinder().findLockFile(this.SourceDirectory);
|
|
85
|
+
if (lockFile.file) {
|
|
86
|
+
await fs.copy(lockFile.file, path.join(tmpDir, path.basename(lockFile.file)));
|
|
87
|
+
}
|
|
87
88
|
|
|
88
89
|
try {
|
|
89
90
|
await fs.writeJson(path.join(tmpDir, 'package.json'), this.PackageMetadata);
|
|
@@ -91,8 +92,7 @@ AwsArchitect.prototype.publishLambdaArtifactPromise = AwsArchitect.prototype.Pub
|
|
|
91
92
|
throw { Error: 'Failed writing production package.json file.', Details: error };
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
let cmd = exists ? 'yarn --prod --frozen-lockfile' : 'npm install --production';
|
|
95
|
+
let cmd = lockFile.command;
|
|
96
96
|
await new Promise((resolve, reject) => {
|
|
97
97
|
/* eslint-disable-next-line no-unused-vars */
|
|
98
98
|
exec(cmd, { cwd: tmpDir }, (error, stdout, stderr) => {
|
package/lib/lockFinder.js
CHANGED
|
@@ -3,19 +3,27 @@ let path = require('path');
|
|
|
3
3
|
let fs = require('fs-extra');
|
|
4
4
|
|
|
5
5
|
module.exports = function LockFinder() {
|
|
6
|
-
let findLockFile = directory => {
|
|
6
|
+
let findLockFile = async directory => {
|
|
7
7
|
if (!directory || directory === '/' || directory === '' || directory.match(/^[a-zA-Z]:\\$/)) { return null; }
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
let yarnLockFile = path.join(directory, 'yarn.lock');
|
|
10
10
|
let packageLockFile = path.join(directory, 'package-lock.json');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
let pnpmLockFile = path.join(directory, 'pnpm-lock.yaml');
|
|
12
|
+
try {
|
|
13
|
+
if (await fs.pathExists(yarnLockFile)) {
|
|
14
|
+
return { type: 'yarn', file: yarnLockFile, command: 'yarn --prod --frozen-lockfile' };
|
|
15
|
+
}
|
|
16
|
+
if (await fs.pathExists(packageLockFile)) {
|
|
17
|
+
return { type: 'npm', file: packageLockFile, command: 'npm install --production' };
|
|
18
|
+
}
|
|
19
|
+
if (await fs.pathExists(pnpmLockFile)) {
|
|
20
|
+
return { type: 'pnpm', file: pnpmLockFile, command: 'pnpm --prod --frozen-lockfile' };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return await findLockFile(path.join(directory, '..'));
|
|
24
|
+
} catch (error) {
|
|
25
|
+
return { command: 'npm install --production' };
|
|
26
|
+
}
|
|
19
27
|
};
|
|
20
28
|
|
|
21
29
|
this.findLockFile = findLockFile;
|