@inditextech/docouture-cli 0.1.0-SNAPSHOT.52.1 → 0.1.0-SNAPSHOT.57.1
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/build/commands/new.js +1 -0
- package/build/commands/upgrade.js +4 -0
- package/build/lib/copy-template.js +1 -0
- package/build/lib/detect-package-manager.js +28 -1
- package/build/lib/dev-server.js +1 -1
- package/build/templates/starter/package.json +1 -0
- package/build/templates/workflows/docouture-kroki-cache-warm.yml +9 -0
- package/build/templates/workflows/docouture-pr-verify.yml +8 -0
- package/package.json +1 -1
package/build/commands/new.js
CHANGED
|
@@ -394,6 +394,7 @@ export async function runNew(argv, io = defaultIO()) {
|
|
|
394
394
|
pmLockfile: pm.lockfile,
|
|
395
395
|
pmCiCmd: pm.ciCmd,
|
|
396
396
|
pmSetupStepYaml: pm.setupStepYaml,
|
|
397
|
+
pmPackageManagerField: pm.packageManagerField,
|
|
397
398
|
repoIgnoreGlob: repoIgnoreGlob(target),
|
|
398
399
|
};
|
|
399
400
|
// The whole starter subtree — package.json, antora-playbook.yml, its own
|
|
@@ -108,6 +108,10 @@ export async function runUpgrade(argv) {
|
|
|
108
108
|
pmLockfile: pm.lockfile,
|
|
109
109
|
pmCiCmd: pm.ciCmd,
|
|
110
110
|
pmSetupStepYaml: pm.setupStepYaml,
|
|
111
|
+
// Same reasoning as repoIgnoreGlob below: package.json (the only
|
|
112
|
+
// template file this placeholder appears in) is never re-copied by
|
|
113
|
+
// upgrade either, so there's nothing meaningful to compute it from.
|
|
114
|
+
pmPackageManagerField: 'unused-by-upgrade',
|
|
111
115
|
// upgrade never re-copies docs/ (see below) — package.json, the only
|
|
112
116
|
// template file this placeholder appears in, is never touched here — so
|
|
113
117
|
// there's nothing meaningful to compute it from. Not an empty string:
|
|
@@ -22,6 +22,7 @@ const PLACEHOLDERS = {
|
|
|
22
22
|
// value (which ends in its own `\n` — see packageManagerPlan) or the
|
|
23
23
|
// empty npm value drop cleanly in its place.
|
|
24
24
|
' # __DOCOUTURE_PM_SETUP_STEP__\n': 'pmSetupStepYaml',
|
|
25
|
+
__DOCOUTURE_PM_PACKAGE_MANAGER__: 'pmPackageManagerField',
|
|
25
26
|
// A bare token this time, unlike pmSetupStepYaml above — see
|
|
26
27
|
// TemplateValues.repoIgnoreGlob's own comment for why the whole-segment
|
|
27
28
|
// trick doesn't survive here.
|
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
2
3
|
import { readFileSync, existsSync } from 'node:fs';
|
|
3
4
|
import { join } from 'node:path';
|
|
4
5
|
const PNPM_ACTION_SETUP_STEP = ' - name: Setup pnpm\n' +
|
|
5
|
-
' uses: pnpm/action-setup@
|
|
6
|
+
' uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4\n' +
|
|
7
|
+
' with:\n' +
|
|
8
|
+
// `package_json_file` "must be relative to the repository root
|
|
9
|
+
// (GITHUB_WORKSPACE)" per the action's own action.yml — its default
|
|
10
|
+
// ('package.json') looks at the true repo root, not this site's own
|
|
11
|
+
// docs/package.json, even though `defaults.run.working-directory: docs`
|
|
12
|
+
// applies everywhere else in this workflow. Same gotcha, same fix as
|
|
13
|
+
// setup-node's `cache-dependency-path` a few lines below.
|
|
14
|
+
' package_json_file: docs/package.json\n' +
|
|
6
15
|
'\n';
|
|
16
|
+
// The exact pnpm/npm version actually available wherever `docouture new` is
|
|
17
|
+
// running — queried directly rather than guessed, so the `packageManager`
|
|
18
|
+
// field this writes into the scaffolded package.json (see
|
|
19
|
+
// packageManagerPlan below) is always a real, installable version. Falls
|
|
20
|
+
// back to a pinned last-known-good version only if the binary can't be
|
|
21
|
+
// queried at all (e.g. a test sandbox with neither on PATH) — degrading
|
|
22
|
+
// gracefully rather than leaving the scaffold without a value that
|
|
23
|
+
// `pnpm/action-setup` (CI) and corepack (locally) both need.
|
|
24
|
+
function detectPackageManagerVersion(pm) {
|
|
25
|
+
try {
|
|
26
|
+
return execFileSync(pm, ['--version'], { encoding: 'utf8' }).trim();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return pm === 'pnpm' ? '10.24.0' : '10.9.2';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
7
32
|
// Reads the invoking package manager off npm's own user-agent env var — set
|
|
8
33
|
// by npm, pnpm and yarn alike on every script/exec they run, e.g.
|
|
9
34
|
// 'pnpm/9.1.0 npm/? node/v20.11.0 darwin x64'. This is how `docouture new` was
|
|
@@ -64,6 +89,7 @@ export function packageManagerPlan(pm) {
|
|
|
64
89
|
lockfile: 'pnpm-lock.yaml',
|
|
65
90
|
cacheName: 'pnpm',
|
|
66
91
|
setupStepYaml: PNPM_ACTION_SETUP_STEP,
|
|
92
|
+
packageManagerField: `pnpm@${detectPackageManagerVersion('pnpm')}`,
|
|
67
93
|
};
|
|
68
94
|
}
|
|
69
95
|
return {
|
|
@@ -74,6 +100,7 @@ export function packageManagerPlan(pm) {
|
|
|
74
100
|
lockfile: 'package-lock.json',
|
|
75
101
|
cacheName: 'npm',
|
|
76
102
|
setupStepYaml: '',
|
|
103
|
+
packageManagerField: `npm@${detectPackageManagerVersion('npm')}`,
|
|
77
104
|
};
|
|
78
105
|
}
|
|
79
106
|
//# sourceMappingURL=detect-package-manager.js.map
|
package/build/lib/dev-server.js
CHANGED
|
@@ -309,7 +309,7 @@ export async function startDevServer(options) {
|
|
|
309
309
|
log(`serving ${root}`);
|
|
310
310
|
log(` http://localhost:${port}${basePath}/`);
|
|
311
311
|
const watchers = [
|
|
312
|
-
watchPath(join(siteRoot, '
|
|
312
|
+
watchPath(join(siteRoot, 'src')),
|
|
313
313
|
watchPath(join(siteRoot, 'antora-playbook.local.yml'), { recursive: false }),
|
|
314
314
|
];
|
|
315
315
|
void Promise.all(watchers);
|
|
@@ -29,6 +29,15 @@ on:
|
|
|
29
29
|
push:
|
|
30
30
|
branches: ['main*']
|
|
31
31
|
|
|
32
|
+
# Least-privilege default: this job only checks out `main`, warms the
|
|
33
|
+
# Docker/Kroki image cache and writes it via actions/cache (a separate,
|
|
34
|
+
# token-independent cache API, not repository contents) — it never uses
|
|
35
|
+
# GITHUB_TOKEN itself, so it never needs more than read access. Declared
|
|
36
|
+
# explicitly rather than left to inherit whatever the repository/
|
|
37
|
+
# organization's default token permissions happen to be.
|
|
38
|
+
permissions:
|
|
39
|
+
contents: read
|
|
40
|
+
|
|
32
41
|
concurrency:
|
|
33
42
|
group: docouture-kroki-cache-warm
|
|
34
43
|
cancel-in-progress: true
|
|
@@ -19,6 +19,14 @@ name: docouture-pr-verify
|
|
|
19
19
|
on:
|
|
20
20
|
pull_request: {}
|
|
21
21
|
|
|
22
|
+
# Least-privilege default: this job only checks out the PR's own HEAD,
|
|
23
|
+
# builds it, and checks links — it never writes to the repository, comments
|
|
24
|
+
# on the PR, or otherwise uses GITHUB_TOKEN, so it never needs more than
|
|
25
|
+
# read access. Declared explicitly rather than left to inherit whatever the
|
|
26
|
+
# repository/organization's default token permissions happen to be.
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
22
30
|
concurrency:
|
|
23
31
|
group: docouture-pr-verify-${{ github.event.pull_request.number }}
|
|
24
32
|
cancel-in-progress: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/docouture-cli",
|
|
3
|
-
"version": "0.1.0-SNAPSHOT.
|
|
3
|
+
"version": "0.1.0-SNAPSHOT.57.1",
|
|
4
4
|
"description": "Command-line tool for docouture documentation sites: scaffold a new site and set its Antora version outside the monorepo",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|