inferative 0.0.0 → 0.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/LICENSE +70 -0
- package/README.md +97 -2
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +18258 -0
- package/dist/index.d.mts +120 -0
- package/dist/index.mjs +2 -0
- package/dist/init-command-C2q2dkCV.mjs +878 -0
- package/package.json +62 -6
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Copyright (c) 2024 WP Online Magyarország Kft.
|
|
2
|
+
Website: https://wpo.hu
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
==============================================================================
|
|
6
|
+
WP Online Magyarország Kft. - Internal Use Software License
|
|
7
|
+
==============================================================================
|
|
8
|
+
|
|
9
|
+
This software package and its accompanying documentation (collectively, "the Software")
|
|
10
|
+
are the proprietary and confidential information of WP Online Magyarország Kft.
|
|
11
|
+
("the Company").
|
|
12
|
+
|
|
13
|
+
1. GRANT OF LICENSE:
|
|
14
|
+
Subject to the terms and conditions of this License, the Company grants to
|
|
15
|
+
its employees and authorized contractors ("Authorized Users") a non-exclusive,
|
|
16
|
+
non-transferable, revocable license to install, use, copy, and modify the
|
|
17
|
+
Software solely for internal Company business purposes.
|
|
18
|
+
|
|
19
|
+
2. RESTRICTIONS:
|
|
20
|
+
Authorized Users shall not:
|
|
21
|
+
a. Distribute, sublicense, sell, rent, lease, lend, or otherwise transfer
|
|
22
|
+
the Software, or any part thereof, to any third party outside of
|
|
23
|
+
WP Online Magyarország Kft. without the express prior written permission
|
|
24
|
+
of an authorized representative of the Company.
|
|
25
|
+
b. Use the Software for any purpose not expressly permitted by this License,
|
|
26
|
+
including any personal or commercial projects unrelated to the
|
|
27
|
+
Company's business.
|
|
28
|
+
c. Remove or alter any copyright, trademark, or other proprietary notices
|
|
29
|
+
contained in the Software.
|
|
30
|
+
d. Reverse engineer, decompile, or disassemble the Software, except and
|
|
31
|
+
only to the extent that such activity is expressly permitted by
|
|
32
|
+
applicable law notwithstanding this limitation.
|
|
33
|
+
|
|
34
|
+
3. OWNERSHIP AND INTELLECTUAL PROPERTY:
|
|
35
|
+
The Company retains all right, title, and interest in and to the Software,
|
|
36
|
+
including all copyrights, patents, trade secrets, trademarks, and other
|
|
37
|
+
intellectual property rights therein. No rights are granted to Authorized
|
|
38
|
+
Users other than those expressly set forth in this License.
|
|
39
|
+
|
|
40
|
+
4. CONFIDENTIALITY:
|
|
41
|
+
The Software, including its source code, design, and structure, is
|
|
42
|
+
confidential information of the Company. Authorized Users shall treat the
|
|
43
|
+
Software with the same degree of care as they treat other Company
|
|
44
|
+
confidential information and shall not disclose it to any third party
|
|
45
|
+
without the Company's prior written consent.
|
|
46
|
+
|
|
47
|
+
5. NO WARRANTY:
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
51
|
+
THE COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
|
|
52
|
+
IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
|
|
53
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
54
|
+
|
|
55
|
+
6. TERMINATION:
|
|
56
|
+
This License will terminate automatically if an Authorized User breaches any
|
|
57
|
+
of its terms and conditions. The license granted herein is also contingent
|
|
58
|
+
upon continued employment or contract with the Company and terminates
|
|
59
|
+
immediately upon the cessation of that relationship. Upon termination, the
|
|
60
|
+
Authorized User must cease all use of the Software and destroy all copies
|
|
61
|
+
|
|
62
|
+
of the Software in their possession or control.
|
|
63
|
+
|
|
64
|
+
7. GOVERNING LAW:
|
|
65
|
+
This License shall be governed by and construed in accordance with the laws
|
|
66
|
+
of Hungary, without regard to its conflict of law principles. Any disputes
|
|
67
|
+
arising under or in connection with this License shall be subject to the
|
|
68
|
+
exclusive jurisdiction of the courts of Hungary.
|
|
69
|
+
|
|
70
|
+
For questions regarding this license, please contact office@wpo.hu.
|
package/README.md
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
-
# inferative
|
|
1
|
+
# `inferative`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Inferative command line. It is on public npm, ships built JavaScript and runs under plain `node` (version 24 or
|
|
4
|
+
later). It has the command `init`, which creates a project, and the group `site`: the commands a website runs against
|
|
5
|
+
its channel.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx inferative init my-site
|
|
9
|
+
npx inferative site --help
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## What a site needs first
|
|
13
|
+
|
|
14
|
+
The command line itself comes from public npm. Its dependencies, the `@inferative/*` packages and the `@heximon/*`
|
|
15
|
+
packages they use, come from GitHub Packages. So `npx inferative` works in a folder where npm can read both scopes:
|
|
16
|
+
|
|
17
|
+
```ini
|
|
18
|
+
@inferative:registry=https://npm.pkg.github.com
|
|
19
|
+
@heximon:registry=https://npm.pkg.github.com
|
|
20
|
+
//npm.pkg.github.com/:_authToken=<a GitHub token with the read:packages scope>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`inferative site doctor` checks both scopes and the token, reads one package through each scope, and prints the
|
|
24
|
+
lines to add for the first scope that fails.
|
|
25
|
+
|
|
26
|
+
## `inferative init`
|
|
27
|
+
|
|
28
|
+
`inferative init [directory]` creates a project from a starter. `npm create inferative` runs the same command (see
|
|
29
|
+
[`create-inferative`](../create-inferative)).
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npx inferative init my-site
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| Argument or flag | What it does |
|
|
36
|
+
| :-- | :-- |
|
|
37
|
+
| `directory` | The folder to create. When you leave it out, the current folder is the target. |
|
|
38
|
+
| `--starter <name>` | The starter to use. `nuxt-cloudflare` by default. |
|
|
39
|
+
| `--source <giget source>` | Download this giget source alone, instead of the default sources. |
|
|
40
|
+
| `--local <folder>` | Copy `<folder>/<starter>` instead of a download. For tests and for work on the starters. |
|
|
41
|
+
| `--no-install` | Do not run `pnpm install`. |
|
|
42
|
+
| `--cwd <folder>` | The folder in which a named `directory` is created. The current folder by default. |
|
|
43
|
+
|
|
44
|
+
The target folder must not exist, or must be empty. The command never overwrites a file. The package name is the
|
|
45
|
+
base name of the folder. A named folder must have a valid npm name: lowercase letters, digits, and `.` `_` `-`. The
|
|
46
|
+
current folder keeps its name on disk, so the command changes the name to a valid one (`My Site` becomes `my-site`).
|
|
47
|
+
|
|
48
|
+
The command does these steps in this order:
|
|
49
|
+
|
|
50
|
+
1. It writes `@inferative:registry=https://npm.pkg.github.com` and `@heximon:registry=https://npm.pkg.github.com`
|
|
51
|
+
into the `.npmrc` of the project. It adds only the lines that are missing. It never removes a line and never writes
|
|
52
|
+
a token.
|
|
53
|
+
2. It probes both scopes, as `inferative site doctor` does. If a scope fails, the command removes what it wrote, prints
|
|
54
|
+
the lines to add to your `~/.npmrc`, and exits with code 1. It downloads nothing. The probe runs `npm` through
|
|
55
|
+
[tinyexec](https://github.com/tinylibs/tinyexec) with `--prefix <the new folder>`, so npm reads the `.npmrc` of the
|
|
56
|
+
new project and not one of a project above it. On Windows tinyexec escapes each argument, so a folder name with a
|
|
57
|
+
space or an `&` reaches npm as one argument.
|
|
58
|
+
3. It downloads the starter from the repository `inferative/starters`, with giget. The command tries
|
|
59
|
+
`gh:inferative/starters/<starter>#v<major.minor>` first, where `major.minor` is the version of this command line.
|
|
60
|
+
If that download fails, it tries `gh:inferative/starters/<starter>#main`. A `--source` is tried alone. Only a failed
|
|
61
|
+
download moves on to the next source.
|
|
62
|
+
4. It sets `name` in `package.json`, and sets the range of `inferative` and of every `@inferative/*` dependency to
|
|
63
|
+
`^<version of this command line>`. The other ranges stay as the starter pins them.
|
|
64
|
+
5. It runs `pnpm install` in the project, through [nypm](https://github.com/unjs/nypm). nypm runs pnpm through
|
|
65
|
+
Corepack when Corepack is installed, and runs `pnpm` directly when it is not. If pnpm is missing, or the install
|
|
66
|
+
fails, the command exits with code 1 and keeps the project, because the files are complete.
|
|
67
|
+
|
|
68
|
+
At the end, the command prints the next steps: `cd` into the folder, copy `.env.example` to `.env`, run `pnpm db:generate` once, and run `pnpm dev`.
|
|
69
|
+
|
|
70
|
+
## The `site` commands
|
|
71
|
+
|
|
72
|
+
Run them from the site's folder. The command finds the site root: the nearest folder above the working directory
|
|
73
|
+
with a `package.json`. It loads the site's declarations from `shared/site.ts` there, through `jiti`, because that
|
|
74
|
+
file is the site's own TypeScript. `--site <path>` names another declarations module.
|
|
75
|
+
|
|
76
|
+
| Command | What it does |
|
|
77
|
+
| :-- | :-- |
|
|
78
|
+
| `inferative site check` | Audits the declarations against the components, builds the manifest and measures it. Needs no network and no credential. `--against <api>` also reports whether the channel serves this build. |
|
|
79
|
+
| `inferative site sync` | Publishes the manifest to the channel, then waits until the channel serves that version. `--first-sync` publishes the first-sync catalog. `--manifest <file>` publishes a prebuilt envelope as it is. |
|
|
80
|
+
| `inferative site doctor [origin]` | Reports registry access, then reads the diagnostic of a running site at `<origin>/_site/health`. `--local` diagnoses from the site's configuration instead. `--path <path>` names a diagnostic mounted elsewhere. |
|
|
81
|
+
| `inferative site config` | Prints what the command line read from the declarations and the runtime configuration. |
|
|
82
|
+
|
|
83
|
+
`sync` presents the key in `INFERATIVE_MANIFEST_TOKEN`. The channel and the API come from the `site` runtime config
|
|
84
|
+
section, or from the `INFERATIVE_SITE_*` variables. Every `site` command first reads the `.env` file of the site root,
|
|
85
|
+
the file the connect guide of the dashboard fills. A variable that is already set in the environment wins over the
|
|
86
|
+
file, and a missing file is not an error. The agent skill (`docs/skills/inferative`, the page
|
|
87
|
+
`site-deploy-and-topologies`) lists every variable and every exit code.
|
|
88
|
+
|
|
89
|
+
## How it is built
|
|
90
|
+
|
|
91
|
+
`vp pack` bundles `src/bin.ts` into `dist/bin.mjs`, and `src/index.ts` into `dist/index.mjs`. The index is the library
|
|
92
|
+
entry: it exports `InitCommand`, which `create-inferative` runs. The pack bundles the `@inferative/*` subpaths that
|
|
93
|
+
map to raw TypeScript (`core`, `utils`), because Node cannot load those from `node_modules`. Every other
|
|
94
|
+
`@inferative/*` and `@heximon/*` import stays external and appears in `dependencies`. That way the command line and the site it reads
|
|
95
|
+
share one copy of each `./api` and `./config` module. `deps.onlyImport` in `vite.config.ts` fails the build when the
|
|
96
|
+
output imports a package that `dependencies` does not name.
|
|
97
|
+
|
|
98
|
+
The package has no `jiti` loader for its own code. `jiti` reads only the site's declarations file.
|
package/dist/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|