tfv 1.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.
- package/.github/workflows/publish.yml +21 -0
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/index.js +14 -0
- package/lib/commands/install.js +43 -0
- package/lib/commands/list.js +26 -0
- package/lib/commands/use.js +27 -0
- package/lib/modules/install.js +73 -0
- package/lib/modules/list.js +30 -0
- package/lib/modules/ps1.js +38 -0
- package/lib/modules/remote.js +29 -0
- package/lib/modules/use.js +52 -0
- package/lib/utils/colors.js +6 -0
- package/lib/utils/postInstall.js +15 -0
- package/package.json +30 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish tfv to npm registry
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: checkout
|
|
12
|
+
uses: actions/checkout@v2
|
|
13
|
+
- name: setup node
|
|
14
|
+
uses: actions/setup-node@v1
|
|
15
|
+
with:
|
|
16
|
+
node-version: 12
|
|
17
|
+
registry-url: https://registry.npmjs.org
|
|
18
|
+
- name: publish
|
|
19
|
+
run: npm publish --access public
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Marcus Chukwuoma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
### Use `tfv` to manage multiple versions of terraform with ease.
|
|
2
|
+
_ ________ __
|
|
3
|
+
_| |__ / _____|\ \ / /
|
|
4
|
+
|_ ___\ | |___ \ \ / /
|
|
5
|
+
| | | ___| \ \ / /
|
|
6
|
+
| |___ | | \ \/ /
|
|
7
|
+
\______\_| \__/
|
|
8
|
+
|
|
9
|
+
Happy terraforming 😍🥂!
|
|
10
|
+
---------------------------------------
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
> **_NOTE:_** `tfv` should be installed `globally` so that it can be run from anywhere on your computer.
|
|
14
|
+
```sh
|
|
15
|
+
npm install -g tfv
|
|
16
|
+
```
|
|
17
|
+
# Table of Contents
|
|
18
|
+
|
|
19
|
+
<!--ts-->
|
|
20
|
+
* [Table of Contents](#table-of-contents)
|
|
21
|
+
* [Usage](#usage)
|
|
22
|
+
* [Modules](#modules)
|
|
23
|
+
* [install](#install)
|
|
24
|
+
* [use](#use)
|
|
25
|
+
* [list](#list)
|
|
26
|
+
<!--te-->
|
|
27
|
+
|
|
28
|
+
## Usag
|
|
29
|
+
|
|
30
|
+
### Modules
|
|
31
|
+
#### *install*
|
|
32
|
+
```sh
|
|
33
|
+
tfv install <version>
|
|
34
|
+
```
|
|
35
|
+
or
|
|
36
|
+
```sh
|
|
37
|
+
tfv i <version>
|
|
38
|
+
```
|
|
39
|
+
| Version | Description |
|
|
40
|
+
| ---------------- | ----------------------------------------- |
|
|
41
|
+
| x.x.x | Installs terraform version x.x.x |
|
|
42
|
+
| x^ | Installs latest version of series x |
|
|
43
|
+
| x.x.^ | Installs latest version of series x.x |
|
|
44
|
+
| latest | Installs latest version of terraform |
|
|
45
|
+
|
|
46
|
+
#### *use*
|
|
47
|
+
```sh
|
|
48
|
+
tfv use <version>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Version | Description |
|
|
52
|
+
| ---------------- | ----------------------------------------- |
|
|
53
|
+
| x.x.x | use terraform version x.x.x |
|
|
54
|
+
| x^ | use latest version of series x |
|
|
55
|
+
| x.x.^ | use latest version of series x.x |
|
|
56
|
+
| latest | use latest version of terraform |
|
|
57
|
+
|
|
58
|
+
> **_NOTE:_** If you're using windows OS, you would be prompted for admin privilege. Accept it. This is a one-time request to set terraform location in you system path. Unix machines would also get password prompt, as this requires permission to copy terraform to your bin directory.
|
|
59
|
+
|
|
60
|
+
#### *list*
|
|
61
|
+
```sh
|
|
62
|
+
tfv list [option]
|
|
63
|
+
```
|
|
64
|
+
or
|
|
65
|
+
```sh
|
|
66
|
+
tfv ls [option]
|
|
67
|
+
```
|
|
68
|
+
| Option | Option Alias | Description |
|
|
69
|
+
| ---------------|---------------|----------------------------------------------------------------------- |
|
|
70
|
+
| `--local` | `-l` | Lists all terraform versions installed locally |
|
|
71
|
+
| `--remote` | `-r` | Lists all terraform versions available remotely, on terraform server |
|
|
72
|
+
| | | Defaults to listing terraform versions installed locally |
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const yargs = require('yargs')
|
|
4
|
+
const {join} = require('path')
|
|
5
|
+
|
|
6
|
+
yargs
|
|
7
|
+
.commandDir(join(__dirname, 'lib', 'commands'))
|
|
8
|
+
.alias('help', 'h')
|
|
9
|
+
.scriptName('tfv')
|
|
10
|
+
.demandCommand(1, 'You need at least one command before moving on')
|
|
11
|
+
.strictOptions()
|
|
12
|
+
// .strictCommands()
|
|
13
|
+
.showHelpOnFail()
|
|
14
|
+
.argv
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const yargs = require('yargs');
|
|
4
|
+
const {install} = require('../modules/install');
|
|
5
|
+
const {fetchAllVersions} = require('../modules/remote');
|
|
6
|
+
const {P_END, P_ERROR, P_OK} = require('../utils/colors');
|
|
7
|
+
|
|
8
|
+
exports.command = 'install <version>'
|
|
9
|
+
exports.aliases = ['i']
|
|
10
|
+
exports.desc = 'Example: tfv install 1.0.11'
|
|
11
|
+
exports.builder = {
|
|
12
|
+
'verbose': {
|
|
13
|
+
describe: 'Produce detailed output',
|
|
14
|
+
alias: 'v'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.handler = async () => {
|
|
19
|
+
let [,version] = yargs.argv._;
|
|
20
|
+
const result = await fetchAllVersions();
|
|
21
|
+
|
|
22
|
+
if (version === 'latest') {
|
|
23
|
+
[version] = result.filter(v => {
|
|
24
|
+
const [, inTest] = v.split('-');
|
|
25
|
+
if (!inTest) return v;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (`${version}`.endsWith('^')) {
|
|
30
|
+
[version] = result.filter(v => {
|
|
31
|
+
const [, inTest] = v.split('-');
|
|
32
|
+
if (v.startsWith(version.replace('^', '')) && !inTest) return v
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!result.find(v => v === version)) {
|
|
37
|
+
console.log(`${P_ERROR}Terraform ${version} not found.${P_END}`);
|
|
38
|
+
console.log(`To view a list of available version, run ${P_OK}tfv list --remote${P_END}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await install(version);
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const yargs = require('yargs');
|
|
4
|
+
const {list} = require('../modules/list');
|
|
5
|
+
|
|
6
|
+
exports.command = 'list [option]'
|
|
7
|
+
exports.aliases = ['ls']
|
|
8
|
+
exports.desc = 'Example: tfv list --local'
|
|
9
|
+
exports.builder = {
|
|
10
|
+
local: {
|
|
11
|
+
alias: 'l',
|
|
12
|
+
describe: 'List terraform versions you have installed using tfv',
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
default: true,
|
|
15
|
+
},
|
|
16
|
+
remote: {
|
|
17
|
+
alias: 'r',
|
|
18
|
+
describe: 'List all available terraform versions',
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.handler = async () => {
|
|
24
|
+
const {local, remote} = yargs.argv;
|
|
25
|
+
await list(local, remote);
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const yargs = require('yargs');
|
|
4
|
+
const {existsSync} = require('fs');
|
|
5
|
+
const {join} = require('path');
|
|
6
|
+
const {use} = require('../modules/use');
|
|
7
|
+
const {P_ERROR, P_END, P_OK} = require('../utils/colors');
|
|
8
|
+
|
|
9
|
+
exports.command = 'use <version>'
|
|
10
|
+
exports.desc = 'Example: tfv use 1.0.11'
|
|
11
|
+
exports.builder = {
|
|
12
|
+
verbose: {
|
|
13
|
+
alias: 'v',
|
|
14
|
+
describe: 'Produce detailed output'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.handler = async () => {
|
|
19
|
+
const [,version] = yargs.argv._;
|
|
20
|
+
|
|
21
|
+
if (!existsSync(join(__dirname, '../../', 'store'))) {
|
|
22
|
+
console.log(`${P_ERROR}You're yet to install terraform with tfv${P_END}`);
|
|
23
|
+
return console.log(`For guidance, run ${P_OK}tfv -h${P_END}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
await use(version);
|
|
27
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const {join} = require('path');
|
|
5
|
+
const {arch} = process;
|
|
6
|
+
const unzip = require('decompress');
|
|
7
|
+
const {P_END, P_ERROR, P_INFO, P_OK, P_WARN} = require('../utils/colors');
|
|
8
|
+
|
|
9
|
+
exports.install = async (version) => {
|
|
10
|
+
try {
|
|
11
|
+
const store = join(__dirname, '../..', 'store');
|
|
12
|
+
const fileName = join(__dirname, '../..', `${version}.zip`);
|
|
13
|
+
const getVersion = os.platform() === 'win32' ? `${version}.exe` : version;
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(`${store}/${getVersion}`)) {
|
|
16
|
+
console.log(`${P_WARN}Terraform ${version} is already installed${P_END}`);
|
|
17
|
+
return console.log(`To use this version Run: ${P_OK}tfv use ${version}${P_END}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const sysOs = os.platform() === 'win32' ? 'windows' : os.platform();
|
|
21
|
+
let sysArch = arch === 'x64' ? 'amd64' : '386';
|
|
22
|
+
|
|
23
|
+
const url = `https://releases.hashicorp.com/terraform/${version}/terraform_${version}_${sysOs}_${sysArch}.zip`;
|
|
24
|
+
|
|
25
|
+
const req = https.get(url, (res) => {
|
|
26
|
+
console.log(`${P_INFO}Installing terraform ${version}${P_END}`);
|
|
27
|
+
|
|
28
|
+
const fileStream = fs.createWriteStream(fileName);
|
|
29
|
+
res.pipe(fileStream);
|
|
30
|
+
|
|
31
|
+
fileStream.on('error', (err) => {
|
|
32
|
+
console.log(`${P_ERROR}Error writing stream ${P_END}\n`, err);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
fileStream.on('close', async () => {
|
|
36
|
+
await clean(version);
|
|
37
|
+
makeExecutable(version);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
fileStream.on('finish', () => {
|
|
41
|
+
fileStream.close();
|
|
42
|
+
console.log(`${P_OK}Successful!${P_END}`);
|
|
43
|
+
console.log(`To use this version Run: ${P_OK}tfv use ${version}${P_END}`);
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
req.on('error', (err) => {
|
|
48
|
+
console.log(`${P_ERROR}Error downloading the terraform ${version}${P_END}\n`, err)
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const clean = async (version) => {
|
|
52
|
+
if (fs.existsSync(fileName)) {
|
|
53
|
+
await unzip(fileName, store, {
|
|
54
|
+
map: file => {
|
|
55
|
+
const [, ext] = `${file.path}`.split('.');
|
|
56
|
+
file.path = ext ? `${version}.${ext}` : `${version}`;
|
|
57
|
+
return file;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
fs.unlinkSync(fileName);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const makeExecutable = async (version) => {
|
|
66
|
+
if (sysOs !== 'windows') {
|
|
67
|
+
fs.chmodSync(`${store}/${version}`, '755');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch ({message}) {
|
|
71
|
+
console.log('ERROR:', message)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const {join} = require('path');
|
|
3
|
+
const {fetchAllVersions} = require('./remote');
|
|
4
|
+
const {P_END, P_OK} = require('../utils/colors');
|
|
5
|
+
|
|
6
|
+
exports.list = async (local, remote) => {
|
|
7
|
+
try {
|
|
8
|
+
let versions;
|
|
9
|
+
|
|
10
|
+
const result = (message, v) => {
|
|
11
|
+
console.log(`${P_OK}${message}${P_END}` + '\n');
|
|
12
|
+
console.log(v.join('\n'));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (remote) {
|
|
16
|
+
versions = await fetchAllVersions();
|
|
17
|
+
|
|
18
|
+
return result('List of all available terraform versions', versions)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (local) {
|
|
22
|
+
const store = join(__dirname, '../..', 'store');
|
|
23
|
+
versions = fs.readdirSync(store).map(v => v.replace('.exe', ''));
|
|
24
|
+
|
|
25
|
+
return result('Terraform versions managed by tfv', versions);
|
|
26
|
+
}
|
|
27
|
+
} catch ({message}) {
|
|
28
|
+
console.log(message)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const {spawnSync} = require("child_process");
|
|
2
|
+
const {P_END, P_ERROR} = require('../utils/colors');
|
|
3
|
+
|
|
4
|
+
exports.setWindowsTerraform = async () => {
|
|
5
|
+
const getSystemEnv = spawnSync(
|
|
6
|
+
"powershell",
|
|
7
|
+
["(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).path"],
|
|
8
|
+
{stdio: 'pipe'}
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
if (!getSystemEnv || getSystemEnv.status === 1) {
|
|
12
|
+
console.log(`${P_ERROR}Error ocurred while fetching windows environment${P_END}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const systemEnv = getSystemEnv.stdout.toString().trim();
|
|
17
|
+
|
|
18
|
+
const terraformPath = 'C:\\terraform';
|
|
19
|
+
const getTerraformEnv = systemEnv.split(';').find(v => v === terraformPath);
|
|
20
|
+
|
|
21
|
+
if (!getTerraformEnv) {
|
|
22
|
+
const newSystemEnv = `${terraformPath};${systemEnv}`;
|
|
23
|
+
|
|
24
|
+
const updateEnv = spawnSync(
|
|
25
|
+
"powershell",
|
|
26
|
+
[
|
|
27
|
+
"-command",
|
|
28
|
+
`start-process powershell -verb runas -argumentlist "Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value '${newSystemEnv}'"`
|
|
29
|
+
],
|
|
30
|
+
{stdio: 'pipe'}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (!updateEnv || updateEnv.status === 1) {
|
|
34
|
+
console.log(`${P_ERROR}Error ocurred while setting windows Environment${P_END}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const client = require('https');
|
|
2
|
+
|
|
3
|
+
const getAvailableVersions = (url) => {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
client.get(url, (resp) => {
|
|
6
|
+
let data = '';
|
|
7
|
+
|
|
8
|
+
// A chunk of data has been received.
|
|
9
|
+
resp.on('data', (chunk) => {
|
|
10
|
+
data += chunk;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// The whole response has been received. Print out the result.
|
|
14
|
+
resp.on('end', () => {
|
|
15
|
+
resolve(data);
|
|
16
|
+
});
|
|
17
|
+
}).on("error", (err) => {
|
|
18
|
+
reject(err);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.fetchAllVersions = async () => {
|
|
24
|
+
const content = await getAvailableVersions('https://releases.hashicorp.com/terraform/');
|
|
25
|
+
const pattern = /(>terraform_).*(?=<\/a>)/g;
|
|
26
|
+
const versions = content.match(pattern).map(v => v.replace('>terraform_', ''));
|
|
27
|
+
|
|
28
|
+
return versions;
|
|
29
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const {join} = require('path');
|
|
3
|
+
const {spawnSync} = require('child_process');
|
|
4
|
+
const {readdirSync, mkdirSync, copyFileSync, existsSync} = require('fs');
|
|
5
|
+
const {setWindowsTerraform} = require('./ps1');
|
|
6
|
+
const {P_END, P_OK, P_INFO, P_ERROR} = require('../utils/colors');
|
|
7
|
+
|
|
8
|
+
exports.use = async (tfVer) => {
|
|
9
|
+
try {
|
|
10
|
+
let version = os.platform() === 'win32' ? `${tfVer}.exe` : tfVer;
|
|
11
|
+
|
|
12
|
+
if (tfVer === 'latest') {
|
|
13
|
+
[version] = readdirSync(join(__dirname, '../../store')).sort((a, b) => {
|
|
14
|
+
const aVer = a.replace(/(.exe)|\./g, '')
|
|
15
|
+
const bVer = b.replace(/(.exe)|\./g, '')
|
|
16
|
+
return Number(bVer) - Number(aVer)
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
console.log(`${P_INFO}Your latest installed version is ${version}${P_END}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
console.log(`${P_INFO}Switching to terraform ${version}${P_END}`);
|
|
23
|
+
|
|
24
|
+
const source = join(__dirname, '../../store', version);
|
|
25
|
+
|
|
26
|
+
if (!existsSync(source)) {
|
|
27
|
+
console.log(`${P_ERROR}terraform ${version} is not installed${P_END}`);
|
|
28
|
+
return console.log(`To install this version Run: ${P_OK}tfv install ${version}${P_END}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let destination;
|
|
32
|
+
|
|
33
|
+
if (['darwin', 'linux'].includes(os.platform())) {
|
|
34
|
+
const bin = os.platform() === 'darwin' ? '/usr/local/bin' : `${os.homedir()}/bin`;
|
|
35
|
+
|
|
36
|
+
destination = `${bin}/terraform`;
|
|
37
|
+
spawnSync('sudo', ['cp', `${source}`, `${destination}`], {stdio: 'inherit', shell: true});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (os.platform() === 'win32') {
|
|
41
|
+
mkdirSync('C:\\terraform', { recursive: true });
|
|
42
|
+
destination = 'C:\\terraform\\terraform.exe';
|
|
43
|
+
|
|
44
|
+
copyFileSync(source, destination);
|
|
45
|
+
setWindowsTerraform();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`${P_OK}Successful!${P_END}`)
|
|
49
|
+
} catch ({message}) {
|
|
50
|
+
console.log('ERROR:', message)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const {P_END, P_OK, P_INFO, P_ERROR} = require('./colors');
|
|
2
|
+
|
|
3
|
+
const message = `\n\
|
|
4
|
+
_ ________ __\n\
|
|
5
|
+
_| |__ / _____|\\ \\ / /\n\
|
|
6
|
+
|_ ___\\ | |___ \\ \\ / /\n\
|
|
7
|
+
| | | ___| \\ \\ / /\n\
|
|
8
|
+
| |___ | | \\ \\/ /\n\
|
|
9
|
+
\\______\\_| \\__/\n\
|
|
10
|
+
\n\
|
|
11
|
+
${P_OK}Happy terraforming!${P_END} 😍🥂\n\
|
|
12
|
+
---------------------------------\n\
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
console.log(message);
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tfv",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Terraform version manager",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"lib": "lib",
|
|
8
|
+
"store": "store"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"postinstall": "node lib/utils/postInstall.js"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"tfv": "index.js"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"Terraform",
|
|
18
|
+
"version"
|
|
19
|
+
],
|
|
20
|
+
"author": "Marcus Chukwuoma <marcus2cu@gmail.com> (https://github.com/marcdomain)",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/marcdomain/tfv.git"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"decompress": "^4.2.1",
|
|
28
|
+
"yargs": "^17.2.1"
|
|
29
|
+
}
|
|
30
|
+
}
|