Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
"warn",
"always"
],
"perfectionist/sort-classes": [
"off"
],
"perfectionist/sort-classes": "off",
"perfectionist/sort-interfaces": "off",
"perfectionist/sort-enums": "off",
"perfectionist/sort-objects": "off",
"perfectionist/sort-object-types": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-array-for-each": "off",
"unicorn/prefer-object-from-entries": "off",
"unicorn/prefer-type-error": "off",
"quotes": [
"error",
"single"
Expand Down
90 changes: 77 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g codify
$ codify COMMAND
running command...
$ codify (--version)
codify/0.0.1 darwin-arm64 node-v20.15.0
codify/0.0.4 darwin-arm64 node-v20.15.0
$ codify --help [COMMAND]
USAGE
$ codify COMMAND
Expand All @@ -28,6 +28,7 @@ USAGE
# Commands
<!-- commands -->
* [`codify apply`](#codify-apply)
* [`codify autocomplete [SHELL]`](#codify-autocomplete-shell)
* [`codify help [COMMAND]`](#codify-help-command)
* [`codify plan`](#codify-plan)
* [`codify plugins`](#codify-plugins)
Expand All @@ -41,6 +42,7 @@ USAGE
* [`codify plugins unlink [PLUGIN]`](#codify-plugins-unlink-plugin)
* [`codify plugins update`](#codify-plugins-update)
* [`codify uninstall`](#codify-uninstall)
* [`codify update [CHANNEL]`](#codify-update-channel)

## `codify apply`

Expand Down Expand Up @@ -68,7 +70,36 @@ EXAMPLES
$ codify apply
```

_See code: [src/commands/apply/index.ts](https://github.com/kevinwang5658/codify/blob/v0.0.1/src/commands/apply/index.ts)_
## `codify autocomplete [SHELL]`

Display autocomplete installation instructions.

```
USAGE
$ codify autocomplete [SHELL] [-r]

ARGUMENTS
SHELL (zsh|bash|powershell) Shell type

FLAGS
-r, --refresh-cache Refresh cache (ignores displaying instructions)

DESCRIPTION
Display autocomplete installation instructions.

EXAMPLES
$ codify autocomplete

$ codify autocomplete bash

$ codify autocomplete zsh

$ codify autocomplete powershell

$ codify autocomplete --refresh-cache
```

_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.4/src/commands/autocomplete/index.ts)_

## `codify help [COMMAND]`

Expand All @@ -88,7 +119,7 @@ DESCRIPTION
Display help for codify.
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.4/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.5/src/commands/help.ts)_

## `codify plan`

Expand Down Expand Up @@ -116,8 +147,6 @@ EXAMPLES
$ codify plan
```

_See code: [src/commands/plan/index.ts](https://github.com/kevinwang5658/codify/blob/v0.0.1/src/commands/plan/index.ts)_

## `codify plugins`

List installed plugins.
Expand All @@ -139,7 +168,7 @@ EXAMPLES
$ codify plugins
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/index.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/index.ts)_

## `codify plugins add PLUGIN`

Expand Down Expand Up @@ -213,7 +242,7 @@ EXAMPLES
$ codify plugins inspect myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/inspect.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/inspect.ts)_

## `codify plugins install PLUGIN`

Expand Down Expand Up @@ -262,7 +291,7 @@ EXAMPLES
$ codify plugins install someuser/someplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/install.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/install.ts)_

## `codify plugins link PATH`

Expand Down Expand Up @@ -292,7 +321,7 @@ EXAMPLES
$ codify plugins link myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/link.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/link.ts)_

## `codify plugins remove [PLUGIN]`

Expand Down Expand Up @@ -333,7 +362,7 @@ FLAGS
--reinstall Reinstall all plugins after uninstalling.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/reset.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/reset.ts)_

## `codify plugins uninstall [PLUGIN]`

Expand Down Expand Up @@ -361,7 +390,7 @@ EXAMPLES
$ codify plugins uninstall myplugin
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/uninstall.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/uninstall.ts)_

## `codify plugins unlink [PLUGIN]`

Expand Down Expand Up @@ -405,7 +434,7 @@ DESCRIPTION
Update installed plugins.
```

_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/update.ts)_
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.4/src/commands/plugins/update.ts)_

## `codify uninstall`

Expand All @@ -431,5 +460,40 @@ EXAMPLES
$ codify uninstall
```

_See code: [src/commands/uninstall.ts](https://github.com/kevinwang5658/codify/blob/v0.0.1/src/commands/uninstall.ts)_
## `codify update [CHANNEL]`

update the codify CLI

```
USAGE
$ codify update [CHANNEL] [--force | | [-a | -v <value> | -i]]

FLAGS
-a, --available See available versions.
-i, --interactive Interactively select version to install. This is ignored if a channel is provided.
-v, --version=<value> Install a specific version.
--force Force a re-download of the requested version.

DESCRIPTION
update the codify CLI

EXAMPLES
Update to the stable channel:

$ codify update stable

Update to a specific version:

$ codify update --version 1.0.0

Interactively select version:

$ codify update --interactive

See available versions:

$ codify update --available
```

_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.5.9/src/commands/update.ts)_
<!-- commandsstop -->
40 changes: 35 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
"@oclif/core": "^4.0.8",
"@oclif/plugin-help": "^6.2.4",
"@oclif/plugin-plugins": "^5.3.3",
"@oclif/plugin-autocomplete": "3.2.4",
"@oclif/plugin-commands": "4.0.16",
"@oclif/plugin-update": "4.5.9",
"@oclif/plugin-version": "2.2.13",
"@oclif/plugin-warn-if-update-available": "3.1.17",
"@oclif/plugin-which": "3.2.14",
"ajv": "^8.12.0",
"ajv-formats": "^3.0.1",
"chalk": "^5.3.0",
"codify-schemas": "1.0.44",
"codify-schemas": "1.0.45",
"debug": "^4.3.4",
"ink": "^4.4.1",
"parse-json": "^8.1.0",
Expand All @@ -26,6 +32,12 @@
"devDependencies": {
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^4.0.4",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-wasm": "^6.2.2",
"@types/chai": "^4",
"@types/chai-as-promised": "^7.1.7",
"@types/chalk": "^2.2.0",
Expand All @@ -46,6 +58,8 @@
"mocha": "^10",
"mock-fs": "^5.2.0",
"oclif": "4.13.12",
"rollup": "^4.12.0",
"rollup-plugin-copy": "^3.5.0",
"shx": "^0.3.3",
"strip-ansi": "^7.1.0",
"tsx": "^4.7.3",
Expand All @@ -69,11 +83,18 @@
"oclif": {
"bin": "codify",
"dirname": "codify",
"commands": "./dist/commands",
"plugins": [
"@oclif/plugin-help",
"@oclif/plugin-plugins"
"@oclif/plugin-plugins",
"@oclif/plugin-autocomplete",
"@oclif/plugin-update",
"@oclif/plugin-warn-if-update-available"
],
"commands": {
"strategy": "explicit",
"target": "./dist/index.js",
"identifier": "COMMANDS"
},
"topicSeparator": " ",
"topics": {
"plan": {
Expand All @@ -86,22 +107,31 @@
"macos": {
"identifier": "com.codify.cli",
"sign": "\"Developer ID Installer: Qingran Wang (PCG246DPVT)\""
},
"update": {
"s3": {
"host": "https://releases.codifycli.com",
"bucket": "cli-releases"
}
},
"warn-if-update-available": {
"timeoutInDays": 7
}
},
"repository": "kevinwang5658/codify",
"scripts": {
"build": "shx rm -rf dist && tsc -b",
"lint": "tsc && eslint . --ext .ts",
"postpack": "shx rm -f oclif.manifest.json",
"pkg": "tsc && oclif pack macos -r .",
"pkg": "shx rm -rf dist && rollup -c && oclif pack macos -r .",
"posttest": "npm run lint",
"prepack": "oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md",
"start:dev": "./bin/dev.js",
"start:vm": "npm run build && npm run pack:macos && npm run start:vm"
},
"version": "0.0.1",
"version": "0.0.4",
"bugs": "https://github.com/kevinwang5658/codify/issues",
"keywords": [
"oclif"
Expand Down
26 changes: 26 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import wasm from '@rollup/plugin-wasm';
import copy from 'rollup-plugin-copy';

export default {
input: 'src/index.ts',
output: {
dir:'./dist',
format: 'es'
},
plugins: [
copy({
targets: [{ dest: './dist/', src: './node_modules/yoga-wasm-web/dist/yoga.wasm' }]
}),
json(),
wasm(),
nodeResolve({ exportConditions: ['node'] }),
typescript(),
commonjs(),
terser()
]
}
34 changes: 34 additions & 0 deletions scripts/pkg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

import chalk from 'chalk'
import { ChildProcess, exec } from 'node:child_process'
import fs from 'node:fs/promises'

console.log(chalk.magenta('Removing ./dist folder'))
await fs.rm('../dist', {
force: true,
recursive: true,
})

console.log(chalk.magenta('Creating build directory'))
try {
await fs.mkdir('../build', {});
} catch {
console.error('Directory already exists')
}

await fs.cp('../src/', '../build')
await fs.cp('../package.json', '../build')


console.log(chalk.magenta('Running rollup'))
const rollupProcess = exec('rollup -c --file ');
addStdout(rollupProcess)

function addStdout(process: ChildProcess) {
process.stdout!.on('data', (data) => {
console.log(data)
})
process.stderr!.on('data', (data) => {
console.log(data)
})
}
4 changes: 4 additions & 0 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
npm run pkg
oclif pack tarballs -r . -t darwin-arm64,darwin-x64
oclif upload macos
oclif upload tarballs -t darwin-arm64,darwin-x64
2 changes: 1 addition & 1 deletion src/commands/apply/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Args, Flags } from '@oclif/core'
import Flags from '@oclif/core/flags'
import * as path from 'node:path';

import { BaseCommand } from '../../common/base-command.js';
Expand Down
4 changes: 2 additions & 2 deletions src/commands/plan/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Args, Flags } from '@oclif/core'
import Flags from '@oclif/core/flags'
import * as path from 'node:path';

import { PlanOrchestrator } from '../../orchestrators/plan.js';
import { BaseCommand } from '../../common/base-command.js';
import { PlanOrchestrator } from '../../orchestrators/plan.js';

export default class Plan extends BaseCommand {
static description = 'Generate a plan based on a codify.json file. This plan will list ' +
Expand Down
2 changes: 1 addition & 1 deletion src/common/base-command.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Command, Flags } from '@oclif/core';
import { OutputFlags } from '@oclif/core/interfaces';
import chalk from 'chalk';
import { SudoRequestData } from 'codify-schemas';
import createDebug from 'debug';

import { Event, ctx } from '../events/context.js';
import { Reporter, ReporterFactory, ReporterType } from '../ui/reporters/reporter.js';
import { prettyPrintError } from './errors.js';
import { OutputFlags } from '@oclif/core/interfaces';

export abstract class BaseCommand extends Command {

Expand Down
Loading