@textmode/release 0.1.0 → 0.2.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/README.md +63 -30
- package/index.d.ts +8 -1
- package/lint-staged.config.cjs +5 -1
- package/package.json +2 -5
- package/src/cli/textmode-release.mjs +14 -11
- package/src/lib/release-config.js +31 -1
- package/src/internal/check.mjs +0 -85
package/README.md
CHANGED
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
+
<img alt="@textmode/release — release textmode from one command" src=".github/assets/readme-og.png" />
|
|
6
|
+
|
|
5
7
|
| [](https://developer.mozilla.org/en-US/docs/Web/JavaScript) [](https://semantic-release.gitbook.io/) | [](https://code.textmode.art/) [](https://discord.gg/sjrw8QXNks) | [](https://ko-fi.com/V7V8JG2FY) [](https://github.com/sponsors/humanbydefinition) |
|
|
6
8
|
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
7
9
|
|
|
8
10
|
</div>
|
|
9
11
|
|
|
10
|
-
`@textmode/release` owns release
|
|
12
|
+
`@textmode/release` owns release automation and managed Git hooks for the [`textmode.js`](https://github.com/humanbydefinition/textmode.js) ecosystem. It bundles [semantic-release](https://semantic-release.gitbook.io/), [commitlint](https://commitlint.js.org/), and [lint-staged](https://github.com/lint-staged/lint-staged) behind one `textmode-release` command, so consumers no longer install or configure the engines themselves.
|
|
11
13
|
|
|
12
|
-
Use it to release every package the same way
|
|
14
|
+
Use it to release every package the same way and install the same managed Git hooks without repeating dependencies or config files. Consumers compose whole-project workflows such as `check`, `build`, and `prepack` explicitly in their own package scripts.
|
|
13
15
|
|
|
14
16
|
## Features
|
|
15
17
|
|
|
16
18
|
- **One package, multiple engines** - semantic-release and its plugins, commitlint, and lint-staged are implementation dependencies, not peer dependencies. Consumers install only `@textmode/release`.
|
|
17
19
|
- **Managed Git hooks** - `textmode-release hooks` installs commitlint, lint-staged, and push-guard hooks directly into Git's hooks directory, invoking the engines from the package itself.
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **Backward compatible behavior** - The release flow, commit rules, and hook behavior are identical to the previous `@textmode/release-config`, `@textmode/commitlint-config`, and `@textmode/tooling-scripts` packages.
|
|
20
|
+
- **pnpm-safe staged formatting** - The `pre-commit` hook formats staged files through an internal `format-staged` command, so it works without `textmode-lint` being exposed at the consumer root.
|
|
21
|
+
- **Stable release and hook behavior** - The release flow, commit rules, and hook behavior remain compatible with the previous `@textmode/release-config`, `@textmode/commitlint-config`, and `@textmode/tooling-scripts` packages.
|
|
21
22
|
|
|
22
23
|
## Installation
|
|
23
24
|
|
|
@@ -29,41 +30,42 @@ No engine dependencies are required.
|
|
|
29
30
|
|
|
30
31
|
## Usage
|
|
31
32
|
|
|
32
|
-
Conventional projects delegate their
|
|
33
|
+
Conventional projects delegate their release and hooks to the command:
|
|
33
34
|
|
|
34
35
|
```json
|
|
35
36
|
{
|
|
36
37
|
"scripts": {
|
|
37
|
-
"check": "textmode-release check",
|
|
38
|
-
"prepack": "textmode-release prepack",
|
|
39
38
|
"prepare": "textmode-release hooks",
|
|
40
39
|
"release": "textmode-release release"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
- `check` first validates the repository's Node 24 runtime contract, then runs
|
|
46
|
-
`format:check`, `lint`, `lint:markdown`, `typecheck`, `docs:check`, `test`,
|
|
47
|
-
`build`, and `types:verify` in that order using the domain CLIs directly.
|
|
48
|
-
- `prepack` runs `build` and `types:verify`.
|
|
49
44
|
- `hooks` installs the managed Git hooks.
|
|
50
45
|
- `release` runs semantic-release with the shared release config.
|
|
51
46
|
|
|
47
|
+
Projects keep their domain scripts visible and compose them locally. A typical
|
|
48
|
+
library's `check` script runs formatting, linting, type checking, documentation,
|
|
49
|
+
tests, build, and declaration verification in the order required by that
|
|
50
|
+
repository. Its `prepack` script runs the local build and declaration
|
|
51
|
+
verification.
|
|
52
|
+
|
|
52
53
|
## Commands
|
|
53
54
|
|
|
54
55
|
```text
|
|
55
56
|
textmode-release release [args...]
|
|
56
57
|
textmode-release hooks
|
|
57
|
-
textmode-release check
|
|
58
|
-
textmode-release prepack
|
|
59
58
|
```
|
|
60
59
|
|
|
61
60
|
Every argument after `release` is forwarded to semantic-release, so
|
|
62
61
|
`textmode-release release --dry-run` works without special handling.
|
|
63
62
|
|
|
64
63
|
Every command accepts `--cwd <directory>`, `--help`, and `--version`. Exit
|
|
65
|
-
status `0` means success, `1` means
|
|
66
|
-
|
|
64
|
+
status `0` means success, `1` means an engine reported a problem, and `2` means
|
|
65
|
+
the invocation was invalid.
|
|
66
|
+
|
|
67
|
+
The managed pre-commit hook also invokes the internal `format-staged` command.
|
|
68
|
+
It is an implementation detail of the hook interface, not a project workflow.
|
|
67
69
|
|
|
68
70
|
## Configuration
|
|
69
71
|
|
|
@@ -74,11 +76,41 @@ status `0` means success, `1` means a workflow or engine reported a problem, and
|
|
|
74
76
|
- publishes stable releases on `main` and prereleases on `beta`;
|
|
75
77
|
- derives release types from Conventional Commits;
|
|
76
78
|
- updates package metadata, builds via the `build` script, then publishes;
|
|
77
|
-
-
|
|
79
|
+
- creates the GitHub release as a **private draft** by default and attaches
|
|
80
|
+
JavaScript bundle assets derived from the package `exports`;
|
|
81
|
+
- leaves publishing the drafted release to a maintainer in the GitHub UI.
|
|
78
82
|
|
|
79
83
|
Projects keep a `build` script that produces the publishable bundles (e.g.
|
|
80
84
|
`textmode-build build`).
|
|
81
85
|
|
|
86
|
+
### GitHub release mode
|
|
87
|
+
|
|
88
|
+
The GitHub release is created as a private draft by default. A project that
|
|
89
|
+
wants the release published immediately opts out through a
|
|
90
|
+
`textmodeRelease.githubRelease` field in its own `package.json`:
|
|
91
|
+
|
|
92
|
+
```jsonc
|
|
93
|
+
{
|
|
94
|
+
"textmodeRelease": {
|
|
95
|
+
"githubRelease": "draft" // default; created as a private draft
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```jsonc
|
|
101
|
+
{
|
|
102
|
+
"textmodeRelease": {
|
|
103
|
+
"githubRelease": "direct" // published immediately
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The `draft` mode still uploads the bundle assets to the release, and drafts
|
|
109
|
+
created from the `beta` branch keep their prerelease flag when published.
|
|
110
|
+
Unknown values fall back to `draft` with a warning. The plugin's `addChannel`
|
|
111
|
+
step (promoting an already-released version to another channel) is unaffected
|
|
112
|
+
and publishes directly.
|
|
113
|
+
|
|
82
114
|
### Git hooks
|
|
83
115
|
|
|
84
116
|
`textmode-release hooks` installs:
|
|
@@ -86,7 +118,7 @@ Projects keep a `build` script that produces the publishable bundles (e.g.
|
|
|
86
118
|
| Hook | Behavior |
|
|
87
119
|
| --- | --- |
|
|
88
120
|
| `commit-msg` | Validates the message with the shared commitlint config |
|
|
89
|
-
| `pre-commit` | Runs the shared lint-staged config (formats staged files with `textmode-
|
|
121
|
+
| `pre-commit` | Runs the shared lint-staged config (formats staged files with `textmode-release format-staged`) |
|
|
90
122
|
| `pre-push` | Blocks direct pushes to `dev`, `beta`, and `main` |
|
|
91
123
|
|
|
92
124
|
### commitlint
|
|
@@ -97,14 +129,16 @@ and extend `@commitlint/config-conventional`.
|
|
|
97
129
|
### lint-staged
|
|
98
130
|
|
|
99
131
|
The shared config ships at `@textmode/release/lint-staged` (a `.cjs` config
|
|
100
|
-
file) and formats staged files
|
|
132
|
+
file) and formats staged files through `textmode-release format-staged`, which
|
|
133
|
+
resolves the `textmode-lint` binary from this package's own dependency graph.
|
|
101
134
|
|
|
102
135
|
## Configuration ownership
|
|
103
136
|
|
|
104
137
|
- `@textmode/release` owns the semantic-release config, commitlint rules,
|
|
105
138
|
lint-staged config, Git hooks, and command behavior.
|
|
106
|
-
- `package.json` owns
|
|
107
|
-
|
|
139
|
+
- Each consumer's `package.json` owns its package metadata, release/hook
|
|
140
|
+
delegates, its `textmodeRelease` release-mode field, and its explicit
|
|
141
|
+
`check`, `build`, and `prepack` composition.
|
|
108
142
|
|
|
109
143
|
Consumers should not declare `semantic-release`, `@commitlint/cli`,
|
|
110
144
|
`lint-staged`, or the former `@textmode/release-config`,
|
|
@@ -112,22 +146,21 @@ Consumers should not declare `semantic-release`, `@commitlint/cli`,
|
|
|
112
146
|
|
|
113
147
|
## Deprecations
|
|
114
148
|
|
|
115
|
-
`@textmode/release` replaces
|
|
116
|
-
`@textmode/
|
|
117
|
-
deprecated and removed from this
|
|
118
|
-
|
|
149
|
+
`@textmode/release` replaces the release, commitlint, and hook responsibilities
|
|
150
|
+
of `@textmode/release-config`, `@textmode/commitlint-config`, and
|
|
151
|
+
`@textmode/tooling-scripts`, which are deprecated and removed from this
|
|
152
|
+
workspace. Project-level `check` and `prepack` orchestration from the former
|
|
153
|
+
tooling scripts belongs in consumer manifests. The older packages remain
|
|
119
154
|
published on npm for projects that have not migrated yet.
|
|
120
155
|
|
|
121
156
|
## Related packages
|
|
122
157
|
|
|
123
|
-
`@textmode/
|
|
158
|
+
`@textmode/lint` remains an implementation dependency because the managed
|
|
159
|
+
`pre-commit` hook formats staged files through it:
|
|
124
160
|
|
|
125
161
|
| Package | Relationship |
|
|
126
162
|
| ------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
127
|
-
| [`@textmode/lint`](../lint/README.md) | Powers
|
|
128
|
-
| [`@textmode/build`](../build/README.md) | Powers the `build` and `test` workflow steps |
|
|
129
|
-
| [`@textmode/docs`](../docs/README.md) | Powers the `docs:check` workflow step |
|
|
130
|
-
| [`@textmode/tsconfig`](../tsconfig/README.md) | Powers the `typecheck` and `types:verify` workflow steps |
|
|
163
|
+
| [`@textmode/lint`](../lint/README.md) | Powers `textmode-release format-staged` for the lint-staged hook |
|
|
131
164
|
|
|
132
165
|
## License
|
|
133
166
|
|
package/index.d.ts
CHANGED
|
@@ -13,9 +13,16 @@ export interface ReleaseConfig {
|
|
|
13
13
|
ci: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export type GitHubReleaseMode = 'draft' | 'direct';
|
|
17
|
+
|
|
18
|
+
export interface ReleaseConfigOptions {
|
|
19
|
+
githubAssets?: string[];
|
|
20
|
+
githubRelease?: GitHubReleaseMode;
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
export declare function githubAssetsFromPackageJson(packageJson: { exports?: unknown }): string[];
|
|
17
24
|
|
|
18
|
-
export declare function createReleaseConfig(options?:
|
|
25
|
+
export declare function createReleaseConfig(options?: ReleaseConfigOptions): ReleaseConfig;
|
|
19
26
|
|
|
20
27
|
export declare const releaseConfig: ReleaseConfig;
|
|
21
28
|
|
package/lint-staged.config.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textmode/release",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "CC0-1.0",
|
|
6
|
-
"description": "Shared release
|
|
6
|
+
"description": "Shared release and Git-hook tooling for the textmode.js ecosystem (semantic-release, commitlint, lint-staged).",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"textmode",
|
|
9
9
|
"semantic-release",
|
|
@@ -51,10 +51,7 @@
|
|
|
51
51
|
"@semantic-release/github": "^12.0.9",
|
|
52
52
|
"@semantic-release/npm": "^13.1.5",
|
|
53
53
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
54
|
-
"@textmode/build": "^0.1.0",
|
|
55
|
-
"@textmode/docs": "^0.3.0",
|
|
56
54
|
"@textmode/lint": "^0.1.0",
|
|
57
|
-
"@textmode/tsconfig": "^0.2.0",
|
|
58
55
|
"lint-staged": "^17.0.8",
|
|
59
56
|
"semantic-release": "^25.0.5"
|
|
60
57
|
},
|
|
@@ -5,14 +5,13 @@ import path from 'node:path';
|
|
|
5
5
|
import process from 'node:process';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
|
|
8
|
-
import { runCheck, runPrepack } from '../internal/check.mjs';
|
|
9
8
|
import { runEngine } from '../internal/engines.mjs';
|
|
10
9
|
import { installGitHooks } from '../internal/hooks.mjs';
|
|
11
10
|
|
|
12
11
|
const PACKAGE_JSON = JSON.parse(fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));
|
|
13
12
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
|
14
13
|
|
|
15
|
-
const COMMANDS = new Set(['release', 'hooks', '
|
|
14
|
+
const COMMANDS = new Set(['release', 'hooks', 'format-staged']);
|
|
16
15
|
|
|
17
16
|
function printGeneralHelp() {
|
|
18
17
|
console.log(`@textmode/release ${PACKAGE_JSON.version}`);
|
|
@@ -22,8 +21,7 @@ function printGeneralHelp() {
|
|
|
22
21
|
console.log('Commands:');
|
|
23
22
|
console.log(' release [args...] Run semantic-release with the shared config');
|
|
24
23
|
console.log(' hooks Install managed Git hooks (commitlint, lint-staged, push guard)');
|
|
25
|
-
console.log('
|
|
26
|
-
console.log(' prepack Run the prepack workflow (build, types verify)');
|
|
24
|
+
console.log(' format-staged [files...] Format staged files with the shared Prettier config (internal)');
|
|
27
25
|
console.log('');
|
|
28
26
|
console.log('Common options:');
|
|
29
27
|
console.log(' --cwd <directory> Directory to run in');
|
|
@@ -37,8 +35,7 @@ function printCommandHelp(command) {
|
|
|
37
35
|
const usage = {
|
|
38
36
|
release: 'textmode-release release [args...]',
|
|
39
37
|
hooks: 'textmode-release hooks',
|
|
40
|
-
|
|
41
|
-
prepack: 'textmode-release prepack',
|
|
38
|
+
'format-staged': 'textmode-release format-staged [files...]',
|
|
42
39
|
};
|
|
43
40
|
console.log(`Usage: ${usage[command]}`);
|
|
44
41
|
}
|
|
@@ -78,7 +75,7 @@ function parseArgv(argv) {
|
|
|
78
75
|
if (command !== undefined && !COMMANDS.has(command)) {
|
|
79
76
|
throw new Error(`Unknown command "${command}".`);
|
|
80
77
|
}
|
|
81
|
-
if (command !== 'release' && forwarded.length > 0) {
|
|
78
|
+
if (command !== 'release' && command !== 'format-staged' && forwarded.length > 0) {
|
|
82
79
|
throw new Error(`The ${command} command does not accept arguments.`);
|
|
83
80
|
}
|
|
84
81
|
|
|
@@ -90,6 +87,14 @@ function runRelease(forwarded, cwd) {
|
|
|
90
87
|
return runEngine('semantic-release', 'semantic-release', ['--extends', releaseConfig, ...forwarded], { cwd });
|
|
91
88
|
}
|
|
92
89
|
|
|
90
|
+
function runFormatStaged(files, cwd) {
|
|
91
|
+
if (files.length === 0) {
|
|
92
|
+
console.error('format-staged requires at least one staged file.');
|
|
93
|
+
return 2;
|
|
94
|
+
}
|
|
95
|
+
return runEngine('@textmode/lint', 'textmode-lint', ['format', ...files], { cwd });
|
|
96
|
+
}
|
|
97
|
+
|
|
93
98
|
function main(argv) {
|
|
94
99
|
let parsed;
|
|
95
100
|
try {
|
|
@@ -124,10 +129,8 @@ function main(argv) {
|
|
|
124
129
|
return runRelease(forwarded, cwd);
|
|
125
130
|
case 'hooks':
|
|
126
131
|
return installGitHooks({ cwd }) === false ? 1 : 0;
|
|
127
|
-
case '
|
|
128
|
-
return
|
|
129
|
-
case 'prepack':
|
|
130
|
-
return runPrepack({ cwd });
|
|
132
|
+
case 'format-staged':
|
|
133
|
+
return runFormatStaged(forwarded, cwd);
|
|
131
134
|
default:
|
|
132
135
|
return 2;
|
|
133
136
|
}
|
|
@@ -38,7 +38,36 @@ function githubAssetsFromCurrentPackage() {
|
|
|
38
38
|
return githubAssetsFromPackageJson(JSON.parse(fs.readFileSync(packagePath, 'utf8')));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
function githubReleaseFromCurrentPackage() {
|
|
42
|
+
const packagePath = path.resolve(process.cwd(), 'package.json');
|
|
43
|
+
if (!fs.existsSync(packagePath)) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return JSON.parse(fs.readFileSync(packagePath, 'utf8'))?.textmodeRelease?.githubRelease;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the GitHub release mode to the `@semantic-release/github`
|
|
52
|
+
* `draftRelease` boolean. Drafts are the default; `direct` publishes the
|
|
53
|
+
* release immediately. Unknown values warn and fall back to the default.
|
|
54
|
+
*/
|
|
55
|
+
function githubReleaseToDraft(githubRelease) {
|
|
56
|
+
if (githubRelease === 'direct') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (githubRelease !== undefined && githubRelease !== 'draft') {
|
|
60
|
+
console.error(
|
|
61
|
+
`@textmode/release: unknown textmodeRelease.githubRelease value ${JSON.stringify(githubRelease)}; using "draft".`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function createReleaseConfig({
|
|
68
|
+
githubAssets = githubAssetsFromCurrentPackage(),
|
|
69
|
+
githubRelease = githubReleaseFromCurrentPackage(),
|
|
70
|
+
} = {}) {
|
|
42
71
|
return {
|
|
43
72
|
branches: [
|
|
44
73
|
'main',
|
|
@@ -95,6 +124,7 @@ export function createReleaseConfig({ githubAssets = githubAssetsFromCurrentPack
|
|
|
95
124
|
'@semantic-release/github',
|
|
96
125
|
{
|
|
97
126
|
assets: githubAssets,
|
|
127
|
+
draftRelease: githubReleaseToDraft(githubRelease),
|
|
98
128
|
successComment: false,
|
|
99
129
|
failComment: false,
|
|
100
130
|
releasedLabels: false,
|
package/src/internal/check.mjs
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import process from 'node:process';
|
|
4
|
-
|
|
5
|
-
import { runEngine } from './engines.mjs';
|
|
6
|
-
|
|
7
|
-
const EXPECTED_NODE_MAJOR = '24';
|
|
8
|
-
const EXPECTED_NODE_RANGE = '^24.0.0';
|
|
9
|
-
|
|
10
|
-
function validateRuntimeContract(cwd) {
|
|
11
|
-
const nvmrcPath = path.join(cwd, '.nvmrc');
|
|
12
|
-
const packageJsonPath = path.join(cwd, 'package.json');
|
|
13
|
-
const errors = [];
|
|
14
|
-
|
|
15
|
-
if (process.versions.node.split('.')[0] !== EXPECTED_NODE_MAJOR) {
|
|
16
|
-
errors.push(`Node.js ${EXPECTED_NODE_MAJOR} is required; received ${process.version}.`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (!fs.existsSync(nvmrcPath) || fs.readFileSync(nvmrcPath, 'utf8').trim() !== EXPECTED_NODE_MAJOR) {
|
|
20
|
-
errors.push(`.nvmrc must contain ${EXPECTED_NODE_MAJOR}.`);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
24
|
-
errors.push('package.json is required.');
|
|
25
|
-
} else {
|
|
26
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
27
|
-
const runtime = packageJson.devEngines?.runtime;
|
|
28
|
-
if (runtime?.name !== 'node' || runtime.version !== EXPECTED_NODE_RANGE || runtime.onFail !== 'error') {
|
|
29
|
-
errors.push(
|
|
30
|
-
`package.json devEngines.runtime must require node ${EXPECTED_NODE_RANGE} with onFail set to error.`
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const nodeTypes = packageJson.devDependencies?.['@types/node'];
|
|
35
|
-
if (nodeTypes && !/^\^24(?:\.|$)/u.test(nodeTypes)) {
|
|
36
|
-
errors.push(`@types/node must target Node.js 24; received ${nodeTypes}.`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const error of errors) {
|
|
41
|
-
console.error(`Runtime contract error: ${error}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return errors.length === 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const CHECK_STEPS = [
|
|
48
|
-
['@textmode/lint', 'textmode-lint', ['format:check']],
|
|
49
|
-
['@textmode/lint', 'textmode-lint', ['lint']],
|
|
50
|
-
['@textmode/lint', 'textmode-lint', ['lint:markdown']],
|
|
51
|
-
['@textmode/tsconfig', 'textmode-types', ['check']],
|
|
52
|
-
['@textmode/docs', 'textmode-docs', ['check']],
|
|
53
|
-
['@textmode/build', 'textmode-build', ['test']],
|
|
54
|
-
['@textmode/build', 'textmode-build', ['build']],
|
|
55
|
-
['@textmode/tsconfig', 'textmode-types', ['build']],
|
|
56
|
-
['@textmode/tsconfig', 'textmode-types', ['verify']],
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
const PREPACK_STEPS = [
|
|
60
|
-
['@textmode/build', 'textmode-build', ['build']],
|
|
61
|
-
['@textmode/tsconfig', 'textmode-types', ['build']],
|
|
62
|
-
['@textmode/tsconfig', 'textmode-types', ['verify']],
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
function runSteps(steps, cwd) {
|
|
66
|
-
for (const [packageName, binName, args] of steps) {
|
|
67
|
-
console.log(`\n[textmode] ${binName} ${args.join(' ')}`);
|
|
68
|
-
const status = runEngine(packageName, binName, args, { cwd });
|
|
69
|
-
if (status !== 0) {
|
|
70
|
-
return status;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function runCheck({ cwd = process.cwd() } = {}) {
|
|
77
|
-
if (!validateRuntimeContract(cwd)) {
|
|
78
|
-
return 1;
|
|
79
|
-
}
|
|
80
|
-
return runSteps(CHECK_STEPS, cwd);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function runPrepack({ cwd = process.cwd() } = {}) {
|
|
84
|
-
return runSteps(PREPACK_STEPS, cwd);
|
|
85
|
-
}
|