@seangalie/precast 0.0.0-stage → 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/CHANGELOG.md +28 -0
- package/LICENSE +202 -0
- package/README.md +217 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +3 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +140 -0
- package/dist/collect.d.ts +17 -0
- package/dist/collect.js +143 -0
- package/dist/context.d.ts +32 -0
- package/dist/context.js +159 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +8 -0
- package/dist/fnmatch.d.ts +9 -0
- package/dist/fnmatch.js +110 -0
- package/dist/generate.d.ts +17 -0
- package/dist/generate.js +67 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/output-path.d.ts +30 -0
- package/dist/output-path.js +84 -0
- package/dist/platforms.d.ts +17 -0
- package/dist/platforms.js +62 -0
- package/dist/tiers.d.ts +23 -0
- package/dist/tiers.js +96 -0
- package/package.json +44 -4
- package/platforms/forgejo/files/.forgejo/CODEOWNERS.tmpl +2 -0
- package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/01_bug_report.yml.tmpl +83 -0
- package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/02_feature_request.yml.tmpl +57 -0
- package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/03_codebase_improvement.yml.tmpl +44 -0
- package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/04_support_question.yml.tmpl +47 -0
- package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/config.yml.tmpl +13 -0
- package/platforms/forgejo/files/.forgejo/PULL_REQUEST_TEMPLATE.md.tmpl +49 -0
- package/platforms/forgejo/files/.forgejo/SETUP.md.tmpl +61 -0
- package/platforms/forgejo/files/.forgejo/labels.yml.tmpl +99 -0
- package/platforms/forgejo/files/.forgejo/scripts/check-labels.sh.tmpl +91 -0
- package/platforms/forgejo/files/.forgejo/scripts/sync-labels.sh.tmpl +165 -0
- package/platforms/forgejo/files/.forgejo/workflows/labels.yml.tmpl +45 -0
- package/platforms/forgejo/files/.forgejo/workflows/lint.yml.tmpl +78 -0
- package/platforms/forgejo/files/.forgejo/workflows/pr-labels.yml.tmpl +51 -0
- package/platforms/forgejo/files/.forgejo/workflows/pre-commit.yml.tmpl +24 -0
- package/platforms/forgejo/files/.forgejo/workflows/release.yml.tmpl +130 -0
- package/platforms/forgejo/files/.forgejo/workflows/renovate.yml.tmpl +61 -0
- package/platforms/forgejo/files/.forgejo/workflows/stale.yml.tmpl +260 -0
- package/platforms/forgejo/files/renovate.json +36 -0
- package/platforms/forgejo/platform.json +41 -0
- package/platforms/github/files/.github/CODEOWNERS.tmpl +2 -0
- package/platforms/github/files/.github/ISSUE_TEMPLATE/01_bug_report.yml.tmpl +83 -0
- package/platforms/github/files/.github/ISSUE_TEMPLATE/02_feature_request.yml.tmpl +57 -0
- package/platforms/github/files/.github/ISSUE_TEMPLATE/03_codebase_improvement.yml.tmpl +44 -0
- package/platforms/github/files/.github/ISSUE_TEMPLATE/04_support_question.yml.tmpl +47 -0
- package/platforms/github/files/.github/ISSUE_TEMPLATE/config.yml.tmpl +16 -0
- package/platforms/github/files/.github/PULL_REQUEST_TEMPLATE.md.tmpl +49 -0
- package/platforms/github/files/.github/SETUP.md.tmpl +46 -0
- package/platforms/github/files/.github/dependabot.yml.tmpl +75 -0
- package/platforms/github/files/.github/labels.yml.tmpl +103 -0
- package/platforms/github/files/.github/release.yml.tmpl +47 -0
- package/platforms/github/files/.github/workflows/ci.yml.tmpl +55 -0
- package/platforms/github/files/.github/workflows/codeql.yml.tmpl +63 -0
- package/platforms/github/files/.github/workflows/labels.yml.tmpl +34 -0
- package/platforms/github/files/.github/workflows/lint-workflows.yml.tmpl +75 -0
- package/platforms/github/files/.github/workflows/lint.yml.tmpl +69 -0
- package/platforms/github/files/.github/workflows/lock.yml.tmpl +46 -0
- package/platforms/github/files/.github/workflows/pr-labels.yml.tmpl +26 -0
- package/platforms/github/files/.github/workflows/pre-commit.yml.tmpl +25 -0
- package/platforms/github/files/.github/workflows/release.yml.tmpl +101 -0
- package/platforms/github/files/.github/workflows/stale.yml.tmpl +57 -0
- package/platforms/github/platform.json +44 -0
- package/platforms/gitlab/files/.gitlab/CODEOWNERS.tmpl +2 -0
- package/platforms/gitlab/files/.gitlab/SETUP.md.tmpl +62 -0
- package/platforms/gitlab/files/.gitlab/issue_templates/01_bug_report.md +18 -0
- package/platforms/gitlab/files/.gitlab/issue_templates/02_feature_request.md +11 -0
- package/platforms/gitlab/files/.gitlab/issue_templates/03_codebase_improvement.md +11 -0
- package/platforms/gitlab/files/.gitlab/issue_templates/04_support_question.md +12 -0
- package/platforms/gitlab/files/.gitlab/labels.json +122 -0
- package/platforms/gitlab/files/.gitlab/merge_request_templates/Default.md +14 -0
- package/platforms/gitlab/files/.gitlab/scripts/project.py +159 -0
- package/platforms/gitlab/files/.gitlab-ci.yml.tmpl +54 -0
- package/platforms/gitlab/platform.json +34 -0
- package/template/.editorconfig.tmpl +54 -0
- package/template/.gitattributes +107 -0
- package/template/.gitignore.tmpl +244 -0
- package/template/.pre-commit-config.yaml.tmpl +43 -0
- package/template/.repo/check-secrets.py +40 -0
- package/template/.repo/ci-checks.sh +18 -0
- package/template/AGENTS.md.tmpl +75 -0
- package/template/CHANGELOG.md.tmpl +24 -0
- package/template/CLAUDE.md +1 -0
- package/template/LICENSE +202 -0
- package/template/README.md.tmpl +101 -0
- package/template/SETUP.md.tmpl +47 -0
- package/template/docs/CODE_OF_CONDUCT.md +85 -0
- package/template/docs/CONTRIBUTING.md.tmpl +54 -0
- package/template/docs/SECURITY.md.tmpl +26 -0
- package/template/docs/SUPPORT.md.tmpl +19 -0
- package/template/docs/logo.svg +84 -0
- package/template/docs/screenshot.png +0 -0
- package/tiers.json +10 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { lstatSync, realpathSync, statSync } from "node:fs";
|
|
2
|
+
import path, {} from "node:path";
|
|
3
|
+
import { PrecastError } from "./errors.js";
|
|
4
|
+
export const nodeHost = {
|
|
5
|
+
path,
|
|
6
|
+
cwd: () => process.cwd(),
|
|
7
|
+
// On Windows, resolve uses the drive's own working directory when it has one.
|
|
8
|
+
driveCwd: (drive) => path.resolve(drive),
|
|
9
|
+
realpath(entry) {
|
|
10
|
+
try {
|
|
11
|
+
return realpathSync.native(entry);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const code = error.code;
|
|
15
|
+
// Only a missing entry is treated as a directory still to be created.
|
|
16
|
+
// A dangling symlink is also ENOENT, so check for the entry itself.
|
|
17
|
+
if (code === "ENOENT" && !lstatSync(entry, { throwIfNoEntry: false })) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
throw new PrecastError(`Output path cannot be followed at ${entry}: ${code ?? error}`);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
isDirectory: (entry) => statSync(entry).isDirectory(),
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Resolve `output` the way the operating system would: each existing directory
|
|
27
|
+
* becomes its real path, with symlinks followed and letter case corrected,
|
|
28
|
+
* before the next `..` applies. Path normalization alone would apply `..` to
|
|
29
|
+
* a link's name instead. The final component stays as written, so a symlink
|
|
30
|
+
* there still counts as an existing output.
|
|
31
|
+
*
|
|
32
|
+
* Only the host's separators split the path, so a backslash is part of a name
|
|
33
|
+
* outside Windows, and the root (`/`, `C:\`, or `\\server\share\`) is never
|
|
34
|
+
* split. An existing file cannot be followed by more components, as the
|
|
35
|
+
* operating system would refuse it with ENOTDIR.
|
|
36
|
+
*/
|
|
37
|
+
export function canonicalPath(output, host = nodeHost) {
|
|
38
|
+
const { path: paths } = host;
|
|
39
|
+
const absolute = absolutePath(output, host);
|
|
40
|
+
const root = paths.parse(absolute).root;
|
|
41
|
+
const separators = paths.sep === "\\" ? /[\\/]/ : /\//;
|
|
42
|
+
const parts = absolute
|
|
43
|
+
.slice(root.length)
|
|
44
|
+
.split(separators)
|
|
45
|
+
.filter((part) => part !== "" && part !== ".");
|
|
46
|
+
let current = paths.normalize(root);
|
|
47
|
+
parts.forEach((part, index) => {
|
|
48
|
+
if (part === "..") {
|
|
49
|
+
current = paths.dirname(current);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const next = paths.join(current, part);
|
|
53
|
+
if (index === parts.length - 1) {
|
|
54
|
+
current = next;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const real = host.realpath(next);
|
|
58
|
+
if (real !== undefined && !host.isDirectory(real)) {
|
|
59
|
+
throw new PrecastError(`Output path continues past a file: ${next}`);
|
|
60
|
+
}
|
|
61
|
+
current = real ?? next;
|
|
62
|
+
});
|
|
63
|
+
return current;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Make `output` absolute without collapsing `..`, which join and resolve would
|
|
67
|
+
* do lexically. On Windows, `C:demo` is relative to drive C's working
|
|
68
|
+
* directory and `\demo` to the root of the working directory's drive or share.
|
|
69
|
+
*/
|
|
70
|
+
function absolutePath(output, host) {
|
|
71
|
+
const { path: paths } = host;
|
|
72
|
+
const cwd = host.cwd();
|
|
73
|
+
if (paths.sep === "\\") {
|
|
74
|
+
const root = paths.parse(output).root;
|
|
75
|
+
const cwdRoot = paths.parse(cwd).root;
|
|
76
|
+
if (/^[A-Za-z]:$/.test(root)) {
|
|
77
|
+
return `${host.driveCwd(root)}${paths.sep}${output.slice(root.length)}`;
|
|
78
|
+
}
|
|
79
|
+
if (root === "\\" || root === "/") {
|
|
80
|
+
return `${cwdRoot.replace(/[\\/]$/, "")}${output}`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return paths.isAbsolute(output) ? output : `${cwd}${paths.sep}${output}`;
|
|
84
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The contents of `platforms/<id>/platform.json`; see docs/ARCHITECTURE.md. */
|
|
2
|
+
export interface PlatformDescriptor {
|
|
3
|
+
server_url: string;
|
|
4
|
+
nested_namespaces: boolean;
|
|
5
|
+
runner: string;
|
|
6
|
+
codeowners_pattern: string;
|
|
7
|
+
tiers?: Record<string, string[]>;
|
|
8
|
+
/** Ordered values; later entries may refer to earlier ones with `{KEY}`. */
|
|
9
|
+
context: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/** Platform IDs are the names of directories that contain a descriptor. */
|
|
12
|
+
export declare function platformNames(root: string): string[];
|
|
13
|
+
/** Read a descriptor's JSON without checking its shape; tier lists are validated separately. */
|
|
14
|
+
export declare function readRawPlatform(root: string, name: string): Record<string, unknown>;
|
|
15
|
+
export declare function readPlatform(root: string, name: string): PlatformDescriptor;
|
|
16
|
+
export declare function parseDescriptor(value: Record<string, unknown>, name: string): PlatformDescriptor;
|
|
17
|
+
export declare function readJson(path: string): unknown;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { PrecastError } from "./errors.js";
|
|
4
|
+
import { isPlainObject } from "./tiers.js";
|
|
5
|
+
const STRING_FIELDS = ["server_url", "runner", "codeowners_pattern"];
|
|
6
|
+
const KNOWN_FIELDS = new Set([...STRING_FIELDS, "nested_namespaces", "tiers", "context"]);
|
|
7
|
+
/** Platform IDs are the names of directories that contain a descriptor. */
|
|
8
|
+
export function platformNames(root) {
|
|
9
|
+
const directory = join(root, "platforms");
|
|
10
|
+
if (!existsSync(directory)) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
return readdirSync(directory, { withFileTypes: true })
|
|
14
|
+
.filter((entry) => entry.isDirectory() && existsSync(join(directory, entry.name, "platform.json")))
|
|
15
|
+
.map((entry) => entry.name)
|
|
16
|
+
.sort();
|
|
17
|
+
}
|
|
18
|
+
/** Read a descriptor's JSON without checking its shape; tier lists are validated separately. */
|
|
19
|
+
export function readRawPlatform(root, name) {
|
|
20
|
+
if (!platformNames(root).includes(name)) {
|
|
21
|
+
throw new PrecastError(`Unknown platform: ${name}`);
|
|
22
|
+
}
|
|
23
|
+
const value = readJson(join(root, "platforms", name, "platform.json"));
|
|
24
|
+
if (!isPlainObject(value)) {
|
|
25
|
+
throw new PrecastError(`Platform descriptor ${name} must be a JSON object`);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
export function readPlatform(root, name) {
|
|
30
|
+
return parseDescriptor(readRawPlatform(root, name), name);
|
|
31
|
+
}
|
|
32
|
+
export function parseDescriptor(value, name) {
|
|
33
|
+
const label = `Platform descriptor ${name}`;
|
|
34
|
+
for (const field of Object.keys(value)) {
|
|
35
|
+
if (!KNOWN_FIELDS.has(field)) {
|
|
36
|
+
throw new PrecastError(`${label} has an unknown field: ${field}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const field of STRING_FIELDS) {
|
|
40
|
+
if (typeof value[field] !== "string") {
|
|
41
|
+
throw new PrecastError(`${label} needs a string ${field}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (typeof value.nested_namespaces !== "boolean") {
|
|
45
|
+
throw new PrecastError(`${label} needs a boolean nested_namespaces`);
|
|
46
|
+
}
|
|
47
|
+
const context = value.context;
|
|
48
|
+
if (!isPlainObject(context) ||
|
|
49
|
+
!Object.values(context).every((entry) => typeof entry === "string")) {
|
|
50
|
+
throw new PrecastError(`${label} needs a context object of strings`);
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
export function readJson(path) {
|
|
55
|
+
const text = readFileSync(path, "utf8");
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(text);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw new PrecastError(`Invalid JSON in ${path}: ${error.message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
package/dist/tiers.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Each tier includes everything in the tiers before it. */
|
|
2
|
+
export declare const TIERS: readonly ["slim", "regular", "full"];
|
|
3
|
+
export type Tier = (typeof TIERS)[number];
|
|
4
|
+
export declare const DEFAULT_TIER: Tier;
|
|
5
|
+
export declare function isTier(value: string): value is Tier;
|
|
6
|
+
export declare function tierIndex(tier: Tier): number;
|
|
7
|
+
export interface TierPattern {
|
|
8
|
+
/** The first tier that includes matching files. */
|
|
9
|
+
tier: Tier;
|
|
10
|
+
regex: RegExp;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Map output patterns to the first tier that includes them. Files no pattern
|
|
14
|
+
* matches belong to every tier, so only `regular` and `full` may be listed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function tierPatterns(manifest: unknown, label: string): Map<string, TierPattern>;
|
|
17
|
+
/**
|
|
18
|
+
* Keep the lines of `@@TIERS ...@@` blocks that list `tier` and drop the rest.
|
|
19
|
+
* Every line is checked, including those the selected tier drops, so a
|
|
20
|
+
* malformed block fails in every tier rather than only where it is kept.
|
|
21
|
+
*/
|
|
22
|
+
export declare function renderTierBlocks(text: string, tier: Tier, source: string): string;
|
|
23
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
package/dist/tiers.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { PrecastError } from "./errors.js";
|
|
2
|
+
import { compilePattern } from "./fnmatch.js";
|
|
3
|
+
/** Each tier includes everything in the tiers before it. */
|
|
4
|
+
export const TIERS = ["slim", "regular", "full"];
|
|
5
|
+
export const DEFAULT_TIER = "regular";
|
|
6
|
+
const TIER_OPEN = /^[ \t]*@@TIERS((?: [a-z]+)+)@@[ \t]*\n$/;
|
|
7
|
+
const TIER_CLOSE = /^[ \t]*@@END_TIERS@@[ \t]*\n$/;
|
|
8
|
+
const TIER_MARKER = /@@(?:TIERS[ @]|END_TIERS@@)/;
|
|
9
|
+
export function isTier(value) {
|
|
10
|
+
return TIERS.includes(value);
|
|
11
|
+
}
|
|
12
|
+
export function tierIndex(tier) {
|
|
13
|
+
return TIERS.indexOf(tier);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Map output patterns to the first tier that includes them. Files no pattern
|
|
17
|
+
* matches belong to every tier, so only `regular` and `full` may be listed.
|
|
18
|
+
*/
|
|
19
|
+
export function tierPatterns(manifest, label) {
|
|
20
|
+
if (manifest === undefined) {
|
|
21
|
+
return new Map();
|
|
22
|
+
}
|
|
23
|
+
if (!isPlainObject(manifest)) {
|
|
24
|
+
throw new PrecastError(`${label} tiers must be an object of pattern lists`);
|
|
25
|
+
}
|
|
26
|
+
const patterns = new Map();
|
|
27
|
+
for (const [tier, entries] of Object.entries(manifest)) {
|
|
28
|
+
if (tier !== "regular" && tier !== "full") {
|
|
29
|
+
throw new PrecastError(`${label} lists files for an unknown or base tier: '${tier}'`);
|
|
30
|
+
}
|
|
31
|
+
if (!Array.isArray(entries) || !entries.every((entry) => typeof entry === "string")) {
|
|
32
|
+
throw new PrecastError(`${label} tier '${tier}' must be a list of patterns`);
|
|
33
|
+
}
|
|
34
|
+
for (const pattern of entries) {
|
|
35
|
+
if (patterns.has(pattern)) {
|
|
36
|
+
throw new PrecastError(`${label} assigns '${pattern}' to more than one tier`);
|
|
37
|
+
}
|
|
38
|
+
let regex;
|
|
39
|
+
try {
|
|
40
|
+
regex = compilePattern(pattern);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw new PrecastError(`${label} has an invalid pattern '${pattern}': ${error.message}`);
|
|
44
|
+
}
|
|
45
|
+
patterns.set(pattern, { tier, regex });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return patterns;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Keep the lines of `@@TIERS ...@@` blocks that list `tier` and drop the rest.
|
|
52
|
+
* Every line is checked, including those the selected tier drops, so a
|
|
53
|
+
* malformed block fails in every tier rather than only where it is kept.
|
|
54
|
+
*/
|
|
55
|
+
export function renderTierBlocks(text, tier, source) {
|
|
56
|
+
const output = [];
|
|
57
|
+
let block;
|
|
58
|
+
let number = 0;
|
|
59
|
+
for (const line of splitLines(text)) {
|
|
60
|
+
number += 1;
|
|
61
|
+
const opening = TIER_OPEN.exec(line);
|
|
62
|
+
if (opening) {
|
|
63
|
+
if (block !== undefined) {
|
|
64
|
+
throw new PrecastError(`Nested tier block at ${source}:${number}`);
|
|
65
|
+
}
|
|
66
|
+
block = (opening[1] ?? "").trim().split(" ");
|
|
67
|
+
const unknown = block.filter((name) => !isTier(name)).sort();
|
|
68
|
+
if (unknown.length > 0) {
|
|
69
|
+
throw new PrecastError(`Unknown tier '${unknown[0]}' at ${source}:${number}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (TIER_CLOSE.test(line)) {
|
|
73
|
+
if (block === undefined) {
|
|
74
|
+
throw new PrecastError(`Unmatched end of tier block at ${source}:${number}`);
|
|
75
|
+
}
|
|
76
|
+
block = undefined;
|
|
77
|
+
}
|
|
78
|
+
else if (TIER_MARKER.test(line)) {
|
|
79
|
+
throw new PrecastError(`Malformed tier block marker at ${source}:${number}`);
|
|
80
|
+
}
|
|
81
|
+
else if (block === undefined || block.includes(tier)) {
|
|
82
|
+
output.push(line);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (block !== undefined) {
|
|
86
|
+
throw new PrecastError(`Unterminated tier block in ${source}`);
|
|
87
|
+
}
|
|
88
|
+
return output.join("");
|
|
89
|
+
}
|
|
90
|
+
/** Split after each LF, keeping the terminators so joining restores the input. */
|
|
91
|
+
function splitLines(text) {
|
|
92
|
+
return text.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
93
|
+
}
|
|
94
|
+
export function isPlainObject(value) {
|
|
95
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
96
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seangalie/precast",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generate new Forgejo, GitHub, and GitLab projects with documentation, checks, and forge settings in place",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Sean Galie",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"precast": "dist/bin.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"CHANGELOG.md",
|
|
19
|
+
"dist/",
|
|
20
|
+
"platforms/",
|
|
21
|
+
"template/",
|
|
22
|
+
"tiers.json",
|
|
23
|
+
"!**/__pycache__/**"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.18"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json",
|
|
30
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
31
|
+
"lint": "biome check",
|
|
32
|
+
"format": "biome check --write",
|
|
33
|
+
"test": "node --test --experimental-strip-types \"test/**/*.test.ts\"",
|
|
34
|
+
"check-generated": "node --experimental-strip-types scripts/check-generated.ts",
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"prepublishOnly": "npm run build && npm test && node scripts/check-package.ts"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@biomejs/biome": "2.6.8",
|
|
40
|
+
"@types/node": "22.20.5",
|
|
41
|
+
"typescript": "7.0.2"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 🐛 Bug Report
|
|
3
|
+
description: Report a defect so that this project can be fixed
|
|
4
|
+
title: "bug: "
|
|
5
|
+
labels: ["bug"]
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: |
|
|
10
|
+
Thanks for taking the time to file a report. The more precisely you can
|
|
11
|
+
describe the problem, the faster it can be reproduced and fixed.
|
|
12
|
+
|
|
13
|
+
- type: checkboxes
|
|
14
|
+
id: preflight
|
|
15
|
+
attributes:
|
|
16
|
+
label: Before you start
|
|
17
|
+
options:
|
|
18
|
+
- label: I searched the open and closed issues and this has not been reported yet.
|
|
19
|
+
required: true
|
|
20
|
+
- label: I am running the most recent version of this project.
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: input
|
|
24
|
+
id: version
|
|
25
|
+
attributes:
|
|
26
|
+
label: Version
|
|
27
|
+
description: The release tag or commit SHA you are running.
|
|
28
|
+
placeholder: "v1.2.3, or 0a1b2c3"
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
|
|
32
|
+
- type: textarea
|
|
33
|
+
id: current
|
|
34
|
+
attributes:
|
|
35
|
+
label: Current behavior
|
|
36
|
+
description: What happens today? Describe how the bug manifests.
|
|
37
|
+
validations:
|
|
38
|
+
required: true
|
|
39
|
+
|
|
40
|
+
- type: textarea
|
|
41
|
+
id: expected
|
|
42
|
+
attributes:
|
|
43
|
+
label: Expected behavior
|
|
44
|
+
description: What did you expect to happen instead?
|
|
45
|
+
validations:
|
|
46
|
+
required: true
|
|
47
|
+
|
|
48
|
+
- type: textarea
|
|
49
|
+
id: steps
|
|
50
|
+
attributes:
|
|
51
|
+
label: Steps to reproduce
|
|
52
|
+
description: The exact sequence someone else can follow to see the same result.
|
|
53
|
+
value: |
|
|
54
|
+
1.
|
|
55
|
+
2.
|
|
56
|
+
3.
|
|
57
|
+
validations:
|
|
58
|
+
required: true
|
|
59
|
+
|
|
60
|
+
- type: textarea
|
|
61
|
+
id: environment
|
|
62
|
+
attributes:
|
|
63
|
+
label: Environment
|
|
64
|
+
description: Operating system, runtime version, browser -- whatever is relevant here.
|
|
65
|
+
validations:
|
|
66
|
+
required: false
|
|
67
|
+
|
|
68
|
+
- type: textarea
|
|
69
|
+
id: logs
|
|
70
|
+
attributes:
|
|
71
|
+
label: Relevant logs, errors, or code
|
|
72
|
+
description: This is rendered as a code block automatically, so no backticks are needed.
|
|
73
|
+
render: shell
|
|
74
|
+
validations:
|
|
75
|
+
required: false
|
|
76
|
+
|
|
77
|
+
- type: textarea
|
|
78
|
+
id: context
|
|
79
|
+
attributes:
|
|
80
|
+
label: Anything else?
|
|
81
|
+
description: Related issues, suggested fixes, or links to discussion elsewhere.
|
|
82
|
+
validations:
|
|
83
|
+
required: false
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ✨ Feature Request
|
|
3
|
+
description: Suggest an idea for this project
|
|
4
|
+
title: "feat: "
|
|
5
|
+
labels: ["enhancement"]
|
|
6
|
+
body:
|
|
7
|
+
- type: checkboxes
|
|
8
|
+
id: preflight
|
|
9
|
+
attributes:
|
|
10
|
+
label: Before you start
|
|
11
|
+
options:
|
|
12
|
+
- label: I searched the open and closed issues and this has not been requested yet.
|
|
13
|
+
required: true
|
|
14
|
+
|
|
15
|
+
- type: textarea
|
|
16
|
+
id: problem
|
|
17
|
+
attributes:
|
|
18
|
+
label: What problem does this solve?
|
|
19
|
+
description: Describe the problem or limitation you are running into.
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: solution
|
|
25
|
+
attributes:
|
|
26
|
+
label: Preferred solution
|
|
27
|
+
description: A clear description of what you would like to happen.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: alternatives
|
|
33
|
+
attributes:
|
|
34
|
+
label: Alternatives considered
|
|
35
|
+
description: Other approaches you looked at, and why they fall short.
|
|
36
|
+
validations:
|
|
37
|
+
required: false
|
|
38
|
+
|
|
39
|
+
- type: textarea
|
|
40
|
+
id: context
|
|
41
|
+
attributes:
|
|
42
|
+
label: Additional context
|
|
43
|
+
description: Use cases, example code, screenshots, links to prior art.
|
|
44
|
+
validations:
|
|
45
|
+
required: false
|
|
46
|
+
|
|
47
|
+
- type: dropdown
|
|
48
|
+
id: contribute
|
|
49
|
+
attributes:
|
|
50
|
+
label: Would you be willing to submit a pull request for this?
|
|
51
|
+
description: Help is available if you would like to try but are not sure where to start.
|
|
52
|
+
options:
|
|
53
|
+
- "Yes"
|
|
54
|
+
- "Yes, with guidance"
|
|
55
|
+
- "No"
|
|
56
|
+
validations:
|
|
57
|
+
required: true
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 🛠 Codebase Improvement
|
|
3
|
+
description: Suggest a better algorithm, structure, tool, or developer workflow
|
|
4
|
+
title: "dev: "
|
|
5
|
+
labels: ["enhancement", "refactor"]
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: |
|
|
10
|
+
Use this for changes that improve the codebase without changing what
|
|
11
|
+
@@PROJECT_NAME@@ does for its users -- refactors, tooling, build times,
|
|
12
|
+
test coverage, developer ergonomics.
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: area
|
|
16
|
+
attributes:
|
|
17
|
+
label: What part of the codebase?
|
|
18
|
+
description: Files, modules, or workflows this concerns. Links to lines are welcome.
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
21
|
+
|
|
22
|
+
- type: textarea
|
|
23
|
+
id: current
|
|
24
|
+
attributes:
|
|
25
|
+
label: What is the current approach?
|
|
26
|
+
description: Describe how it works today and what makes it worth changing.
|
|
27
|
+
validations:
|
|
28
|
+
required: true
|
|
29
|
+
|
|
30
|
+
- type: textarea
|
|
31
|
+
id: proposal
|
|
32
|
+
attributes:
|
|
33
|
+
label: What would you change it to?
|
|
34
|
+
description: The improvement you have in mind, and the benefit it brings.
|
|
35
|
+
validations:
|
|
36
|
+
required: true
|
|
37
|
+
|
|
38
|
+
- type: textarea
|
|
39
|
+
id: tradeoffs
|
|
40
|
+
attributes:
|
|
41
|
+
label: Trade-offs and risks
|
|
42
|
+
description: What would this cost, break, or make harder?
|
|
43
|
+
validations:
|
|
44
|
+
required: false
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ❓ Support Question
|
|
3
|
+
description: Ask how to use this project
|
|
4
|
+
title: "support: "
|
|
5
|
+
labels: ["question"]
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: |
|
|
10
|
+
Use this form when you have a question about using @@PROJECT_NAME@@.
|
|
11
|
+
Something that looks like a defect belongs in a bug report instead.
|
|
12
|
+
|
|
13
|
+
- type: checkboxes
|
|
14
|
+
id: preflight
|
|
15
|
+
attributes:
|
|
16
|
+
label: Before you start
|
|
17
|
+
options:
|
|
18
|
+
- label: I read the README and the documentation.
|
|
19
|
+
required: true
|
|
20
|
+
- label: I searched the existing open and closed issues.
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: question
|
|
25
|
+
attributes:
|
|
26
|
+
label: What are you trying to do?
|
|
27
|
+
description: Describe your goal, not only the step you are stuck on.
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: tried
|
|
33
|
+
attributes:
|
|
34
|
+
label: What have you tried so far?
|
|
35
|
+
description: Commands, configuration, or code you have already attempted.
|
|
36
|
+
render: shell
|
|
37
|
+
validations:
|
|
38
|
+
required: false
|
|
39
|
+
|
|
40
|
+
- type: input
|
|
41
|
+
id: version
|
|
42
|
+
attributes:
|
|
43
|
+
label: Version
|
|
44
|
+
description: The release tag or commit SHA you are running.
|
|
45
|
+
placeholder: "v1.2.3, or 0a1b2c3"
|
|
46
|
+
validations:
|
|
47
|
+
required: false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
blank_issues_enabled: false
|
|
3
|
+
|
|
4
|
+
contact_links:
|
|
5
|
+
- name: 📖 Contributing guide
|
|
6
|
+
url: @@REPO_URL@@/src/branch/@@BRANCH_URL@@/docs/CONTRIBUTING.md
|
|
7
|
+
about: How to set up a development environment and open a pull request.
|
|
8
|
+
- name: 🔒 Report a security vulnerability
|
|
9
|
+
url: @@REPO_URL@@/src/branch/@@BRANCH_URL@@/docs/SECURITY.md
|
|
10
|
+
about: Never open a public issue for a vulnerability. The security policy explains how to report one privately.
|
|
11
|
+
- name: 💬 Support guide
|
|
12
|
+
url: @@REPO_URL@@/src/branch/@@BRANCH_URL@@/docs/SUPPORT.md
|
|
13
|
+
about: Where to ask what, and what to expect.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!--- Please provide a general summary of your changes in the title above -->
|
|
2
|
+
|
|
3
|
+
## Pull Request type
|
|
4
|
+
|
|
5
|
+
<!-- Please try to limit your pull request to one type; submit multiple pull requests if needed. -->
|
|
6
|
+
|
|
7
|
+
Please check the type of change your PR introduces:
|
|
8
|
+
|
|
9
|
+
- [ ] Bugfix
|
|
10
|
+
- [ ] Feature
|
|
11
|
+
- [ ] Code style update (formatting, renaming)
|
|
12
|
+
- [ ] Refactoring (no functional changes, no API changes)
|
|
13
|
+
- [ ] Build-related changes
|
|
14
|
+
- [ ] Documentation content changes
|
|
15
|
+
- [ ] Other (please describe):
|
|
16
|
+
|
|
17
|
+
## What is the current behavior?
|
|
18
|
+
|
|
19
|
+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
|
20
|
+
|
|
21
|
+
Issue Number: N/A
|
|
22
|
+
|
|
23
|
+
## What is the new behavior?
|
|
24
|
+
|
|
25
|
+
<!-- Please describe the behavior or changes that are being added by this PR. -->
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
-
|
|
29
|
+
-
|
|
30
|
+
|
|
31
|
+
## Does this introduce a breaking change?
|
|
32
|
+
|
|
33
|
+
- [ ] Yes
|
|
34
|
+
- [ ] No
|
|
35
|
+
|
|
36
|
+
<!-- If this does introduce a breaking change, please describe the impact and migration path for existing applications below. -->
|
|
37
|
+
|
|
38
|
+
## Other information
|
|
39
|
+
|
|
40
|
+
<!-- Any other information that is important to this PR, such as screenshots of how the component looks before and after the change. -->
|
|
41
|
+
|
|
42
|
+
## Checklist
|
|
43
|
+
|
|
44
|
+
@@TIERS full@@
|
|
45
|
+
- [ ] This PR has a label saying what kind of change it is, such as `bugfix`, `new-feature` or `documentation`. The `PR Labels` check lists the accepted ones if it is missing, and a maintainer can add it for you.
|
|
46
|
+
@@END_TIERS@@
|
|
47
|
+
- [ ] User-visible changes are recorded under `## [Unreleased]` in [CHANGELOG.md](@@REPO_URL@@/src/branch/@@BRANCH_URL@@/CHANGELOG.md).
|
|
48
|
+
- [ ] Commit messages follow [conventional commits](https://www.conventionalcommits.org).
|
|
49
|
+
- [ ] Documentation has been updated where it was affected.
|