Skip to content

Commit

Permalink
Merge pull request #54 from idearium/apple-silicon
Browse files Browse the repository at this point in the history
Apple silicon
  • Loading branch information
allanchau committed Feb 19, 2024
2 parents 800cee4 + 9f29444 commit 074b6b4
Show file tree
Hide file tree
Showing 31 changed files with 469 additions and 63 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
publish:
if: github.event_name == 'release'
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ This file is a history of the changes made to @idearium/cli.

## Unreleased

### Added

- `c d image prune` command.

## v5.1.0-beta.3 - 2022-08-09

### Fixed

- Fixed issue with `set-value` usage.

## v5.1.0-beta.2 - 2022-08-09

### Added

- Incorporated v5.0.1.

## v5.1.0-beta.1 - 2022-08-09

- Re-release of v4.4.0-beta.3.

## v5.0.1 - 2022-08-09

### Fixed
Expand All @@ -17,6 +37,29 @@ This file is a history of the changes made to @idearium/cli.
- Version bumped all dev dependencies.
- Removed gulp and gulp-replace.

## v4.4.0-beta.3 - 2022-08-04

### Added

- `c ts` commands.
- `c ds` commands.

### Changed

- `c mk ip` now retrieves the IP of your Minikube machine on tailnet as configured with `c ds handle set`, or `c ds mk set`.

## v4.4.0-beta.2 - 2022-08-02

### Changed

- Added more CPU and memory when starting Minikube.

## v4.4.0-beta.1 - 2022-08-02

### Changed

- Updated `c mk start` to use the Docker driver.

## v4.3.0 - 2022-08-02

### Added
Expand Down
6 changes: 1 addition & 5 deletions bin/c-d-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,10 @@ return loadConfig('docker.locations').then((locations) => {
}

exec(cmd, { silent: program.R }, (err, stdout, stderr) => {
if ((err || stderr) && stderr) {
if (err !== 0) {
return reportError(stderr, false, true);
}

if ((err || stderr) && err) {
return reportError(err, false, true);
}

if (program.R) {
process.stdout.write(`${tag}${newline(opts.name)}`);
}
Expand Down
9 changes: 9 additions & 0 deletions bin/c-d-image-prune.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const program = require('commander');
const { exec } = require('shelljs');

// The basic program, which uses sub-commands.
program.parse(process.argv);

exec('docker image prune');
8 changes: 8 additions & 0 deletions bin/c-d-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

const program = require('commander');
const { missingCommand } = require('./lib/c');

program.command('prune', 'Removes unused dangling images.').parse(process.argv);

missingCommand(program);
1 change: 1 addition & 0 deletions bin/c-d.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { missingCommand } = require('./lib/c');
program
.command('build <location>', 'Builds a Docker image from a Docker location')
.command('clean <type>', 'Removes unused containers and images')
.command('image', 'Commands for working with images')
.command('images', 'List images')
.command('ps', 'List containers')
.parse(process.argv);
Expand Down
34 changes: 34 additions & 0 deletions bin/c-ds-handle-get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
loadState,
devspacePath,
newline,
reportError,
stateFilePath,
} = require('./lib/c');

program
.option('-n', 'Do not print the trailing newline character.')
.parse(process.argv);

return loadState('handle', stateFilePath(devspacePath()))
.then((data) => {
process.stdout.write(`${data}${newline(program.N)}`);
})
.catch((err) => {
if (err.code === 'ENOENT') {
return reportError(
new Error(
"Your handle hasn't been configured yet. Use `c ds handle set <handle>`."
),
false,
true
);
}

return reportError(err, false, true);
});
39 changes: 39 additions & 0 deletions bin/c-ds-handle-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
devspacePath,
reportError,
stateFilePath,
storeState,
} = require('./lib/c');

program
.arguments('<handle>')
.description('Set your Idearium handle.')
.parse(process.argv);

const [handle] = program.args;

if (!handle) {
return reportError(
new Error('You must provide your Idearium handle.'),
program
);
}

const run = async () => {
const file = stateFilePath(devspacePath());

try {
await storeState('handle', handle, file);
await storeState('mkName', `${handle}-minikube`, file);
await storeState('pcName', `${handle}-pc`, file);
} catch (err) {
reportError(err, program, true);
}
};

run();
13 changes: 13 additions & 0 deletions bin/c-ds-handle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const { missingCommand } = require('./lib/c');

program
.command('get', 'Get your handle.')
.command('set <handle>', 'Set your handle.')
.parse(process.argv);

missingCommand(program);
34 changes: 34 additions & 0 deletions bin/c-ds-mk-get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
loadState,
devspacePath,
newline,
reportError,
stateFilePath,
} = require('./lib/c');

program
.option('-n', 'Do not print the trailing newline character.')
.parse(process.argv);

return loadState('mkName', stateFilePath(devspacePath()))
.then((data) => {
process.stdout.write(`${data}${newline(program.N)}`);
})
.catch((err) => {
if (err.code === 'ENOENT') {
return reportError(
new Error(
"Your Minikube name hasn't been configured yet. Use `c ds mk set <minikube-name>`."
),
false,
true
);
}

return reportError(err, false, true);
});
35 changes: 35 additions & 0 deletions bin/c-ds-mk-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
devspacePath,
reportError,
stateFilePath,
storeState,
} = require('./lib/c');

program
.arguments('<mk-name>')
.description("Set your Minikube's name.")
.parse(process.argv);

const [name] = program.args;

if (!name) {
return reportError(
new Error("You must provide your Minikube's name."),
program
);
}

const run = async () => {
try {
await storeState('mkName', name, stateFilePath(devspacePath()));
} catch (err) {
reportError(err, program, true);
}
};

run();
13 changes: 13 additions & 0 deletions bin/c-ds-mk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const { missingCommand } = require('./lib/c');

program
.command('get', 'Get your Minikube name.')
.command('set <minikube-name>', 'Set your Minikube name.')
.parse(process.argv);

missingCommand(program);
34 changes: 34 additions & 0 deletions bin/c-ds-pc-get.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
loadState,
devspacePath,
newline,
reportError,
stateFilePath,
} = require('./lib/c');

program
.option('-n', 'Do not print the trailing newline character.')
.parse(process.argv);

return loadState('pcName', stateFilePath(devspacePath()))
.then((data) => {
process.stdout.write(`${data}${newline(program.N)}`);
})
.catch((err) => {
if (err.code === 'ENOENT') {
return reportError(
new Error(
"Your pc name hasn't been configured yet. Use `c ds pc set <pc-name>`."
),
false,
true
);
}

return reportError(err, false, true);
});
35 changes: 35 additions & 0 deletions bin/c-ds-pc-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const {
devspacePath,
reportError,
stateFilePath,
storeState,
} = require('./lib/c');

program
.arguments('<pc-name>')
.description("Set your pc's name.")
.parse(process.argv);

const [name] = program.args;

if (!name) {
return reportError(
new Error("You must provide your computer's name."),
program
);
}

const run = async () => {
try {
await storeState('pcName', name, stateFilePath(devspacePath()));
} catch (err) {
reportError(err, program, true);
}
};

run();
13 changes: 13 additions & 0 deletions bin/c-ds-pc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const { missingCommand } = require('./lib/c');

program
.command('get', 'Get your pc name.')
.command('set <pc-name>', 'Set your pc name.')
.parse(process.argv);

missingCommand(program);
14 changes: 14 additions & 0 deletions bin/c-ds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env -S node --trace-warnings

'use strict';

const program = require('commander');
const { missingCommand } = require('./lib/c');

program
.command('handle', 'Manage your Idearium handle.')
.command('mk', 'Manage your Minikube name.')
.command('pc', 'Manager your computer name.')
.parse(process.argv);

missingCommand(program);
6 changes: 1 addition & 5 deletions bin/c-kc-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,10 @@ const buildLocation = ({ config, loc, prefix, state }) =>
)} ${loc}`;

exec(cmd, (err, stdout, stderr) => {
if ((err || stderr) && stderr) {
if (err !== 0) {
return reject(new Error(stderr));
}

if ((err || stderr) && err) {
return reject(err);
}

storeState(
`kubernetes.environments.${state.env}.build.tags.${prefix}/${loc}`,
tag
Expand Down
Loading

0 comments on commit 074b6b4

Please sign in to comment.