@idomatic/create 1.2.0 → 1.3.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/helpers/index.js +47 -8
- package/index.js +4 -4
- package/lib/initConfig.js +4 -0
- package/package.json +11 -1
package/helpers/index.js
CHANGED
|
@@ -1,20 +1,59 @@
|
|
|
1
|
+
const base = {
|
|
2
|
+
attributeName: "id",
|
|
3
|
+
idStrategy: "semantic",
|
|
4
|
+
prefix: "",
|
|
5
|
+
excludeFiles: ["node_modules", "public"],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// Solid control-flow components render no DOM node of their own.
|
|
9
|
+
const SOLID_CONTROL_FLOW = [
|
|
10
|
+
"For",
|
|
11
|
+
"Index",
|
|
12
|
+
"Show",
|
|
13
|
+
"Switch",
|
|
14
|
+
"Match",
|
|
15
|
+
"Suspense",
|
|
16
|
+
"ErrorBoundary",
|
|
17
|
+
"Portal",
|
|
18
|
+
"Dynamic",
|
|
19
|
+
];
|
|
20
|
+
|
|
1
21
|
const defaultConfigs = {
|
|
2
22
|
js: {
|
|
3
|
-
|
|
4
|
-
idStrategy: "semantic",
|
|
5
|
-
prefix: "",
|
|
23
|
+
...base,
|
|
6
24
|
excludeTags: ["html", "head", "script"],
|
|
7
25
|
includeExtensions: ["js", "jsx", "ts", "tsx"],
|
|
8
|
-
|
|
26
|
+
},
|
|
27
|
+
solid: {
|
|
28
|
+
...base,
|
|
29
|
+
excludeTags: ["html", "head", "script", ...SOLID_CONTROL_FLOW],
|
|
30
|
+
includeExtensions: ["jsx", "tsx"],
|
|
9
31
|
},
|
|
10
32
|
html: {
|
|
11
|
-
|
|
12
|
-
idStrategy: "semantic",
|
|
13
|
-
prefix: "",
|
|
33
|
+
...base,
|
|
14
34
|
excludeTags: ["html", "head", "script"],
|
|
15
35
|
includeExtensions: ["html", "vue"],
|
|
16
|
-
|
|
36
|
+
},
|
|
37
|
+
svelte: {
|
|
38
|
+
...base,
|
|
39
|
+
excludeTags: ["html", "head", "script"],
|
|
40
|
+
includeExtensions: ["svelte"],
|
|
41
|
+
},
|
|
42
|
+
astro: {
|
|
43
|
+
...base,
|
|
44
|
+
excludeTags: ["html", "head", "script"],
|
|
45
|
+
includeExtensions: ["astro"],
|
|
46
|
+
},
|
|
47
|
+
handlebars: {
|
|
48
|
+
...base,
|
|
49
|
+
excludeTags: ["html", "head", "script"],
|
|
50
|
+
includeExtensions: ["hbs", "handlebars"],
|
|
17
51
|
},
|
|
18
52
|
};
|
|
19
53
|
|
|
54
|
+
export const parserFor = (framework) =>
|
|
55
|
+
framework === "js" || framework === "solid"
|
|
56
|
+
? "@idomatic/parser-js"
|
|
57
|
+
: "@idomatic/parser-html";
|
|
58
|
+
|
|
20
59
|
export default defaultConfigs;
|
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
import prompts from "prompts";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
4
|
import { detectPackageManagerFallback } from "./utils/index.js";
|
|
5
5
|
import initConfig from "./lib/initConfig.js";
|
|
6
|
+
import { parserFor } from "./helpers/index.js";
|
|
6
7
|
|
|
7
8
|
console.log("✨ Welcome to idomatic setup!");
|
|
8
9
|
|
|
@@ -25,8 +26,7 @@ const pkg = detectPackageManagerFallback();
|
|
|
25
26
|
|
|
26
27
|
// Install parser if opted-in
|
|
27
28
|
if (res.installParsers) {
|
|
28
|
-
const parser =
|
|
29
|
-
framework === "js" ? "@idomatic/parser-js" : "@idomatic/parser-html";
|
|
29
|
+
const parser = parserFor(framework);
|
|
30
30
|
const installParserCmd = {
|
|
31
31
|
npm: `npm install ${parser} --save-dev`,
|
|
32
32
|
yarn: `yarn add ${parser} --dev`,
|
|
@@ -47,4 +47,4 @@ const installCoreCmd = {
|
|
|
47
47
|
console.log(`📦 Installing @idomatic/core with ${pkg}...`);
|
|
48
48
|
execSync(installCoreCmd, { stdio: "inherit" });
|
|
49
49
|
|
|
50
|
-
console.log("🎉 You're ready to run: npx idomatic --
|
|
50
|
+
console.log("🎉 You're ready to run: npx idomatic scan --dry");
|
package/lib/initConfig.js
CHANGED
|
@@ -11,7 +11,11 @@ async function initConfig() {
|
|
|
11
11
|
message: "Which framework are you using?",
|
|
12
12
|
choices: [
|
|
13
13
|
{ title: "React (JS/TSX)", value: "js" },
|
|
14
|
+
{ title: "SolidJS", value: "solid" },
|
|
14
15
|
{ title: "HTML / Vue / Angular", value: "html" },
|
|
16
|
+
{ title: "Svelte", value: "svelte" },
|
|
17
|
+
{ title: "Astro", value: "astro" },
|
|
18
|
+
{ title: "Handlebars / Ember", value: "handlebars" },
|
|
15
19
|
],
|
|
16
20
|
},
|
|
17
21
|
]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idomatic/create",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Interactive setup CLI for idomatic — run `npm init @idomatic` to scaffold config in an existing project.",
|
|
4
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/AmarSmajlovic/idomatic.git",
|
|
9
|
+
"directory": "packages/create"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://www.idomatic.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/AmarSmajlovic/idomatic/issues"
|
|
14
|
+
},
|
|
5
15
|
"bin": {
|
|
6
16
|
"@idomatic/create": "./index.js"
|
|
7
17
|
},
|