@ryanatkn/gro 0.181.0 → 0.182.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
3
  Copyright (c) Ryan Atkinson <mail@ryanatkn.com> <https://ryanatkn.com/>
4
4
 
package/README.md CHANGED
@@ -6,7 +6,12 @@
6
6
 
7
7
  [`npm i -D @ryanatkn/gro`](https://www.npmjs.com/package/@ryanatkn/gro)
8
8
 
9
- [Windows won't be supported](https://github.com/ryanatkn/gro/issues/319), I chose Bash instead.
9
+ > ⚠️ I still use Gro heavily but I'm transitioning to Rust-based tooling
10
+ > with [Fuz](https://github.com/fuzdev) using [Deno](https://github.com/denoland) as a sidecar.
11
+ > I consider Gro deprecated but there should be a migration path.
12
+ > Please open issues if you need help.
13
+
14
+ > ⚠️[Windows won't be supported](https://github.com/ryanatkn/gro/issues/319), I chose Bash instead.
10
15
 
11
16
  Docs at [gro.ryanatkn.com/docs](https://gro.ryanatkn.com/docs) and [src/docs](./src/docs).
12
17
 
package/dist/cli.d.ts CHANGED
@@ -18,13 +18,13 @@ export type Cli = {
18
18
  */
19
19
  export declare const find_cli: (name: string, cwd?: string | URL, options?: SpawnOptions) => Promise<Cli | null>;
20
20
  /**
21
- * Spawns a CLI if available using Belt's `spawn`.
21
+ * Spawns a CLI if available using fuz_util's `spawn`.
22
22
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
23
23
  * @returns `undefined` if no CLI is found, or the spawn result
24
24
  */
25
25
  export declare const spawn_cli: (name_or_cli: string | Cli, args?: Array<string>, log?: Logger, options?: SpawnOptions) => Promise<SpawnResult | undefined>;
26
26
  /**
27
- * Spawns a CLI if available using Belt's `spawn_process`.
27
+ * Spawns a CLI if available using fuz_util's `spawn_process`.
28
28
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
29
29
  * @returns `undefined` if no CLI is found, or the spawn result
30
30
  */
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ export const find_cli = async (name, cwd = process.cwd(), options) => {
21
21
  return { name, id: global_id, kind: 'global' };
22
22
  };
23
23
  /**
24
- * Spawns a CLI if available using Belt's `spawn`.
24
+ * Spawns a CLI if available using fuz_util's `spawn`.
25
25
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
26
26
  * @returns `undefined` if no CLI is found, or the spawn result
27
27
  */
@@ -32,7 +32,7 @@ export const spawn_cli = async (name_or_cli, args = [], log, options) => {
32
32
  return spawn(cli.id, args, options);
33
33
  };
34
34
  /**
35
- * Spawns a CLI if available using Belt's `spawn_process`.
35
+ * Spawns a CLI if available using fuz_util's `spawn_process`.
36
36
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
37
37
  * @returns `undefined` if no CLI is found, or the spawn result
38
38
  */
@@ -1 +1 @@
1
- {"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAUrD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,eAsBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAUrD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,eAoBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -26,9 +26,7 @@ const config = async (cfg, svelte_config) => {
26
26
  gro_plugin_gen(),
27
27
  has_server_result.ok ? gro_plugin_server() : null,
28
28
  has_sveltekit_library_result.ok ? gro_plugin_sveltekit_library() : null,
29
- has_sveltekit_app_result.ok
30
- ? gro_plugin_sveltekit_app({ host_target: has_server_result.ok ? 'node' : 'github_pages' })
31
- : null,
29
+ has_sveltekit_app_result.ok ? gro_plugin_sveltekit_app() : null,
32
30
  ].filter((v) => v !== null);
33
31
  return cfg;
34
32
  };
@@ -3,10 +3,13 @@ import { type PackageJsonMapper } from './package_json.ts';
3
3
  import { type SourceJsonMapper } from './source_json.ts';
4
4
  export interface GroPluginSveltekitAppOptions {
5
5
  /**
6
- * Used for finalizing a SvelteKit build like adding a `.nojekyll` file for GitHub Pages.
7
- * @default 'github_pages'
6
+ * Whether to include a `.nojekyll` file in the build output.
7
+ * GitHub Pages processes files with Jekyll by default, breaking files/dirs prefixed with `_`.
8
+ * The `.nojekyll` file tells GitHub Pages to skip Jekyll processing.
9
+ *
10
+ * @default `true` if the SvelteKit adapter name contains 'static'
8
11
  */
9
- host_target?: HostTarget;
12
+ include_nojekyll?: boolean;
10
13
  /**
11
14
  * If truthy, adds `/.well-known/package.json` to the static output.
12
15
  * If a function, maps the value.
@@ -27,7 +30,6 @@ export interface GroPluginSveltekitAppOptions {
27
30
  */
28
31
  vite_cli?: string;
29
32
  }
30
- export type HostTarget = 'github_pages' | 'static' | 'node';
31
33
  export type CopyFileFilter = (file_path: string) => boolean;
32
- export declare const gro_plugin_sveltekit_app: ({ host_target, well_known_package_json, well_known_source_json, well_known_src_files, vite_cli, }?: GroPluginSveltekitAppOptions) => Plugin;
34
+ export declare const gro_plugin_sveltekit_app: ({ include_nojekyll, well_known_package_json, well_known_source_json, well_known_src_files, vite_cli, }?: GroPluginSveltekitAppOptions) => Plugin;
33
35
  //# sourceMappingURL=gro_plugin_sveltekit_app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gro_plugin_sveltekit_app.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_plugin_sveltekit_app.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAExC,OAAO,EAAyB,KAAK,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC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AAED,MAAM,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;AAE5D,eAAO,MAAM,wBAAwB,GAAI,yGAMtC,4BAAiC,KAAG,MAiHtC,CAAC"}
@@ -9,11 +9,11 @@ import { source_json_serialize, source_json_create } from "./source_json.js";
9
9
  import { EXPORTS_EXCLUDER_DEFAULT } from "./gro_config.js";
10
10
  import { default_svelte_config } from "./svelte_config.js";
11
11
  import { SOURCE_DIRNAME, VITE_CLI } from "./constants.js";
12
- export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_known_package_json, well_known_source_json, well_known_src_files, vite_cli = VITE_CLI, } = {}) => {
12
+ export const gro_plugin_sveltekit_app = ({ include_nojekyll, well_known_package_json, well_known_source_json, well_known_src_files, vite_cli = VITE_CLI, } = {}) => {
13
13
  let sveltekit_process = undefined;
14
14
  return {
15
15
  name: 'gro_plugin_sveltekit_app',
16
- setup: async ({ dev, watch, log, config }) => {
16
+ setup: async ({ dev, watch, log, config, svelte_config }) => {
17
17
  const found_vite_cli = await find_cli(vite_cli);
18
18
  if (!found_vite_cli)
19
19
  throw Error(`Failed to find Vite CLI \`${vite_cli}\`, do you need to run \`${config.pm_cli} i\`?`);
@@ -58,6 +58,9 @@ export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_kn
58
58
  // copy files to `static` before building, in such a way
59
59
  // that's non-destructive to existing files and dirs and easy to clean up
60
60
  const { assets_path } = default_svelte_config;
61
+ // detect whether to include .nojekyll based on adapter if not explicitly set
62
+ const adapter_name = svelte_config.svelte_config?.kit?.adapter?.name;
63
+ const should_include_nojekyll = include_nojekyll ?? (adapter_name ? adapter_name.includes('static') : false);
61
64
  const cleanup_promises = [
62
65
  serialized_package_json
63
66
  ? create_temporarily(join(assets_path, '.well-known/package.json'), serialized_package_json)
@@ -70,15 +73,7 @@ export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_kn
70
73
  ? (file_path) => !EXPORTS_EXCLUDER_DEFAULT.test(file_path)
71
74
  : well_known_src_files)
72
75
  : null,
73
- /**
74
- * GitHub pages processes everything with Jekyll by default,
75
- * breaking things like files and dirs prefixed with an underscore.
76
- * This adds a `.nojekyll` file to the root of the output
77
- * to tell GitHub Pages to treat the outputs as plain static files.
78
- */
79
- host_target === 'github_pages'
80
- ? create_temporarily(join(assets_path, '.nojekyll'), '')
81
- : null,
76
+ should_include_nojekyll ? create_temporarily(join(assets_path, '.nojekyll'), '') : null,
82
77
  ].filter((v) => v != null);
83
78
  const cleanups = await Promise.all(cleanup_promises);
84
79
  const cleanup = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.181.0",
3
+ "version": "0.182.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -82,24 +82,24 @@
82
82
  "devDependencies": {
83
83
  "@changesets/changelog-git": "^0.2.1",
84
84
  "@changesets/types": "^6.1.0",
85
- "@fuzdev/fuz_code": "^0.37.0",
86
- "@fuzdev/fuz_css": "^0.40.0",
87
- "@fuzdev/fuz_ui": "^0.169.0",
88
- "@fuzdev/fuz_util": "^0.42.0",
85
+ "@fuzdev/fuz_code": "^0.38.0",
86
+ "@fuzdev/fuz_css": "^0.42.1",
87
+ "@fuzdev/fuz_ui": "^0.172.0",
88
+ "@fuzdev/fuz_util": "^0.43.0",
89
89
  "@ryanatkn/eslint-config": "^0.9.0",
90
90
  "@sveltejs/adapter-static": "^3.0.10",
91
- "@sveltejs/kit": "^2.49.0",
91
+ "@sveltejs/kit": "^2.49.1",
92
92
  "@sveltejs/package": "^2.5.7",
93
93
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
94
94
  "@types/node": "^24.10.1",
95
- "esbuild": "^0.27.0",
95
+ "esbuild": "^0.27.1",
96
96
  "eslint": "^9.39.1",
97
- "eslint-plugin-svelte": "^3.13.0",
98
- "svelte": "^5.45.2",
97
+ "eslint-plugin-svelte": "^3.13.1",
98
+ "svelte": "^5.45.6",
99
99
  "svelte-check": "^4.3.4",
100
100
  "typescript": "^5.9.3",
101
- "typescript-eslint": "^8.48.0",
102
- "vitest": "^4.0.14"
101
+ "typescript-eslint": "^8.48.1",
102
+ "vitest": "^4.0.15"
103
103
  },
104
104
  "prettier": {
105
105
  "plugins": [
package/src/lib/cli.ts CHANGED
@@ -15,7 +15,7 @@ import type {PathId} from '@fuzdev/fuz_util/path.js';
15
15
  import {NODE_MODULES_DIRNAME} from './constants.ts';
16
16
  import {print_command_args} from './args.ts';
17
17
 
18
- // TODO maybe upstream to Belt?
18
+ // TODO maybe upstream to fuz_util?
19
19
 
20
20
  export type Cli =
21
21
  | {kind: 'local'; name: string; id: PathId}
@@ -42,7 +42,7 @@ export const find_cli = async (
42
42
  };
43
43
 
44
44
  /**
45
- * Spawns a CLI if available using Belt's `spawn`.
45
+ * Spawns a CLI if available using fuz_util's `spawn`.
46
46
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
47
47
  * @returns `undefined` if no CLI is found, or the spawn result
48
48
  */
@@ -58,7 +58,7 @@ export const spawn_cli = async (
58
58
  };
59
59
 
60
60
  /**
61
- * Spawns a CLI if available using Belt's `spawn_process`.
61
+ * Spawns a CLI if available using fuz_util's `spawn_process`.
62
62
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
63
63
  * @returns `undefined` if no CLI is found, or the spawn result
64
64
  */
@@ -33,9 +33,7 @@ const config: CreateGroConfig = async (cfg, svelte_config) => {
33
33
  gro_plugin_gen(),
34
34
  has_server_result.ok ? gro_plugin_server() : null,
35
35
  has_sveltekit_library_result.ok ? gro_plugin_sveltekit_library() : null,
36
- has_sveltekit_app_result.ok
37
- ? gro_plugin_sveltekit_app({host_target: has_server_result.ok ? 'node' : 'github_pages'})
38
- : null,
36
+ has_sveltekit_app_result.ok ? gro_plugin_sveltekit_app() : null,
39
37
  ].filter((v) => v !== null);
40
38
 
41
39
  return cfg;
@@ -15,10 +15,13 @@ import {SOURCE_DIRNAME, VITE_CLI} from './constants.ts';
15
15
 
16
16
  export interface GroPluginSveltekitAppOptions {
17
17
  /**
18
- * Used for finalizing a SvelteKit build like adding a `.nojekyll` file for GitHub Pages.
19
- * @default 'github_pages'
18
+ * Whether to include a `.nojekyll` file in the build output.
19
+ * GitHub Pages processes files with Jekyll by default, breaking files/dirs prefixed with `_`.
20
+ * The `.nojekyll` file tells GitHub Pages to skip Jekyll processing.
21
+ *
22
+ * @default `true` if the SvelteKit adapter name contains 'static'
20
23
  */
21
- host_target?: HostTarget;
24
+ include_nojekyll?: boolean;
22
25
 
23
26
  /**
24
27
  * If truthy, adds `/.well-known/package.json` to the static output.
@@ -43,12 +46,10 @@ export interface GroPluginSveltekitAppOptions {
43
46
  vite_cli?: string;
44
47
  }
45
48
 
46
- export type HostTarget = 'github_pages' | 'static' | 'node';
47
-
48
49
  export type CopyFileFilter = (file_path: string) => boolean;
49
50
 
50
51
  export const gro_plugin_sveltekit_app = ({
51
- host_target = 'github_pages',
52
+ include_nojekyll,
52
53
  well_known_package_json,
53
54
  well_known_source_json,
54
55
  well_known_src_files,
@@ -57,7 +58,7 @@ export const gro_plugin_sveltekit_app = ({
57
58
  let sveltekit_process: SpawnedProcess | undefined = undefined;
58
59
  return {
59
60
  name: 'gro_plugin_sveltekit_app',
60
- setup: async ({dev, watch, log, config}) => {
61
+ setup: async ({dev, watch, log, config, svelte_config}) => {
61
62
  const found_vite_cli = await find_cli(vite_cli);
62
63
  if (!found_vite_cli)
63
64
  throw Error(
@@ -110,6 +111,12 @@ export const gro_plugin_sveltekit_app = ({
110
111
  // copy files to `static` before building, in such a way
111
112
  // that's non-destructive to existing files and dirs and easy to clean up
112
113
  const {assets_path} = default_svelte_config;
114
+
115
+ // detect whether to include .nojekyll based on adapter if not explicitly set
116
+ const adapter_name = svelte_config.svelte_config?.kit?.adapter?.name;
117
+ const should_include_nojekyll =
118
+ include_nojekyll ?? (adapter_name ? adapter_name.includes('static') : false);
119
+
113
120
  const cleanup_promises = [
114
121
  serialized_package_json
115
122
  ? create_temporarily(
@@ -133,15 +140,7 @@ export const gro_plugin_sveltekit_app = ({
133
140
  : well_known_src_files,
134
141
  )
135
142
  : null,
136
- /**
137
- * GitHub pages processes everything with Jekyll by default,
138
- * breaking things like files and dirs prefixed with an underscore.
139
- * This adds a `.nojekyll` file to the root of the output
140
- * to tell GitHub Pages to treat the outputs as plain static files.
141
- */
142
- host_target === 'github_pages'
143
- ? create_temporarily(join(assets_path, '.nojekyll'), '')
144
- : null,
143
+ should_include_nojekyll ? create_temporarily(join(assets_path, '.nojekyll'), '') : null,
145
144
  ].filter((v): v is Promise<AsyncCleanup> => v != null);
146
145
  const cleanups = await Promise.all(cleanup_promises);
147
146
  const cleanup = async () => {