@idomatic/create 1.0.3 → 1.0.5

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.
@@ -0,0 +1,18 @@
1
+ const defaultConfigs = {
2
+ js: {
3
+ attributeName: "id",
4
+ prefix: "auto-id-",
5
+ excludeTags: ["html", "head", "script"],
6
+ includeExtensions: ["js", "jsx", "ts", "tsx"],
7
+ excludeFiles: [],
8
+ },
9
+ html: {
10
+ attributeName: "id",
11
+ prefix: "auto-id-",
12
+ excludeTags: ["html", "head", "script"],
13
+ includeExtensions: ["html", "vue"],
14
+ excludeFiles: [],
15
+ },
16
+ };
17
+
18
+ export default defaultConfigs;
package/index.js CHANGED
@@ -3,19 +3,13 @@
3
3
  import prompts from "prompts";
4
4
  import { execSync } from "child_process";
5
5
  import { writeFileSync } from "fs";
6
+ import initConfig from "./lib/initConfig.js";
6
7
 
7
8
  console.log("✨ Welcome to idomatic setup!");
8
9
 
10
+ await initConfig();
11
+
9
12
  const res = await prompts([
10
- {
11
- type: "select",
12
- name: "framework",
13
- message: "Which framework are you using?",
14
- choices: [
15
- { title: "React (JS/TSX)", value: "js" },
16
- { title: "HTML / Vue / Angular", value: "html" },
17
- ],
18
- },
19
13
  {
20
14
  type: "toggle",
21
15
  name: "installParsers",
@@ -0,0 +1,28 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import inquirer from "inquirer";
4
+ import defaultConfigs from "./defaultConfigs.js";
5
+
6
+ async function initConfig() {
7
+ const { framework } = await inquirer.prompt([
8
+ {
9
+ type: "select",
10
+ name: "framework",
11
+ message: "Which framework are you using?",
12
+ choices: [
13
+ { title: "React (JS/TSX)", value: "js" },
14
+ { title: "HTML / Vue / Angular", value: "html" },
15
+ ],
16
+ },
17
+ ]);
18
+
19
+ const config = defaultConfigs[framework];
20
+
21
+ // Write the config to .idomaticsrc.json in the current working directory
22
+ const configFilePath = path.join(process.cwd(), ".idomaticsrc.json");
23
+ fs.writeFileSync(configFilePath, JSON.stringify(config, null, 2));
24
+
25
+ console.log(`Configuration file created at ${configFilePath}`);
26
+ }
27
+
28
+ export default initConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idomatic/create",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "@idomatic/create": "./index.js"