@ossy/cli 1.16.7 → 1.16.10

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/README.md CHANGED
@@ -1,23 +1,37 @@
1
1
  # @ossy/cli
2
2
 
3
- Unified CLI for the Ossy platform: app dev/build and CMS workflows.
3
+ Unified CLI for the Ossy platform.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @ossy/cli
9
+ ```
10
+
11
+ After install, the `ossy` command is on your PATH:
12
+
13
+ ```bash
14
+ ossy --version
15
+ ossy --help
16
+ ossy <command> --help
17
+ ```
18
+
19
+ For one-off use without installing, you can still run `npx @ossy/cli <command>`.
4
20
 
5
21
  ## Commands
6
22
 
7
23
  | Command | Description |
8
24
  |---------|-------------|
9
25
  | `init [dir]` | Scaffold a new Ossy app (default: current directory) |
10
- | `dev` | Start dev server with watch (uses `src/**/*.page.jsx`, `src/config.js`) |
11
26
  | `build` | Production build |
12
27
  | `publish` | Queue a container deployment via `@ossy/deployment-tools` (**temporary**; see below), then upload `resourceTemplates` and **site build artifacts** (S3 presign + CMS resource) when `workspaceId` is set |
13
28
  | `cms upload` | Upload resource templates only (same API as publish’s upload step) |
14
29
  | `cms validate` | Validate ossy config and resource templates |
15
30
 
16
- ## App: dev & build
31
+ ## App: build
17
32
 
18
33
  ```bash
19
- npx @ossy/cli dev
20
- npx @ossy/cli build
34
+ ossy build
21
35
  ```
22
36
 
23
37
  Options: e.g. `--config` for `src/config.js`. See `packages/app/README.md` for app build behavior.
@@ -53,7 +67,7 @@ Container deploys assume **Amazon ECR** in **`deployments.json`** (`registry` li
53
67
  cd packages/my-website
54
68
  export OSSY_API_KEY=<ossy-api-jwt> # or pass --authentication <ossy-api-jwt>
55
69
 
56
- npx @ossy/cli publish \
70
+ ossy publish \
57
71
  --platforms-path ../infrastructure/platforms.json \
58
72
  --deployments-path "../infrastructure/deployments/**/*.json"
59
73
  ```
@@ -79,7 +93,7 @@ Upload resource templates to your workspace so they can be used in the UI.
79
93
  Prefer **`--authentication` / `-a`** for the **Ossy API JWT** (same as **`publish`**); it matches **`OSSY_API_KEY`** in CI.
80
94
 
81
95
  ```bash
82
- npx @ossy/cli cms upload --authentication <ossy-api-jwt> --config src/config.js
96
+ ossy cms upload --authentication <ossy-api-jwt> --config src/config.js
83
97
  # optional: --api-url https://api.ossy.se/api/v0 (or set OSSY_API_URL)
84
98
  # In CI you may omit --authentication when OSSY_API_KEY is set
85
99
  ```
@@ -88,7 +102,7 @@ When **`--config`** is omitted, **`./src/config.js`** is used if it exists (same
88
102
 
89
103
  ### Config consistency
90
104
 
91
- - **App** (`dev`, `build`), **CMS** (`cms upload` / `cms validate`), and **publish** all use **`--config`** (`-c`) for the app / workspace config file (`src/config.js` by default when present).
105
+ - **App** (`build`), **CMS** (`cms upload` / `cms validate`), and **publish** all use **`--config`** (`-c`) for the app / workspace config file (`src/config.js` by default when present).
92
106
 
93
107
  ### Workflow example
94
108
 
@@ -121,7 +135,7 @@ jobs:
121
135
  Validate an ossy config file before uploading:
122
136
 
123
137
  ```bash
124
- npx @ossy/cli cms validate --config src/config.js
138
+ ossy cms validate --config src/config.js
125
139
  ```
126
140
 
127
141
  When **`--config`** is omitted, **`./src/config.js`** is used if it exists.
@@ -139,8 +153,8 @@ When **`--config`** is omitted, **`./src/config.js`** is used if it exists.
139
153
  Scaffold a new Ossy app:
140
154
 
141
155
  ```bash
142
- npx @ossy/cli init
143
- npx @ossy/cli init my-app
156
+ ossy init
157
+ ossy init my-app
144
158
  ```
145
159
 
146
160
  Creates `src/home.page.jsx`, `src/config.js`, and `package.json` (if missing).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/cli",
3
- "version": "1.16.7",
3
+ "version": "1.16.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ossy-se/packages.git"
@@ -15,10 +15,12 @@
15
15
  },
16
16
  "author": "Ossy <yourfriends@ossy.se> (https://ossy.se)",
17
17
  "license": "MIT",
18
- "bin": "./src/index.js",
18
+ "bin": {
19
+ "ossy": "./src/index.js"
20
+ },
19
21
  "dependencies": {
20
22
  "@babel/parser": "^7.28.6",
21
- "@ossy/app": "^1.16.7",
23
+ "@ossy/app": "^1.16.10",
22
24
  "arg": "^5.0.2",
23
25
  "glob": "^10.3.10"
24
26
  },
@@ -30,5 +32,5 @@
30
32
  "/src",
31
33
  "README.md"
32
34
  ],
33
- "gitHead": "ca79da159a5d017ea80dfddbb7218b1a51aab396"
35
+ "gitHead": "5821b2cea64c9ca0ece35d65a463006852abf167"
34
36
  }
package/src/index.js CHANGED
@@ -1,17 +1,104 @@
1
1
  #!/usr/bin/env node
2
- import { build, dev } from '@ossy/app'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+ import { build } from '@ossy/app'
3
6
  import * as Cms from './cms/cli.js'
4
7
  import * as Init from './init/cli.js'
5
8
  import { publish } from './publish/cli.js'
6
9
  import * as Registry from './registry/cli.js'
7
10
 
8
- const [,, command, ...restArgs] = process.argv
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
12
+ const pkg = JSON.parse(
13
+ fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')
14
+ )
9
15
 
10
- if (!command) {
11
- console.error(
12
- '[@ossy/cli] No command provided. Usage: ossy dev | build [--worker] | publish | registry <subcommand> | init | cms <subcommand>'
13
- )
14
- process.exit(1)
16
+ const HELP = `ossy ${pkg.version}
17
+ Command line tool for the Ossy platform.
18
+
19
+ Usage:
20
+ ossy <command> [options]
21
+
22
+ Commands:
23
+ init [dir] Scaffold a new Ossy app
24
+ build Production build of the app in the current directory
25
+ publish Deploy a site and upload templates / site artifacts
26
+ cms <subcommand> Resource template workflows: upload | validate
27
+ registry <subcommand> Container registry helpers: ecr-push-credentials
28
+
29
+ Options:
30
+ -h, --help Show this help, or for a command: ossy <command> --help
31
+ -v, --version Print the installed version
32
+ `
33
+
34
+ const SUBCOMMAND_HELP = {
35
+ init: `ossy init [dir]
36
+ Scaffold a new Ossy app in [dir] (defaults to current directory).
37
+ Creates src/home.page.jsx, src/config.js, and package.json (if missing).
38
+ `,
39
+ build: `ossy build
40
+ Run the production build for the app in the current directory.
41
+ See the @ossy/app README for build options.
42
+ `,
43
+ publish: `ossy publish [options]
44
+ Deploy via @ossy/deployment-tools, then optionally upload resource templates
45
+ and site artifacts.
46
+
47
+ Options:
48
+ -a, --authentication Ossy API JWT (or set OSSY_API_KEY)
49
+ -d, --domain Site domain
50
+ -p, --platform Target deployment platform
51
+ -c, --config Path to src/config.js
52
+ --platforms-path Path to platforms.json
53
+ --deployments-path Glob for deployments JSON files
54
+ --all Deploy all sites for the platform
55
+ --skip-resource-templates Skip post-deploy resource-template upload
56
+ --skip-site-artifacts Skip post-deploy site-artifact upload
57
+ --site-artifacts-build-dir Override the site build directory
58
+ --api-url API base URL for CMS calls
59
+ `,
60
+ cms: `ossy cms <subcommand>
61
+ Subcommands:
62
+ upload Upload resource templates from src/config.js to the workspace
63
+ validate Validate ossy app config and resource templates locally
64
+
65
+ Options (upload):
66
+ -a, --authentication Ossy API JWT (or set OSSY_API_KEY)
67
+ -c, --config Path to src/config.js
68
+ --api-url API base URL for CMS calls
69
+
70
+ Options (validate):
71
+ -c, --config Path to src/config.js
72
+ `,
73
+ registry: `ossy registry <subcommand>
74
+ Subcommands:
75
+ ecr-push-credentials Fetch a short-lived ECR password for docker login
76
+
77
+ Options:
78
+ -a, --authentication Ossy API JWT (or set OSSY_API_KEY)
79
+ --workspace-id Workspace id
80
+ --format json | github-actions
81
+ `,
82
+ }
83
+
84
+ const isHelpFlag = (a) => a === '--help' || a === '-h'
85
+ const isVersionFlag = (a) => a === '--version' || a === '-v'
86
+
87
+ const [, , command, ...restArgs] = process.argv
88
+
89
+ if (command === undefined || isHelpFlag(command)) {
90
+ console.log(HELP)
91
+ process.exit(0)
92
+ }
93
+
94
+ if (isVersionFlag(command)) {
95
+ console.log(pkg.version)
96
+ process.exit(0)
97
+ }
98
+
99
+ if (restArgs.some(isHelpFlag) && SUBCOMMAND_HELP[command]) {
100
+ console.log(SUBCOMMAND_HELP[command])
101
+ process.exit(0)
15
102
  }
16
103
 
17
104
  const run = async () => {
@@ -31,15 +118,12 @@ const run = async () => {
31
118
  await publish(restArgs)
32
119
  return
33
120
  }
34
- if (command === 'dev') {
35
- await dev(restArgs)
36
- return
37
- }
38
121
  if (command === 'build') {
39
122
  await build(restArgs)
40
123
  return
41
124
  }
42
125
  console.error(`[@ossy/cli] Unknown command: ${command}`)
126
+ console.error('Run `ossy --help` for available commands.')
43
127
  process.exit(1)
44
128
  }
45
129
 
package/src/init/cli.js CHANGED
@@ -26,7 +26,6 @@ const TEMPLATE_PACKAGE_JSON = {
26
26
  private: true,
27
27
  type: 'module',
28
28
  scripts: {
29
- dev: 'app dev',
30
29
  build: 'app build',
31
30
  start: 'node build/server.js',
32
31
  },
@@ -69,5 +68,5 @@ export const init = (options) => {
69
68
  logInfo({ message: '[@ossy/cli] package.json exists, skipping. Add scripts manually if needed.' })
70
69
  }
71
70
 
72
- logInfo({ message: '[@ossy/cli] Done. Run: npm install && npm run dev' })
71
+ logInfo({ message: '[@ossy/cli] Done. Run: npm install && npm run build' })
73
72
  }