Skip to content

Commit

Permalink
welcome install version command, so we dont have to run the instance …
Browse files Browse the repository at this point in the history
…first
  • Loading branch information
viqueen committed May 5, 2023
1 parent 83f77ac commit b74fa13
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ module.exports = {
order: 'asc',
caseInsensitive: true,
},
pathGroupsExcludedImportTypes: ['builtin']
pathGroupsExcludedImportTypes: ['builtin'],
},
]
],
},
settings: {
'import/resolver': {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
- run: yarn
- run: yarn build
- run: yarn format:check
- run: yarn lint
- run: yarn lint
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ module.exports = {
},
},
],
};
};
74 changes: 36 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

## requirements

* [java - 8 / 11](https://adoptopenjdk.net/)
* [maven - 3.6.x / 3.8.x](https://maven.apache.org/install.html)
* [node](https://nodejs.org/en/)
- [java - 8 / 11](https://adoptopenjdk.net/)
- [maven - 3.6.x / 3.8.x](https://maven.apache.org/install.html)
- [node](https://nodejs.org/en/)

## install it

Expand All @@ -22,17 +22,20 @@ brew install atlassian-devbox

### from npm

* first time
- first time

```bash
npm install -g atlassian-devbox
```

* does it need an update ?
- does it need an update ?

```bash
npm outdated -g --depth=0
```

* update it
- update it

```bash
npm update -g atlassian-devbox
```
Expand Down Expand Up @@ -68,67 +71,62 @@ For example this is what the Confluence script documentation looks like
Usage: confluence [options] [command]

Options:
-hp, --http-port <httpPort> with http port (default: "1990")
-dp, --debug-port <debugPort> with debug port (default: "5005")
-cp, --context-path <contextPath> with context path (default: "/confluence")
-ap, --ajp-port <ajpPort> with ajp port (default: "8009")
--plugins <plugins> with plugins
--jvm-args <jvmArgs> with jvmargs
--amps-version <ampsVersion> with amps version (default: "8.2.0")
-V, --version output the version number
-h, --help display help for command
--amps-version <ampsVersion> with amps version (default: "8.8.1")
--with-plugins <withPlugins> with plugins (default: "")
--with-jvm-args <withJvmArgs> with jvm args (default: "")
-V, --version output the version number
-h, --help display help for command

Commands:
start <version> runs confluence
debug <version> runs confluence with debug port open
cmd <name> <version> prints the resolved command
list lists installed confluence instances
remove <pattern> removes confluence instance with version matching given pattern
logs <version> tails confluence logs
versions lists available confluence versions in local maven repo
purge <type> purges available confluence versions in local maven repo
help [command] display help for command
install <productVersion> installs confluence version
start <productVersion> runs confluence
debug <productVersion> runs confluence in debug mode
logs <productVersion> tails confluence log file
remove <pattern> removes confluence instance with version matching given pattern
list [options] [pattern] lists installed confluence instances
versions lists available confluence versions in local maven repo
help [command] display help for command
```

* start a confluence instance
- start a confluence instance

```bash
confluence start 7.4.9
```

* tail the logs
- tail the logs

```bash
confluence logs 7.4.9
```

* debug a confluence instance
- debug a confluence instance

```bash
confluence debug 7.4.9
```

* print the underlying command
```bash
confluence cmd start 7.4.9
confluence cmd debug 7.4.9
```
- list installed versions

* list installed versions
```bash
confluence list
```

* remove some installed version
- remove some installed version

```bash
confluence remove 7.4.9
confluence remove 7.4 # removes all 7.4.x instances
```

* list available versions in local cache
- list available versions in local cache

```bash
confluence versions
```

* purge versions in local cache
- install a specific version without running it

```bash
confluence purge internal # remove any snapshots / milestones / beta / release candidates
confluence purge all # purges the whole thing
confluence install 7.18.0
```
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atlassian-devbox",
"version": "2.1.0",
"version": "2.2.0",
"description": "atlassian devbox",
"preferGlobal": true,
"bin": {
Expand All @@ -14,8 +14,8 @@
},
"scripts": {
"build": "tsc",
"format:check": "prettier --check src",
"format": "prettier --check --write src",
"format:check": "prettier --check .",
"format": "prettier --check --write .",
"lint": "eslint src/ --ext .ts,.tsx,.js"
},
"files": [
Expand Down
4 changes: 1 addition & 3 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
"extends": ["config:base"]
}
10 changes: 10 additions & 0 deletions src/lib/executable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ const executable = (definition: ProductDefinition) => {
program.option('--with-jvm-args <withJvmArgs>', 'with jvm args', '');

// commands
program
.command('install <productVersion>')
.description(`installs ${definition.name} version`)
.action((productVersion) => {
const install = product(definition).installVersionCmd({
productVersion
});
executeCommand(install);
});

program
.command('start <productVersion>')
.description(`runs ${definition.name}`)
Expand Down
19 changes: 18 additions & 1 deletion src/lib/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type Product = {
viewInstanceLogCmd: (
runnerOptions: Pick<RunnerOptions, 'productVersion'>
) => ExecuteCommand;
installVersionCmd: (
runnerOptions: Pick<RunnerOptions, 'productVersion'>
) => ExecuteCommand;
listInstances: (args: ListInstancesArgs) => string[];
listVersions: () => string[];
};
Expand Down Expand Up @@ -93,6 +96,19 @@ const product = ({
return _runStandalone(runnerOptions, ['-Xmx2g', '-Xms1g']);
};

const installVersionCmd = ({
productVersion
}: Pick<RunnerOptions, 'productVersion'>) => {
const directory = home();
const params: string[] = [
`-s`,
path.resolve(directory, 'settings.xml'),
'org.apache.maven.plugins:maven-dependency-plugin:3.5.0:get',
`-Dartifact=${groupId}:${webappName}:${productVersion}`
];
return { cmd: 'mvn', params, cwd: directory };
};

const viewInstanceLogCmd = ({
productVersion
}: Pick<RunnerOptions, 'productVersion'>) => {
Expand Down Expand Up @@ -152,7 +168,8 @@ const product = ({
debugInstanceCmd,
viewInstanceLogCmd,
listInstances,
listVersions
listVersions,
installVersionCmd
};
};

Expand Down

0 comments on commit b74fa13

Please sign in to comment.