@fishawack/lab-env 2.1.0 → 3.1.0

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 (38) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/_Test/_fixtures/.gitkeep +0 -0
  3. package/_Test/_helpers/globals.js +10 -0
  4. package/_Test/boilerplate-craftcms.js +4 -4
  5. package/_Test/boilerplate-drupal.js +4 -4
  6. package/_Test/boilerplate-laravel.js +4 -4
  7. package/_Test/boilerplate-wordpress.js +4 -4
  8. package/_Test/boilerplate.js +4 -4
  9. package/_Test/check.js +29 -0
  10. package/_Test/key.js +33 -0
  11. package/_Test/provision.js +33 -0
  12. package/cli.js +6 -6
  13. package/commands/check.js +1 -1
  14. package/commands/create/cmds/dekey.js +72 -0
  15. package/commands/create/cmds/deprovision.js +54 -0
  16. package/commands/create/cmds/diagnose.js +15 -3
  17. package/commands/create/cmds/key.js +96 -0
  18. package/commands/create/cmds/provision.js +120 -0
  19. package/commands/create/libs/aws-cloudfront-auth.js +77 -0
  20. package/commands/create/libs/aws-cloudfront-simple.js +51 -0
  21. package/commands/create/libs/utilities.js +51 -2
  22. package/commands/create/services/aws/cloudfront.js +295 -0
  23. package/commands/create/services/aws/iam.js +170 -0
  24. package/commands/create/services/aws/index.js +25 -0
  25. package/commands/create/services/aws/misc.js +9 -0
  26. package/commands/create/services/aws/s3.js +109 -0
  27. package/commands/create/services/guide.js +13 -0
  28. package/commands/docker/rebuild.js +1 -1
  29. package/commands/execute.js +10 -1
  30. package/core/{0.1.0 → 0.2.0}/Dockerfile +8 -4
  31. package/core/{0.1.0 → 0.2.0}/entrypoint.sh +0 -0
  32. package/core/CHANGELOG.md +4 -0
  33. package/core/package.json +3 -2
  34. package/drupal/9/apache/apache.conf +1 -0
  35. package/drupal/9/docker-compose.yml +1 -1
  36. package/drupal/9/php/Dockerfile +1 -1
  37. package/globals.js +31 -1
  38. package/package.json +16 -5
@@ -0,0 +1,170 @@
1
+ const { IAMClient, CreateUserCommand, GetUserCommand, DeleteUserCommand, AttachUserPolicyCommand, ListAttachedUserPoliciesCommand, DetachUserPolicyCommand, CreateAccessKeyCommand, DeleteAccessKeyCommand, ListAccessKeysCommand } = require("@aws-sdk/client-iam");
2
+ const { Spinner } = require('../../libs/utilities');
3
+ const { createClient } = require('./misc.js');
4
+
5
+ module.exports.createIAMUser = async (UserName, account) => {
6
+ const client = createClient(IAMClient, account);
7
+
8
+ let res;
9
+
10
+ try{
11
+ res = await Spinner.prototype.simple(`Creating IAM user ${UserName}`, () => {
12
+ return client.send(
13
+ new CreateUserCommand({ UserName })
14
+ );
15
+ });
16
+ } catch(e){
17
+ res = await Spinner.prototype.simple(`Retrieving the already existing IAM user ${UserName}`, () => {
18
+ return client.send(
19
+ new GetUserCommand({ UserName })
20
+ );
21
+ });
22
+ }
23
+
24
+ return res;
25
+ };
26
+
27
+ module.exports.createFWIAMUser = async (UserName, account) => {
28
+ await module.exports.createIAMUser(UserName, account);
29
+
30
+ await module.exports.syncFWIAMPolicies(UserName, account);
31
+
32
+ let res = await module.exports.createAccessKeySafe(UserName, account);
33
+
34
+ return res;
35
+ };
36
+
37
+ module.exports.removeIAMUser = async (UserName, account) => {
38
+ const client = createClient(IAMClient, account);
39
+
40
+ let res;
41
+
42
+ try{
43
+ await Spinner.prototype.simple(`Checking if IAM user ${UserName} exists`, () => {
44
+ return client.send(
45
+ new GetUserCommand({ UserName })
46
+ );
47
+ });
48
+
49
+ await module.exports.removeAllIAMPolicies(UserName, account);
50
+
51
+ await module.exports.removeAllAccessKeys(UserName, account);
52
+
53
+ res = await Spinner.prototype.simple(`Removing IAM user ${UserName}`, () => {
54
+ return client.send(
55
+ new DeleteUserCommand({ UserName })
56
+ );
57
+ });
58
+ } catch(e){
59
+ }
60
+
61
+ return res;
62
+ };
63
+
64
+ module.exports.attachIAMPolicy = async (UserName, account, policy) => {
65
+ const client = createClient(IAMClient, account);
66
+
67
+ let res = await Spinner.prototype.simple(`Attaching IAM policy ${policy}`, () => {
68
+ return client.send(
69
+ new AttachUserPolicyCommand({ UserName, PolicyArn: policy })
70
+ );
71
+ });
72
+
73
+ return res;
74
+ };
75
+
76
+ module.exports.syncFWIAMPolicies = async (UserName, account) => {
77
+ await module.exports.removeAllIAMPolicies(UserName, account);
78
+ await module.exports.attachIAMPolicy(UserName, account, 'arn:aws:iam::aws:policy/AmazonS3FullAccess');
79
+ await module.exports.attachIAMPolicy(UserName, account, 'arn:aws:iam::aws:policy/CloudFrontFullAccess');
80
+ };
81
+
82
+ module.exports.removeIAMPolicy = async (UserName, account, policy) => {
83
+ const client = createClient(IAMClient, account);
84
+
85
+ let res = await Spinner.prototype.simple(`Detaching IAM policy ${policy}`, () => {
86
+ return client.send(
87
+ new DetachUserPolicyCommand({ UserName, PolicyArn: policy })
88
+ );
89
+ });
90
+
91
+ return res;
92
+ };
93
+
94
+ module.exports.listIAMPolicies = async (UserName, account) => {
95
+ const client = createClient(IAMClient, account);
96
+
97
+ let res = await Spinner.prototype.simple(`Listing IAM policies`, () => {
98
+ return client.send(
99
+ new ListAttachedUserPoliciesCommand({ UserName })
100
+ );
101
+ });
102
+
103
+ return res;
104
+ };
105
+
106
+ module.exports.removeAllIAMPolicies = async (UserName, account) => {
107
+ let res = await module.exports.listIAMPolicies(UserName, account);
108
+
109
+ for(let i = 0; i < res.AttachedPolicies.length; i++){
110
+ await module.exports.removeIAMPolicy(UserName, account, res.AttachedPolicies[i].PolicyArn);
111
+ }
112
+
113
+ return res;
114
+ };
115
+
116
+ module.exports.createAccessKey = async (UserName, account) => {
117
+ const client = createClient(IAMClient, account);
118
+
119
+ let res = await Spinner.prototype.simple(`Creating access key`, () => {
120
+ return client.send(
121
+ new CreateAccessKeyCommand({ UserName })
122
+ );
123
+ });
124
+
125
+ return res;
126
+ };
127
+
128
+ module.exports.removeAccessKey = async (UserName, account, AccessKeyId) => {
129
+ const client = createClient(IAMClient, account);
130
+
131
+ let res = await Spinner.prototype.simple(`Removing access key ${AccessKeyId}`, () => {
132
+ return client.send(
133
+ new DeleteAccessKeyCommand({ AccessKeyId, UserName })
134
+ );
135
+ });
136
+
137
+ return res;
138
+ };
139
+
140
+ module.exports.listAccessKeys = async (UserName, account) => {
141
+ const client = createClient(IAMClient, account);
142
+
143
+ let res = await Spinner.prototype.simple(`Listing access keys`, () => {
144
+ return client.send(
145
+ new ListAccessKeysCommand({ UserName })
146
+ );
147
+ });
148
+
149
+ return res;
150
+ };
151
+
152
+ module.exports.removeAllAccessKeys = async (UserName, account) => {
153
+ let res = await module.exports.listAccessKeys(UserName, account);
154
+
155
+ for(let i = 0; i < res.AccessKeyMetadata.length; i++){
156
+ await module.exports.removeAccessKey(UserName, account, res.AccessKeyMetadata[i].AccessKeyId);
157
+ }
158
+
159
+ return res;
160
+ };
161
+
162
+ module.exports.createAccessKeySafe = async (UserName, account) => {
163
+ let res = await module.exports.listAccessKeys(UserName, account);
164
+
165
+ if(!res.AccessKeyMetadata.length){
166
+ res = await module.exports.createAccessKey(UserName, account);
167
+ }
168
+
169
+ return res;
170
+ };
@@ -0,0 +1,25 @@
1
+ module.exports.s3 = require("./s3.js");
2
+ module.exports.cloudfront = require("./cloudfront.js");
3
+ module.exports.iam = require("./iam.js");
4
+
5
+ module.exports.slug = (repo, client, branch) => `fw-auto-${client}-${repo}-${branch}`;
6
+
7
+ module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training'];
8
+
9
+ module.exports.static = async (name, account, tags = [], credentials = []) => {
10
+ let s3 = await module.exports.s3.createS3Bucket(name, account, tags);
11
+
12
+ let cloudfrontFunction = await module.exports.cloudfront.createCloudFrontFunction(name, account, credentials.length ? 'aws-cloudfront-auth' : 'aws-cloudfront-simple', {credentials: credentials.map(d => `Basic ${Buffer.from(`${d.username}:${d.password}`).toString('base64')}`)});
13
+
14
+ let cloudfront = await module.exports.cloudfront.createCloudFrontDistribution(name, account, tags, cloudfrontFunction.FunctionSummary.FunctionMetadata.FunctionARN);
15
+
16
+ await module.exports.s3.setS3BucketPolicy(name, account, cloudfront.Distribution.DistributionConfig.Origins.Items[0].S3OriginConfig.OriginAccessIdentity.split('origin-access-identity/cloudfront/')[1]);
17
+
18
+ let config = {
19
+ "bucket": s3.Location,
20
+ "url": `https://${cloudfront.Distribution.DomainName}`,
21
+ "cloudfront": cloudfront.Distribution.Id,
22
+ };
23
+
24
+ return config;
25
+ }
@@ -0,0 +1,9 @@
1
+ module.exports.createClient = (client, account, region = 'us-east-1') => {
2
+ delete process.env.AWS_PROFILE;
3
+
4
+ if(account){
5
+ process.env.AWS_PROFILE = account;
6
+ }
7
+
8
+ return new client({ region });
9
+ }
@@ -0,0 +1,109 @@
1
+ const { S3Client, CreateBucketCommand, DeleteBucketCommand, ListBucketsCommand, PutPublicAccessBlockCommand, PutBucketTaggingCommand, PutBucketPolicyCommand, PutObjectCommand, DeleteObjectCommand } = require("@aws-sdk/client-s3");
2
+ const { Spinner } = require('../../libs/utilities');
3
+ const { createClient } = require('./misc.js');
4
+
5
+ module.exports.createS3Bucket = async (bucket, account, tags = []) => {
6
+ const client = createClient(S3Client, account);
7
+
8
+ let res = await Spinner.prototype.simple(`Creating s3 bucket ${bucket}`, () => {
9
+ return client.send(
10
+ new CreateBucketCommand({ Bucket: bucket })
11
+ );
12
+ });
13
+
14
+ await Spinner.prototype.simple(`Blocking all public access to s3 bucket`, () => {
15
+ return client.send(
16
+ new PutPublicAccessBlockCommand({ Bucket: bucket, PublicAccessBlockConfiguration: { BlockPublicAcls: true, BlockPublicPolicy: true, IgnorePublicAcls: true, RestrictPublicBuckets: true } })
17
+ );
18
+ });
19
+
20
+ await Spinner.prototype.simple(`Adding tags to s3 bucket`, () => {
21
+ return client.send(
22
+ new PutBucketTaggingCommand({ Bucket: bucket, Tagging: {TagSet: [{Key: 'client', Value: account}].concat(tags)} })
23
+ );
24
+ });
25
+
26
+ return res;
27
+ }
28
+
29
+ module.exports.listS3Buckets = async (account) => {
30
+ const client = createClient(S3Client, account);
31
+
32
+ let res = await Spinner.prototype.simple(`Listing s3 buckets`, () => {
33
+ return client.send(
34
+ new ListBucketsCommand({})
35
+ );
36
+ });
37
+
38
+ return res;
39
+ }
40
+
41
+ module.exports.removeS3Bucket = async (bucket, account) => {
42
+ const client = createClient(S3Client, account);
43
+
44
+ await Spinner.prototype.simple(`Removing s3 bucket ${bucket}`, () => {
45
+ return client.send(
46
+ new DeleteBucketCommand({ Bucket: bucket })
47
+ );
48
+ });
49
+ }
50
+
51
+ module.exports.setS3BucketPolicy = async (bucket, account, OAI) => {
52
+ const client = createClient(S3Client, account);
53
+
54
+ let res = await Spinner.prototype.simple(`Updating s3 bucket policy`, () => {
55
+ return client.send(
56
+ new PutBucketPolicyCommand({
57
+ Bucket: bucket,
58
+ Policy: JSON.stringify({
59
+ "Version": "2008-10-17",
60
+ "Id": "PolicyForCloudFrontPrivateContent",
61
+ "Statement": [
62
+ {
63
+ "Sid": "1",
64
+ "Effect": "Allow",
65
+ "Principal": {
66
+ "AWS": `arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${OAI}`
67
+ },
68
+ "Action": "s3:GetObject",
69
+ "Resource": `arn:aws:s3:::${bucket}/*`
70
+ }
71
+ ]
72
+ })
73
+ })
74
+ );
75
+ });
76
+
77
+ return res;
78
+ }
79
+
80
+ module.exports.addFileToS3Bucket = async (bucket, account, filepath, file) => {
81
+ const client = createClient(S3Client, account);
82
+
83
+ let res = await Spinner.prototype.simple(`Adding file to s3 bucket`, () => {
84
+ return client.send(
85
+ new PutObjectCommand({
86
+ Bucket: bucket,
87
+ Body: file,
88
+ Key: filepath
89
+ })
90
+ );
91
+ });
92
+
93
+ return res;
94
+ };
95
+
96
+ module.exports.removeFileToS3Bucket = async (bucket, account, filepath) => {
97
+ const client = createClient(S3Client, account);
98
+
99
+ let res = await Spinner.prototype.simple(`Removing file from s3 bucket`, () => {
100
+ return client.send(
101
+ new DeleteObjectCommand({
102
+ Bucket: bucket,
103
+ Key: filepath
104
+ })
105
+ );
106
+ });
107
+
108
+ return res;
109
+ }
@@ -194,6 +194,19 @@ module.exports.preset = async () => {
194
194
  return inputs.preset;
195
195
  }
196
196
 
197
+ module.exports.gitlabSkip = async () => {
198
+ let inputs = await inquirer.prompt([
199
+ {
200
+ type: 'confirm',
201
+ name: 'confirm',
202
+ message: 'Do you want to test gitlab setup? (VPN required)',
203
+ default: true
204
+ }
205
+ ]);
206
+
207
+ return !inputs.confirm;
208
+ }
209
+
197
210
  module.exports.config = async () => {
198
211
  let inputs = await inquirer.prompt([
199
212
  {
@@ -11,5 +11,5 @@ module.exports = [
11
11
  default: ''
12
12
  });
13
13
  },
14
- argv => execSync(`${_.docker} build ${argv.image} --no-cache`, _.opts)
14
+ argv => execSync(`${_.docker} build --no-cache ${argv.image}`, _.opts)
15
15
  ];
@@ -16,6 +16,15 @@ module.exports = [
16
16
  describe: 'Run with a virtual display',
17
17
  type: 'boolean'
18
18
  });
19
+
20
+ yargs.option('grunt', {
21
+ alias: 'g',
22
+ describe: 'Execute a grunt command',
23
+ type: 'boolean'
24
+ });
19
25
  },
20
- argv => execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}${argv.command.join(' ')}"`, _.opts)
26
+ argv => {
27
+ const prep = argv.g ? '$grunt ' : ' ';
28
+ execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}${prep}${argv.command.join(prep)}"`, _.opts)
29
+ }
21
30
  ];
@@ -37,6 +37,9 @@ RUN npm install grunt-cli -g
37
37
  # Install package.json checker
38
38
  RUN npm install check-dependencies -g
39
39
 
40
+ # Install node_modules checker
41
+ RUN npm install are-you-es5 -g
42
+
40
43
  # Install imagemagick
41
44
  RUN apt-get update && apt-get install -y imagemagick
42
45
 
@@ -105,7 +108,7 @@ RUN apt-get update
105
108
 
106
109
  # Specific chrome version
107
110
  # Check available versions here: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
108
- ARG CHROME_VERSION="87.0.4280.141-1"
111
+ ARG CHROME_VERSION="105.0.5195.102-1"
109
112
  RUN wget --no-verbose -O /tmp/chrome.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
110
113
  RUN apt install -y /tmp/chrome.deb
111
114
 
@@ -185,10 +188,11 @@ npm(){(\n\
185
188
  sed -i \'s/watchTask: true,/watchTask: true,watchOptions: { usePolling: true },port: process.env.PORT || 3000, ui: {port: +process.env.PORT_OPT || 3001},/g\' $PWD/node_modules/@fishawack/core/_Tasks/options/browserSync.js 2>/dev/null || true\n\
186
189
  sed -i \'s/watchTask: true,/watchTask: true,watchOptions: { usePolling: true },port: process.env.PORT || 3000, ui: {port: +process.env.PORT_OPT || 3001},/g\' $PWD/node_modules/@fishawack/config-grunt/_Tasks/options/browserSync.js 2>/dev/null || true\n\
187
190
  echo "Overwrite webdriver browsers to fix them to specific browser versions"\n\
188
- sed -i \'s/exports.config = {.*/exports.config = { seleniumArgs: { drivers: {chrome: { version: "87.0.4280.88" },firefox: { version: "0.28.0" }} },/\' $PWD/node_modules/@fishawack/core/wdio.conf.js 2>/dev/null || true\n\
189
- sed -i \'s/exports.config = {.*/exports.config = { seleniumArgs: { drivers: {chrome: { version: "87.0.4280.88" },firefox: { version: "0.28.0" }} },/\' $PWD/node_modules/@fishawack/config-grunt/wdio.conf.js 2>/dev/null || true\n\
191
+ sed -i \'s/exports.config = {.*/exports.config = { seleniumArgs: { drivers: {chrome: { version: "105.0.5195.52" },firefox: { version: "0.28.0" }} },/\' $PWD/node_modules/@fishawack/core/wdio.conf.js 2>/dev/null || true\n\
192
+ sed -i \'s/exports.config = {.*/exports.config = { seleniumArgs: { drivers: {chrome: { version: "105.0.5195.52" },firefox: { version: "0.28.0" }} },/\' $PWD/node_modules/@fishawack/config-grunt/wdio.conf.js 2>/dev/null || true\n\
193
+ sed -i \'s/87.0.4280.88/105.0.5195.52/\' $PWD/node_modules/@fishawack/core/wdio.conf.js 2>/dev/null || true\n\
190
194
  sed -i \'s/puppeteer.launch({headless: true}).*/puppeteer.launch({headless: true, args: [ "--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage" ]}).then(async browser => {/\' $PWD/node_modules/sprinkle/bin/commands/screenshots.js 2>/dev/null || true\n\
191
- npx --no-install selenium-standalone --singleDriverInstall=chrome install --drivers.chrome.version=87.0.4280.88 2>/dev/null || true\n\
195
+ npx --no-install selenium-standalone --singleDriverInstall=chrome install --drivers.chrome.version=105.0.5195.52 2>/dev/null || true\n\
192
196
  npx --no-install selenium-standalone --singleDriverInstall=firefox install --drivers.firefox.version=0.28.0 2>/dev/null || true\n\
193
197
  export OVERRIDE=true\n\
194
198
  else\n\
File without changes
package/core/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.2.0 (2022-09-08)
4
+ * [Feature] are-you-es5 dependency now globally installed with npm
5
+ * [Fix] core now points to google-chrome 105 now that 87 is no longer available to download through the image
6
+
3
7
  ### 0.1.0 (2022-05-27)
4
8
  * [Feature] Added aws-cli@2 to core container
package/core/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "lab-env docker config for the @fishawack/core npm module",
5
5
  "scripts": {
6
- "postversion": "mv ./*/ ./$npm_package_version && docker build ./*/ -t fishawack/core:$npm_package_version -t fishawack/core:latest && docker push fishawack/core:$npm_package_version && docker push fishawack/core:latest && git add . && git commit -m 'Bumped core to $npm_package_version'"
6
+ "preversion": "docker login",
7
+ "postversion": "mv ./*/ ./$npm_package_version && docker build ./*/ -t fishawack/core:$npm_package_version --platform linux/amd64 -t fishawack/core:latest && docker push fishawack/core:$npm_package_version && docker push fishawack/core:latest && git add . && git commit -m 'Bumped core to $npm_package_version'"
7
8
  },
8
9
  "author": "Mike Mellor",
9
10
  "license": "ISC"
@@ -1,3 +1,4 @@
1
+ Mutex posixsem
1
2
  LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
2
3
 
3
4
  <VirtualHost *:8080>
@@ -36,7 +36,7 @@ services:
36
36
  build:
37
37
  context: ./php/
38
38
  dockerfile: Dockerfile
39
- image: lab-env/drupal/9/php:0.0.3
39
+ image: lab-env/drupal/9/php:0.0.4
40
40
  init: true
41
41
  working_dir: /app
42
42
  networks:
@@ -1,4 +1,4 @@
1
- FROM chialab/php:7.4-fpm
1
+ FROM chialab/php:8.1-fpm
2
2
 
3
3
  MAINTAINER Mike Mellor
4
4
 
package/globals.js CHANGED
@@ -1,15 +1,19 @@
1
1
  const execSync = require('child_process').execSync;
2
2
  const path = require('path');
3
- const { lstatSync, readdirSync, copyFileSync, existsSync } = require('fs');
3
+ const { lstatSync, readdirSync, copyFileSync, existsSync, readFileSync } = require('fs');
4
4
  const semver = require('semver');
5
5
  const getPort = require('get-port');
6
6
  const utilities = require('./commands/create/libs/utilities');
7
+ const os = require('os');
8
+ const { hideBin } = require('yargs/helpers');
9
+ const args = hideBin(process.argv);
7
10
 
8
11
  process.env.DIRNAME = __dirname;
9
12
 
10
13
  const isDirectory = source => lstatSync(source).isDirectory();
11
14
  const getDirectories = source => readdirSync(source).map(name => path.join(source, name)).filter(isDirectory);
12
15
 
16
+ var config;
13
17
  var repo;
14
18
  var platform;
15
19
  var pkg;
@@ -20,8 +24,31 @@ var run;
20
24
  var exec;
21
25
  var running;
22
26
  var services;
27
+ var branch;
28
+ var diagnosis = '1.0.0';
23
29
  var opts = {encoding: 'utf8', stdio: 'inherit', shell: '/bin/bash'};
24
30
 
31
+ try{
32
+ config = JSON.parse(readFileSync(`${os.homedir()}/.lab-env`, {encoding: 'utf8'}));
33
+ } catch(e){
34
+ config = {};
35
+ }
36
+
37
+ if(args[0] !== 'diag' && args[0] !== 'diagnose'){
38
+ if(!config.diagnosis || semver.diff(config.diagnosis, diagnosis) === 'major'){
39
+ console.log(`${utilities.colorize(`@fishawack/lab-env`, 'title')} diagnosis is ${utilities.colorize(`outdated`, 'error')}.\n\nRun ${utilities.colorize(`fw diagnose`, 'success')} to reconfigure.`);
40
+ process.exit(1);
41
+ } else if(semver.diff(config.diagnosis, diagnosis) !== null){
42
+ console.log(`${utilities.colorize(`@fishawack/lab-env`, 'title')} diagnosis is ${utilities.colorize(`outdated`, 'warning')}.\n\nRun ${utilities.colorize(`fw diagnose`, 'success')} to reconfigure.`);
43
+ }
44
+ }
45
+
46
+ try{
47
+ branch = process.env.BRANCH || process.env.CI_COMMIT_REF_NAME || require('git-branch').sync();
48
+ } catch(e){
49
+ branch = 'unknown';
50
+ }
51
+
25
52
  try{
26
53
  repo = execSync('basename "$(git rev-parse --show-toplevel)"', {encoding: 'utf8', stdio: 'pipe'}).trim() || path.basename(process.cwd());
27
54
  } catch(e){
@@ -110,9 +137,12 @@ try{
110
137
  }
111
138
 
112
139
  module.exports = {
140
+ config,
141
+ diagnosis,
113
142
  services,
114
143
  platform,
115
144
  repo,
145
+ branch,
116
146
  repo_safe: repo.replace(/\./g, ''),
117
147
  pkg,
118
148
  docker,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "2.1.0",
3
+ "version": "3.1.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {
7
- "test": "rm -rf _Test/_fixtures && mkdir _Test/_fixtures && mocha _Test/*.js --timeout 120s --bail",
7
+ "test": "rm -rf _Test/_fixtures/boilerplate*; mocha _Test/*.js --timeout 1200s --bail",
8
8
  "preversion": "npm test",
9
9
  "postversion": "git push && git push --tags && npm publish",
10
10
  "postpublish": "git checkout development && git merge master && git push"
@@ -16,23 +16,34 @@
16
16
  "author": "",
17
17
  "license": "ISC",
18
18
  "homepage": "https://bitbucket.org/fishawackdigital/lab-env#readme",
19
+ "type": "commonjs",
19
20
  "bin": {
20
21
  "lab-env": "./cli.js",
21
22
  "fw": "./cli.js"
22
23
  },
23
24
  "dependencies": {
24
- "axios": "0.21.1",
25
+ "@aws-sdk/client-cloudfront": "^3.141.0",
26
+ "@aws-sdk/client-iam": "^3.150.0",
27
+ "@aws-sdk/client-s3": "^3.141.0",
28
+ "axios": "^0.21.4",
25
29
  "chalk": "4.1.0",
30
+ "generate-password": "^1.7.0",
26
31
  "get-port": "5.1.1",
32
+ "git-branch": "^2.0.1",
27
33
  "glob": "7.1.7",
28
34
  "inquirer": "8.1.2",
29
35
  "ora": "5.4.1",
30
36
  "semver": "7.3.4",
31
- "update-notifier": "5.1.0",
37
+ "update-notifier": "^6.0.2",
32
38
  "yargs": "16.2.0"
33
39
  },
34
40
  "devDependencies": {
35
41
  "chai": "4.3.4",
36
- "mocha": "9.1.2"
42
+ "mocha": "^9.2.2",
43
+ "node-fetch": "^3.2.10"
44
+ },
45
+ "engines": {
46
+ "npm": ">=8",
47
+ "node": ">=18"
37
48
  }
38
49
  }