@knotx/cli 0.4.4 → 0.4.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.
package/dist/index.cjs
CHANGED
|
@@ -766,9 +766,12 @@ function createConfigFiles(targetDir) {
|
|
|
766
766
|
const tsconfigTemplate = yield fs__default.readFile(safeResolvePath(templatesDir, "tsconfig.json.template"), "utf-8");
|
|
767
767
|
const buildConfigTemplate = yield fs__default.readFile(safeResolvePath(templatesDir, "build.config.ts.template"), "utf-8");
|
|
768
768
|
const eslintConfigTemplate = yield fs__default.readFile(safeResolvePath(templatesDir, "eslint.config.mjs.template"), "utf-8");
|
|
769
|
+
const vscodeSettingsTemplate = yield fs__default.readFile(safeResolvePath(templatesDir, ".vscode", "settings.json.template"), "utf-8");
|
|
770
|
+
yield safeEnsureDir(safeResolvePath(targetDir, ".vscode"));
|
|
769
771
|
yield fs__default.writeFile(safeResolvePath(targetDir, "tsconfig.json"), tsconfigTemplate);
|
|
770
772
|
yield fs__default.writeFile(safeResolvePath(targetDir, "build.config.ts"), buildConfigTemplate);
|
|
771
773
|
yield fs__default.writeFile(safeResolvePath(targetDir, "eslint.config.mjs"), eslintConfigTemplate);
|
|
774
|
+
yield fs__default.writeFile(safeResolvePath(targetDir, ".vscode", "settings.json"), vscodeSettingsTemplate);
|
|
772
775
|
} catch (error) {
|
|
773
776
|
console.error("\u65E0\u6CD5\u8BFB\u53D6\u6A21\u677F\u6587\u4EF6:", error);
|
|
774
777
|
const tsconfig = {
|
|
@@ -802,8 +805,7 @@ function createSourceFiles(targetDir, pluginName, environment) {
|
|
|
802
805
|
const camelCaseName = toCamelCase(pluginNameWithoutScope);
|
|
803
806
|
const pascalCaseName = toPascalCase(pluginNameWithoutScope);
|
|
804
807
|
const indexTemplate = yield fs__default.readFile(safeResolvePath(templatesDir, "index.ts.template"), "utf-8");
|
|
805
|
-
|
|
806
|
-
yield fs__default.writeFile(safeResolvePath(targetDir, "src", "index.ts"), indexContent);
|
|
808
|
+
yield fs__default.writeFile(safeResolvePath(targetDir, "src", "index.ts"), indexTemplate);
|
|
807
809
|
let templatePath;
|
|
808
810
|
if (environment === "jsx") {
|
|
809
811
|
templatePath = safeResolvePath(templatesDir, "plugin.jsx.template");
|
|
@@ -812,7 +814,7 @@ function createSourceFiles(targetDir, pluginName, environment) {
|
|
|
812
814
|
}
|
|
813
815
|
const pluginTemplate = yield fs__default.readFile(templatePath, "utf-8");
|
|
814
816
|
const pluginContent = pluginTemplate.replace(/\{\{camelCaseName\}\}/g, camelCaseName).replace(/\{\{capitalizedPluginName\}\}/g, pascalCaseName);
|
|
815
|
-
const fileName =
|
|
817
|
+
const fileName = "plugin.tsx";
|
|
816
818
|
yield fs__default.writeFile(safeResolvePath(targetDir, "src", fileName), pluginContent);
|
|
817
819
|
yield createPlayground(targetDir, pluginNameWithoutScope, camelCaseName, pascalCaseName, environment);
|
|
818
820
|
} catch (error) {
|
|
@@ -835,7 +837,7 @@ function createPlayground(targetDir, pluginName, camelCaseName, pascalCaseName,
|
|
|
835
837
|
);
|
|
836
838
|
const fileExtension = isReact ? "tsx" : "ts";
|
|
837
839
|
const viteConfigContent = viteConfigTemplate.replace(new RegExp("\\{\\{#if isReact\\}\\}(.*?)\\{\\{\\/if\\}\\}", "gs"), isReact ? "$1" : "");
|
|
838
|
-
const htmlContent = htmlTemplate.replace(/\{\{
|
|
840
|
+
const htmlContent = htmlTemplate.replace(/\{\{fileExtension\}\}/g, fileExtension);
|
|
839
841
|
const mainContent = mainTemplate.replace(/\{\{pluginName\}\}/g, pluginName).replace(/\{\{camelCaseName\}\}/g, camelCaseName).replace(/\{\{capitalizedPluginName\}\}/g, pascalCaseName);
|
|
840
842
|
yield fs__default.writeFile(safeResolvePath(playgroundDir, "vite.config.ts"), viteConfigContent);
|
|
841
843
|
yield fs__default.writeFile(safeResolvePath(playgroundDir, "index.html"), htmlContent);
|
package/dist/index.js
CHANGED
|
@@ -741,9 +741,12 @@ function createConfigFiles(targetDir) {
|
|
|
741
741
|
const tsconfigTemplate = yield fs.readFile(safeResolvePath(templatesDir, "tsconfig.json.template"), "utf-8");
|
|
742
742
|
const buildConfigTemplate = yield fs.readFile(safeResolvePath(templatesDir, "build.config.ts.template"), "utf-8");
|
|
743
743
|
const eslintConfigTemplate = yield fs.readFile(safeResolvePath(templatesDir, "eslint.config.mjs.template"), "utf-8");
|
|
744
|
+
const vscodeSettingsTemplate = yield fs.readFile(safeResolvePath(templatesDir, ".vscode", "settings.json.template"), "utf-8");
|
|
745
|
+
yield safeEnsureDir(safeResolvePath(targetDir, ".vscode"));
|
|
744
746
|
yield fs.writeFile(safeResolvePath(targetDir, "tsconfig.json"), tsconfigTemplate);
|
|
745
747
|
yield fs.writeFile(safeResolvePath(targetDir, "build.config.ts"), buildConfigTemplate);
|
|
746
748
|
yield fs.writeFile(safeResolvePath(targetDir, "eslint.config.mjs"), eslintConfigTemplate);
|
|
749
|
+
yield fs.writeFile(safeResolvePath(targetDir, ".vscode", "settings.json"), vscodeSettingsTemplate);
|
|
747
750
|
} catch (error) {
|
|
748
751
|
console.error("\u65E0\u6CD5\u8BFB\u53D6\u6A21\u677F\u6587\u4EF6:", error);
|
|
749
752
|
const tsconfig = {
|
|
@@ -777,8 +780,7 @@ function createSourceFiles(targetDir, pluginName, environment) {
|
|
|
777
780
|
const camelCaseName = toCamelCase(pluginNameWithoutScope);
|
|
778
781
|
const pascalCaseName = toPascalCase(pluginNameWithoutScope);
|
|
779
782
|
const indexTemplate = yield fs.readFile(safeResolvePath(templatesDir, "index.ts.template"), "utf-8");
|
|
780
|
-
|
|
781
|
-
yield fs.writeFile(safeResolvePath(targetDir, "src", "index.ts"), indexContent);
|
|
783
|
+
yield fs.writeFile(safeResolvePath(targetDir, "src", "index.ts"), indexTemplate);
|
|
782
784
|
let templatePath;
|
|
783
785
|
if (environment === "jsx") {
|
|
784
786
|
templatePath = safeResolvePath(templatesDir, "plugin.jsx.template");
|
|
@@ -787,7 +789,7 @@ function createSourceFiles(targetDir, pluginName, environment) {
|
|
|
787
789
|
}
|
|
788
790
|
const pluginTemplate = yield fs.readFile(templatePath, "utf-8");
|
|
789
791
|
const pluginContent = pluginTemplate.replace(/\{\{camelCaseName\}\}/g, camelCaseName).replace(/\{\{capitalizedPluginName\}\}/g, pascalCaseName);
|
|
790
|
-
const fileName =
|
|
792
|
+
const fileName = "plugin.tsx";
|
|
791
793
|
yield fs.writeFile(safeResolvePath(targetDir, "src", fileName), pluginContent);
|
|
792
794
|
yield createPlayground(targetDir, pluginNameWithoutScope, camelCaseName, pascalCaseName, environment);
|
|
793
795
|
} catch (error) {
|
|
@@ -810,7 +812,7 @@ function createPlayground(targetDir, pluginName, camelCaseName, pascalCaseName,
|
|
|
810
812
|
);
|
|
811
813
|
const fileExtension = isReact ? "tsx" : "ts";
|
|
812
814
|
const viteConfigContent = viteConfigTemplate.replace(new RegExp("\\{\\{#if isReact\\}\\}(.*?)\\{\\{\\/if\\}\\}", "gs"), isReact ? "$1" : "");
|
|
813
|
-
const htmlContent = htmlTemplate.replace(/\{\{
|
|
815
|
+
const htmlContent = htmlTemplate.replace(/\{\{fileExtension\}\}/g, fileExtension);
|
|
814
816
|
const mainContent = mainTemplate.replace(/\{\{pluginName\}\}/g, pluginName).replace(/\{\{camelCaseName\}\}/g, camelCaseName).replace(/\{\{capitalizedPluginName\}\}/g, pascalCaseName);
|
|
815
817
|
yield fs.writeFile(safeResolvePath(playgroundDir, "vite.config.ts"), viteConfigContent);
|
|
816
818
|
yield fs.writeFile(safeResolvePath(playgroundDir, "index.html"), htmlContent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knotx/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "CLI tool for Knotx",
|
|
5
5
|
"author": "boenfu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/fs-extra": "^11.0.4",
|
|
44
44
|
"@types/inquirer": "^9.0.7",
|
|
45
|
-
"@knotx/build-config": "0.4.
|
|
46
|
-
"@knotx/eslint-config": "0.4.
|
|
47
|
-
"@knotx/typescript-config": "0.4.
|
|
45
|
+
"@knotx/build-config": "0.4.5",
|
|
46
|
+
"@knotx/eslint-config": "0.4.5",
|
|
47
|
+
"@knotx/typescript-config": "0.4.5"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "unbuild",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Enable the ESlint flat config support
|
|
3
|
+
"eslint.experimental.useFlatConfig": true,
|
|
4
|
+
// Disable the default formatter, use eslint instead
|
|
5
|
+
"prettier.enable": false,
|
|
6
|
+
"editor.formatOnSave": false,
|
|
7
|
+
// Auto fix
|
|
8
|
+
"editor.codeActionsOnSave": {
|
|
9
|
+
"source.fixAll": "explicit",
|
|
10
|
+
"source.organizeImports": "never"
|
|
11
|
+
},
|
|
12
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
13
|
+
"eslint.rules.customizations": [
|
|
14
|
+
{
|
|
15
|
+
"rule": "style/*",
|
|
16
|
+
"severity": "off"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"rule": "*-indent",
|
|
20
|
+
"severity": "off"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"rule": "*-spacing",
|
|
24
|
+
"severity": "off"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"rule": "*-spaces",
|
|
28
|
+
"severity": "off"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"rule": "*-order",
|
|
32
|
+
"severity": "off"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"rule": "*-dangle",
|
|
36
|
+
"severity": "off"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"rule": "*-newline",
|
|
40
|
+
"severity": "off"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"rule": "*quotes",
|
|
44
|
+
"severity": "off"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"rule": "*semi",
|
|
48
|
+
"severity": "off"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
// Enable eslint for all supported languages
|
|
52
|
+
"eslint.validate": [
|
|
53
|
+
"javascript",
|
|
54
|
+
"javascriptreact",
|
|
55
|
+
"typescript",
|
|
56
|
+
"typescriptreact",
|
|
57
|
+
"vue",
|
|
58
|
+
"html",
|
|
59
|
+
"markdown",
|
|
60
|
+
"json",
|
|
61
|
+
"jsonc",
|
|
62
|
+
"yaml"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './plugin'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html lang="
|
|
2
|
+
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
6
|
+
<title>Plugin Playground</title>
|
|
7
7
|
<style>
|
|
8
8
|
body {
|
|
9
9
|
margin: 0;
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
</head>
|
|
28
28
|
<body>
|
|
29
29
|
<div class="container">
|
|
30
|
-
<h1>
|
|
31
|
-
<p
|
|
30
|
+
<h1>Plugin Playground</h1>
|
|
31
|
+
<p>Demo and testing environment for the plugin.</p>
|
|
32
32
|
|
|
33
33
|
<div id="app">
|
|
34
|
-
<!--
|
|
34
|
+
<!-- Plugin content will be rendered here -->
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"extends": "../tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"jsx": "react-jsx",
|
|
5
|
+
"rootDir": "..",
|
|
5
6
|
"types": ["vite/client"],
|
|
7
|
+
"noEmit": true,
|
|
6
8
|
"esModuleInterop": true
|
|
7
9
|
},
|
|
8
|
-
"include": ["."]
|
|
10
|
+
"include": [".", "../src"],
|
|
11
|
+
"exclude": ["vite.config.ts"]
|
|
9
12
|
}
|