create-astro 0.10.0 → 0.12.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/dist/index.js +63 -120
- package/dist/templates.js +3 -4
- package/dist/types/templates.d.ts +2 -7
- package/package.json +1 -2
- package/dist/config.js +0 -23
- package/dist/frameworks.js +0 -134
- package/dist/types/config.d.ts +0 -4
- package/dist/types/frameworks.d.ts +0 -30
package/dist/index.js
CHANGED
|
@@ -1,32 +1,13 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
1
|
import fs from "fs";
|
|
18
2
|
import path from "path";
|
|
19
|
-
import { bold, cyan, gray, green, red, yellow } from "kleur/colors";
|
|
20
|
-
import fetch from "node-fetch";
|
|
3
|
+
import { bgCyan, black, bold, cyan, gray, green, red, yellow } from "kleur/colors";
|
|
21
4
|
import prompts from "prompts";
|
|
22
5
|
import degit from "degit";
|
|
23
6
|
import yargs from "yargs-parser";
|
|
24
7
|
import ora from "ora";
|
|
25
|
-
import { FRAMEWORKS, COUNTER_COMPONENTS } from "./frameworks.js";
|
|
26
8
|
import { TEMPLATES } from "./templates.js";
|
|
27
|
-
import { createConfig } from "./config.js";
|
|
28
9
|
import { logger, defaultLogLevel } from "./logger.js";
|
|
29
|
-
import { execa } from "execa";
|
|
10
|
+
import { execa, execaCommand } from "execa";
|
|
30
11
|
const cleanArgv = process.argv.filter((arg) => arg !== "--");
|
|
31
12
|
const args = yargs(cleanArgv);
|
|
32
13
|
prompts.override(args);
|
|
@@ -43,15 +24,12 @@ function isEmpty(dirPath) {
|
|
|
43
24
|
return !fs.existsSync(dirPath) || fs.readdirSync(dirPath).length === 0;
|
|
44
25
|
}
|
|
45
26
|
const { version } = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
46
|
-
const FILES_TO_REMOVE = [".stackblitzrc", "sandbox.config.json"];
|
|
47
|
-
const POSTPROCESS_FILES = ["package.json", "astro.config.mjs", "CHANGELOG.md"];
|
|
27
|
+
const FILES_TO_REMOVE = [".stackblitzrc", "sandbox.config.json", "CHANGELOG.md"];
|
|
48
28
|
async function main() {
|
|
49
29
|
const pkgManager = pkgManagerFromUserAgent(process.env.npm_config_user_agent);
|
|
50
30
|
logger.debug("Verbose logging turned on");
|
|
51
31
|
console.log(`
|
|
52
32
|
${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
53
|
-
console.log(`If you encounter a problem, visit ${cyan("https://github.com/withastro/astro/issues")} to search or file a new issue.
|
|
54
|
-
`);
|
|
55
33
|
let spinner = ora({ color: "green", text: "Prepare for liftoff." });
|
|
56
34
|
spinner.succeed();
|
|
57
35
|
let cwd = args["_"][2];
|
|
@@ -63,7 +41,7 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
|
63
41
|
acknowledgeProjectDir.succeed();
|
|
64
42
|
}
|
|
65
43
|
if (!cwd || !isEmpty(cwd)) {
|
|
66
|
-
const notEmptyMsg = (dirPath) => `"${bold(dirPath)}" is not empty
|
|
44
|
+
const notEmptyMsg = (dirPath) => `"${bold(dirPath)}" is not empty!`;
|
|
67
45
|
if (!isEmpty(cwd)) {
|
|
68
46
|
let rejectProjectDir = ora({ color: "red", text: notEmptyMsg(cwd) });
|
|
69
47
|
rejectProjectDir.fail();
|
|
@@ -97,7 +75,7 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
|
97
75
|
process.exit(1);
|
|
98
76
|
}
|
|
99
77
|
const hash = args.commit ? `#${args.commit}` : "";
|
|
100
|
-
const templateTarget =
|
|
78
|
+
const templateTarget = `withastro/astro/examples/${options.template}#latest`;
|
|
101
79
|
const emitter = degit(`${templateTarget}${hash}`, {
|
|
102
80
|
cache: false,
|
|
103
81
|
force: true,
|
|
@@ -108,19 +86,6 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
|
108
86
|
force: true,
|
|
109
87
|
verbose: defaultLogLevel === "debug" ? true : false
|
|
110
88
|
});
|
|
111
|
-
const selectedTemplate = TEMPLATES.find((template) => template.value === options.template);
|
|
112
|
-
let integrations = [];
|
|
113
|
-
if ((selectedTemplate == null ? void 0 : selectedTemplate.integrations) === true) {
|
|
114
|
-
const result = await prompts([
|
|
115
|
-
{
|
|
116
|
-
type: "multiselect",
|
|
117
|
-
name: "integrations",
|
|
118
|
-
message: "Which frameworks would you like to use?",
|
|
119
|
-
choices: FRAMEWORKS
|
|
120
|
-
}
|
|
121
|
-
]);
|
|
122
|
-
integrations = result.integrations;
|
|
123
|
-
}
|
|
124
89
|
spinner = ora({ color: "green", text: "Copying project files..." }).start();
|
|
125
90
|
if (!args.dryrun) {
|
|
126
91
|
try {
|
|
@@ -142,67 +107,12 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
|
142
107
|
spinner.fail();
|
|
143
108
|
process.exit(1);
|
|
144
109
|
}
|
|
145
|
-
await Promise.all(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return fs.promises.rm(fileLoc);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const fileLoc = path.resolve(path.join(cwd, file));
|
|
152
|
-
switch (file) {
|
|
153
|
-
case "CHANGELOG.md": {
|
|
154
|
-
if (fs.existsSync(fileLoc)) {
|
|
155
|
-
await fs.promises.unlink(fileLoc);
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
case "astro.config.mjs": {
|
|
160
|
-
if ((selectedTemplate == null ? void 0 : selectedTemplate.integrations) !== true) {
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
await fs.promises.writeFile(fileLoc, createConfig({ integrations }));
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
case "package.json": {
|
|
167
|
-
const packageJSON = JSON.parse(await fs.promises.readFile(fileLoc, "utf8"));
|
|
168
|
-
delete packageJSON.snowpack;
|
|
169
|
-
const integrationEntries = (await Promise.all(integrations.map((integration) => fetch(`https://registry.npmjs.org/${integration.packageName}/latest`).then((res) => res.json()).then((res) => {
|
|
170
|
-
let dependencies = [[res["name"], `^${res["version"]}`]];
|
|
171
|
-
if (res["peerDependencies"]) {
|
|
172
|
-
for (const peer in res["peerDependencies"]) {
|
|
173
|
-
dependencies.push([peer, res["peerDependencies"][peer]]);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return dependencies;
|
|
177
|
-
})))).flat(1);
|
|
178
|
-
packageJSON.devDependencies = __spreadValues(__spreadValues({}, packageJSON.devDependencies ?? {}), Object.fromEntries(integrationEntries));
|
|
179
|
-
packageJSON.devDependencies = Object.fromEntries(Object.entries(packageJSON.devDependencies).sort((a, b) => a[0].localeCompare(b[0])));
|
|
180
|
-
await fs.promises.writeFile(fileLoc, JSON.stringify(packageJSON, void 0, 2));
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
]);
|
|
186
|
-
if ((selectedTemplate == null ? void 0 : selectedTemplate.value) === "starter") {
|
|
187
|
-
let importStatements = [];
|
|
188
|
-
let components = [];
|
|
189
|
-
await Promise.all(integrations.map(async (integration) => {
|
|
190
|
-
const component = COUNTER_COMPONENTS[integration.id];
|
|
191
|
-
const componentName = path.basename(component.filename, path.extname(component.filename));
|
|
192
|
-
const absFileLoc = path.resolve(cwd, component.filename);
|
|
193
|
-
importStatements.push(`import ${componentName} from '${component.filename.replace(/^src/, "..")}';`);
|
|
194
|
-
components.push(`<${componentName} client:visible />`);
|
|
195
|
-
await fs.promises.writeFile(absFileLoc, component.content);
|
|
196
|
-
}));
|
|
197
|
-
const pageFileLoc = path.resolve(path.join(cwd, "src", "pages", "index.astro"));
|
|
198
|
-
const content = (await fs.promises.readFile(pageFileLoc)).toString();
|
|
199
|
-
const newContent = content.replace(/^(\s*)\/\* ASTRO\:COMPONENT_IMPORTS \*\//gm, (_, indent) => {
|
|
200
|
-
return indent + importStatements.join("\n");
|
|
201
|
-
}).replace(/^(\s*)<!-- ASTRO:COMPONENT_MARKUP -->/gm, (_, indent) => {
|
|
202
|
-
return components.map((ln) => indent + ln).join("\n");
|
|
203
|
-
});
|
|
204
|
-
await fs.promises.writeFile(pageFileLoc, newContent);
|
|
205
|
-
}
|
|
110
|
+
await Promise.all(FILES_TO_REMOVE.map(async (file) => {
|
|
111
|
+
const fileLoc = path.resolve(path.join(cwd, file));
|
|
112
|
+
if (fs.existsSync(fileLoc)) {
|
|
113
|
+
return fs.promises.rm(fileLoc, {});
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
206
116
|
}
|
|
207
117
|
spinner.succeed();
|
|
208
118
|
console.log(bold(green("\u2714") + " Done!"));
|
|
@@ -215,39 +125,65 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
|
|
|
215
125
|
if (!installResponse) {
|
|
216
126
|
process.exit(0);
|
|
217
127
|
}
|
|
218
|
-
if (installResponse.install) {
|
|
128
|
+
if (installResponse.install && !args.dryrun) {
|
|
219
129
|
const installExec = execa(pkgManager, ["install"], { cwd });
|
|
220
130
|
const installingPackagesMsg = `Installing packages${emojiWithFallback(" \u{1F4E6}", "...")}`;
|
|
221
131
|
spinner = ora({ color: "green", text: installingPackagesMsg }).start();
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
spinner.text = `${installingPackagesMsg}
|
|
132
|
+
await new Promise((resolve, reject) => {
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = installExec.stdout) == null ? void 0 : _a.on("data", function(data) {
|
|
135
|
+
spinner.text = `${installingPackagesMsg}
|
|
227
136
|
${bold(`[${pkgManager}]`)} ${data}`;
|
|
228
|
-
});
|
|
229
|
-
installExec.on("error", (error) => reject(error));
|
|
230
|
-
installExec.on("close", () => resolve());
|
|
231
137
|
});
|
|
232
|
-
|
|
138
|
+
installExec.on("error", (error) => reject(error));
|
|
139
|
+
installExec.on("close", () => resolve());
|
|
140
|
+
});
|
|
233
141
|
spinner.succeed();
|
|
234
142
|
}
|
|
235
|
-
|
|
236
|
-
|
|
143
|
+
const astroAddCommand = installResponse.install ? "astro add --yes" : `${pkgManagerExecCommand(pkgManager)} astro@latest add --yes`;
|
|
144
|
+
const astroAddResponse = await prompts({
|
|
145
|
+
type: "confirm",
|
|
146
|
+
name: "astroAdd",
|
|
147
|
+
message: `Run "${astroAddCommand}?" This lets you optionally add component frameworks (ex. React), CSS frameworks (ex. Tailwind), and more.`,
|
|
148
|
+
initial: true
|
|
149
|
+
});
|
|
150
|
+
if (!astroAddResponse) {
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
if (!astroAddResponse.astroAdd) {
|
|
154
|
+
ora().info(`No problem. You can always run "${pkgManagerExecCommand(pkgManager)} astro add" later!`);
|
|
155
|
+
}
|
|
156
|
+
if (astroAddResponse.astroAdd && !args.dryrun) {
|
|
157
|
+
await execaCommand(astroAddCommand, astroAddCommand === "astro add --yes" ? { cwd, stdio: "inherit", localDir: cwd, preferLocal: true } : { cwd, stdio: "inherit" });
|
|
158
|
+
}
|
|
159
|
+
const gitResponse = await prompts({
|
|
160
|
+
type: "confirm",
|
|
161
|
+
name: "git",
|
|
162
|
+
message: "Initialize a git repository?",
|
|
163
|
+
initial: true
|
|
164
|
+
});
|
|
165
|
+
if (!gitResponse) {
|
|
166
|
+
process.exit(0);
|
|
167
|
+
}
|
|
168
|
+
if (gitResponse.git && !args.dryrun) {
|
|
169
|
+
await execaCommand("git init", { cwd });
|
|
170
|
+
}
|
|
171
|
+
console.log(`
|
|
172
|
+
${bgCyan(black(" Next steps "))}
|
|
173
|
+
`);
|
|
237
174
|
const relative = path.relative(process.cwd(), cwd);
|
|
175
|
+
const startCommand = [];
|
|
238
176
|
if (relative !== "") {
|
|
239
|
-
|
|
177
|
+
startCommand.push(bold(cyan(`cd ${relative}`)));
|
|
240
178
|
}
|
|
241
179
|
if (!installResponse.install) {
|
|
242
|
-
|
|
180
|
+
startCommand.push(bold(cyan(`${pkgManager} install`)));
|
|
243
181
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
console.log(` ${i++}: ${bold(cyan(runCommand))}`);
|
|
182
|
+
startCommand.push(bold(cyan(pkgManager === "npm" ? "npm run dev" : `${pkgManager} dev`)));
|
|
183
|
+
console.log(startCommand.join(" && "));
|
|
247
184
|
console.log(`
|
|
248
185
|
To close the dev server, hit ${bold(cyan("Ctrl-C"))}`);
|
|
249
|
-
console.log(`
|
|
250
|
-
Stuck? Visit us at ${cyan("https://astro.build/chat")}
|
|
186
|
+
console.log(`Stuck? Visit us at ${cyan("https://astro.build/chat")}
|
|
251
187
|
`);
|
|
252
188
|
}
|
|
253
189
|
function emojiWithFallback(char, fallback) {
|
|
@@ -260,6 +196,13 @@ function pkgManagerFromUserAgent(userAgent) {
|
|
|
260
196
|
const pkgSpecArr = pkgSpec.split("/");
|
|
261
197
|
return pkgSpecArr[0];
|
|
262
198
|
}
|
|
199
|
+
function pkgManagerExecCommand(pkgManager) {
|
|
200
|
+
if (pkgManager === "pnpm") {
|
|
201
|
+
return "pnpx";
|
|
202
|
+
} else {
|
|
203
|
+
return "npx";
|
|
204
|
+
}
|
|
205
|
+
}
|
|
263
206
|
export {
|
|
264
207
|
main,
|
|
265
208
|
mkdirp
|
package/dist/templates.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const TEMPLATES = [
|
|
2
2
|
{
|
|
3
|
-
title: "
|
|
4
|
-
value: "
|
|
5
|
-
integrations: true
|
|
3
|
+
title: "Just the basics",
|
|
4
|
+
value: "basics"
|
|
6
5
|
},
|
|
7
6
|
{
|
|
8
7
|
title: "Blog",
|
|
@@ -17,7 +16,7 @@ const TEMPLATES = [
|
|
|
17
16
|
value: "portfolio"
|
|
18
17
|
},
|
|
19
18
|
{
|
|
20
|
-
title: "
|
|
19
|
+
title: "Completely empty",
|
|
21
20
|
value: "minimal"
|
|
22
21
|
}
|
|
23
22
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"degit": "^2.8.4",
|
|
34
34
|
"execa": "^6.1.0",
|
|
35
35
|
"kleur": "^4.1.4",
|
|
36
|
-
"node-fetch": "^3.2.3",
|
|
37
36
|
"ora": "^6.1.0",
|
|
38
37
|
"prompts": "^2.4.2",
|
|
39
38
|
"yargs-parser": "^21.0.1"
|
package/dist/config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const createConfig = ({ integrations }) => {
|
|
2
|
-
if (integrations.length === 0) {
|
|
3
|
-
return `import { defineConfig } from 'astro/config';
|
|
4
|
-
// https://astro.build/config
|
|
5
|
-
export default defineConfig({});
|
|
6
|
-
`;
|
|
7
|
-
}
|
|
8
|
-
const rendererImports = integrations.map((r) => ` import ${r.id} from '${r.packageName}';`);
|
|
9
|
-
const rendererIntegrations = integrations.map((r) => ` ${r.id}(),`);
|
|
10
|
-
return [
|
|
11
|
-
`import { defineConfig } from 'astro/config';`,
|
|
12
|
-
...rendererImports,
|
|
13
|
-
`// https://astro.build/config`,
|
|
14
|
-
`export default defineConfig({`,
|
|
15
|
-
` integrations: [`,
|
|
16
|
-
...rendererIntegrations,
|
|
17
|
-
` ]`,
|
|
18
|
-
`});`
|
|
19
|
-
].join("\n");
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
createConfig
|
|
23
|
-
};
|
package/dist/frameworks.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
const COUNTER_COMPONENTS = {
|
|
2
|
-
preact: {
|
|
3
|
-
filename: `src/components/PreactCounter.jsx`,
|
|
4
|
-
content: `import { useState } from 'preact/hooks';
|
|
5
|
-
|
|
6
|
-
export default function PreactCounter() {
|
|
7
|
-
const [count, setCount] = useState(0);
|
|
8
|
-
const add = () => setCount((i) => i + 1);
|
|
9
|
-
const subtract = () => setCount((i) => i - 1);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div id="preact" class="counter">
|
|
13
|
-
<button onClick={subtract}>-</button>
|
|
14
|
-
<pre>{count}</pre>
|
|
15
|
-
<button onClick={add}>+</button>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
`
|
|
20
|
-
},
|
|
21
|
-
react: {
|
|
22
|
-
filename: `src/components/ReactCounter.jsx`,
|
|
23
|
-
content: `import { useState } from 'react';
|
|
24
|
-
|
|
25
|
-
export default function ReactCounter() {
|
|
26
|
-
const [count, setCount] = useState(0);
|
|
27
|
-
const add = () => setCount((i) => i + 1);
|
|
28
|
-
const subtract = () => setCount((i) => i - 1);
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div id="react" className="counter">
|
|
32
|
-
<button onClick={subtract}>-</button>
|
|
33
|
-
<pre>{count}</pre>
|
|
34
|
-
<button onClick={add}>+</button>
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
`
|
|
39
|
-
},
|
|
40
|
-
solid: {
|
|
41
|
-
filename: `src/components/SolidCounter.jsx`,
|
|
42
|
-
content: `import { createSignal } from "solid-js";
|
|
43
|
-
|
|
44
|
-
export default function SolidCounter() {
|
|
45
|
-
const [count, setCount] = createSignal(0);
|
|
46
|
-
const add = () => setCount(count() + 1);
|
|
47
|
-
const subtract = () => setCount(count() - 1);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div id="solid" class="counter">
|
|
51
|
-
<button onClick={subtract}>-</button>
|
|
52
|
-
<pre>{count()}</pre>
|
|
53
|
-
<button onClick={add}>+</button>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
`
|
|
58
|
-
},
|
|
59
|
-
svelte: {
|
|
60
|
-
filename: `src/components/SvelteCounter.svelte`,
|
|
61
|
-
content: `<script>
|
|
62
|
-
let count = 0;
|
|
63
|
-
|
|
64
|
-
function add() {
|
|
65
|
-
count += 1;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function subtract() {
|
|
69
|
-
count -= 1;
|
|
70
|
-
}
|
|
71
|
-
<\/script>
|
|
72
|
-
|
|
73
|
-
<div id="svelte" class="counter">
|
|
74
|
-
<button on:click={subtract}>-</button>
|
|
75
|
-
<pre>{ count }</pre>
|
|
76
|
-
<button on:click={add}>+</button>
|
|
77
|
-
</div>
|
|
78
|
-
`
|
|
79
|
-
},
|
|
80
|
-
vue: {
|
|
81
|
-
filename: `src/components/VueCounter.vue`,
|
|
82
|
-
content: `<template>
|
|
83
|
-
<div id="vue" class="counter">
|
|
84
|
-
<button @click="subtract()">-</button>
|
|
85
|
-
<pre>{{ count }}</pre>
|
|
86
|
-
<button @click="add()">+</button>
|
|
87
|
-
</div>
|
|
88
|
-
</template>
|
|
89
|
-
|
|
90
|
-
<script>
|
|
91
|
-
import { ref } from 'vue';
|
|
92
|
-
export default {
|
|
93
|
-
setup() {
|
|
94
|
-
const count = ref(0)
|
|
95
|
-
const add = () => count.value = count.value + 1;
|
|
96
|
-
const subtract = () => count.value = count.value - 1;
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
count,
|
|
100
|
-
add,
|
|
101
|
-
subtract
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
<\/script>
|
|
106
|
-
`
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const FRAMEWORKS = [
|
|
110
|
-
{
|
|
111
|
-
title: "Preact",
|
|
112
|
-
value: { id: "preact", packageName: "@astrojs/preact" }
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
title: "React",
|
|
116
|
-
value: { id: "react", packageName: "@astrojs/react" }
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
title: "Solid.js",
|
|
120
|
-
value: { id: "solid", packageName: "@astrojs/solid-js" }
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: "Svelte",
|
|
124
|
-
value: { id: "svelte", packageName: "@astrojs/svelte" }
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
title: "Vue",
|
|
128
|
-
value: { id: "vue", packageName: "@astrojs/vue" }
|
|
129
|
-
}
|
|
130
|
-
];
|
|
131
|
-
export {
|
|
132
|
-
COUNTER_COMPONENTS,
|
|
133
|
-
FRAMEWORKS
|
|
134
|
-
};
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const COUNTER_COMPONENTS: {
|
|
2
|
-
preact: {
|
|
3
|
-
filename: string;
|
|
4
|
-
content: string;
|
|
5
|
-
};
|
|
6
|
-
react: {
|
|
7
|
-
filename: string;
|
|
8
|
-
content: string;
|
|
9
|
-
};
|
|
10
|
-
solid: {
|
|
11
|
-
filename: string;
|
|
12
|
-
content: string;
|
|
13
|
-
};
|
|
14
|
-
svelte: {
|
|
15
|
-
filename: string;
|
|
16
|
-
content: string;
|
|
17
|
-
};
|
|
18
|
-
vue: {
|
|
19
|
-
filename: string;
|
|
20
|
-
content: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export interface Integration {
|
|
24
|
-
id: string;
|
|
25
|
-
packageName: string;
|
|
26
|
-
}
|
|
27
|
-
export declare const FRAMEWORKS: {
|
|
28
|
-
title: string;
|
|
29
|
-
value: Integration;
|
|
30
|
-
}[];
|