@fishawack/lab-env 1.14.0 → 1.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.15.0 (2022-01-17)
4
+ * [Feature] Docker images are now pulled from docker hub if lab-env not running with devDependencies installed
5
+ * [Feature] Added a package.json to the core package in lab-env for more streamlined docker hub publishes
6
+ * [Change] Core image path now defined by new $DIRNAME variable
7
+ * [Change] Ignore fixtures in tests folder as they're cloned repos
8
+
3
9
  ### 1.14.0 (2021-12-03)
4
10
  * [Change] Bumped core `0.0.19` to `0.0.20`
5
11
 
@@ -0,0 +1,5 @@
1
+ version: "3.8"
2
+ services:
3
+ core:
4
+ build:
5
+ context: $DIRNAME/core/${VERSION:-1.0.0}/
@@ -1,10 +1,7 @@
1
1
  version: "3.8"
2
2
  services:
3
3
  core:
4
- build:
5
- context: ../../core/${VERSION:-1.0.0}/
6
- dockerfile: Dockerfile
7
- image: core:${VERSION:-1.0.0}
4
+ image: fishawack/core:${VERSION:-1.0.0}
8
5
  init: true
9
6
  tty: true
10
7
  volumes:
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "core",
3
+ "version": "0.0.20",
4
+ "description": "lab-env docker config for the @fishawack/core npm module",
5
+ "scripts": {
6
+ "postversion": "docker tag fishawack/core:$npm_package_version fishawack/core:latest && docker push fishawack/core:$npm_package_version fishawack/core:latest"
7
+ },
8
+ "author": "Mike Mellor",
9
+ "license": "ISC"
10
+ }
package/globals.js CHANGED
@@ -4,6 +4,8 @@ const { lstatSync, readdirSync, copyFileSync, existsSync } = require('fs');
4
4
  const semver = require('semver');
5
5
  const getPort = require('get-port');
6
6
 
7
+ process.env.DIRNAME = __dirname;
8
+
7
9
  const isDirectory = source => lstatSync(source).isDirectory();
8
10
  const getDirectories = source => readdirSync(source).map(name => path.join(source, name)).filter(isDirectory);
9
11
 
@@ -50,26 +52,34 @@ const version = pkg && pkg.devDependencies && (pkg.devDependencies['@fishawack/c
50
52
  process.env.VERSION = versions[0];
51
53
  // }
52
54
 
55
+ var core = `-f ${__dirname}/core/docker-compose.yml`;
56
+
57
+ // If dev dep installed, then assume running from npm linked local dev version of lab-env and point to build context rather than docker hub
58
+ try {
59
+ require('mocha');
60
+ core = `-f ${__dirname}/core/docker-compose-dev.yml ${core}`;
61
+ } catch(e) {}
62
+
53
63
  if(platform === 'laravel'){
54
64
  if(!existsSync(path.join(process.cwd(), '.env'))){
55
65
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
56
66
  }
57
67
 
58
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/laravel/8/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
68
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/laravel/8/docker-compose.yml ${core} -p ${repo}`;
59
69
  } else if(platform === 'wordpress'){
60
70
  if(!existsSync(path.join(process.cwd(), '.env'))){
61
71
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
62
72
  }
63
73
 
64
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/5.7.2/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
74
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/wordpress/5.7.2/docker-compose.yml ${core} -p ${repo}`;
65
75
  } else if(platform === "drupal"){
66
76
  if(!existsSync(path.join(process.cwd(), '.env'))){
67
77
  copyFileSync(path.join(process.cwd(), '.env.example'), path.join(process.cwd(), '.env'));
68
78
  }
69
79
 
70
- docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
80
+ docker = `docker-compose --env-file ${path.join(process.cwd(), '.env')} -f ${__dirname}/drupal/9/docker-compose.yml ${core} -p ${repo}`;
71
81
  } else {
72
- docker = `docker-compose -f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml -p ${repo}`;
82
+ docker = `docker-compose ${core} -p ${repo}`;
73
83
  }
74
84
 
75
85
  services = execSync(`${docker} ps --services --filter "status=running"`, {encoding: 'utf8'});
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {
7
- "test": "mocha _Test/*.js --timeout 120s --bail",
7
+ "test": "rm -rf _Test/_fixtures && mocha _Test/*.js --timeout 120s --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"