@fishawack/lab-env 4.10.0 → 4.11.1
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 +18 -0
- package/_Test/_fixtures/core@0/_Build/config/level-0.json +4 -0
- package/_Test/_fixtures/core@0/package.json +7 -0
- package/_Test/_fixtures/core@1/_Build/config/level-0.json +4 -0
- package/_Test/_fixtures/core@1/package.json +7 -0
- package/_Test/bash.js +74 -0
- package/commands/check.js +1 -1
- package/commands/clean.js +1 -1
- package/commands/connect.js +14 -1
- package/commands/content.js +1 -1
- package/commands/deploy.js +1 -1
- package/commands/docker/mocha.js +1 -1
- package/commands/execute.js +2 -2
- package/commands/install.js +1 -1
- package/commands/npm.js +1 -1
- package/commands/production.js +1 -1
- package/commands/regenerate.js +1 -1
- package/commands/reinstall.js +1 -1
- package/commands/run.js +1 -1
- package/commands/setup.js +1 -1
- package/commands/start.js +12 -2
- package/commands/test.js +9 -1
- package/commands/uninstall.js +1 -1
- package/commands/watch.js +1 -1
- package/core/0/docker-compose-dev.yml +1 -1
- package/core/1/docker-compose-dev.yml +2 -1
- package/globals.js +11 -6
- package/package.json +2 -2
- package/_Test/_fixtures/.gitkeep +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 4.11.1 (2023-02-25)
|
|
4
|
+
* [Bug] coerce core version to remove tilde/carats
|
|
5
|
+
|
|
6
|
+
### 4.11.0 (2023-02-24)
|
|
7
|
+
* [Feature] target now specified in core@1 so it defaults to alpine when building
|
|
8
|
+
* [Change] don't pass -l flag to core@1 connect
|
|
9
|
+
* [Change] dont pass -l login flag to core@1 commands so root $PATH isnt reset
|
|
10
|
+
* [Bug] set CI flag during tests to avoid non tty prompt
|
|
11
|
+
* [Bug] check for core in dependencies too
|
|
12
|
+
* [Bug] allow certain commands to pass through mismatch core
|
|
13
|
+
* [Bug] use full expaned $grunt alias so it isn't needed inside the image as ENV variable
|
|
14
|
+
* [Bug] only set user on connect during exec calls and not run calls
|
|
15
|
+
* [Bug] set -u node on core@1 exec commands
|
|
16
|
+
* [Bug] dont set -l flag on start and test core exec command unless on core@0
|
|
17
|
+
* [Bug] use $DIRNAME on dev build contexts as codebases that use core as partial context for compose file have PWD elsewhere
|
|
18
|
+
* [Bug] commands that automatically prefixed xvfb-run now only do in on core@0
|
|
19
|
+
* [Bug] xvfb-run automated prefix is now only applied to core@0 commands
|
|
20
|
+
|
|
3
21
|
### 4.10.0 (2023-02-21)
|
|
4
22
|
* [Feature] Created core@1 image for @fishawack/core projects >= 8
|
|
5
23
|
* [Feature] New env variables for changing lab-env behaviour, FW_DEV, FW_NEXT, FW_FULL, FW_ROOT
|
package/_Test/bash.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const expect = require('chai').expect;
|
|
4
|
+
const execSync = require('child_process').execSync;
|
|
5
|
+
|
|
6
|
+
describe('bash', () => {
|
|
7
|
+
describe('core@0', () => {
|
|
8
|
+
const repo = `core@0`;
|
|
9
|
+
const cwd = {cwd: `_Test/_fixtures/${repo}`};
|
|
10
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: cwd.cwd};
|
|
11
|
+
|
|
12
|
+
describe('run', () => {
|
|
13
|
+
it(`Should show correct user when executing commands`, () => {
|
|
14
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('root');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
18
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain('ebcli-virtual-env');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('exec', () => {
|
|
23
|
+
before(() => {
|
|
24
|
+
execSync('node ../../../cli.js up -d', opts);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it(`Should show correct user when executing commands`, () => {
|
|
28
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('root');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
32
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain('ebcli-virtual-env');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
after(() => {
|
|
36
|
+
execSync('node ../../../cli.js down', opts);
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('core@1', () => {
|
|
42
|
+
const repo = `core@1`;
|
|
43
|
+
const cwd = {cwd: `_Test/_fixtures/${repo}`};
|
|
44
|
+
const opts = {encoding: 'utf8', stdio: 'inherit', cwd: cwd.cwd};
|
|
45
|
+
|
|
46
|
+
describe('run', () => {
|
|
47
|
+
it(`Should show correct user when executing commands`, () => {
|
|
48
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('node');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
52
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain(':/dart-sass/');
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('exec', () => {
|
|
57
|
+
before(() => {
|
|
58
|
+
execSync('node ../../../cli.js up -d', opts);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it(`Should show correct user when executing commands`, () => {
|
|
62
|
+
expect(execSync('node ../../../cli.js exec whoami', cwd).toString()).to.contain('node');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it(`Should have cli tools in $PATH`, () => {
|
|
66
|
+
expect(execSync('node ../../../cli.js exec "env | grep PATH"', cwd).toString()).to.contain(':/dart-sass/');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
after(() => {
|
|
70
|
+
execSync('node ../../../cli.js down', opts);
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
package/commands/check.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = [
|
|
|
13
13
|
});
|
|
14
14
|
},
|
|
15
15
|
argv => {
|
|
16
|
-
execSync(`${_.docker} ${_.run}c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; } && are-you-es5 check . && echo -e '\\033[0;32mNpm-ES5 compatibility OK\\033[0m' || { echo -e '\\033[0;31mNpm-ES5 incompatibilities detected\\033[0m'; }"`, _.opts);
|
|
16
|
+
execSync(`${_.docker} ${_.run} -c "check-dependencies ${argv.v ? '' : '&>/dev/null'} && echo -e '\\033[0;32mNpm deps OK\\033[0m' || { echo -e '\\033[0;31mNpm deps missing or outdated\\033[0m'; } && are-you-es5 check . && echo -e '\\033[0;32mNpm-ES5 compatibility OK\\033[0m' || { echo -e '\\033[0;31mNpm-ES5 incompatibilities detected\\033[0m'; }"`, _.opts);
|
|
17
17
|
|
|
18
18
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
19
19
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install --dry-run ${argv.v ? '' : '2>&1'} | grep -q 'Nothing to install, update or remove' && echo -e '\\033[0;32mComposer deps OK\\033[0m' || echo -e '\\033[0;31mComposer deps missing or outdated\\033[0m'"`, _.opts);
|
package/commands/clean.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'cleans out dependencies',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "git clean -xfd node_modules/ 2>/dev/null || true"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "git clean -xfd vendor/ 2>/dev/null || true"`, _.opts);
|
package/commands/connect.js
CHANGED
|
@@ -11,5 +11,18 @@ module.exports = [
|
|
|
11
11
|
default: 'core'
|
|
12
12
|
});
|
|
13
13
|
},
|
|
14
|
-
argv =>
|
|
14
|
+
argv => {
|
|
15
|
+
let run = ' -l';
|
|
16
|
+
let user = '';
|
|
17
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
18
|
+
if(argv.container === "core" && process.env.VERSION === "1"){
|
|
19
|
+
run = '';
|
|
20
|
+
|
|
21
|
+
if(_.running){
|
|
22
|
+
user = ' -u node';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
execSync(`${_.docker} ${_.method}${user} ${argv.container} bash${run}`, _.opts);
|
|
27
|
+
}
|
|
15
28
|
];
|
package/commands/content.js
CHANGED
package/commands/deploy.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = [
|
|
|
10
10
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/deploy.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
|
-
execSync(`${_.docker} ${_.run}c "xvfb-run npm run deploy"`, _.opts);
|
|
13
|
+
execSync(`${_.docker} ${_.run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run deploy"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
];
|
package/commands/docker/mocha.js
CHANGED
package/commands/execute.js
CHANGED
|
@@ -26,7 +26,7 @@ module.exports = [
|
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
28
|
argv => {
|
|
29
|
-
const prep = argv.g ? '
|
|
30
|
-
execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}${prep}${argv.command.join(prep)}"`, _.opts)
|
|
29
|
+
const prep = argv.g ? 'npx grunt --gruntfile node_modules/@fishawack/core/Gruntfile.js ' : ' ';
|
|
30
|
+
execSync(`${_.docker} ${_.run} -c "${argv.d ? 'xvfb-run ' : ''}${prep}${argv.command.join(prep)}"`, _.opts)
|
|
31
31
|
}
|
|
32
32
|
];
|
package/commands/install.js
CHANGED
package/commands/npm.js
CHANGED
package/commands/production.js
CHANGED
|
@@ -6,5 +6,5 @@ module.exports = [
|
|
|
6
6
|
['production', 'prod'],
|
|
7
7
|
'builds for production',
|
|
8
8
|
yargs => {},
|
|
9
|
-
argv => execSync(`${_.docker} ${_.run}c "xvfb-run npm run production"`, _.opts)
|
|
9
|
+
argv => execSync(`${_.docker} ${_.run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run production"`, _.opts)
|
|
10
10
|
];
|
package/commands/regenerate.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'regenerates dependency lock files',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "rm composer.lock; git clean -xfd vendor/ 2>/dev/null || true; composer install"`, _.opts)
|
package/commands/reinstall.js
CHANGED
|
@@ -7,7 +7,7 @@ module.exports = [
|
|
|
7
7
|
'installs fresh dependencies',
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
|
-
execSync(`${_.docker} ${_.run}c "npm ci || npm i"`, _.opts);
|
|
10
|
+
execSync(`${_.docker} ${_.run} -c "npm ci || npm i"`, _.opts);
|
|
11
11
|
|
|
12
12
|
if(_.platform === "laravel" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
13
13
|
execSync(`${_.docker} ${_.method} php bash -lc "composer install"`, _.opts);
|
package/commands/run.js
CHANGED
|
@@ -24,5 +24,5 @@ module.exports = [
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
argv => execSync(`${_.docker} ${_.run}c "${argv.d ? 'xvfb-run ' : ''}npm run ${argv.command} -- -- ${argv.flags.join(' ')}"`, _.opts)
|
|
27
|
+
argv => execSync(`${_.docker} ${_.run} -c "${argv.d ? 'xvfb-run ' : ''}npm run ${argv.command} -- -- ${argv.flags.join(' ')}"`, _.opts)
|
|
28
28
|
];
|
package/commands/setup.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = [
|
|
|
10
10
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
11
11
|
_.up(() => execSync(`source ${__dirname}/../intercept.sh && /bin/bash ./_Scripts/setup.sh`, _.opts));
|
|
12
12
|
} else {
|
|
13
|
-
execSync(`${_.docker} ${_.run}c "npm run setup"`, _.opts);
|
|
13
|
+
execSync(`${_.docker} ${_.run} -c "npm run setup"`, _.opts);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
];
|
package/commands/start.js
CHANGED
|
@@ -15,9 +15,19 @@ module.exports = [
|
|
|
15
15
|
_.ports.get();
|
|
16
16
|
|
|
17
17
|
if(_.platform === "laravel" || _.platform === "wordpress" || _.platform === "drupal" || _.platform === "craftcms"){
|
|
18
|
-
_.up(() =>
|
|
18
|
+
_.up(() => {
|
|
19
|
+
let run = ' -l';
|
|
20
|
+
let user = '';
|
|
21
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
22
|
+
if(process.env.VERSION === "1"){
|
|
23
|
+
run = '';
|
|
24
|
+
user = ' -u node';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
execSync(`${_.docker} ${_.exec}${user} core bash${run} -c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
28
|
+
});
|
|
19
29
|
} else {
|
|
20
|
-
execSync(`${_.docker} ${_.run}c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
30
|
+
execSync(`${_.docker} ${_.run} -c "npm start -- -- ${argv.flags.join(' ')}" 2>/dev/null`, _.opts);
|
|
21
31
|
}
|
|
22
32
|
}
|
|
23
33
|
];
|
package/commands/test.js
CHANGED
|
@@ -8,7 +8,15 @@ module.exports = [
|
|
|
8
8
|
yargs => {},
|
|
9
9
|
argv => {
|
|
10
10
|
_.up(() => {
|
|
11
|
-
|
|
11
|
+
let run = ' -l';
|
|
12
|
+
let user = '';
|
|
13
|
+
// Don't login on core@1 so /etc/profile isn't loaded and $PATH reset (likely don't need to login on anything other than core@0 but need test suite to check)
|
|
14
|
+
if(process.env.VERSION === "1"){
|
|
15
|
+
run = '';
|
|
16
|
+
user = ' -u node';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
execSync(`${_.docker} ${_.exec}${user} core bash${run} -c "${(process.env.VERSION === "0") ? 'xvfb-run ' : ''}npm run test"`, _.opts);
|
|
12
20
|
|
|
13
21
|
if(_.platform === "laravel"){
|
|
14
22
|
execSync(`${_.docker} ${_.exec} php bash -lc "php artisan test"`, _.opts);
|
package/commands/uninstall.js
CHANGED
package/commands/watch.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = [
|
|
|
14
14
|
){
|
|
15
15
|
console.log("Watch command not supported in this project");
|
|
16
16
|
} else {
|
|
17
|
-
execSync(`${_.docker} ${_.run}c "$grunt browserSync watch" 2>/dev/null`, _.opts)
|
|
17
|
+
execSync(`${_.docker} ${_.run} -c "$grunt browserSync watch" 2>/dev/null`, _.opts)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
];
|
package/globals.js
CHANGED
|
@@ -77,18 +77,20 @@ if(composer && composer.require && composer.require['laravel/framework']){
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
const versions = getDirectories(path.resolve(__dirname, './core')).map(d => path.basename(d)).sort((a, b) => +a - +b);
|
|
80
|
-
const version = pkg && pkg.devDependencies && (
|
|
80
|
+
const version = semver.coerce(pkg && ((pkg.devDependencies && (pkg.devDependencies['@fishawack/core'] || pkg.devDependencies['@fishawack/config-grunt'])) || (pkg.dependencies && (pkg.dependencies['@fishawack/core'] || pkg.dependencies['@fishawack/config-grunt'])) || pkg.name === '@fishawack/core' && pkg.version))?.version;
|
|
81
81
|
|
|
82
82
|
if(process.env.FW_NEXT){
|
|
83
83
|
process.env.VERSION = versions[versions.length - 1];
|
|
84
84
|
} else if(semver.satisfies(version, '<=7.24.0')){
|
|
85
85
|
process.env.VERSION = '0';
|
|
86
|
-
} else if(semver.satisfies(version, '
|
|
86
|
+
} else if(semver.satisfies(version, '8.x')) {
|
|
87
87
|
process.env.VERSION = '1';
|
|
88
88
|
} else {
|
|
89
|
-
if(
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if(args[0] !== 'diag' && args[0] !== 'diagnose' && args[0] !== 'origin' && args[0] !== '--version' && args[0] !== '--help' && args[0] !== 'new' && args[0] !== 'key' && args[0] !== 'dekey'){
|
|
90
|
+
if(!args.find(d => d === '--force')){
|
|
91
|
+
console.log(`${utilities.colorize(`@fishawack/core`, 'title')} and ${utilities.colorize(`@fishawack/lab-env`, 'title')} have mismatching versions.\n\nRun ${utilities.colorize(`npm i -g @fishawack/lab-env@latest`, 'success')} or pass ${utilities.colorize(`--force`, 'warning')} to continue.`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
// Default to latest image when outside of known core versions
|
|
@@ -98,6 +100,7 @@ if(process.env.FW_NEXT){
|
|
|
98
100
|
// Map full image or alpine
|
|
99
101
|
if(process.env.FW_FULL){
|
|
100
102
|
process.env.FW_CORE_1_IMAGE = "fishawack/lab-env-core-1";
|
|
103
|
+
process.env.FW_CORE_1_TARGET = "full";
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
var core = `-f ${__dirname}/core/${process.env.VERSION}/docker-compose.yml`;
|
|
@@ -155,7 +158,9 @@ try{
|
|
|
155
158
|
running = services.trim().length;
|
|
156
159
|
exec = `exec ${process.env.CI_BUILD_ID ? '-T' : ''}`;
|
|
157
160
|
method = running ? exec : 'run --rm --service-ports';
|
|
158
|
-
|
|
161
|
+
// Set user on exec command using core@1
|
|
162
|
+
// Login on core@0 so .bash_profile is loaded
|
|
163
|
+
run = `${method} ${(running && process.env.VERSION === "1") ? '-u node ' : ''}core bash${(process.env.VERSION === "0") ? ' -l' : ''}`;
|
|
159
164
|
} catch(e){
|
|
160
165
|
if(args.find(d => d === '--debug')){
|
|
161
166
|
console.log(utilities.colorize(e.stderr, 'error'));
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "rm -rf _Test/_fixtures/boilerplate*; mocha _Test/*.js --timeout 1200s --bail",
|
|
7
|
+
"test": "rm -rf _Test/_fixtures/boilerplate*; CI_BUILD_ID=true 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"
|
package/_Test/_fixtures/.gitkeep
DELETED
|
File without changes
|