@adviser/cement 0.4.51 → 0.4.52-pre
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/cjs/cli/generate-version-ts-cmd.cjs +79 -0
- package/cjs/cli/generate-version-ts-cmd.cjs.map +1 -0
- package/cjs/cli/generate-version-ts-cmd.d.ts +3 -0
- package/cjs/cli/generate-version-ts-cmd.d.ts.map +1 -0
- package/cjs/cli/main.cjs +8 -3
- package/cjs/cli/main.cjs.map +1 -1
- package/cjs/cli/patch-version-cmd.cjs +3 -226
- package/cjs/cli/patch-version-cmd.cjs.map +1 -1
- package/cjs/cli/patch-version-cmd.d.ts +0 -4
- package/cjs/cli/patch-version-cmd.d.ts.map +1 -1
- package/cjs/cli/prepare-pubdir-cmd.cjs +150 -0
- package/cjs/cli/prepare-pubdir-cmd.cjs.map +1 -0
- package/cjs/cli/prepare-pubdir-cmd.d.ts +4 -0
- package/cjs/cli/prepare-pubdir-cmd.d.ts.map +1 -0
- package/cjs/cli/publish-tags-cmd.cjs +94 -0
- package/cjs/cli/publish-tags-cmd.cjs.map +1 -0
- package/cjs/cli/publish-tags-cmd.d.ts +3 -0
- package/cjs/cli/publish-tags-cmd.d.ts.map +1 -0
- package/cjs/cli/setup-deno-json-cmd.cjs +77 -0
- package/cjs/cli/setup-deno-json-cmd.cjs.map +1 -0
- package/cjs/cli/setup-deno-json-cmd.d.ts +3 -0
- package/cjs/cli/setup-deno-json-cmd.d.ts.map +1 -0
- package/cjs/cli/utils.cjs +93 -0
- package/cjs/cli/utils.cjs.map +1 -0
- package/cjs/cli/utils.d.ts +6 -0
- package/cjs/cli/utils.d.ts.map +1 -0
- package/cjs/version.cjs +1 -1
- package/cjs/version.cjs.map +1 -1
- package/cjs/version.d.ts.map +1 -1
- package/deno.json +1 -1
- package/esm/cli/generate-version-ts-cmd.d.ts +3 -0
- package/esm/cli/generate-version-ts-cmd.d.ts.map +1 -0
- package/esm/cli/generate-version-ts-cmd.js +43 -0
- package/esm/cli/generate-version-ts-cmd.js.map +1 -0
- package/esm/cli/main.js +6 -1
- package/esm/cli/main.js.map +1 -1
- package/esm/cli/patch-version-cmd.d.ts +0 -4
- package/esm/cli/patch-version-cmd.d.ts.map +1 -1
- package/esm/cli/patch-version-cmd.js +1 -220
- package/esm/cli/patch-version-cmd.js.map +1 -1
- package/esm/cli/prepare-pubdir-cmd.d.ts +4 -0
- package/esm/cli/prepare-pubdir-cmd.d.ts.map +1 -0
- package/esm/cli/prepare-pubdir-cmd.js +113 -0
- package/esm/cli/prepare-pubdir-cmd.js.map +1 -0
- package/esm/cli/publish-tags-cmd.d.ts +3 -0
- package/esm/cli/publish-tags-cmd.d.ts.map +1 -0
- package/esm/cli/publish-tags-cmd.js +58 -0
- package/esm/cli/publish-tags-cmd.js.map +1 -0
- package/esm/cli/setup-deno-json-cmd.d.ts +3 -0
- package/esm/cli/setup-deno-json-cmd.d.ts.map +1 -0
- package/esm/cli/setup-deno-json-cmd.js +41 -0
- package/esm/cli/setup-deno-json-cmd.js.map +1 -0
- package/esm/cli/utils.d.ts +6 -0
- package/esm/cli/utils.d.ts.map +1 -0
- package/esm/cli/utils.js +54 -0
- package/esm/cli/utils.js.map +1 -0
- package/esm/version.d.ts.map +1 -1
- package/esm/version.js +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +42 -25
- package/src/cli/generate-version-ts-cmd.ts +43 -0
- package/src/cli/main.ts +6 -1
- package/src/cli/patch-version-cmd.ts +1 -289
- package/src/cli/prepare-pubdir-cmd.ts +156 -0
- package/src/cli/publish-tags-cmd.ts +69 -0
- package/src/cli/run.sh +10 -1
- package/src/cli/setup-deno-json-cmd.ts +51 -0
- package/src/cli/utils.ts +70 -0
- package/ts/cjs/cli/generate-version-ts-cmd.d.ts +3 -0
- package/ts/cjs/cli/generate-version-ts-cmd.d.ts.map +1 -0
- package/ts/cjs/cli/generate-version-ts-cmd.js +79 -0
- package/ts/cjs/cli/generate-version-ts-cmd.js.map +1 -0
- package/ts/cjs/cli/main.js +8 -3
- package/ts/cjs/cli/main.js.map +1 -1
- package/ts/cjs/cli/patch-version-cmd.d.ts +0 -4
- package/ts/cjs/cli/patch-version-cmd.d.ts.map +1 -1
- package/ts/cjs/cli/patch-version-cmd.js +3 -226
- package/ts/cjs/cli/patch-version-cmd.js.map +1 -1
- package/ts/cjs/cli/prepare-pubdir-cmd.d.ts +4 -0
- package/ts/cjs/cli/prepare-pubdir-cmd.d.ts.map +1 -0
- package/ts/cjs/cli/prepare-pubdir-cmd.js +150 -0
- package/ts/cjs/cli/prepare-pubdir-cmd.js.map +1 -0
- package/ts/cjs/cli/publish-tags-cmd.d.ts +3 -0
- package/ts/cjs/cli/publish-tags-cmd.d.ts.map +1 -0
- package/ts/cjs/cli/publish-tags-cmd.js +94 -0
- package/ts/cjs/cli/publish-tags-cmd.js.map +1 -0
- package/ts/cjs/cli/setup-deno-json-cmd.d.ts +3 -0
- package/ts/cjs/cli/setup-deno-json-cmd.d.ts.map +1 -0
- package/ts/cjs/cli/setup-deno-json-cmd.js +77 -0
- package/ts/cjs/cli/setup-deno-json-cmd.js.map +1 -0
- package/ts/cjs/cli/utils.d.ts +6 -0
- package/ts/cjs/cli/utils.d.ts.map +1 -0
- package/ts/cjs/cli/utils.js +93 -0
- package/ts/cjs/cli/utils.js.map +1 -0
- package/ts/cjs/version.d.ts.map +1 -1
- package/ts/cjs/version.js +1 -1
- package/ts/cjs/version.js.map +1 -1
- package/ts/esm/cli/generate-version-ts-cmd.d.ts +3 -0
- package/ts/esm/cli/generate-version-ts-cmd.d.ts.map +1 -0
- package/ts/esm/cli/generate-version-ts-cmd.js +43 -0
- package/ts/esm/cli/generate-version-ts-cmd.js.map +1 -0
- package/ts/esm/cli/main.js +6 -1
- package/ts/esm/cli/main.js.map +1 -1
- package/ts/esm/cli/patch-version-cmd.d.ts +0 -4
- package/ts/esm/cli/patch-version-cmd.d.ts.map +1 -1
- package/ts/esm/cli/patch-version-cmd.js +1 -220
- package/ts/esm/cli/patch-version-cmd.js.map +1 -1
- package/ts/esm/cli/prepare-pubdir-cmd.d.ts +4 -0
- package/ts/esm/cli/prepare-pubdir-cmd.d.ts.map +1 -0
- package/ts/esm/cli/prepare-pubdir-cmd.js +113 -0
- package/ts/esm/cli/prepare-pubdir-cmd.js.map +1 -0
- package/ts/esm/cli/publish-tags-cmd.d.ts +3 -0
- package/ts/esm/cli/publish-tags-cmd.d.ts.map +1 -0
- package/ts/esm/cli/publish-tags-cmd.js +58 -0
- package/ts/esm/cli/publish-tags-cmd.js.map +1 -0
- package/ts/esm/cli/setup-deno-json-cmd.d.ts +3 -0
- package/ts/esm/cli/setup-deno-json-cmd.d.ts.map +1 -0
- package/ts/esm/cli/setup-deno-json-cmd.js +41 -0
- package/ts/esm/cli/setup-deno-json-cmd.js.map +1 -0
- package/ts/esm/cli/utils.d.ts +6 -0
- package/ts/esm/cli/utils.d.ts.map +1 -0
- package/ts/esm/cli/utils.js +54 -0
- package/ts/esm/cli/utils.js.map +1 -0
- package/ts/esm/version.d.ts.map +1 -1
- package/ts/esm/version.js +1 -1
- package/ts/esm/version.js.map +1 -1
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { command, option, string } from "cmd-ts";
|
|
2
|
+
import * as process from "node:process";
|
|
3
|
+
import { SemVer } from "semver";
|
|
4
|
+
import { versionFromPackageJson } from "./utils.js";
|
|
5
|
+
|
|
6
|
+
// Regex patterns for version parsing
|
|
7
|
+
const reVersionAlphaStart = /^[a-z](\d+\.\d+\.\d+.*)$/;
|
|
8
|
+
// const reVersionOptionalAlphaStart = /^[a-z]?(\d+\.\d+\.\d+.*)$/;
|
|
9
|
+
const reScopedVersion = /^[^@]+@(.*)$/;
|
|
10
|
+
const reEndVersion = /.*\/([^/]+)$/;
|
|
11
|
+
|
|
12
|
+
function getEnvVersion(version?: string, xenv = process.env): string {
|
|
13
|
+
let wversion = version || xenv.GITHUB_REF || versionFromPackageJson();
|
|
14
|
+
if (reEndVersion.test(wversion)) {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
+
wversion = wversion.match(reEndVersion)[1];
|
|
17
|
+
}
|
|
18
|
+
const calculatedVersion = wversion.replace(reScopedVersion, "$1").replace(reVersionAlphaStart, "$1");
|
|
19
|
+
try {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
21
|
+
new SemVer(calculatedVersion);
|
|
22
|
+
return calculatedVersion;
|
|
23
|
+
} catch (e) {
|
|
24
|
+
// Fallback to package.json version if parsing fails
|
|
25
|
+
return versionFromPackageJson();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function publishTagsCmd(): ReturnType<typeof command> {
|
|
30
|
+
return command({
|
|
31
|
+
name: "publish-tags",
|
|
32
|
+
description: "Calculate npm publish tags based on version",
|
|
33
|
+
version: "1.0.0",
|
|
34
|
+
args: {
|
|
35
|
+
releaseVersion: option({
|
|
36
|
+
long: "release-version",
|
|
37
|
+
short: "r",
|
|
38
|
+
defaultValue: () => undefined,
|
|
39
|
+
defaultValueIsSerializable: true,
|
|
40
|
+
type: string,
|
|
41
|
+
description: "Version string to analyze, defaults to GITHUB_REF or package.json version.",
|
|
42
|
+
}),
|
|
43
|
+
},
|
|
44
|
+
handler: (args) => {
|
|
45
|
+
const calculatedVersion = getEnvVersion(args.releaseVersion);
|
|
46
|
+
const tags: string[] = [];
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
const semVer = new SemVer(calculatedVersion);
|
|
50
|
+
// Check if the last prerelease identifier is a string
|
|
51
|
+
if (semVer.prerelease.length > 0) {
|
|
52
|
+
const lastIdentifier = semVer.prerelease[semVer.prerelease.length - 1];
|
|
53
|
+
if (typeof lastIdentifier === "string") {
|
|
54
|
+
tags.push("dev");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// eslint-disable-next-line no-console
|
|
59
|
+
console.warn(`Warn parsing version ${calculatedVersion}:`, e);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Output the --tag options if there are tags
|
|
63
|
+
if (tags.length > 0) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.log(tags.map((tag) => `--tag ${tag}`).join(" "));
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
}) as ReturnType<typeof command>;
|
|
69
|
+
}
|
package/src/cli/run.sh
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
|
|
2
|
+
TSX="npx tsx"
|
|
3
|
+
if [ -x ./node_modules/.bin/tsx ]
|
|
4
|
+
then
|
|
5
|
+
TSX=./node_modules/.bin/tsx
|
|
6
|
+
fi
|
|
7
|
+
if [ -x ../node_modules/.bin/tsx ]
|
|
8
|
+
then
|
|
9
|
+
TSX=../node_modules/.bin/tsx
|
|
10
|
+
fi
|
|
11
|
+
exec $TSX $(dirname $0)/main.ts $@
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { command, option, string } from "cmd-ts";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
|
|
5
|
+
// node ./setup-jsr-json.cjs ./pubdir/deno.json
|
|
6
|
+
function setupDenoJson(packageJsonFile: string, jsrJsonFile: string): void {
|
|
7
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString()) as { dependencies: Record<string, string> };
|
|
8
|
+
const jsrJson = JSON.parse(fs.readFileSync(jsrJsonFile).toString()) as {
|
|
9
|
+
name: string;
|
|
10
|
+
exports: Record<string, string>;
|
|
11
|
+
imports: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
// self imports
|
|
14
|
+
const jsrJsonImports = Object.fromEntries(Object.entries(jsrJson.exports ?? {}).map(([k, v]) => [path.join(jsrJson.name, k), v]));
|
|
15
|
+
const nodeJsonImports = Object.fromEntries(
|
|
16
|
+
Array.from(Object.entries(packageJson.dependencies ?? {})).map(([k, v]) => [k, `npm:${k}@${v.replace(/^npm:/, "")}`]),
|
|
17
|
+
);
|
|
18
|
+
jsrJson.imports = { ...jsrJson.imports, ...jsrJsonImports, ...nodeJsonImports };
|
|
19
|
+
fs.writeFileSync(jsrJsonFile, JSON.stringify(jsrJson, undefined, 2) + "\n");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function setUpDenoJsonCmd(): ReturnType<typeof command> {
|
|
23
|
+
return command({
|
|
24
|
+
name: "setup-deno-json",
|
|
25
|
+
description: "setup deno.json",
|
|
26
|
+
version: "1.0.0",
|
|
27
|
+
args: {
|
|
28
|
+
packageJson: option({
|
|
29
|
+
long: "packageJson",
|
|
30
|
+
short: "p",
|
|
31
|
+
defaultValue: () => "package.json",
|
|
32
|
+
defaultValueIsSerializable: true,
|
|
33
|
+
type: string,
|
|
34
|
+
description: "Path to the package.json file, defaults to './package.json'.",
|
|
35
|
+
}),
|
|
36
|
+
jsrJson: option({
|
|
37
|
+
long: "jsrJson",
|
|
38
|
+
short: "j",
|
|
39
|
+
defaultValue: () => "deno.json",
|
|
40
|
+
defaultValueIsSerializable: true,
|
|
41
|
+
type: string,
|
|
42
|
+
description: "Path to the deno.json file, defaults to './deno.json'.",
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
handler: (args) => {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.log(`Setup deno.json ${args.jsrJson} from ${args.packageJson}`);
|
|
48
|
+
setupDenoJson(args.packageJson, args.jsrJson);
|
|
49
|
+
},
|
|
50
|
+
}) as ReturnType<typeof command>;
|
|
51
|
+
}
|
package/src/cli/utils.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as process from "node:process";
|
|
5
|
+
import { $ } from "zx";
|
|
6
|
+
|
|
7
|
+
// Custom compiler host
|
|
8
|
+
export function createCompilerHost(options: ts.CompilerOptions, version: string): ts.CompilerHost {
|
|
9
|
+
const host = ts.createCompilerHost(options);
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11
|
+
const myGetSourceFile = host.getSourceFile;
|
|
12
|
+
|
|
13
|
+
host.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile): ts.SourceFile => {
|
|
14
|
+
const sourceFile = myGetSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
|
|
15
|
+
if (!sourceFile) {
|
|
16
|
+
throw new Error("getSourceFile is not defined");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Patch version.ts during compilation
|
|
20
|
+
if (fileName.endsWith("version.ts") && sourceFile) {
|
|
21
|
+
const newText = `export const VERSION: string = "${version}";`;
|
|
22
|
+
return ts.createSourceFile(fileName, newText, languageVersion);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return sourceFile;
|
|
26
|
+
};
|
|
27
|
+
return host;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function readTSConfig(configPath = "./tsconfig.json"): ts.CompilerOptions {
|
|
31
|
+
// Read the config file
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
33
|
+
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
34
|
+
|
|
35
|
+
if (configFile.error) {
|
|
36
|
+
throw new Error(`Error reading tsconfig: ${configFile.error.messageText as string}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Parse and resolve the config
|
|
40
|
+
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath), undefined, configPath);
|
|
41
|
+
|
|
42
|
+
if (parsedConfig.errors.length > 0) {
|
|
43
|
+
const errors = parsedConfig.errors.map((err) => err.messageText as string).join("\n");
|
|
44
|
+
throw new Error(`Error parsing tsconfig: ${errors}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return parsedConfig.options; // This is CompilerOptions
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function versionFromPackageJson(): string {
|
|
51
|
+
const packageJson = JSON.parse(fs.readFileSync("package.json").toString()) as { version: string };
|
|
52
|
+
return packageJson.version;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getVersion(iversion?: string): string {
|
|
56
|
+
const ghref = iversion || process.env.GITHUB_REF || versionFromPackageJson() || "a/v0.0.0-smoke";
|
|
57
|
+
let lastPart = ghref.split("/").slice(-1)[0];
|
|
58
|
+
if (iversion) {
|
|
59
|
+
return iversion.replace(/^[vdsp]/, "");
|
|
60
|
+
}
|
|
61
|
+
const short = $.sync`git rev-parse --short HEAD`.stdout.trim();
|
|
62
|
+
if (process.env.GITHUB_REF) {
|
|
63
|
+
lastPart = lastPart.replace(/^[vdsp]/, "");
|
|
64
|
+
if (lastPart.match(/^\d+\.\d+\.\d+/)) {
|
|
65
|
+
return lastPart;
|
|
66
|
+
}
|
|
67
|
+
return `0.0.0-dev-ci-${short}`;
|
|
68
|
+
}
|
|
69
|
+
return `0.0.0-dev-local-${Date.now()}`;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-version-ts-cmd.d.ts","sourceRoot":"","sources":["../../../../src/cli/generate-version-ts-cmd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAkB,MAAM,QAAQ,CAAC;AAGjD,wBAAgB,oBAAoB,IAAI,UAAU,CAAC,OAAO,OAAO,CAAC,CAsCjE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateVersionTsCmd = generateVersionTsCmd;
|
|
37
|
+
const ts = __importStar(require("typescript"));
|
|
38
|
+
const cmd_ts_1 = require("cmd-ts");
|
|
39
|
+
const utils_js_1 = require("./utils.js");
|
|
40
|
+
function generateVersionTsCmd() {
|
|
41
|
+
return (0, cmd_ts_1.command)({
|
|
42
|
+
name: "fireproof build cli",
|
|
43
|
+
description: "helps to build fp",
|
|
44
|
+
version: "1.0.0",
|
|
45
|
+
args: {
|
|
46
|
+
version: (0, cmd_ts_1.option)({
|
|
47
|
+
long: "version",
|
|
48
|
+
short: "v",
|
|
49
|
+
defaultValue: () => (0, utils_js_1.getVersion)(),
|
|
50
|
+
defaultValueIsSerializable: true,
|
|
51
|
+
type: cmd_ts_1.string,
|
|
52
|
+
description: "Version to patch in, defaults to reading from package.json.",
|
|
53
|
+
}),
|
|
54
|
+
versionFile: (0, cmd_ts_1.option)({
|
|
55
|
+
long: "versionFile",
|
|
56
|
+
short: "f",
|
|
57
|
+
defaultValue: () => "src/version.ts",
|
|
58
|
+
defaultValueIsSerializable: true,
|
|
59
|
+
type: cmd_ts_1.string,
|
|
60
|
+
description: "Path to the file containing the version, defaults to './src/version.ts'.",
|
|
61
|
+
}),
|
|
62
|
+
tsconfig: (0, cmd_ts_1.option)({
|
|
63
|
+
long: "tsconfig",
|
|
64
|
+
short: "t",
|
|
65
|
+
defaultValue: () => "tsconfig.json",
|
|
66
|
+
defaultValueIsSerializable: true,
|
|
67
|
+
type: cmd_ts_1.string,
|
|
68
|
+
description: "Path to the tsconfig.json file, defaults to './tsconfig.json'.",
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
handler: (args) => {
|
|
72
|
+
const options = (0, utils_js_1.readTSConfig)(args.tsconfig);
|
|
73
|
+
const host = (0, utils_js_1.createCompilerHost)(options, args.version);
|
|
74
|
+
const program = ts.createProgram([args.versionFile], options, host);
|
|
75
|
+
program.emit();
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=generate-version-ts-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-version-ts-cmd.js","sourceRoot":"","sources":["../../../../src/cli/generate-version-ts-cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,EAAE,uCAAmB;AACjC,mCAAiD;AACjD,yCAA0E;AAE1E,gCAAmE;IACjE,OAAO,IAAA,gBAAO,EAAC;QACb,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,mBAAmB;QAChC,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,OAAO,EAAE,IAAA,eAAM,EAAC;gBACd,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,GAAG;gBACV,YAAY,EAAE,GAAG,EAAE,CAAC,IAAA,qBAAU,GAAE;gBAChC,0BAA0B,EAAE,IAAI;gBAChC,IAAI,EAAE,eAAM;gBACZ,WAAW,EAAE,6DAA6D;aAC3E,CAAC;YACF,WAAW,EAAE,IAAA,eAAM,EAAC;gBAClB,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,GAAG;gBACV,YAAY,EAAE,GAAG,EAAE,CAAC,gBAAgB;gBACpC,0BAA0B,EAAE,IAAI;gBAChC,IAAI,EAAE,eAAM;gBACZ,WAAW,EAAE,0EAA0E;aACxF,CAAC;YACF,QAAQ,EAAE,IAAA,eAAM,EAAC;gBACf,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,GAAG;gBACV,YAAY,EAAE,GAAG,EAAE,CAAC,eAAe;gBACnC,0BAA0B,EAAE,IAAI;gBAChC,IAAI,EAAE,eAAM;gBACZ,WAAW,EAAE,gEAAgE;aAC9E,CAAC;SACH;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5C,MAAM,IAAI,GAAG,IAAA,6BAAkB,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACvD,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACpE,OAAO,CAAC,IAAI,EAAE,CAAC;QAAA,CAChB;KACF,CAA+B,CAAC;AAAA,CAClC"}
|
package/ts/cjs/cli/main.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cmd_ts_1 = require("cmd-ts");
|
|
4
4
|
const patch_version_cmd_js_1 = require("./patch-version-cmd.js");
|
|
5
|
+
const generate_version_ts_cmd_js_1 = require("./generate-version-ts-cmd.js");
|
|
6
|
+
const setup_deno_json_cmd_js_1 = require("./setup-deno-json-cmd.js");
|
|
7
|
+
const prepare_pubdir_cmd_js_1 = require("./prepare-pubdir-cmd.js");
|
|
8
|
+
const publish_tags_cmd_js_1 = require("./publish-tags-cmd.js");
|
|
5
9
|
(async () => {
|
|
6
10
|
const cmd = (0, cmd_ts_1.subcommands)({
|
|
7
11
|
name: "cement",
|
|
@@ -9,9 +13,10 @@ const patch_version_cmd_js_1 = require("./patch-version-cmd.js");
|
|
|
9
13
|
version: "1.0.0",
|
|
10
14
|
cmds: {
|
|
11
15
|
patchVersion: (0, patch_version_cmd_js_1.patchVersionCmd)(),
|
|
12
|
-
generateVersionTs: (0,
|
|
13
|
-
setUpDenoJson: (0,
|
|
14
|
-
preparePubdir: (0,
|
|
16
|
+
generateVersionTs: (0, generate_version_ts_cmd_js_1.generateVersionTsCmd)(),
|
|
17
|
+
setUpDenoJson: (0, setup_deno_json_cmd_js_1.setUpDenoJsonCmd)(),
|
|
18
|
+
preparePubdir: (0, prepare_pubdir_cmd_js_1.preparePubdirCmd)(),
|
|
19
|
+
publishTags: (0, publish_tags_cmd_js_1.publishTagsCmd)(),
|
|
15
20
|
},
|
|
16
21
|
});
|
|
17
22
|
await (0, cmd_ts_1.run)(cmd, process.argv.slice(2));
|
package/ts/cjs/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/cli/main.ts"],"names":[],"mappings":";;AAAA,mCAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/cli/main.ts"],"names":[],"mappings":";;AAAA,mCAA0C;AAC1C,iEAAyD;AACzD,6EAAoE;AACpE,qEAA4D;AAC5D,mEAA2D;AAC3D,+DAAuD;AAEvD,CAAC,KAAK,IAAmB,EAAE,CAAC;IAC1B,MAAM,GAAG,GAAG,IAAA,oBAAW,EAAC;QACtB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,YAAY,EAAE,IAAA,sCAAe,GAAE;YAC/B,iBAAiB,EAAE,IAAA,iDAAoB,GAAE;YACzC,aAAa,EAAE,IAAA,yCAAgB,GAAE;YACjC,aAAa,EAAE,IAAA,wCAAgB,GAAE;YACjC,WAAW,EAAE,IAAA,oCAAc,GAAE;SAC9B;KACF,CAAC,CAAC;IAEH,MAAM,IAAA,YAAG,EAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAAA,CAEvC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { command } from "cmd-ts";
|
|
2
|
-
export declare function generateVersionTsCmd(): ReturnType<typeof command>;
|
|
3
2
|
export declare function patchVersionCmd(): ReturnType<typeof command>;
|
|
4
|
-
export declare function setUpDenoJsonCmd(): ReturnType<typeof command>;
|
|
5
|
-
export declare function preparePubdir(pubdir: string, version: string, baseDir: string, srcDir: string): Promise<void>;
|
|
6
|
-
export declare function preparePubdirCmd(): ReturnType<typeof command>;
|
|
7
3
|
//# sourceMappingURL=patch-version-cmd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-version-cmd.d.ts","sourceRoot":"","sources":["../../../../src/cli/patch-version-cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patch-version-cmd.d.ts","sourceRoot":"","sources":["../../../../src/cli/patch-version-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmC,MAAM,QAAQ,CAAC;AAKlE,wBAAgB,eAAe,IAAI,UAAU,CAAC,OAAO,OAAO,CAAC,CA+B5D"}
|
|
@@ -33,105 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.generateVersionTsCmd = generateVersionTsCmd;
|
|
37
36
|
exports.patchVersionCmd = patchVersionCmd;
|
|
38
|
-
exports.setUpDenoJsonCmd = setUpDenoJsonCmd;
|
|
39
|
-
exports.preparePubdir = preparePubdir;
|
|
40
|
-
exports.preparePubdirCmd = preparePubdirCmd;
|
|
41
|
-
const ts = __importStar(require("typescript"));
|
|
42
37
|
const cmd_ts_1 = require("cmd-ts");
|
|
43
|
-
const path = __importStar(require("node:path"));
|
|
44
38
|
const fs = __importStar(require("node:fs"));
|
|
45
39
|
const process = __importStar(require("node:process"));
|
|
46
|
-
const
|
|
47
|
-
function createCompilerHost(options, version) {
|
|
48
|
-
const host = ts.createCompilerHost(options);
|
|
49
|
-
const myGetSourceFile = host.getSourceFile;
|
|
50
|
-
host.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
|
|
51
|
-
const sourceFile = myGetSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
|
|
52
|
-
if (!sourceFile) {
|
|
53
|
-
throw new Error("getSourceFile is not defined");
|
|
54
|
-
}
|
|
55
|
-
if (fileName.endsWith("version.ts") && sourceFile) {
|
|
56
|
-
const newText = `export const VERSION: string = "${version}";`;
|
|
57
|
-
return ts.createSourceFile(fileName, newText, languageVersion);
|
|
58
|
-
}
|
|
59
|
-
return sourceFile;
|
|
60
|
-
};
|
|
61
|
-
return host;
|
|
62
|
-
}
|
|
63
|
-
function readTSConfig(configPath = "./tsconfig.json") {
|
|
64
|
-
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
65
|
-
if (configFile.error) {
|
|
66
|
-
throw new Error(`Error reading tsconfig: ${configFile.error.messageText}`);
|
|
67
|
-
}
|
|
68
|
-
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath), undefined, configPath);
|
|
69
|
-
if (parsedConfig.errors.length > 0) {
|
|
70
|
-
const errors = parsedConfig.errors.map((err) => err.messageText).join("\n");
|
|
71
|
-
throw new Error(`Error parsing tsconfig: ${errors}`);
|
|
72
|
-
}
|
|
73
|
-
return parsedConfig.options;
|
|
74
|
-
}
|
|
75
|
-
function versionFromPackageJson() {
|
|
76
|
-
const packageJson = JSON.parse(fs.readFileSync("package.json").toString());
|
|
77
|
-
return packageJson.version;
|
|
78
|
-
}
|
|
79
|
-
const versionArgs = {
|
|
80
|
-
version: (0, cmd_ts_1.option)({
|
|
81
|
-
long: "version",
|
|
82
|
-
short: "v",
|
|
83
|
-
defaultValue: () => getVersion(),
|
|
84
|
-
defaultValueIsSerializable: true,
|
|
85
|
-
type: cmd_ts_1.string,
|
|
86
|
-
description: "Version to patch in, defaults to reading from package.json.",
|
|
87
|
-
}),
|
|
88
|
-
versionFile: (0, cmd_ts_1.option)({
|
|
89
|
-
long: "versionFile",
|
|
90
|
-
short: "f",
|
|
91
|
-
defaultValue: () => "src/version.ts",
|
|
92
|
-
defaultValueIsSerializable: true,
|
|
93
|
-
type: cmd_ts_1.string,
|
|
94
|
-
description: "Path to the file containing the version, defaults to './src/version.ts'.",
|
|
95
|
-
}),
|
|
96
|
-
tsconfig: (0, cmd_ts_1.option)({
|
|
97
|
-
long: "tsconfig",
|
|
98
|
-
short: "t",
|
|
99
|
-
defaultValue: () => "tsconfig.json",
|
|
100
|
-
defaultValueIsSerializable: true,
|
|
101
|
-
type: cmd_ts_1.string,
|
|
102
|
-
description: "Path to the tsconfig.json file, defaults to './tsconfig.json'.",
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
105
|
-
function generateVersionTsCmd() {
|
|
106
|
-
return (0, cmd_ts_1.command)({
|
|
107
|
-
name: "fireproof build cli",
|
|
108
|
-
description: "helps to build fp",
|
|
109
|
-
version: "1.0.0",
|
|
110
|
-
args: versionArgs,
|
|
111
|
-
handler: (args) => {
|
|
112
|
-
const options = readTSConfig(args.tsconfig);
|
|
113
|
-
const host = createCompilerHost(options, args.version);
|
|
114
|
-
const program = ts.createProgram([args.versionFile], options, host);
|
|
115
|
-
program.emit();
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function getVersion(iversion) {
|
|
120
|
-
const ghref = iversion || process.env.GITHUB_REF || versionFromPackageJson() || "a/v0.0.0-smoke";
|
|
121
|
-
let lastPart = ghref.split("/").slice(-1)[0];
|
|
122
|
-
if (iversion) {
|
|
123
|
-
return iversion.replace(/^[vdsp]/, "");
|
|
124
|
-
}
|
|
125
|
-
const short = zx_1.$.sync `git rev-parse --short HEAD`.stdout.trim();
|
|
126
|
-
if (process.env.GITHUB_REF) {
|
|
127
|
-
lastPart = lastPart.replace(/^[vdsp]/, "");
|
|
128
|
-
if (lastPart.match(/^\d+\.\d+\.\d+/)) {
|
|
129
|
-
return lastPart;
|
|
130
|
-
}
|
|
131
|
-
return `0.0.0-dev-ci-${short}`;
|
|
132
|
-
}
|
|
133
|
-
return `0.0.0-dev-local-${Date.now()}`;
|
|
134
|
-
}
|
|
40
|
+
const utils_js_1 = require("./utils.js");
|
|
135
41
|
function patchVersionCmd() {
|
|
136
42
|
return (0, cmd_ts_1.command)({
|
|
137
43
|
name: "patch-version",
|
|
@@ -141,7 +47,7 @@ function patchVersionCmd() {
|
|
|
141
47
|
version: (0, cmd_ts_1.option)({
|
|
142
48
|
long: "version",
|
|
143
49
|
short: "v",
|
|
144
|
-
defaultValue: () => getVersion(),
|
|
50
|
+
defaultValue: () => (0, utils_js_1.getVersion)(),
|
|
145
51
|
defaultValueIsSerializable: true,
|
|
146
52
|
type: cmd_ts_1.string,
|
|
147
53
|
description: "Path to the file containing the version, defaults to './package.json'.",
|
|
@@ -153,7 +59,7 @@ function patchVersionCmd() {
|
|
|
153
59
|
}),
|
|
154
60
|
},
|
|
155
61
|
handler: (args) => {
|
|
156
|
-
const version = getVersion(args.version);
|
|
62
|
+
const version = (0, utils_js_1.getVersion)(args.version);
|
|
157
63
|
for (const fileToPatch of args.files) {
|
|
158
64
|
console.log(`Patch ${fileToPatch} version to ${version}(${process.env.GITHUB_REF})`);
|
|
159
65
|
const packageJson = JSON.parse(fs.readFileSync(fileToPatch).toString());
|
|
@@ -163,133 +69,4 @@ function patchVersionCmd() {
|
|
|
163
69
|
},
|
|
164
70
|
});
|
|
165
71
|
}
|
|
166
|
-
function setupDenoJson(packageJsonFile, jsrJsonFile) {
|
|
167
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString());
|
|
168
|
-
const jsrJson = JSON.parse(fs.readFileSync(jsrJsonFile).toString());
|
|
169
|
-
const jsrJsonImports = Object.fromEntries(Object.entries(jsrJson.exports ?? {}).map(([k, v]) => [path.join(jsrJson.name, k), v]));
|
|
170
|
-
const nodeJsonImports = Object.fromEntries(Array.from(Object.entries(packageJson.dependencies ?? {})).map(([k, v]) => [k, `npm:${k}@${v.replace(/^npm:/, "")}`]));
|
|
171
|
-
jsrJson.imports = { ...jsrJson.imports, ...jsrJsonImports, ...nodeJsonImports };
|
|
172
|
-
fs.writeFileSync(jsrJsonFile, JSON.stringify(jsrJson, undefined, 2) + "\n");
|
|
173
|
-
}
|
|
174
|
-
function setUpDenoJsonCmd() {
|
|
175
|
-
return (0, cmd_ts_1.command)({
|
|
176
|
-
name: "setup-deno-json",
|
|
177
|
-
description: "setup deno.json",
|
|
178
|
-
version: "1.0.0",
|
|
179
|
-
args: {
|
|
180
|
-
packageJson: (0, cmd_ts_1.option)({
|
|
181
|
-
long: "packageJson",
|
|
182
|
-
short: "p",
|
|
183
|
-
defaultValue: () => "package.json",
|
|
184
|
-
defaultValueIsSerializable: true,
|
|
185
|
-
type: cmd_ts_1.string,
|
|
186
|
-
description: "Path to the package.json file, defaults to './package.json'.",
|
|
187
|
-
}),
|
|
188
|
-
jsrJson: (0, cmd_ts_1.option)({
|
|
189
|
-
long: "jsrJson",
|
|
190
|
-
short: "j",
|
|
191
|
-
defaultValue: () => "deno.json",
|
|
192
|
-
defaultValueIsSerializable: true,
|
|
193
|
-
type: cmd_ts_1.string,
|
|
194
|
-
description: "Path to the deno.json file, defaults to './deno.json'.",
|
|
195
|
-
}),
|
|
196
|
-
},
|
|
197
|
-
handler: (args) => {
|
|
198
|
-
console.log(`Setup deno.json ${args.jsrJson} from ${args.packageJson}`);
|
|
199
|
-
setupDenoJson(args.packageJson, args.jsrJson);
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
async function preparePubdir(pubdir, version, baseDir, srcDir) {
|
|
204
|
-
zx_1.$.verbose = true;
|
|
205
|
-
if (process.env.IN_CI !== "in_ci") {
|
|
206
|
-
await (0, zx_1.$) `pnpm run build`;
|
|
207
|
-
}
|
|
208
|
-
await (0, zx_1.$) `rm -rf ${pubdir}`;
|
|
209
|
-
await (0, zx_1.$) `mkdir -p ${pubdir}`;
|
|
210
|
-
await (0, zx_1.$) `cp -pr ${path.join(baseDir, ".gitignore")} ${path.join(baseDir, "README.md")} ${path.join(baseDir, "LICENSE")} ./dist/ts/ ${pubdir}/`;
|
|
211
|
-
(0, zx_1.cd)("dist/pkg");
|
|
212
|
-
await (0, zx_1.$) `cp -pr . ../../${pubdir}/`;
|
|
213
|
-
(0, zx_1.cd)("../..");
|
|
214
|
-
(0, zx_1.cd)(srcDir);
|
|
215
|
-
await (0, zx_1.$) `cp -pr . ../${pubdir}/${srcDir}/`;
|
|
216
|
-
(0, zx_1.cd)("..");
|
|
217
|
-
const jsFiles = await (0, zx_1.glob)(`${pubdir}/cjs/**/*.js`);
|
|
218
|
-
for (const file of jsFiles) {
|
|
219
|
-
const newFile = file.replace(/\.js$/, ".cjs");
|
|
220
|
-
await (0, zx_1.$) `mv ${file} ${newFile}`;
|
|
221
|
-
}
|
|
222
|
-
const mapFiles = await (0, zx_1.glob)(`${pubdir}/cjs/**/*.js.map`);
|
|
223
|
-
for (const file of mapFiles) {
|
|
224
|
-
const newFile = file.replace(/\.js\.map$/, ".cjs.map");
|
|
225
|
-
await (0, zx_1.$) `mv ${file} ${newFile}`;
|
|
226
|
-
}
|
|
227
|
-
const cjsFiles = await (0, zx_1.glob)(`${pubdir}/cjs/**/*.cjs`);
|
|
228
|
-
if (cjsFiles.length > 0) {
|
|
229
|
-
await (0, zx_1.$) `pnpm exec jscodeshift --parser=babel -t=./to-cjs.js ${cjsFiles}`;
|
|
230
|
-
}
|
|
231
|
-
await (0, zx_1.$) `cp package.json ${pubdir}/`;
|
|
232
|
-
(0, zx_1.cd)(`${pubdir}/${srcDir}`);
|
|
233
|
-
await (0, zx_1.$) `rm -f test/test-exit-handler.* ./utils/stream-test-helper.ts`.catch(() => {
|
|
234
|
-
});
|
|
235
|
-
(0, zx_1.cd)("../..");
|
|
236
|
-
const screenshotDirs = await (0, zx_1.glob)(`${pubdir}/${srcDir}/**/__screenshots__`);
|
|
237
|
-
for (const dir of screenshotDirs) {
|
|
238
|
-
await (0, zx_1.$) `rm -rf ${dir}`;
|
|
239
|
-
}
|
|
240
|
-
const testFiles = await (0, zx_1.glob)(`${pubdir}/${srcDir}/**/*.test.ts`);
|
|
241
|
-
for (const file of testFiles) {
|
|
242
|
-
await (0, zx_1.$) `rm -f ${file}`;
|
|
243
|
-
}
|
|
244
|
-
await (0, zx_1.$) `cp ./deno.json ./${pubdir}/`;
|
|
245
|
-
await patchVersionCmd().handler({ version, files: [`${pubdir}/package.json`, `${pubdir}/deno.json`] });
|
|
246
|
-
await setUpDenoJsonCmd().handler({ packageJson: `${pubdir}/package.json`, jsrJson: `${pubdir}/deno.json` });
|
|
247
|
-
(0, zx_1.cd)("pubdir");
|
|
248
|
-
await (0, zx_1.$) `pnpm pack`;
|
|
249
|
-
await (0, zx_1.$) `deno publish --dry-run --unstable-sloppy-imports --allow-dirty`;
|
|
250
|
-
}
|
|
251
|
-
function preparePubdirCmd() {
|
|
252
|
-
return (0, cmd_ts_1.command)({
|
|
253
|
-
name: "prepare-pubdir",
|
|
254
|
-
description: "prepare pubdir",
|
|
255
|
-
version: "1.0.0",
|
|
256
|
-
args: {
|
|
257
|
-
pubdir: (0, cmd_ts_1.option)({
|
|
258
|
-
long: "pubdir",
|
|
259
|
-
short: "p",
|
|
260
|
-
defaultValue: () => "pubdir",
|
|
261
|
-
defaultValueIsSerializable: true,
|
|
262
|
-
type: cmd_ts_1.string,
|
|
263
|
-
description: "Path to the pubdir, defaults to './pubdir'.",
|
|
264
|
-
}),
|
|
265
|
-
srcDir: (0, cmd_ts_1.option)({
|
|
266
|
-
long: "srcDir",
|
|
267
|
-
short: "s",
|
|
268
|
-
defaultValue: () => "src",
|
|
269
|
-
defaultValueIsSerializable: true,
|
|
270
|
-
type: cmd_ts_1.string,
|
|
271
|
-
description: "Path to the src directory, defaults to './src'.",
|
|
272
|
-
}),
|
|
273
|
-
baseDir: (0, cmd_ts_1.option)({
|
|
274
|
-
long: "baseDir",
|
|
275
|
-
short: "b",
|
|
276
|
-
defaultValue: () => "../",
|
|
277
|
-
defaultValueIsSerializable: true,
|
|
278
|
-
type: cmd_ts_1.string,
|
|
279
|
-
description: "Path to the base directory of the project, defaults to '../'.",
|
|
280
|
-
}),
|
|
281
|
-
version: (0, cmd_ts_1.option)({
|
|
282
|
-
long: "version",
|
|
283
|
-
short: "v",
|
|
284
|
-
defaultValue: () => getVersion(),
|
|
285
|
-
defaultValueIsSerializable: true,
|
|
286
|
-
type: cmd_ts_1.string,
|
|
287
|
-
description: "Version to patch in, defaults to reading from package.json.",
|
|
288
|
-
}),
|
|
289
|
-
},
|
|
290
|
-
handler: async (args) => {
|
|
291
|
-
await preparePubdir(args.pubdir, args.version, args.baseDir, args.srcDir);
|
|
292
|
-
},
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
72
|
//# sourceMappingURL=patch-version-cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-version-cmd.js","sourceRoot":"","sources":["../../../../src/cli/patch-version-cmd.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patch-version-cmd.js","sourceRoot":"","sources":["../../../../src/cli/patch-version-cmd.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkE;AAClE,MAAY,EAAE,oCAAgB;AAC9B,MAAY,OAAO,yCAAqB;AACxC,yCAAwC;AAExC,2BAA8D;IAC5D,OAAO,IAAA,gBAAO,EAAC;QACb,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,OAAO,EAAE,IAAA,eAAM,EAAC;gBACd,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,GAAG;gBACV,YAAY,EAAE,GAAG,EAAE,CAAC,IAAA,qBAAU,GAAE;gBAChC,0BAA0B,EAAE,IAAI;gBAChC,IAAI,EAAE,eAAM;gBACZ,WAAW,EAAE,wEAAwE;aACtF,CAAC;YACF,KAAK,EAAE,IAAA,wBAAe,EAAC;gBACrB,IAAI,EAAE,eAAM;gBACZ,WAAW,EAAE,kBAAkB;gBAC/B,WAAW,EAAE,+BAA+B;aAC7C,CAAC;SACH;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,IAAA,qBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAErC,OAAO,CAAC,GAAG,CAAC,SAAS,WAAW,eAAe,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;gBACrF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAwB,CAAC;gBAC/F,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC;gBAC9B,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YAClF,CAAC;QAAA,CACF;KACF,CAA+B,CAAC;AAAA,CAClC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { command } from "cmd-ts";
|
|
2
|
+
export declare function preparePubdir(pubdir: string, version: string, baseDir: string, srcDir: string): Promise<void>;
|
|
3
|
+
export declare function preparePubdirCmd(): ReturnType<typeof command>;
|
|
4
|
+
//# sourceMappingURL=prepare-pubdir-cmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-pubdir-cmd.d.ts","sourceRoot":"","sources":["../../../../src/cli/prepare-pubdir-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,QAAQ,CAAC;AAgBjD,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8FnH;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAAC,OAAO,OAAO,CAAC,CA2C7D"}
|