create-conformal 0.3.0 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-conformal",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Project generator script for conformal projects",
5
5
  "homepage": "https://russellmcc.github.io/conformal",
6
6
  "bugs": "https://github.com/russellmcc/conformal/issues",
@@ -14,9 +14,9 @@
14
14
  "bin": "./src/index.ts",
15
15
  "type": "module",
16
16
  "dependencies": {
17
+ "@conformal/stamp": "^0.3.2",
18
+ "@conformal/create-plugin": "^0.3.2",
17
19
  "@commander-js/extra-typings": "^12.1.0",
18
- "@inquirer/prompts": "^5.3.8",
19
- "commander": "^12.1.0",
20
- "handlebars": "^4.7.8"
20
+ "commander": "^12.1.0"
21
21
  }
22
22
  }
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-conformal",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Project generator script for conformal projects",
5
5
  "homepage": "https://russellmcc.github.io/conformal",
6
6
  "bugs": "https://github.com/russellmcc/conformal/issues",
@@ -14,9 +14,9 @@
14
14
  "bin": "./src/index.ts",
15
15
  "type": "module",
16
16
  "dependencies": {
17
+ "@conformal/stamp": "^0.3.2",
18
+ "@conformal/create-plugin": "^0.3.2",
17
19
  "@commander-js/extra-typings": "^12.1.0",
18
- "@inquirer/prompts": "^5.3.8",
19
- "commander": "^12.1.0",
20
- "handlebars": "^4.7.8"
20
+ "commander": "^12.1.0"
21
21
  }
22
22
  }
package/src/config.ts CHANGED
@@ -1,108 +1,37 @@
1
- import { Command } from "@commander-js/extra-typings";
2
- import { input } from "@inquirer/prompts";
3
- import uuidHex from "./uuid";
1
+ import { ConfigMetadata, stampTemplate } from "@conformal/stamp";
2
+ import {
3
+ Config as PlugConfig,
4
+ metadatas as plugMetadatas,
5
+ toEnv,
6
+ toTemplate,
7
+ postBuild as plugPostBuild,
8
+ } from "@conformal/create-plugin";
9
+ import { $ } from "bun";
10
+ import path from "node:path";
4
11
 
5
12
  export type Config = {
6
13
  proj_slug: string;
7
- plug_slug: string;
8
- plug_name: string;
9
- vendor_name: string;
10
- };
11
-
12
- type ConfigMetadata = {
13
- key: keyof Config;
14
- prompt: string;
15
- description: string;
16
- default?: string;
17
- };
14
+ } & PlugConfig;
18
15
 
19
- export const toEnv = (
20
- config: Config,
21
- {
22
- skipTodo,
23
- component_crate_version,
24
- vst_crate_version,
25
- }: {
26
- skipTodo?: boolean;
27
- component_crate_version: string;
28
- vst_crate_version: string;
29
- },
30
- ): Record<string, string> => ({
31
- ...config,
32
- class_id: uuidHex(),
33
- edit_class_id: uuidHex(),
34
- gitignore: ".gitignore",
35
- component_crate_version,
36
- vst_crate_version,
37
- task_marker: (skipTodo ?? false) ? "DONE" : "TOD" + "O",
38
- });
39
-
40
- const metadatas: ConfigMetadata[] = [
41
- {
42
- key: "proj_slug",
16
+ export const metadatas: Record<keyof Config, ConfigMetadata> = {
17
+ ...plugMetadatas,
18
+ proj_slug: {
43
19
  prompt: "Project slug (lower snake_case, e.g. `my_project`)",
44
20
  description: "Slug for the project in lower snake_case, e.g. `my_project`",
45
21
  default: "my_project",
22
+ positional: true,
46
23
  },
47
- {
48
- key: "plug_slug",
49
- prompt: "Plug-in slug (lower snake_case, e.g. `my_plugin`)",
50
- description:
51
- "The name of the first plug-in in lower snake_case, e.g. `my_plugin`",
52
- default: "my_plugin",
53
- },
54
- {
55
- key: "vendor_name",
56
- prompt:
57
- 'Human-readable vendor name (DAWs often present plug-ins grouped by vendor). e.g., "My Project"?',
58
- description:
59
- "Human-readable vendor name, e.g. `My Project`. DAWs often present plug-ins grouped by vendor",
60
- default: "My Project",
61
- },
62
- {
63
- key: "plug_name",
64
- prompt: "Human-readable plug-in name (e.g. `My Plug-in`)?",
65
- description: "Human-readable vendor name, e.g. `My Plug-in`",
66
- default: "My Plug-in",
67
- },
68
- ];
24
+ };
69
25
 
70
- const fromCli = async (argv?: readonly string[]): Promise<Partial<Config>> => {
71
- const command = new Command();
72
- for (const { key, description } of metadatas) {
73
- if (key !== "proj_slug") {
74
- command.option(`--${key} <${key}>`, description);
75
- } else {
76
- // Name is a positional argument
77
- command.argument("<proj_slug>", description);
78
- }
79
- }
80
- const processed = await command.parseAsync(argv);
26
+ export const postBuild = async (config: Config, root?: string) => {
27
+ const env = await toEnv(config);
28
+ const template = await toTemplate(config);
29
+ const dest =
30
+ root === undefined ? config.proj_slug : path.join(root, config.proj_slug);
81
31
 
82
- const ret = Object.fromEntries(
83
- Object.entries(processed.opts()).filter(([_, v]) => v !== undefined),
84
- );
85
- if (processed.args.length > 0) {
86
- ret.proj_slug = processed.args[0];
87
- }
88
- return ret;
89
- };
32
+ await stampTemplate(dest, template, env, { merge: true });
90
33
 
91
- const doPrompt = async (metadata: ConfigMetadata): Promise<string> =>
92
- input({ message: metadata.prompt, default: metadata.default });
34
+ await plugPostBuild(dest, config);
93
35
 
94
- const promptRemainder = async (config: Partial<Config>): Promise<Config> => {
95
- const ret: Partial<Config> = { ...config };
96
- for (const metadata of metadatas) {
97
- if (metadata.key in ret) {
98
- continue;
99
- }
100
- ret[metadata.key] = await doPrompt(metadata);
101
- }
102
- // Note that we've filled in all of config here, since metadatas must contain all configs!
103
- // It would be cool to check this in ts but I don't know how
104
- return ret as Config;
36
+ await $`git init`.cwd(dest);
105
37
  };
106
-
107
- export const getConfig = async (argv?: readonly string[]): Promise<Config> =>
108
- await promptRemainder(await fromCli(argv));
package/src/index.ts CHANGED
@@ -1,27 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- import { getConfig, toEnv } from "./config";
4
- import { stampTemplate } from "./stamp";
3
+ import { Command } from "@commander-js/extra-typings";
4
+ import { Config, metadatas, postBuild } from "./config";
5
+ import { toEnv } from "@conformal/create-plugin";
6
+ import { buildStampCommand } from "@conformal/stamp";
5
7
  import path from "node:path";
6
- import { $ } from "bun";
7
8
 
8
- const config = await getConfig();
9
- const dest = config.proj_slug;
9
+ const command = buildStampCommand<keyof Config>({
10
+ command: new Command(),
11
+ metadatas,
12
+ toEnv,
13
+ toDest: (config) => Promise.resolve(config.proj_slug),
14
+ toTemplate: () =>
15
+ Promise.resolve(
16
+ path.join(path.dirname(import.meta.path), "..", "template"),
17
+ ),
18
+ postBuild,
19
+ });
10
20
 
11
- // Update the rust versions by grabbing our own package.json,
12
- // This is valid because we version all crates and packages together.
13
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
14
- const version: string =
15
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
16
- (await Bun.file(path.join(__dirname, "..", "package.json")).json()).version;
17
-
18
- await stampTemplate(
19
- dest,
20
- path.join(path.dirname(import.meta.path), "..", "template"),
21
- toEnv(config, {
22
- component_crate_version: `"${version}"`,
23
- vst_crate_version: `"${version}"`,
24
- }),
25
- );
26
-
27
- await $`git init`.cwd(dest);
21
+ await command.parseAsync();
@@ -1,15 +1,18 @@
1
1
  import { describe, test, expect } from "bun:test";
2
2
  import { withDir } from "tmp-promise";
3
3
  import path from "node:path";
4
+ import { unlink, rm } from "node:fs/promises";
4
5
  import { $ } from "bun";
5
- import { Config, toEnv } from "./config";
6
- import { stampTemplate } from "./stamp";
6
+ import { Config, postBuild } from "./config";
7
+ import { stampTemplate } from "@conformal/stamp";
8
+ import { toEnv } from "@conformal/create-plugin";
7
9
 
8
10
  const TEST_CONFIG: Config = {
9
11
  proj_slug: "test",
10
12
  plug_slug: "test_plug",
11
13
  plug_name: "Test Plug",
12
14
  vendor_name: "Test Project",
15
+ plug_type: "effect",
13
16
  };
14
17
 
15
18
  const MINUTE = 60_000;
@@ -28,19 +31,61 @@ describe("create-conformal template", () => {
28
31
  "..",
29
32
  );
30
33
 
34
+ const rewireDeps = async (dest: string) => {
35
+ // Note we use perl as a sed replacement because of https://github.com/oven-sh/bun/issues/13197,
36
+ // which makes sed unusable on macOS.
37
+ const perl_command = `s!"\\@conformal/([^"]+)": "workspace:\\*"!"\\@conformal/$1": "file://${tmpDir}/conformal-$1-0.0.0.tgz"!`;
38
+ await $`perl -pi -e ${perl_command} package.json`.cwd(dest);
39
+ };
40
+
31
41
  // Note that bun skips dependencies when installing packages from local paths :'(,
32
42
  // so instead, we use `npm pack` to create tarballs.
33
43
 
34
- const localDependencies = ["scripts", "plugin"];
44
+ const localDependencies = [
45
+ "scripts",
46
+ "plugin",
47
+ "stamp",
48
+ "create-plugin",
49
+ ];
35
50
  for (const dep of localDependencies) {
36
51
  await $`npm pack --pack-destination=${tmpDir}`.cwd(
37
52
  path.join(workspacePath, "web", dep),
38
53
  );
39
- expect(
40
- Bun.file(
41
- path.join(tmpDir, `conformal-${dep}-0.0.0.tgz`),
42
- ).exists(),
43
- ).resolves.toBe(true);
54
+ const tgzPath = path.join(tmpDir, `conformal-${dep}-0.0.0.tgz`);
55
+ expect(Bun.file(tgzPath).exists()).resolves.toBe(true);
56
+
57
+ // Extract the tarball to a sub-directory of tmpDir
58
+ const extractDir = path.join(tmpDir, `package`);
59
+ await $`tar -xzf ${tgzPath}`.cwd(tmpDir);
60
+ // Fix up all dependencies
61
+ await rewireDeps(extractDir);
62
+
63
+ // Remove any "prepack" and "postpack" scripts as these have already been run
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
65
+ const packageJson = await Bun.file(
66
+ `${extractDir}/package.json`,
67
+ ).json();
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
69
+ if (packageJson.scripts?.prepack) {
70
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
71
+ delete packageJson.scripts.prepack;
72
+ }
73
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
74
+ if (packageJson.scripts?.postpack) {
75
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
76
+ delete packageJson.scripts.postpack;
77
+ }
78
+ await Bun.write(
79
+ `${extractDir}/package.json`,
80
+ JSON.stringify(packageJson, null, 2),
81
+ );
82
+ // Remove the unfixed tarball
83
+ await unlink(tgzPath);
84
+ // Re-pack the tarball
85
+ await $`npm pack --pack-destination=${tmpDir}`.cwd(extractDir);
86
+ expect(Bun.file(tgzPath).exists()).resolves.toBe(true);
87
+
88
+ await rm(extractDir, { recursive: true });
44
89
  }
45
90
 
46
91
  // stamp the template
@@ -48,21 +93,35 @@ describe("create-conformal template", () => {
48
93
  await stampTemplate(
49
94
  dest,
50
95
  path.join(workspacePath, "web", "create", "template"),
51
- toEnv(TEST_CONFIG, {
52
- skipTodo: true,
53
- component_crate_version: `{ path = "${path.join(workspacePath, "rust", "component")}" }`,
54
- vst_crate_version: `{ path = "${path.join(workspacePath, "rust", "vst-wrapper")}" }`,
55
- }),
96
+ await toEnv(TEST_CONFIG),
56
97
  );
57
- await $`git init`.cwd(dest);
98
+ await postBuild(TEST_CONFIG, tmpDir);
58
99
 
59
- // Note we use perl as a sed replacement because of https://github.com/oven-sh/bun/issues/13197,
60
- // which makes sed unusable on macOS.
61
- const perl_command = `s/"\\@conformal\\/([^"]+)": "workspace:\\*"/"\\@conformal\\/$1": "file:..\\/conformal-$1-0.0.0.tgz"/`;
62
- await $`perl -pi -e ${perl_command} package.json`.cwd(dest);
100
+ await rewireDeps(dest);
63
101
 
64
- // Make sure CI would pass.
65
102
  await $`bun install`.cwd(dest);
103
+
104
+ // Add a synth target
105
+ await $`bun x conformal-scripts create-plugin --plug_type synth --plug_slug test_synth --vendor_name "Test Vendor" --plug_name "Test Synth"`.cwd(
106
+ dest,
107
+ );
108
+
109
+ // Note that the generate script leaves some intentional task markers - replace all these with "DONE"
110
+ await $`find web rust -type f -exec perl -pi -e 's/TOD[O]/DONE/g' {} +`.cwd(
111
+ dest,
112
+ );
113
+
114
+ // In CI, we will have a 0.0.0 version for the conformal crates.
115
+ // Replace these with a link to the local crate
116
+ const createDependencies = ["component", "vst_wrapper", "poly"];
117
+ for (const dep of createDependencies) {
118
+ const crateVersion = `{ path = "${path.join(workspacePath, "rust", dep.replace("_", "-"))}" }`;
119
+ await $`find rust -type f -exec perl -pi -e 's!conformal_${dep} = "0.0.0"!conformal_${dep} = ${crateVersion}!' {} +`.cwd(
120
+ dest,
121
+ );
122
+ }
123
+
124
+ // Make sure CI would pass.
66
125
  await $`bun run ci`.cwd(dest);
67
126
  },
68
127
  { unsafeCleanup: true },
@@ -1,6 +1,3 @@
1
1
  [workspace]
2
2
  resolver = "2"
3
- members = [
4
- "rust/{{plug_slug}}/component",
5
- "rust/{{plug_slug}}/vst",
6
- ]
3
+ members = []
@@ -10,6 +10,7 @@
10
10
  "check-lfs": "conformal-scripts check-lfs",
11
11
  "check-todo": "conformal-scripts check-todo",
12
12
  "check-format": "conformal-scripts check-format",
13
+ "create-plugin": "conformal-scripts create-plugin",
13
14
  "format": "conformal-scripts format",
14
15
  "web-dev": "conformal-scripts web-script -s dev",
15
16
  "web-build": "conformal-scripts web-script -s build",
@@ -40,8 +41,8 @@
40
41
  "react-dom": "^18.2.0",
41
42
  "typescript": "^5.4.5",
42
43
  "vite": "^5.2.9",
43
- "@conformal/scripts": "^0.3.0",
44
- "@conformal/plugin": "^0.3.0",
44
+ "@conformal/scripts": "^0.3.2",
45
+ "@conformal/plugin": "^0.3.2",
45
46
  "rollup-plugin-license": "^3.4.0"
46
47
  }
47
48
  }
package/src/stamp.ts DELETED
@@ -1,46 +0,0 @@
1
- import { promises as fs } from "node:fs";
2
- import path from "node:path";
3
- import { compile } from "handlebars";
4
-
5
- const dirExists = async (dir: string) => {
6
- try {
7
- await fs.readdir(dir);
8
- return true;
9
- } catch {
10
- return false;
11
- }
12
- };
13
-
14
- export const stampTemplate = async (
15
- dest: string,
16
- templateDir: string,
17
- env: Record<string, string>,
18
- ) => {
19
- if (await dirExists(dest)) {
20
- throw new Error(`Directory already exists: ${dest}`);
21
- }
22
-
23
- const files = await fs.readdir(templateDir, {
24
- recursive: true,
25
- withFileTypes: true,
26
- });
27
- for (const file of files) {
28
- const srcPath = path.join(file.path, file.name);
29
- const destPath = path.join(
30
- dest,
31
- compile(path.relative(templateDir, srcPath))(env),
32
- );
33
-
34
- if (file.isDirectory()) {
35
- continue;
36
- }
37
-
38
- if (await Bun.file(destPath).exists()) {
39
- throw new Error(`File already exists: ${destPath}`);
40
- }
41
-
42
- await fs.mkdir(path.dirname(destPath), { recursive: true });
43
- const srcContent = await Bun.file(srcPath).text();
44
- await Bun.write(destPath, compile(srcContent)(env));
45
- }
46
- };
package/src/uuid.ts DELETED
@@ -1,4 +0,0 @@
1
- const uuidHex = () =>
2
- crypto.randomUUID().replace(/-/g, "").replace(/../g, "0x$&, ").slice(0, -1);
3
-
4
- export default uuidHex;
@@ -1,8 +0,0 @@
1
- [package]
2
- name = "{{plug_slug}}_component"
3
- edition = "2021"
4
- rust-version = "1.79.0"
5
- publish = false
6
-
7
- [dependencies]
8
- conformal_component = {{{component_crate_version}}}
@@ -1,82 +0,0 @@
1
- #![warn(
2
- nonstandard_style,
3
- rust_2018_idioms,
4
- future_incompatible,
5
- clippy::pedantic,
6
- clippy::todo
7
- )]
8
- #![allow(
9
- clippy::type_complexity,
10
- clippy::cast_sign_loss,
11
- clippy::cast_possible_wrap,
12
- clippy::default_trait_access
13
- )]
14
-
15
- use conformal_component::audio::{channels, channels_mut, Buffer, BufferMut};
16
- use conformal_component::effect::Effect as EffectTrait;
17
- use conformal_component::parameters::{self, BufferStates, Flags, InfoRef, TypeSpecificInfoRef};
18
- use conformal_component::pzip;
19
- use conformal_component::{Component as ComponentTrait, ProcessingEnvironment, Processor};
20
-
21
- const PARAMETERS: [InfoRef<'static, &'static str>; 2] = [
22
- InfoRef {
23
- title: "Bypass",
24
- short_title: "Bypass",
25
- unique_id: "bypass",
26
- flags: Flags { automatable: true },
27
- type_specific: TypeSpecificInfoRef::Switch { default: false },
28
- },
29
- InfoRef {
30
- title: "Gain",
31
- short_title: "Gain",
32
- unique_id: "gain",
33
- flags: Flags { automatable: true },
34
- type_specific: TypeSpecificInfoRef::Numeric {
35
- default: 100.,
36
- valid_range: 0f32..=100.,
37
- units: Some("%"),
38
- },
39
- },
40
- ];
41
-
42
- #[derive(Clone, Debug, Default)]
43
- pub struct Component {}
44
-
45
- #[derive(Clone, Debug, Default)]
46
- pub struct Effect {}
47
-
48
- impl Processor for Effect {
49
- fn set_processing(&mut self, _processing: bool) {}
50
- }
51
-
52
- impl EffectTrait for Effect {
53
- fn handle_parameters<P: parameters::States>(&mut self, _: P) {}
54
- fn process<P: BufferStates, I: Buffer, O: BufferMut>(
55
- &mut self,
56
- parameters: P,
57
- input: &I,
58
- output: &mut O,
59
- ) {
60
- for (input_channel, output_channel) in channels(input).zip(channels_mut(output)) {
61
- for ((input_sample, output_sample), (gain, bypass)) in input_channel
62
- .iter()
63
- .zip(output_channel.iter_mut())
64
- .zip(pzip!(parameters[numeric "gain", switch "bypass"]))
65
- {
66
- *output_sample = *input_sample * (if bypass { 1.0 } else { gain / 100.0 });
67
- }
68
- }
69
- }
70
- }
71
-
72
- impl ComponentTrait for Component {
73
- type Processor = Effect;
74
-
75
- fn parameter_infos(&self) -> Vec<parameters::Info> {
76
- parameters::to_infos(&PARAMETERS)
77
- }
78
-
79
- fn create_processor(&self, _env: &ProcessingEnvironment) -> Self::Processor {
80
- Default::default()
81
- }
82
- }
@@ -1,13 +0,0 @@
1
- [package]
2
- name = "{{plug_slug}}_vst"
3
- edition = "2021"
4
- rust-version = "1.79.0"
5
- publish = false
6
-
7
- [lib]
8
- crate-type = ["cdylib"]
9
-
10
- [dependencies]
11
- conformal_vst_wrapper = {{{vst_crate_version}}}
12
- vst3 = "0.1.2"
13
- {{plug_slug}}_component = { path = "../component" }
@@ -1,13 +0,0 @@
1
- {{task_marker}}: Add end-user license information here! This file will be shown
2
- in the installer. This program was created using a variety of open source
3
- software, whose licenses are listed below. All distributions of this software
4
- must contain these license notices.
5
-
6
- \{{#each licenses}}
7
- \{{#each used_by}} -----
8
- \{{crate.name}}
9
- \{{crate.version}} (\{{{../name}}})
10
-
11
- \{{{../text}}}
12
- \{{/each}}
13
- \{{/each}}
@@ -1,10 +0,0 @@
1
- accepted = [
2
- "MIT",
3
- "ISC",
4
- "MPL-2.0",
5
- "Apache-2.0 WITH LLVM-exception",
6
- "Apache-2.0",
7
- "Unicode-DFS-2016",
8
- ]
9
-
10
- ignore-dev-dependencies = true
@@ -1,49 +0,0 @@
1
- #![warn(
2
- nonstandard_style,
3
- rust_2018_idioms,
4
- future_incompatible,
5
- clippy::pedantic,
6
- clippy::todo
7
- )]
8
- #![allow(
9
- clippy::type_complexity,
10
- clippy::cast_sign_loss,
11
- clippy::cast_possible_wrap,
12
- clippy::default_trait_access
13
- )]
14
-
15
- use {{plug_slug}}_component::Component;
16
-
17
- use conformal_vst_wrapper::{ClassID, ClassInfo, EffectClass, HostInfo, Info};
18
-
19
- const CID: ClassID = [
20
- {{class_id}}
21
- ];
22
- const EDIT_CONTROLLER_CID: ClassID = [
23
- {{edit_class_id}}
24
- ];
25
-
26
- conformal_vst_wrapper::wrap_factory!(
27
- &const {
28
- [&EffectClass {
29
- info: ClassInfo {
30
- name: "{{plug_name}}",
31
- cid: CID,
32
- edit_controller_cid: EDIT_CONTROLLER_CID,
33
- ui_initial_size: conformal_vst_wrapper::UiSize {
34
- width: 400,
35
- height: 400,
36
- },
37
- },
38
- factory: |_: &HostInfo| -> Component { Default::default() },
39
- category: "Fx",
40
- bypass_id: "bypass",
41
- }]
42
- },
43
- Info {
44
- vendor: "{{vendor_name}}",
45
- url: "{{task_marker}} add URL",
46
- email: "test@example.com",
47
- version: "1.0.0",
48
- }
49
- );
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ["eslint-config-custom"],
4
- parserOptions: {
5
- project: ["./tsconfig.json"],
6
- tsconfigRootDir: __dirname,
7
- },
8
- };
@@ -1,7 +0,0 @@
1
- {
2
- "rustPackage": "{{plug_slug}}_vst",
3
- "name": "{{plug_name}}",
4
- "id": "com.{{task_marker}}.{{plug_slug}}",
5
- "sig": "{{task_marker}}",
6
- "version": "0.0.0"
7
- }
@@ -1,10 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- </head>
6
- <body>
7
- <div id="root"></div>
8
- <script type="module" src="src/main.tsx"></script>
9
- </body>
10
- </html>
@@ -1,15 +0,0 @@
1
- {
2
- "name": "{{plug_slug}}",
3
- "private": true,
4
- "scripts": {
5
- "dev": "vite",
6
- "build": "tsc && vite build",
7
- "lint": "tsc && eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
8
- "preview": "vite preview",
9
- "check-format": "prettier --ignore-path .gitignore -c .",
10
- "format": "prettier --ignore-path .gitignore --write .",
11
- "package": "conformal-scripts package",
12
- "validate": "conformal-scripts validate"
13
- },
14
- "type": "module"
15
- }
@@ -1,11 +0,0 @@
1
- import { DevModeTools } from "@conformal/plugin";
2
- import Layout from "./Layout.tsx";
3
-
4
- const App = () => (
5
- <div>
6
- <Layout />
7
- <DevModeTools />
8
- </div>
9
- );
10
-
11
- export default App;
@@ -1,29 +0,0 @@
1
- import { useNumericParam } from "@conformal/plugin";
2
-
3
- const Layout = () => {
4
- const { value: gain, set: setGain } = useNumericParam("gain");
5
-
6
- return (
7
- <div>
8
- <p>Current gain: {gain}%</p>
9
- <p>
10
- <span
11
- onClick={() => {
12
- setGain(Math.max(0, gain - 10));
13
- }}
14
- >
15
- -
16
- </span>
17
- <span
18
- onClick={() => {
19
- setGain(Math.min(100, gain + 10));
20
- }}
21
- >
22
- +
23
- </span>
24
- </p>
25
- </div>
26
- );
27
- };
28
-
29
- export default Layout;
@@ -1,4 +0,0 @@
1
- body {
2
- user-select: none;
3
- -webkit-user-select: none;
4
- }
@@ -1,29 +0,0 @@
1
- // Temporary workaround for https://github.com/oven-sh/bun/issues/4890
2
- /// <reference lib="dom" />
3
- /// <reference lib="dom.iterable" />
4
-
5
- import App from "./App.tsx";
6
- import * as Jotai from "jotai";
7
- import { StrictMode, Suspense } from "react";
8
- import * as Client from "react-dom/client";
9
- import { Provider } from "@conformal/plugin";
10
- import "./index.css";
11
- import infos from "./mock_infos.ts";
12
-
13
- const domElement = document.querySelector("#root");
14
-
15
- if (!(domElement == null)) {
16
- Client.createRoot(domElement).render(
17
- <StrictMode>
18
- <Jotai.Provider>
19
- <Provider mockInfos={infos}>
20
- <Suspense fallback={<></>}>
21
- <App />
22
- </Suspense>
23
- </Provider>
24
- </Jotai.Provider>
25
- </StrictMode>,
26
- );
27
- }
28
-
29
- export {};
@@ -1,24 +0,0 @@
1
- import { Info } from "@conformal/plugin";
2
-
3
- const infos = new Map<string, Info>(
4
- Object.entries({
5
- bypass: {
6
- title: "Bypass",
7
- type_specific: {
8
- t: "switch",
9
- default: false,
10
- },
11
- },
12
- gain: {
13
- title: "Gain",
14
- type_specific: {
15
- t: "numeric",
16
- default: 100,
17
- valid_range: [0, 100],
18
- units: "%",
19
- },
20
- },
21
- }),
22
- );
23
-
24
- export default infos;
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "tsconfig/tsconfig.json",
3
- "include": ["src", "vite.config.ts"],
4
- "compilerOptions": {
5
- "types": ["vite/client"]
6
- }
7
- }
@@ -1,40 +0,0 @@
1
- import react from "@vitejs/plugin-react-swc";
2
- import license from "rollup-plugin-license";
3
- import { join } from "path";
4
-
5
- const unwrap = (x: string | null, name: string, field: string): string => {
6
- if (x === null) {
7
- throw new Error(`Malformed dependency ${name} (${field})`);
8
- }
9
- return x;
10
- };
11
-
12
- /** @type {import('vite').UserConfig} */
13
- export default {
14
- plugins: [
15
- react(),
16
- license({
17
- thirdParty: {
18
- output: {
19
- file: join(__dirname, "installer_resources", "license.txt"),
20
- template: (dependencies) =>
21
- dependencies
22
- .map(
23
- (dependency) =>
24
- `-----
25
- ${unwrap(dependency.name, "unknown", "name")} ${unwrap(dependency.version, dependency.name!, "version")} (${unwrap(dependency.license, dependency.name!, "license")})
26
-
27
- ${unwrap(dependency.licenseText, dependency.name!, "licenseText")}
28
- `,
29
- )
30
- .join("\n"),
31
- },
32
- allow: {
33
- failOnUnlicensed: true,
34
- failOnViolation: true,
35
- test: "(MIT OR ISC)",
36
- },
37
- },
38
- }),
39
- ],
40
- };