create-isotope-app 1.0.1 → 1.0.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/index.js +33 -9
- package/package.json +1 -1
- package/src/templates/configs/extension.js +66 -0
package/index.js
CHANGED
|
@@ -30,6 +30,10 @@ import {
|
|
|
30
30
|
} from "./src/templates/configs/configs.js";
|
|
31
31
|
import { splitterTs } from "./src/templates/configs/splitter.js";
|
|
32
32
|
import { readmeMd } from "./src/templates/configs/readme.js";
|
|
33
|
+
import {
|
|
34
|
+
extensionPackageJson,
|
|
35
|
+
extensionGrammarJson,
|
|
36
|
+
} from "./src/templates/configs/extension.js";
|
|
33
37
|
|
|
34
38
|
const rl = readline.createInterface({
|
|
35
39
|
input: process.stdin,
|
|
@@ -40,17 +44,21 @@ const question = (query) =>
|
|
|
40
44
|
new Promise((resolve) => rl.question(query, resolve));
|
|
41
45
|
|
|
42
46
|
async function init() {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
let projectName = process.argv[2];
|
|
48
|
+
let projectIndex = 2;
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (projectName === "create") {
|
|
51
|
+
projectName = process.argv[3];
|
|
52
|
+
projectIndex = 3;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!projectName) {
|
|
56
|
+
projectName = "my-isotope-app";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const root = path.resolve(projectName);
|
|
52
60
|
|
|
53
|
-
const args = process.argv.slice(
|
|
61
|
+
const args = process.argv.slice(projectIndex + 1);
|
|
54
62
|
let styleChoice = args
|
|
55
63
|
.find((arg) => arg.startsWith("--style="))
|
|
56
64
|
?.split("=")[1];
|
|
@@ -82,6 +90,7 @@ async function init() {
|
|
|
82
90
|
"src/components",
|
|
83
91
|
"docs/framework",
|
|
84
92
|
".vscode",
|
|
93
|
+
".vscode/extensions/isotope-support-v0.1/syntaxes",
|
|
85
94
|
];
|
|
86
95
|
dirs.forEach((dir) => {
|
|
87
96
|
fs.ensureDirSync(path.join(root, dir));
|
|
@@ -157,6 +166,17 @@ async function init() {
|
|
|
157
166
|
2,
|
|
158
167
|
),
|
|
159
168
|
);
|
|
169
|
+
fs.writeFileSync(
|
|
170
|
+
path.join(root, ".vscode/extensions/isotope-support-v0.1/package.json"),
|
|
171
|
+
extensionPackageJson(),
|
|
172
|
+
);
|
|
173
|
+
fs.writeFileSync(
|
|
174
|
+
path.join(
|
|
175
|
+
root,
|
|
176
|
+
".vscode/extensions/isotope-support-v0.1/syntaxes/isx.tmLanguage.json",
|
|
177
|
+
),
|
|
178
|
+
extensionGrammarJson(),
|
|
179
|
+
);
|
|
160
180
|
|
|
161
181
|
// コンポーネント・ページ
|
|
162
182
|
fs.writeFileSync(path.join(root, "src/components/Link.tsx"), linkTsx());
|
|
@@ -177,6 +197,10 @@ async function init() {
|
|
|
177
197
|
const logoSrc = path.join(__dirname, "templates", "logo.png");
|
|
178
198
|
if (fs.existsSync(logoSrc)) {
|
|
179
199
|
fs.copySync(logoSrc, path.join(root, "public/logo.png"));
|
|
200
|
+
fs.copySync(
|
|
201
|
+
logoSrc,
|
|
202
|
+
path.join(root, ".vscode/extensions/isotope-support-v0.1/icon.png"),
|
|
203
|
+
);
|
|
180
204
|
}
|
|
181
205
|
|
|
182
206
|
// 4. package.json & インストール
|
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const extensionPackageJson = () => {
|
|
2
|
+
return JSON.stringify(
|
|
3
|
+
{
|
|
4
|
+
name: "isotope-support",
|
|
5
|
+
displayName: "Isotope Support",
|
|
6
|
+
description:
|
|
7
|
+
"Premium syntax highlighting for Isotope (.isx) hybrid components.",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
publisher: "ATOMS GAMING",
|
|
10
|
+
icon: "icon.png",
|
|
11
|
+
engines: {
|
|
12
|
+
vscode: "^1.60.0",
|
|
13
|
+
},
|
|
14
|
+
categories: ["Programming Languages"],
|
|
15
|
+
keywords: ["isotope", "php", "react", "tsx", "hybrid"],
|
|
16
|
+
repository: {
|
|
17
|
+
type: "git",
|
|
18
|
+
url: "https://github.com/atoms-gaming/isotope",
|
|
19
|
+
},
|
|
20
|
+
contributes: {
|
|
21
|
+
grammars: [
|
|
22
|
+
{
|
|
23
|
+
scopeName: "inline.php.proton",
|
|
24
|
+
path: "./syntaxes/isx.tmLanguage.json",
|
|
25
|
+
injectTo: ["source.ts.jsx", "source.tsx"],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
null,
|
|
31
|
+
2,
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const extensionGrammarJson = () => {
|
|
36
|
+
return JSON.stringify(
|
|
37
|
+
{
|
|
38
|
+
$schema:
|
|
39
|
+
"https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
40
|
+
scopeName: "inline.php.proton",
|
|
41
|
+
injectionSelector:
|
|
42
|
+
"L:source.ts.jsx -comment -string, L:source.tsx -comment -string",
|
|
43
|
+
patterns: [
|
|
44
|
+
{
|
|
45
|
+
name: "meta.embedded.block.php",
|
|
46
|
+
begin: "(proton)\\s*(`)",
|
|
47
|
+
beginCaptures: {
|
|
48
|
+
1: { name: "entity.name.function.tagged-template" },
|
|
49
|
+
2: { name: "punctuation.definition.string.template.begin" },
|
|
50
|
+
},
|
|
51
|
+
end: "(`)",
|
|
52
|
+
endCaptures: {
|
|
53
|
+
1: { name: "punctuation.definition.string.template.end" },
|
|
54
|
+
},
|
|
55
|
+
patterns: [
|
|
56
|
+
{
|
|
57
|
+
include: "source.php",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
null,
|
|
64
|
+
2,
|
|
65
|
+
);
|
|
66
|
+
};
|