@ryanatkn/gro 0.190.1 → 0.192.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 +4 -278
- package/package.json +5 -142
- package/LICENSE +0 -21
- package/dist/args.d.ts +0 -37
- package/dist/args.d.ts.map +0 -1
- package/dist/args.js +0 -102
- package/dist/build.task.d.ts +0 -20
- package/dist/build.task.d.ts.map +0 -1
- package/dist/build.task.js +0 -119
- package/dist/build_cache.d.ts +0 -100
- package/dist/build_cache.d.ts.map +0 -1
- package/dist/build_cache.js +0 -299
- package/dist/changelog.d.ts +0 -11
- package/dist/changelog.d.ts.map +0 -1
- package/dist/changelog.js +0 -47
- package/dist/changeset.task.d.ts +0 -35
- package/dist/changeset.task.d.ts.map +0 -1
- package/dist/changeset.task.js +0 -151
- package/dist/changeset_helpers.d.ts +0 -17
- package/dist/changeset_helpers.d.ts.map +0 -1
- package/dist/changeset_helpers.js +0 -7
- package/dist/check.task.d.ts +0 -28
- package/dist/check.task.d.ts.map +0 -1
- package/dist/check.task.js +0 -95
- package/dist/child_process_logging.d.ts +0 -10
- package/dist/child_process_logging.d.ts.map +0 -1
- package/dist/child_process_logging.js +0 -26
- package/dist/clean.task.d.ts +0 -15
- package/dist/clean.task.d.ts.map +0 -1
- package/dist/clean.task.js +0 -40
- package/dist/clean_fs.d.ts +0 -9
- package/dist/clean_fs.d.ts.map +0 -1
- package/dist/clean_fs.js +0 -28
- package/dist/cli.d.ts +0 -34
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -61
- package/dist/commit.task.d.ts +0 -11
- package/dist/commit.task.d.ts.map +0 -1
- package/dist/commit.task.js +0 -24
- package/dist/constants.d.ts +0 -46
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -52
- package/dist/deploy.task.d.ts +0 -29
- package/dist/deploy.task.d.ts.map +0 -1
- package/dist/deploy.task.js +0 -217
- package/dist/dev.task.d.ts +0 -16
- package/dist/dev.task.d.ts.map +0 -1
- package/dist/dev.task.js +0 -44
- package/dist/disknode.d.ts +0 -23
- package/dist/disknode.d.ts.map +0 -1
- package/dist/disknode.js +0 -1
- package/dist/env.d.ts +0 -11
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/esbuild_helpers.d.ts +0 -16
- package/dist/esbuild_helpers.d.ts.map +0 -1
- package/dist/esbuild_helpers.js +0 -36
- package/dist/esbuild_plugin_external_worker.d.ts +0 -23
- package/dist/esbuild_plugin_external_worker.d.ts.map +0 -1
- package/dist/esbuild_plugin_external_worker.js +0 -55
- package/dist/esbuild_plugin_svelte.d.ts +0 -15
- package/dist/esbuild_plugin_svelte.d.ts.map +0 -1
- package/dist/esbuild_plugin_svelte.js +0 -83
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts +0 -8
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +0 -30
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +0 -7
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_alias.js +0 -18
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +0 -9
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +0 -22
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +0 -11
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +0 -18
- package/dist/filer.d.ts +0 -33
- package/dist/filer.d.ts.map +0 -1
- package/dist/filer.js +0 -385
- package/dist/format.task.d.ts +0 -11
- package/dist/format.task.d.ts.map +0 -1
- package/dist/format.task.js +0 -27
- package/dist/format_directory.d.ts +0 -13
- package/dist/format_directory.d.ts.map +0 -1
- package/dist/format_directory.js +0 -40
- package/dist/format_file.d.ts +0 -9
- package/dist/format_file.d.ts.map +0 -1
- package/dist/format_file.js +0 -42
- package/dist/gen.d.ts +0 -142
- package/dist/gen.d.ts.map +0 -1
- package/dist/gen.js +0 -199
- package/dist/gen.task.d.ts +0 -12
- package/dist/gen.task.d.ts.map +0 -1
- package/dist/gen.task.js +0 -149
- package/dist/gen_helpers.d.ts +0 -11
- package/dist/gen_helpers.d.ts.map +0 -1
- package/dist/gen_helpers.js +0 -76
- package/dist/github.d.ts +0 -19
- package/dist/github.d.ts.map +0 -1
- package/dist/github.js +0 -33
- package/dist/gro.config.default.d.ts +0 -13
- package/dist/gro.config.default.d.ts.map +0 -1
- package/dist/gro.config.default.js +0 -33
- package/dist/gro.d.ts +0 -3
- package/dist/gro.d.ts.map +0 -1
- package/dist/gro.js +0 -21
- package/dist/gro_config.d.ts +0 -115
- package/dist/gro_config.d.ts.map +0 -1
- package/dist/gro_config.js +0 -114
- package/dist/gro_helpers.d.ts +0 -49
- package/dist/gro_helpers.d.ts.map +0 -1
- package/dist/gro_helpers.js +0 -97
- package/dist/gro_plugin_gen.d.ts +0 -12
- package/dist/gro_plugin_gen.d.ts.map +0 -1
- package/dist/gro_plugin_gen.js +0 -101
- package/dist/gro_plugin_server.d.ts +0 -80
- package/dist/gro_plugin_server.d.ts.map +0 -1
- package/dist/gro_plugin_server.js +0 -167
- package/dist/gro_plugin_sveltekit_app.d.ts +0 -9
- package/dist/gro_plugin_sveltekit_app.d.ts.map +0 -1
- package/dist/gro_plugin_sveltekit_app.js +0 -42
- package/dist/gro_plugin_sveltekit_library.d.ts +0 -16
- package/dist/gro_plugin_sveltekit_library.d.ts.map +0 -1
- package/dist/gro_plugin_sveltekit_library.js +0 -34
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/input_path.d.ts +0 -64
- package/dist/input_path.d.ts.map +0 -1
- package/dist/input_path.js +0 -199
- package/dist/invoke.d.ts +0 -2
- package/dist/invoke.d.ts.map +0 -1
- package/dist/invoke.js +0 -28
- package/dist/invoke_task.d.ts +0 -30
- package/dist/invoke_task.d.ts.map +0 -1
- package/dist/invoke_task.js +0 -104
- package/dist/lint.task.d.ts +0 -11
- package/dist/lint.task.d.ts.map +0 -1
- package/dist/lint.task.js +0 -32
- package/dist/loader.d.ts +0 -6
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -192
- package/dist/module.d.ts +0 -4
- package/dist/module.d.ts.map +0 -1
- package/dist/module.js +0 -6
- package/dist/modules.d.ts +0 -36
- package/dist/modules.d.ts.map +0 -1
- package/dist/modules.js +0 -71
- package/dist/package_json.d.ts +0 -32
- package/dist/package_json.d.ts.map +0 -1
- package/dist/package_json.js +0 -178
- package/dist/parse_exports.d.ts +0 -20
- package/dist/parse_exports.d.ts.map +0 -1
- package/dist/parse_exports.js +0 -65
- package/dist/parse_exports_context.d.ts +0 -21
- package/dist/parse_exports_context.d.ts.map +0 -1
- package/dist/parse_exports_context.js +0 -332
- package/dist/parse_imports.d.ts +0 -5
- package/dist/parse_imports.d.ts.map +0 -1
- package/dist/parse_imports.js +0 -140
- package/dist/paths.d.ts +0 -41
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -69
- package/dist/plugin.d.ts +0 -36
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -78
- package/dist/publish.task.d.ts +0 -26
- package/dist/publish.task.d.ts.map +0 -1
- package/dist/publish.task.js +0 -176
- package/dist/register.d.ts +0 -2
- package/dist/register.d.ts.map +0 -1
- package/dist/register.js +0 -2
- package/dist/reinstall.task.d.ts +0 -8
- package/dist/reinstall.task.d.ts.map +0 -1
- package/dist/reinstall.task.js +0 -35
- package/dist/release.task.d.ts +0 -8
- package/dist/release.task.d.ts.map +0 -1
- package/dist/release.task.js +0 -20
- package/dist/resolve.task.d.ts +0 -11
- package/dist/resolve.task.d.ts.map +0 -1
- package/dist/resolve.task.js +0 -38
- package/dist/resolve_specifier.d.ts +0 -22
- package/dist/resolve_specifier.d.ts.map +0 -1
- package/dist/resolve_specifier.js +0 -57
- package/dist/run.task.d.ts +0 -16
- package/dist/run.task.d.ts.map +0 -1
- package/dist/run.task.js +0 -52
- package/dist/run_gen.d.ts +0 -10
- package/dist/run_gen.d.ts.map +0 -1
- package/dist/run_gen.js +0 -73
- package/dist/run_task.d.ts +0 -17
- package/dist/run_task.d.ts.map +0 -1
- package/dist/run_task.js +0 -45
- package/dist/source_json.d.ts +0 -7
- package/dist/source_json.d.ts.map +0 -1
- package/dist/source_json.js +0 -145
- package/dist/svelte_config.d.ts +0 -57
- package/dist/svelte_config.d.ts.map +0 -1
- package/dist/svelte_config.js +0 -81
- package/dist/sveltekit_helpers.d.ts +0 -75
- package/dist/sveltekit_helpers.d.ts.map +0 -1
- package/dist/sveltekit_helpers.js +0 -94
- package/dist/sveltekit_shim_app.d.ts +0 -11
- package/dist/sveltekit_shim_app.d.ts.map +0 -1
- package/dist/sveltekit_shim_app.js +0 -31
- package/dist/sveltekit_shim_app_environment.d.ts +0 -13
- package/dist/sveltekit_shim_app_environment.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_environment.js +0 -14
- package/dist/sveltekit_shim_app_forms.d.ts +0 -5
- package/dist/sveltekit_shim_app_forms.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_forms.js +0 -6
- package/dist/sveltekit_shim_app_navigation.d.ts +0 -10
- package/dist/sveltekit_shim_app_navigation.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_navigation.js +0 -11
- package/dist/sveltekit_shim_app_paths.d.ts +0 -17
- package/dist/sveltekit_shim_app_paths.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_paths.js +0 -10
- package/dist/sveltekit_shim_app_state.d.ts +0 -5
- package/dist/sveltekit_shim_app_state.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_state.js +0 -26
- package/dist/sveltekit_shim_env.d.ts +0 -5
- package/dist/sveltekit_shim_env.d.ts.map +0 -1
- package/dist/sveltekit_shim_env.js +0 -23
- package/dist/sync.task.d.ts +0 -16
- package/dist/sync.task.d.ts.map +0 -1
- package/dist/sync.task.js +0 -39
- package/dist/task.d.ts +0 -98
- package/dist/task.d.ts.map +0 -1
- package/dist/task.js +0 -109
- package/dist/task_logging.d.ts +0 -6
- package/dist/task_logging.d.ts.map +0 -1
- package/dist/task_logging.js +0 -201
- package/dist/test.task.d.ts +0 -13
- package/dist/test.task.d.ts.map +0 -1
- package/dist/test.task.js +0 -53
- package/dist/typecheck.task.d.ts +0 -13
- package/dist/typecheck.task.d.ts.map +0 -1
- package/dist/typecheck.task.js +0 -68
- package/dist/upgrade.task.d.ts +0 -20
- package/dist/upgrade.task.d.ts.map +0 -1
- package/dist/upgrade.task.js +0 -111
- package/dist/watch_dir.d.ts +0 -36
- package/dist/watch_dir.d.ts.map +0 -1
- package/dist/watch_dir.js +0 -69
- package/src/lib/args.ts +0 -115
- package/src/lib/build.task.ts +0 -151
- package/src/lib/build_cache.ts +0 -378
- package/src/lib/changelog.ts +0 -69
- package/src/lib/changeset.task.ts +0 -228
- package/src/lib/changeset_helpers.ts +0 -14
- package/src/lib/check.task.ts +0 -120
- package/src/lib/child_process_logging.ts +0 -38
- package/src/lib/clean.task.ts +0 -48
- package/src/lib/clean_fs.ts +0 -54
- package/src/lib/cli.ts +0 -98
- package/src/lib/commit.task.ts +0 -34
- package/src/lib/constants.ts +0 -56
- package/src/lib/deploy.task.ts +0 -287
- package/src/lib/dev.task.ts +0 -52
- package/src/lib/disknode.ts +0 -26
- package/src/lib/env.ts +0 -78
- package/src/lib/esbuild_helpers.ts +0 -49
- package/src/lib/esbuild_plugin_external_worker.ts +0 -94
- package/src/lib/esbuild_plugin_svelte.ts +0 -134
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +0 -38
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +0 -27
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +0 -42
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +0 -47
- package/src/lib/filer.ts +0 -458
- package/src/lib/format.task.ts +0 -44
- package/src/lib/format_directory.ts +0 -65
- package/src/lib/format_file.ts +0 -49
- package/src/lib/gen.task.ts +0 -206
- package/src/lib/gen.ts +0 -406
- package/src/lib/gen_helpers.ts +0 -131
- package/src/lib/github.ts +0 -46
- package/src/lib/gro.config.default.ts +0 -42
- package/src/lib/gro.ts +0 -29
- package/src/lib/gro_config.ts +0 -254
- package/src/lib/gro_helpers.ts +0 -108
- package/src/lib/gro_plugin_gen.ts +0 -149
- package/src/lib/gro_plugin_server.ts +0 -288
- package/src/lib/gro_plugin_sveltekit_app.ts +0 -58
- package/src/lib/gro_plugin_sveltekit_library.ts +0 -63
- package/src/lib/index.ts +0 -8
- package/src/lib/input_path.ts +0 -254
- package/src/lib/invoke.ts +0 -34
- package/src/lib/invoke_task.ts +0 -139
- package/src/lib/lint.task.ts +0 -39
- package/src/lib/loader.ts +0 -229
- package/src/lib/module.ts +0 -13
- package/src/lib/modules.ts +0 -117
- package/src/lib/package_json.ts +0 -255
- package/src/lib/parse_exports.ts +0 -100
- package/src/lib/parse_exports_context.ts +0 -395
- package/src/lib/parse_imports.ts +0 -180
- package/src/lib/paths.ts +0 -111
- package/src/lib/plugin.ts +0 -106
- package/src/lib/publish.task.ts +0 -228
- package/src/lib/register.ts +0 -3
- package/src/lib/reinstall.task.ts +0 -45
- package/src/lib/release.task.ts +0 -26
- package/src/lib/resolve.task.ts +0 -43
- package/src/lib/resolve_specifier.ts +0 -81
- package/src/lib/run.task.ts +0 -65
- package/src/lib/run_gen.ts +0 -110
- package/src/lib/run_task.ts +0 -82
- package/src/lib/source_json.ts +0 -183
- package/src/lib/svelte_config.ts +0 -140
- package/src/lib/sveltekit_helpers.ts +0 -193
- package/src/lib/sveltekit_shim_app.ts +0 -41
- package/src/lib/sveltekit_shim_app_environment.ts +0 -16
- package/src/lib/sveltekit_shim_app_forms.ts +0 -13
- package/src/lib/sveltekit_shim_app_navigation.ts +0 -23
- package/src/lib/sveltekit_shim_app_paths.ts +0 -26
- package/src/lib/sveltekit_shim_app_state.ts +0 -35
- package/src/lib/sveltekit_shim_env.ts +0 -45
- package/src/lib/sync.task.ts +0 -47
- package/src/lib/task.ts +0 -245
- package/src/lib/task_logging.ts +0 -255
- package/src/lib/test.task.ts +0 -63
- package/src/lib/typecheck.task.ts +0 -81
- package/src/lib/upgrade.task.ts +0 -148
- package/src/lib/watch_dir.ts +0 -115
package/dist/changeset.task.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
3
|
-
import { styleText as st } from 'node:util';
|
|
4
|
-
import { readdir, readFile, writeFile } from 'node:fs/promises';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
7
|
-
import { GitOrigin, git_check_fully_staged_workspace, git_push_to_create, } from '@fuzdev/fuz_util/git.js';
|
|
8
|
-
import { TaskError } from "./task.js";
|
|
9
|
-
import { find_cli, spawn_cli } from "./cli.js";
|
|
10
|
-
import { has_sveltekit_library } from "./sveltekit_helpers.js";
|
|
11
|
-
import { CHANGESET_CLI, CHANGESET_DIR, ChangesetAccess, ChangesetBump, CHANGESET_PUBLIC_ACCESS, CHANGESET_RESTRICTED_ACCESS, } from "./changeset_helpers.js";
|
|
12
|
-
import { package_json_load } from "./package_json.js";
|
|
13
|
-
/** @nodocs */
|
|
14
|
-
export const Args = z.strictObject({
|
|
15
|
-
/**
|
|
16
|
-
* The optional rest args get joined with a space to form the `message`.
|
|
17
|
-
*/
|
|
18
|
-
_: z
|
|
19
|
-
.array(z.string())
|
|
20
|
-
.meta({ description: 'the message for the changeset and commit' })
|
|
21
|
-
.max(1)
|
|
22
|
-
.default([]),
|
|
23
|
-
minor: z.boolean().meta({ description: 'bump the minor version' }).default(false),
|
|
24
|
-
major: z.boolean().meta({ description: 'bump the major version' }).default(false),
|
|
25
|
-
dir: z.string().meta({ description: 'changeset dir' }).default(CHANGESET_DIR),
|
|
26
|
-
access: ChangesetAccess.describe("changeset 'access' config value, the default depends on package.json#private").optional(),
|
|
27
|
-
changelog: z
|
|
28
|
-
.string()
|
|
29
|
-
.meta({ description: 'changelog dep package name, used as changeset\'s "changelog" config' })
|
|
30
|
-
.default('@changesets/changelog-git'),
|
|
31
|
-
dep: z.boolean().meta({ description: 'dual of no-dep' }).default(true),
|
|
32
|
-
'no-dep': z
|
|
33
|
-
.boolean()
|
|
34
|
-
.meta({ description: 'opt out of installing the changelog package' })
|
|
35
|
-
.default(false),
|
|
36
|
-
origin: GitOrigin.describe('git origin to deploy to').default('origin'),
|
|
37
|
-
changeset_cli: z.string().meta({ description: 'the changeset CLI to use' }).default(CHANGESET_CLI),
|
|
38
|
-
});
|
|
39
|
-
/**
|
|
40
|
-
* Calls the `changeset` CLI with some simple automations.
|
|
41
|
-
* This API is designed for convenient manual usage, not clarity or normality.
|
|
42
|
-
*
|
|
43
|
-
* Usage:
|
|
44
|
-
* - gro changeset some commit message
|
|
45
|
-
* - gro changeset some commit message --minor
|
|
46
|
-
* - gro changeset "some commit message" --minor
|
|
47
|
-
*
|
|
48
|
-
* @nodocs
|
|
49
|
-
*/
|
|
50
|
-
export const task = {
|
|
51
|
-
summary: 'call changeset with gro patterns',
|
|
52
|
-
Args,
|
|
53
|
-
run: async (ctx) => {
|
|
54
|
-
const { invoke_task, args: { _: [message], minor, major, dir, access: access_arg, changelog, dep, origin, changeset_cli, }, log, svelte_config, config, } = ctx;
|
|
55
|
-
if (!message && (minor || major))
|
|
56
|
-
throw new TaskError('cannot bump version without a message');
|
|
57
|
-
if (minor && major)
|
|
58
|
-
throw new TaskError('cannot bump both minor and major');
|
|
59
|
-
const bump = minor ? 'minor' : major ? 'major' : 'patch';
|
|
60
|
-
const found_changeset_cli = await find_cli(changeset_cli);
|
|
61
|
-
if (!found_changeset_cli) {
|
|
62
|
-
throw new TaskError('changeset command not found: install @changesets/cli locally or globally');
|
|
63
|
-
}
|
|
64
|
-
const package_json = await package_json_load();
|
|
65
|
-
const has_sveltekit_library_result = await has_sveltekit_library(package_json, svelte_config);
|
|
66
|
-
if (!has_sveltekit_library_result.ok) {
|
|
67
|
-
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
68
|
-
}
|
|
69
|
-
const path = join(dir, 'config.json');
|
|
70
|
-
const inited = await fs_exists(path);
|
|
71
|
-
if (!inited) {
|
|
72
|
-
await spawn_cli(found_changeset_cli, ['init'], log);
|
|
73
|
-
const access = (access_arg ?? package_json.private)
|
|
74
|
-
? CHANGESET_RESTRICTED_ACCESS
|
|
75
|
-
: CHANGESET_PUBLIC_ACCESS;
|
|
76
|
-
const access_color = access === CHANGESET_RESTRICTED_ACCESS ? 'blue' : 'red';
|
|
77
|
-
log.info('initing changeset with ' + st(access_color, access) + ' access');
|
|
78
|
-
if (access !== CHANGESET_RESTRICTED_ACCESS) {
|
|
79
|
-
await update_changeset_config(path, (config) => {
|
|
80
|
-
const updated = { ...config };
|
|
81
|
-
updated.access = access;
|
|
82
|
-
updated.changelog = changelog;
|
|
83
|
-
return updated;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
await spawn('git', ['add', dir]);
|
|
87
|
-
if (dep) {
|
|
88
|
-
await spawn(config.pm_cli, ['install', '-D', changelog]);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
// TODO small problem here where generated files don't get committed
|
|
92
|
-
await invoke_task('sync', { install: inited || !dep }); // after installing above, and in all cases
|
|
93
|
-
if (message) {
|
|
94
|
-
// TODO see the helper below, simplify this to CLI flags when support is added to Changesets
|
|
95
|
-
const changeset_adder = await create_changeset_adder(package_json.name, dir, message, bump);
|
|
96
|
-
await spawn_cli(found_changeset_cli, ['add', '--empty'], log);
|
|
97
|
-
await changeset_adder();
|
|
98
|
-
if (!(await git_check_fully_staged_workspace())) {
|
|
99
|
-
await spawn('git', ['commit', '-m', message]);
|
|
100
|
-
await git_push_to_create(origin);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
await spawn_cli(found_changeset_cli, [], log);
|
|
105
|
-
await spawn('git', ['add', dir]);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* TODO ideally this wouldn't exist and we'd use CLI flags, but they doesn't exist yet
|
|
111
|
-
* @see https://github.com/changesets/changesets/pull/1121
|
|
112
|
-
*/
|
|
113
|
-
const create_changeset_adder = async (repo_name, dir, message, bump) => {
|
|
114
|
-
const filenames_before = await readdir(dir);
|
|
115
|
-
return async () => {
|
|
116
|
-
const filenames_after = await readdir(dir);
|
|
117
|
-
const filenames_added = filenames_after.filter((p) => !filenames_before.includes(p));
|
|
118
|
-
if (!filenames_added.length) {
|
|
119
|
-
throw Error('expected to find a new changeset file');
|
|
120
|
-
}
|
|
121
|
-
if (filenames_added.length !== 1) {
|
|
122
|
-
throw Error('expected to find exactly one new changeset file');
|
|
123
|
-
}
|
|
124
|
-
const path = join(dir, filenames_added[0]);
|
|
125
|
-
const contents = create_new_changeset(repo_name, message, bump);
|
|
126
|
-
await writeFile(path, contents, 'utf8');
|
|
127
|
-
await spawn('git', ['add', path]);
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
const create_new_changeset = (repo_name, message, bump) => `---
|
|
131
|
-
"${repo_name}": ${bump}
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
${message}
|
|
135
|
-
`;
|
|
136
|
-
// TODO refactor all of this with zod and package_json helpers - util file helper? JSON parse pluggable
|
|
137
|
-
const update_changeset_config = async (path, cb) => {
|
|
138
|
-
const config_contents = await load_changeset_config_contents(path);
|
|
139
|
-
const config = parse_changeset_config(config_contents);
|
|
140
|
-
const updated = await cb(config);
|
|
141
|
-
const serialized = serialize_changeset_config(updated);
|
|
142
|
-
if (serialized === config_contents) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
await write_changeset_config(path, serialized);
|
|
146
|
-
return true;
|
|
147
|
-
};
|
|
148
|
-
const load_changeset_config_contents = (path) => readFile(path, 'utf8');
|
|
149
|
-
const write_changeset_config = (path, serialized) => writeFile(path, serialized);
|
|
150
|
-
const serialize_changeset_config = (config) => JSON.stringify(config, null, '\t') + '\n';
|
|
151
|
-
const parse_changeset_config = (contents) => JSON.parse(contents);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const CHANGESET_RESTRICTED_ACCESS = "restricted";
|
|
3
|
-
export declare const CHANGESET_PUBLIC_ACCESS = "public";
|
|
4
|
-
export declare const ChangesetAccess: z.ZodEnum<{
|
|
5
|
-
public: "public";
|
|
6
|
-
restricted: "restricted";
|
|
7
|
-
}>;
|
|
8
|
-
export type ChangesetAccess = z.infer<typeof ChangesetAccess>;
|
|
9
|
-
export declare const CHANGESET_CLI = "changeset";
|
|
10
|
-
export declare const CHANGESET_DIR = ".changeset";
|
|
11
|
-
export declare const ChangesetBump: z.ZodEnum<{
|
|
12
|
-
patch: "patch";
|
|
13
|
-
minor: "minor";
|
|
14
|
-
major: "major";
|
|
15
|
-
}>;
|
|
16
|
-
export type ChangesetBump = z.infer<typeof ChangesetBump>;
|
|
17
|
-
//# sourceMappingURL=changeset_helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"changeset_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/changeset_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAEhD,eAAO,MAAM,eAAe;;;EAAiE,CAAC;AAC9F,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,eAAO,MAAM,aAAa;;;;EAAsC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const CHANGESET_RESTRICTED_ACCESS = 'restricted';
|
|
3
|
-
export const CHANGESET_PUBLIC_ACCESS = 'public';
|
|
4
|
-
export const ChangesetAccess = z.enum([CHANGESET_RESTRICTED_ACCESS, CHANGESET_PUBLIC_ACCESS]);
|
|
5
|
-
export const CHANGESET_CLI = 'changeset';
|
|
6
|
-
export const CHANGESET_DIR = '.changeset';
|
|
7
|
-
export const ChangesetBump = z.enum(['patch', 'minor', 'major']);
|
package/dist/check.task.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { type Task } from './task.ts';
|
|
3
|
-
/** @nodocs */
|
|
4
|
-
export declare const Args: z.ZodObject<{
|
|
5
|
-
typecheck: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
'no-typecheck': z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
test: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
-
'no-test': z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
gen: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
'no-gen': z.ZodDefault<z.ZodBoolean>;
|
|
11
|
-
format: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
-
'no-format': z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
package_json: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
-
'no-package_json': z.ZodDefault<z.ZodBoolean>;
|
|
15
|
-
lint: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
-
'no-lint': z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
build: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
-
'no-build': z.ZodDefault<z.ZodBoolean>;
|
|
19
|
-
force_build: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
-
sync: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
-
'no-sync': z.ZodDefault<z.ZodBoolean>;
|
|
22
|
-
install: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
-
workspace: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
-
}, z.core.$strict>;
|
|
25
|
-
export type Args = z.infer<typeof Args>;
|
|
26
|
-
/** @nodocs */
|
|
27
|
-
export declare const task: Task<Args>;
|
|
28
|
-
//# sourceMappingURL=check.task.d.ts.map
|
package/dist/check.task.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/check.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAG/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;kBA6Bf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA6E3B,CAAC"}
|
package/dist/check.task.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
3
|
-
import { styleText as st } from 'node:util';
|
|
4
|
-
import { git_check_clean_workspace } from '@fuzdev/fuz_util/git.js';
|
|
5
|
-
import { TaskError } from "./task.js";
|
|
6
|
-
import { package_json_sync } from "./package_json.js";
|
|
7
|
-
/** @nodocs */
|
|
8
|
-
export const Args = z.strictObject({
|
|
9
|
-
typecheck: z.boolean().meta({ description: 'dual of no-typecheck' }).default(true),
|
|
10
|
-
'no-typecheck': z.boolean().meta({ description: 'opt out of typechecking' }).default(false),
|
|
11
|
-
test: z.boolean().meta({ description: 'dual of no-test' }).default(true),
|
|
12
|
-
'no-test': z.boolean().meta({ description: 'opt out of running tests' }).default(false),
|
|
13
|
-
gen: z.boolean().meta({ description: 'dual of no-gen' }).default(true),
|
|
14
|
-
'no-gen': z.boolean().meta({ description: 'opt out of gen check' }).default(false),
|
|
15
|
-
format: z.boolean().meta({ description: 'dual of no-format' }).default(true),
|
|
16
|
-
'no-format': z.boolean().meta({ description: 'opt out of format check' }).default(false),
|
|
17
|
-
package_json: z.boolean().meta({ description: 'dual of no-package_json' }).default(true),
|
|
18
|
-
'no-package_json': z
|
|
19
|
-
.boolean()
|
|
20
|
-
.meta({ description: 'opt out of package.json check' })
|
|
21
|
-
.default(false),
|
|
22
|
-
lint: z.boolean().meta({ description: 'dual of no-lint' }).default(true),
|
|
23
|
-
'no-lint': z.boolean().meta({ description: 'opt out of linting' }).default(false),
|
|
24
|
-
build: z.boolean().meta({ description: 'dual of no-build' }).default(false),
|
|
25
|
-
'no-build': z.boolean().meta({ description: 'opt out of building' }).default(true),
|
|
26
|
-
force_build: z
|
|
27
|
-
.boolean()
|
|
28
|
-
.meta({ description: 'force a fresh build, ignoring the cache' })
|
|
29
|
-
.default(false),
|
|
30
|
-
sync: z.boolean().meta({ description: 'dual of no-sync' }).default(true),
|
|
31
|
-
'no-sync': z.boolean().meta({ description: 'opt out of syncing' }).default(false),
|
|
32
|
-
install: z.boolean().meta({ description: 'opt into installing packages' }).default(false),
|
|
33
|
-
workspace: z
|
|
34
|
-
.boolean()
|
|
35
|
-
.meta({ description: 'ensure a clean git workspace, useful for CI, also implies --no-sync' })
|
|
36
|
-
.default(false),
|
|
37
|
-
});
|
|
38
|
-
/** @nodocs */
|
|
39
|
-
export const task = {
|
|
40
|
-
summary: 'check that everything is ready to commit',
|
|
41
|
-
Args,
|
|
42
|
-
run: async ({ args, invoke_task, log, config }) => {
|
|
43
|
-
const { typecheck, test, gen, format, package_json, lint, build, force_build, sync, install, workspace, } = args;
|
|
44
|
-
// When checking the workspace, which was added for CI, never sync.
|
|
45
|
-
// Setup like installing packages and `sveltekit-sync` should be done in the CI setup.
|
|
46
|
-
if (!workspace) {
|
|
47
|
-
if (sync || install) {
|
|
48
|
-
if (!sync)
|
|
49
|
-
log.warn('sync is false but install is true, so ignoring the sync option');
|
|
50
|
-
await invoke_task('sync', { install, gen: false }); // never generate because `gro gen --check` runs below
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (typecheck) {
|
|
54
|
-
await invoke_task('typecheck');
|
|
55
|
-
}
|
|
56
|
-
if (test) {
|
|
57
|
-
await invoke_task('test');
|
|
58
|
-
}
|
|
59
|
-
if (gen) {
|
|
60
|
-
await invoke_task('gen', { check: true });
|
|
61
|
-
}
|
|
62
|
-
if (package_json && config.map_package_json) {
|
|
63
|
-
const { changed } = await package_json_sync(config.map_package_json, log, false);
|
|
64
|
-
if (changed) {
|
|
65
|
-
throw new TaskError('package.json is out of date, run `gro sync` to update it');
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
log.info('check passed for package.json');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (format) {
|
|
72
|
-
await invoke_task('format', { check: true });
|
|
73
|
-
}
|
|
74
|
-
// Run the linter last to surface every other kind of problem first.
|
|
75
|
-
// It's not the ideal order when the linter would catch errors that cause failing tests,
|
|
76
|
-
// but it's better for most usage.
|
|
77
|
-
if (lint) {
|
|
78
|
-
await invoke_task('lint');
|
|
79
|
-
}
|
|
80
|
-
if (build) {
|
|
81
|
-
// Skip sync/gen/install since check handles those separately
|
|
82
|
-
await invoke_task('build', { sync: false, gen: false, install: false, force_build });
|
|
83
|
-
}
|
|
84
|
-
if (workspace) {
|
|
85
|
-
const error_message = await git_check_clean_workspace();
|
|
86
|
-
if (error_message) {
|
|
87
|
-
log.error(st('red', 'git status'));
|
|
88
|
-
await spawn('git', ['status']);
|
|
89
|
-
throw new TaskError('Failed check for git_check_clean_workspace:' +
|
|
90
|
-
error_message +
|
|
91
|
-
' - do you need to run `gro sync` or commit some files?');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
/**
|
|
3
|
-
* Maps child process output through a transform function.
|
|
4
|
-
*/
|
|
5
|
-
export declare const map_child_process_output: (child_process: ChildProcess, transform: (data: string) => string) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Configures process output handling with path replacements while preserving ANSI colors.
|
|
8
|
-
*/
|
|
9
|
-
export declare const configure_colored_output_with_path_replacement: (child_process: ChildProcess, replacement?: string, cwd?: string) => void;
|
|
10
|
-
//# sourceMappingURL=child_process_logging.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"child_process_logging.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/child_process_logging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAGrD;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACpC,eAAe,YAAY,EAC3B,WAAW,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,KACjC,IAYF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8CAA8C,GAC1D,eAAe,YAAY,EAC3B,cAAa,MAAY,EACzB,MAAK,MAAsB,KACzB,IAOF,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { strip_end } from '@fuzdev/fuz_util/string.js';
|
|
2
|
-
/**
|
|
3
|
-
* Maps child process output through a transform function.
|
|
4
|
-
*/
|
|
5
|
-
export const map_child_process_output = (child_process, transform) => {
|
|
6
|
-
if (child_process.stdout) {
|
|
7
|
-
child_process.stdout.on('data', (data) => {
|
|
8
|
-
process.stdout.write(transform(data.toString()));
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
if (child_process.stderr) {
|
|
12
|
-
child_process.stderr.on('data', (data) => {
|
|
13
|
-
process.stderr.write(transform(data.toString()));
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Configures process output handling with path replacements while preserving ANSI colors.
|
|
19
|
-
*/
|
|
20
|
-
export const configure_colored_output_with_path_replacement = (child_process, replacement = '.', cwd = process.cwd()) => {
|
|
21
|
-
// Escape special characters in the cwd for regexp safety
|
|
22
|
-
const cwd_escaped = strip_end(cwd, '/').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
23
|
-
const cwd_reg_exp = new RegExp(cwd_escaped, 'g');
|
|
24
|
-
// Use the generic mapper with a path replacement transform
|
|
25
|
-
map_child_process_output(child_process, (data) => data.replace(cwd_reg_exp, replacement));
|
|
26
|
-
};
|
package/dist/clean.task.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Task } from './task.ts';
|
|
3
|
-
/** @nodocs */
|
|
4
|
-
export declare const Args: z.ZodObject<{
|
|
5
|
-
build_dev: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
build_dist: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
sveltekit: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
-
nodemodules: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
git: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
git_origin: z.ZodDefault<z.ZodString>;
|
|
11
|
-
}, z.core.$strict>;
|
|
12
|
-
export type Args = z.infer<typeof Args>;
|
|
13
|
-
/** @nodocs */
|
|
14
|
-
export declare const task: Task<Args>;
|
|
15
|
-
//# sourceMappingURL=clean.task.d.ts.map
|
package/dist/clean.task.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clean.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/clean.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;kBAgBf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAmB3B,CAAC"}
|
package/dist/clean.task.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { GitOrigin } from '@fuzdev/fuz_util/git.js';
|
|
4
|
-
import { clean_fs } from "./clean_fs.js";
|
|
5
|
-
/** @nodocs */
|
|
6
|
-
export const Args = z.strictObject({
|
|
7
|
-
build_dev: z.boolean().meta({ description: 'delete the Gro build dev directory' }).default(false),
|
|
8
|
-
build_dist: z.boolean().meta({ description: 'delete the Gro build dist directory' }).default(false),
|
|
9
|
-
sveltekit: z
|
|
10
|
-
.boolean()
|
|
11
|
-
.meta({ description: 'delete the SvelteKit directory and Vite cache' })
|
|
12
|
-
.default(false),
|
|
13
|
-
nodemodules: z.boolean().meta({ description: 'delete the node_modules directory' }).default(false),
|
|
14
|
-
git: z
|
|
15
|
-
.boolean()
|
|
16
|
-
.meta({
|
|
17
|
-
description: 'run "git remote prune" to delete local branches referencing nonexistent remote branches',
|
|
18
|
-
})
|
|
19
|
-
.default(false),
|
|
20
|
-
git_origin: GitOrigin.describe('the origin to "git remote prune"').default('origin'),
|
|
21
|
-
});
|
|
22
|
-
/** @nodocs */
|
|
23
|
-
export const task = {
|
|
24
|
-
summary: 'remove temporary dev and build files, and optionally prune git branches',
|
|
25
|
-
Args,
|
|
26
|
-
run: async ({ args }) => {
|
|
27
|
-
const { build_dev, build_dist, sveltekit, nodemodules, git, git_origin } = args;
|
|
28
|
-
await clean_fs({
|
|
29
|
-
build: !build_dev && !build_dist,
|
|
30
|
-
build_dev,
|
|
31
|
-
build_dist,
|
|
32
|
-
sveltekit,
|
|
33
|
-
nodemodules,
|
|
34
|
-
});
|
|
35
|
-
// lop off stale git branches
|
|
36
|
-
if (git) {
|
|
37
|
-
await spawn('git', ['remote', 'prune', git_origin]);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
};
|
package/dist/clean_fs.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RmOptions } from 'node:fs';
|
|
2
|
-
export declare const clean_fs: ({ build, build_dev, build_dist, sveltekit, nodemodules, }: {
|
|
3
|
-
build?: boolean;
|
|
4
|
-
build_dev?: boolean;
|
|
5
|
-
build_dist?: boolean;
|
|
6
|
-
sveltekit?: boolean;
|
|
7
|
-
nodemodules?: boolean;
|
|
8
|
-
}, rm_options?: RmOptions) => Promise<void>;
|
|
9
|
-
//# sourceMappingURL=clean_fs.d.ts.map
|
package/dist/clean_fs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clean_fs.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/clean_fs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAYvC,eAAO,MAAM,QAAQ,GACpB,2DAMG;IACF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,EACD,aAAY,SAA0C,KACpD,OAAO,CAAC,IAAI,CAyBd,CAAC"}
|
package/dist/clean_fs.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { readdir, rm } from 'node:fs/promises';
|
|
2
|
-
import { paths } from "./paths.js";
|
|
3
|
-
import { NODE_MODULES_DIRNAME, GRO_DIST_PREFIX, SVELTEKIT_DEV_DIRNAME, SVELTEKIT_BUILD_DIRNAME, SVELTEKIT_VITE_CACHE_PATH, SVELTEKIT_DIST_DIRNAME, } from "./constants.js";
|
|
4
|
-
export const clean_fs = async ({ build = false, build_dev = false, build_dist = false, sveltekit = false, nodemodules = false, }, rm_options = { force: true, recursive: true }) => {
|
|
5
|
-
const promises = [];
|
|
6
|
-
if (build) {
|
|
7
|
-
promises.push(rm(paths.build, rm_options));
|
|
8
|
-
}
|
|
9
|
-
else if (build_dev) {
|
|
10
|
-
promises.push(rm(paths.build_dev, rm_options));
|
|
11
|
-
}
|
|
12
|
-
if (build || build_dist) {
|
|
13
|
-
const dir_paths = (await readdir('.')).filter((p) => p.startsWith(GRO_DIST_PREFIX));
|
|
14
|
-
for (const path of dir_paths) {
|
|
15
|
-
promises.push(rm(path, rm_options));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (sveltekit) {
|
|
19
|
-
promises.push(rm(SVELTEKIT_DEV_DIRNAME, rm_options));
|
|
20
|
-
promises.push(rm(SVELTEKIT_BUILD_DIRNAME, rm_options));
|
|
21
|
-
promises.push(rm(SVELTEKIT_DIST_DIRNAME, rm_options));
|
|
22
|
-
promises.push(rm(SVELTEKIT_VITE_CACHE_PATH, rm_options));
|
|
23
|
-
}
|
|
24
|
-
if (nodemodules) {
|
|
25
|
-
promises.push(rm(NODE_MODULES_DIRNAME, rm_options));
|
|
26
|
-
}
|
|
27
|
-
await Promise.all(promises);
|
|
28
|
-
};
|
package/dist/cli.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { SpawnOptions } from 'node:child_process';
|
|
2
|
-
import { type SpawnResult, type SpawnedProcess } from '@fuzdev/fuz_util/process.js';
|
|
3
|
-
import { type URL } from 'node:url';
|
|
4
|
-
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
5
|
-
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
6
|
-
export type Cli = {
|
|
7
|
-
kind: 'local';
|
|
8
|
-
name: string;
|
|
9
|
-
id: PathId;
|
|
10
|
-
} | {
|
|
11
|
-
kind: 'global';
|
|
12
|
-
name: string;
|
|
13
|
-
id: PathId;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Searches the filesystem for the CLI `name`, first local to the cwd and then globally.
|
|
17
|
-
* @returns `null` if not found locally or globally
|
|
18
|
-
*/
|
|
19
|
-
export declare const find_cli: (name: string, cwd?: string | URL, options?: SpawnOptions) => Promise<Cli | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Spawns a CLI if available using fuz_util's `spawn`.
|
|
22
|
-
* If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
|
|
23
|
-
* @returns `undefined` if no CLI is found, or the spawn result
|
|
24
|
-
*/
|
|
25
|
-
export declare const spawn_cli: (name_or_cli: string | Cli, args?: Array<string>, log?: Logger, options?: SpawnOptions) => Promise<SpawnResult | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Spawns a CLI if available using fuz_util's `spawn_process`.
|
|
28
|
-
* If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
|
|
29
|
-
* @returns `undefined` if no CLI is found, or the spawn result
|
|
30
|
-
*/
|
|
31
|
-
export declare const spawn_cli_process: (name_or_cli: string | Cli, args?: Array<string>, log?: Logger, options?: SpawnOptions) => Promise<SpawnedProcess | undefined>;
|
|
32
|
-
export declare const resolve_cli: (name_or_cli: string | Cli, args: Array<string> | undefined, cwd: string | URL | undefined, log?: Logger, options?: SpawnOptions) => Promise<Cli | undefined>;
|
|
33
|
-
export declare const to_cli_name: (cli: string | Cli) => string;
|
|
34
|
-
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAIN,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAgB,KAAK,GAAG,EAAC,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAOrD,MAAM,MAAM,GAAG,GACZ;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,GACzC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,QAAQ,GACpB,MAAM,MAAM,EACZ,MAAK,MAAM,GAAG,GAAmB,EACjC,UAAU,YAAY,KACpB,OAAO,CAAC,GAAG,GAAG,IAAI,CAUpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GACrB,aAAa,MAAM,GAAG,GAAG,EACzB,OAAM,KAAK,CAAC,MAAM,CAAM,EACxB,MAAM,MAAM,EACZ,UAAU,YAAY,KACpB,OAAO,CAAC,WAAW,GAAG,SAAS,CAIjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC7B,aAAa,MAAM,GAAG,GAAG,EACzB,OAAM,KAAK,CAAC,MAAM,CAAM,EACxB,MAAM,MAAM,EACZ,UAAU,YAAY,KACpB,OAAO,CAAC,cAAc,GAAG,SAAS,CAIpC,CAAC;AAEF,eAAO,MAAM,WAAW,GACvB,aAAa,MAAM,GAAG,GAAG,EACzB,MAAM,KAAK,CAAC,MAAM,CAAC,YAAK,EACxB,KAAK,MAAM,GAAG,GAAG,GAAG,SAAS,EAC7B,MAAM,MAAM,EACZ,UAAU,YAAY,KACpB,OAAO,CAAC,GAAG,GAAG,SAAS,CAazB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,GAAG,GAAG,KAAG,MACP,CAAC"}
|
package/dist/cli.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { spawn, spawn_out, spawn_process, } from '@fuzdev/fuz_util/process.js';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { NODE_MODULES_DIRNAME } from "./constants.js";
|
|
6
|
-
import { print_command_args } from "./args.js";
|
|
7
|
-
/**
|
|
8
|
-
* Searches the filesystem for the CLI `name`, first local to the cwd and then globally.
|
|
9
|
-
* @returns `null` if not found locally or globally
|
|
10
|
-
*/
|
|
11
|
-
export const find_cli = async (name, cwd = process.cwd(), options) => {
|
|
12
|
-
const final_cwd = typeof cwd === 'string' ? cwd : fileURLToPath(cwd);
|
|
13
|
-
const local_id = join(final_cwd, NODE_MODULES_DIRNAME, `.bin/${name}`);
|
|
14
|
-
if (await fs_exists(local_id)) {
|
|
15
|
-
return { name, id: local_id, kind: 'local' };
|
|
16
|
-
}
|
|
17
|
-
const { stdout } = await spawn_out('which', [name], options);
|
|
18
|
-
const global_id = stdout?.trim();
|
|
19
|
-
if (!global_id)
|
|
20
|
-
return null;
|
|
21
|
-
return { name, id: global_id, kind: 'global' };
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Spawns a CLI if available using fuz_util's `spawn`.
|
|
25
|
-
* If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
|
|
26
|
-
* @returns `undefined` if no CLI is found, or the spawn result
|
|
27
|
-
*/
|
|
28
|
-
export const spawn_cli = async (name_or_cli, args = [], log, options) => {
|
|
29
|
-
const cli = await resolve_cli(name_or_cli, args, options?.cwd, log, options);
|
|
30
|
-
if (!cli)
|
|
31
|
-
return;
|
|
32
|
-
return spawn(cli.id, args, options);
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Spawns a CLI if available using fuz_util's `spawn_process`.
|
|
36
|
-
* If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
|
|
37
|
-
* @returns `undefined` if no CLI is found, or the spawn result
|
|
38
|
-
*/
|
|
39
|
-
export const spawn_cli_process = async (name_or_cli, args = [], log, options) => {
|
|
40
|
-
const cli = await resolve_cli(name_or_cli, args, options?.cwd, log, options);
|
|
41
|
-
if (!cli)
|
|
42
|
-
return;
|
|
43
|
-
return spawn_process(cli.id, args, options);
|
|
44
|
-
};
|
|
45
|
-
export const resolve_cli = async (name_or_cli, args = [], cwd, log, options) => {
|
|
46
|
-
let final_cli;
|
|
47
|
-
if (typeof name_or_cli === 'string') {
|
|
48
|
-
const found = await find_cli(name_or_cli, cwd, options);
|
|
49
|
-
if (!found)
|
|
50
|
-
return;
|
|
51
|
-
final_cli = found;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
final_cli = name_or_cli;
|
|
55
|
-
}
|
|
56
|
-
if (log) {
|
|
57
|
-
log.info(print_command_args([final_cli.name].concat(args)));
|
|
58
|
-
}
|
|
59
|
-
return final_cli;
|
|
60
|
-
};
|
|
61
|
-
export const to_cli_name = (cli) => typeof cli === 'string' ? cli : cli.name;
|
package/dist/commit.task.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Task } from './task.ts';
|
|
3
|
-
/** @nodocs */
|
|
4
|
-
export declare const Args: z.ZodObject<{
|
|
5
|
-
_: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
6
|
-
origin: z.ZodDefault<z.ZodString>;
|
|
7
|
-
}, z.core.$strict>;
|
|
8
|
-
export type Args = z.infer<typeof Args>;
|
|
9
|
-
/** @nodocs */
|
|
10
|
-
export declare const task: Task<Args>;
|
|
11
|
-
//# sourceMappingURL=commit.task.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commit.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/commit.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAEpC,cAAc;AACd,eAAO,MAAM,IAAI;;;kBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAc3B,CAAC"}
|
package/dist/commit.task.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { GitOrigin, git_current_branch_name, git_push } from '@fuzdev/fuz_util/git.js';
|
|
4
|
-
/** @nodocs */
|
|
5
|
-
export const Args = z.strictObject({
|
|
6
|
-
_: z
|
|
7
|
-
.array(z.string())
|
|
8
|
-
.meta({
|
|
9
|
-
description: 'the git commit message, the same as git commit -m or --message',
|
|
10
|
-
})
|
|
11
|
-
.default([]),
|
|
12
|
-
origin: GitOrigin.describe('git origin to commit to').default('origin'),
|
|
13
|
-
});
|
|
14
|
-
/** @nodocs */
|
|
15
|
-
export const task = {
|
|
16
|
-
summary: 'commit and push to a new branch',
|
|
17
|
-
Args,
|
|
18
|
-
run: async ({ args }) => {
|
|
19
|
-
const { _: [message], origin, } = args;
|
|
20
|
-
const branch = await git_current_branch_name();
|
|
21
|
-
await spawn('git', ['commit', '-a', '-m', message]);
|
|
22
|
-
await git_push(origin, branch, undefined, true);
|
|
23
|
-
},
|
|
24
|
-
};
|
package/dist/constants.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export declare const SOURCE_DIRNAME = "src";
|
|
2
|
-
export declare const GRO_DIRNAME = ".gro";
|
|
3
|
-
export declare const GRO_DIST_PREFIX = "dist_";
|
|
4
|
-
export declare const SERVER_DIST_PATH = "dist_server";
|
|
5
|
-
export declare const GRO_DEV_DIRNAME: string;
|
|
6
|
-
/** @trailing_slash */
|
|
7
|
-
export declare const SOURCE_DIR: string;
|
|
8
|
-
/** @trailing_slash */
|
|
9
|
-
export declare const GRO_DIR: string;
|
|
10
|
-
/** @trailing_slash */
|
|
11
|
-
export declare const GRO_DEV_DIR: string;
|
|
12
|
-
export declare const GRO_CONFIG_FILENAME = "gro.config.ts";
|
|
13
|
-
export declare const README_FILENAME = "README.md";
|
|
14
|
-
export declare const SVELTE_CONFIG_FILENAME = "svelte.config.js";
|
|
15
|
-
export declare const VITE_CONFIG_FILENAME = "vite.config.ts";
|
|
16
|
-
export declare const NODE_MODULES_DIRNAME = "node_modules";
|
|
17
|
-
export declare const PACKAGE_JSON_FILENAME = "package.json";
|
|
18
|
-
export declare const LOCKFILE_FILENAME = "package-lock.json";
|
|
19
|
-
export declare const SVELTEKIT_DEV_DIRNAME = ".svelte-kit";
|
|
20
|
-
export declare const SVELTEKIT_BUILD_DIRNAME = "build";
|
|
21
|
-
export declare const SVELTEKIT_DIST_DIRNAME = "dist";
|
|
22
|
-
export declare const SVELTEKIT_VITE_CACHE_PATH: string;
|
|
23
|
-
export declare const GITHUB_DIRNAME = ".github";
|
|
24
|
-
export declare const GIT_DIRNAME = ".git";
|
|
25
|
-
export declare const TSCONFIG_FILENAME = "tsconfig.json";
|
|
26
|
-
export declare const TS_MATCHER: RegExp;
|
|
27
|
-
export declare const JS_MATCHER: RegExp;
|
|
28
|
-
export declare const JSON_MATCHER: RegExp;
|
|
29
|
-
export declare const SVELTE_MATCHER: RegExp;
|
|
30
|
-
export declare const SVELTE_RUNES_MATCHER: RegExp;
|
|
31
|
-
export declare const CSS_MATCHER: RegExp;
|
|
32
|
-
/** Extracts the script content from Svelte files. */
|
|
33
|
-
export declare const SVELTE_SCRIPT_MATCHER: RegExp;
|
|
34
|
-
export declare const SVELTEKIT_ENV_MATCHER: RegExp;
|
|
35
|
-
export declare const SVELTEKIT_GLOBAL_SPECIFIER: RegExp;
|
|
36
|
-
export declare const EVERYTHING_MATCHER: RegExp;
|
|
37
|
-
export declare const JS_CLI_DEFAULT = "node";
|
|
38
|
-
export declare const PM_CLI_DEFAULT = "npm";
|
|
39
|
-
export declare const PRETTIER_CLI_DEFAULT = "prettier";
|
|
40
|
-
export declare const SVELTEKIT_CLI = "svelte-kit";
|
|
41
|
-
export declare const SVELTE_CHECK_CLI = "svelte-check";
|
|
42
|
-
export declare const SVELTE_PACKAGE_CLI = "svelte-package";
|
|
43
|
-
export declare const SVELTE_PACKAGE_DEP_NAME = "@sveltejs/package";
|
|
44
|
-
export declare const VITE_CLI = "vite";
|
|
45
|
-
export declare const VITEST_CLI = "vitest";
|
|
46
|
-
//# sourceMappingURL=constants.d.ts.map
|