create-atom.io 0.0.1 → 0.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/dist/{create-atom-BV6WVRvY.js → create-atom-DOkiQlT8.js} +27 -11
- package/dist/create-atom-DOkiQlT8.js.map +1 -0
- package/dist/create-atom.d.ts +5 -2
- package/dist/create-atom.d.ts.map +1 -1
- package/dist/create-atom.js +1 -1
- package/dist/create-atom.x.js +8 -1
- package/dist/create-atom.x.js.map +1 -1
- package/package.json +1 -3
- package/src/create-atom.ts +28 -5
- package/src/create-atom.x.ts +7 -0
- package/templates/{base → preact-svg-editor}/eslint.config.ts +4 -3
- package/templates/preact-svg-editor/eslint.d.ts +31 -0
- package/templates/preact-svg-editor/node_modules/.bin/vite +21 -0
- package/templates/{base → preact-svg-editor}/package.json +1 -1
- package/templates/{base → preact-svg-editor}/src/BezierPlayground.tsx +157 -147
- package/templates/{base → preact-svg-editor}/src/index.tsx +6 -4
- package/templates/{base → preact-svg-editor}/vite.config.ts +2 -1
- package/templates/react-node-backend/.turbo/turbo-build.log +12 -0
- package/templates/react-node-backend/README.md +75 -0
- package/templates/react-node-backend/_gitignore +24 -0
- package/templates/react-node-backend/dist/assets/index-6PkP9syN.js +9 -0
- package/templates/react-node-backend/dist/assets/index-By2j7w9s.css +1 -0
- package/templates/react-node-backend/dist/index.html +14 -0
- package/templates/react-node-backend/dist/react.svg +1 -0
- package/templates/react-node-backend/dist/vite.svg +1 -0
- package/templates/react-node-backend/eslint.config.ts +176 -0
- package/templates/react-node-backend/index.html +13 -0
- package/templates/react-node-backend/node/authenticator.ts +47 -0
- package/templates/react-node-backend/node/server.ts +103 -0
- package/templates/react-node-backend/node_modules/.bin/conc +21 -0
- package/templates/react-node-backend/node_modules/.bin/concurrently +21 -0
- package/templates/react-node-backend/node_modules/.bin/eslint +21 -0
- package/templates/react-node-backend/node_modules/.bin/tsc +21 -0
- package/templates/react-node-backend/node_modules/.bin/tsserver +21 -0
- package/templates/react-node-backend/node_modules/.bin/vite +21 -0
- package/templates/react-node-backend/package.json +33 -0
- package/templates/react-node-backend/public/react.svg +1 -0
- package/templates/react-node-backend/public/vite.svg +1 -0
- package/templates/react-node-backend/src/App.tsx +69 -0
- package/templates/react-node-backend/src/index.css +145 -0
- package/templates/react-node-backend/src/main.tsx +12 -0
- package/templates/react-node-backend/tsconfig.app.json +28 -0
- package/templates/react-node-backend/tsconfig.json +7 -0
- package/templates/react-node-backend/tsconfig.node.json +26 -0
- package/templates/react-node-backend/vite.config.ts +13 -0
- package/dist/create-atom-BV6WVRvY.js.map +0 -1
- package/templates/base/node_modules/.bin/browserslist +0 -21
- package/templates/base/node_modules/.bin/eslint +0 -21
- package/templates/base/node_modules/.bin/jiti +0 -21
- package/templates/base/node_modules/.bin/sass +0 -21
- package/templates/base/node_modules/.bin/terser +0 -21
- package/templates/base/node_modules/.bin/tsc +0 -21
- package/templates/base/node_modules/.bin/tsserver +0 -21
- package/templates/base/node_modules/.bin/vite +0 -21
- package/templates/base/node_modules/.bin/yaml +0 -21
- package/templates/base/node_modules/.vite/deps/_metadata.json +0 -82
- package/templates/base/node_modules/.vite/deps/atom__io.js +0 -72
- package/templates/base/node_modules/.vite/deps/atom__io.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/atom__io_react.js +0 -170
- package/templates/base/node_modules/.vite/deps/atom__io_react.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-2PJG54YB.js +0 -364
- package/templates/base/node_modules/.vite/deps/chunk-2PJG54YB.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-6VZTUEOV.js +0 -3777
- package/templates/base/node_modules/.vite/deps/chunk-6VZTUEOV.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-IHAFLL3M.js +0 -204
- package/templates/base/node_modules/.vite/deps/chunk-IHAFLL3M.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-LZJKCPXG.js +0 -84
- package/templates/base/node_modules/.vite/deps/chunk-LZJKCPXG.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-PJQAIOAR.js +0 -311
- package/templates/base/node_modules/.vite/deps/chunk-PJQAIOAR.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/chunk-XRJUZPUF.js +0 -17
- package/templates/base/node_modules/.vite/deps/chunk-XRJUZPUF.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/package.json +0 -3
- package/templates/base/node_modules/.vite/deps/preact.js +0 -27
- package/templates/base/node_modules/.vite/deps/preact.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_compat.js +0 -100
- package/templates/base/node_modules/.vite/deps/preact_compat.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_debug.js +0 -240
- package/templates/base/node_modules/.vite/deps/preact_debug.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_devtools.js +0 -7
- package/templates/base/node_modules/.vite/deps/preact_devtools.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_hooks.js +0 -29
- package/templates/base/node_modules/.vite/deps/preact_hooks.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_jsx-dev-runtime.js +0 -18
- package/templates/base/node_modules/.vite/deps/preact_jsx-dev-runtime.js.map +0 -7
- package/templates/base/node_modules/.vite/deps/preact_jsx-runtime.js +0 -18
- package/templates/base/node_modules/.vite/deps/preact_jsx-runtime.js.map +0 -7
- /package/templates/{base → preact-svg-editor}/_gitignore +0 -0
- /package/templates/{base → preact-svg-editor}/index.html +0 -0
- /package/templates/{base → preact-svg-editor}/public/preact.svg +0 -0
- /package/templates/{base → preact-svg-editor}/src/msg.md +0 -0
- /package/templates/{base → preact-svg-editor}/src/style.css +0 -0
- /package/templates/{base → preact-svg-editor}/tsconfig.json +0 -0
- /package/templates/{base → react-node-backend}/eslint.d.ts +0 -0
|
@@ -12,19 +12,35 @@ async function createAtom(argDir, options) {
|
|
|
12
12
|
const skipHint = options.skipHints ?? false;
|
|
13
13
|
const packageManager = options.packageManager ?? getPkgManager();
|
|
14
14
|
prompts.intro(pico.greenBright(`atom.io - Data Components for TypeScript`));
|
|
15
|
-
const { dir } = await prompts.group({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const { dir, templateName } = await prompts.group({
|
|
16
|
+
templateName: () => prompts.select({
|
|
17
|
+
message: `Template:`,
|
|
18
|
+
initialValue: `preact-svg-editor`,
|
|
19
|
+
options: [{
|
|
20
|
+
label: `Preact SVG Editor`,
|
|
21
|
+
value: `preact-svg-editor`
|
|
22
|
+
}, {
|
|
23
|
+
label: `React Node Backend`,
|
|
24
|
+
value: `react-node-backend`
|
|
25
|
+
}]
|
|
26
|
+
}),
|
|
27
|
+
dir: () => argDir ? Promise.resolve(argDir) : prompts.text({
|
|
28
|
+
message: `Project directory:`,
|
|
29
|
+
placeholder: `my-app`,
|
|
30
|
+
validate(value) {
|
|
31
|
+
if (value.length === 0) return `Directory name is required!`;
|
|
32
|
+
if (existsSync(value)) return `Refusing to overwrite existing directory or file! Please provide a non-clashing name.`;
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}, { onCancel: () => {
|
|
23
36
|
prompts.cancel(pico.yellow(`Cancelled`));
|
|
24
37
|
process.exit(0);
|
|
25
38
|
} });
|
|
26
39
|
const targetDir = resolve(process.cwd(), dir);
|
|
27
|
-
const opts = {
|
|
40
|
+
const opts = {
|
|
41
|
+
packageManager,
|
|
42
|
+
templateName
|
|
43
|
+
};
|
|
28
44
|
await useSpinner(`Setting up your project directory...`, () => scaffold(targetDir, opts), `Set up project directory`);
|
|
29
45
|
await useSpinner(`Installing project dependencies...`, () => installDeps(targetDir, opts), `Installed project dependencies`);
|
|
30
46
|
if (skipHint === false) {
|
|
@@ -43,7 +59,7 @@ async function useSpinner(startMessage, fn, finishMessage) {
|
|
|
43
59
|
}
|
|
44
60
|
async function scaffold(to, opts) {
|
|
45
61
|
await promises.mkdir(to, { recursive: true });
|
|
46
|
-
await templateDir(resolve(dirname(fileURLToPath(import.meta.url)), `../templates`,
|
|
62
|
+
await templateDir(resolve(dirname(fileURLToPath(import.meta.url)), `../templates`, opts.templateName), to, opts);
|
|
47
63
|
}
|
|
48
64
|
/**
|
|
49
65
|
* Recursive fs copy, swiped from `create-wmr`:
|
|
@@ -99,4 +115,4 @@ function getPkgManager() {
|
|
|
99
115
|
|
|
100
116
|
//#endregion
|
|
101
117
|
export { pico as n, createAtom as t };
|
|
102
|
-
//# sourceMappingURL=create-atom-
|
|
118
|
+
//# sourceMappingURL=create-atom-DOkiQlT8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-atom-DOkiQlT8.js","names":["pico: Colors","opts: CreateAtomOptions","fs","dependencies: string[]","devDependencies: string[]"],"sources":["../src/create-atom.ts"],"sourcesContent":["import { existsSync, promises as fs } from \"node:fs\"\nimport { dirname, resolve } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport * as prompts from \"@clack/prompts\"\nimport picocolors from \"picocolors\"\nimport type { Colors } from \"picocolors/types\"\nimport { x } from \"tinyexec\"\n\nexport const pico: Colors = picocolors.createColors(true)\n\nconst s = prompts.spinner()\n\nexport type PackageManager = `bun` | `npm` | `pnpm` | `yarn`\nexport type TemplateName = `preact-svg-editor` | `react-node-backend`\n\nexport type CreateAtomOptions = {\n\tpackageManager: PackageManager\n\ttemplateName: TemplateName\n}\n\nexport type CreateAtomOptionsPreloaded = {\n\t[K in keyof CreateAtomOptions]?: CreateAtomOptions[K] | undefined\n} & { skipHints?: boolean | undefined }\n\nexport async function createAtom(\n\targDir: string | undefined,\n\toptions: CreateAtomOptionsPreloaded,\n): Promise<void> {\n\tconst skipHint = options.skipHints ?? false\n\tconst packageManager = options.packageManager ?? getPkgManager()\n\n\tprompts.intro(pico.greenBright(`atom.io - Data Components for TypeScript`))\n\n\tconst { dir, templateName } = await prompts.group(\n\t\t{\n\t\t\ttemplateName: () =>\n\t\t\t\tprompts.select<TemplateName>({\n\t\t\t\t\tmessage: `Template:`,\n\t\t\t\t\tinitialValue: `preact-svg-editor`,\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: `Preact SVG Editor`,\n\t\t\t\t\t\t\tvalue: `preact-svg-editor`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: `React Node Backend`,\n\t\t\t\t\t\t\tvalue: `react-node-backend`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\tdir: () =>\n\t\t\t\targDir\n\t\t\t\t\t? Promise.resolve(argDir)\n\t\t\t\t\t: prompts.text({\n\t\t\t\t\t\t\tmessage: `Project directory:`,\n\t\t\t\t\t\t\tplaceholder: `my-app`,\n\t\t\t\t\t\t\tvalidate(value) {\n\t\t\t\t\t\t\t\tif (value.length === 0) {\n\t\t\t\t\t\t\t\t\treturn `Directory name is required!`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (existsSync(value)) {\n\t\t\t\t\t\t\t\t\treturn `Refusing to overwrite existing directory or file! Please provide a non-clashing name.`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tonCancel: () => {\n\t\t\t\tprompts.cancel(pico.yellow(`Cancelled`))\n\t\t\t\tprocess.exit(0)\n\t\t\t},\n\t\t},\n\t)\n\tconst targetDir = resolve(process.cwd(), dir)\n\tconst opts: CreateAtomOptions = { packageManager, templateName }\n\n\tawait useSpinner(\n\t\t`Setting up your project directory...`,\n\t\t() => scaffold(targetDir, opts),\n\t\t`Set up project directory`,\n\t)\n\n\tawait useSpinner(\n\t\t`Installing project dependencies...`,\n\t\t() => installDeps(targetDir, opts),\n\t\t`Installed project dependencies`,\n\t)\n\n\tif (skipHint === false) {\n\t\tconst gettingStarted = `\n\t\t\t${pico.dim(`$`)} ${pico.blueBright(`cd ${dir}`)}\n\t\t\t${pico.dim(`$`)} ${pico.blueBright(\n\t\t\t\t`${\n\t\t\t\t\tpackageManager === `npm`\n\t\t\t\t\t\t? `npm run`\n\t\t\t\t\t\t: packageManager === `bun`\n\t\t\t\t\t\t\t? `bun run`\n\t\t\t\t\t\t\t: packageManager\n\t\t\t\t} dev`,\n\t\t\t)}\n\t\t`\n\t\tprompts.note(\n\t\t\tgettingStarted.trim().replace(/^\\t\\t\\t/gm, ``),\n\t\t\t`Getting Started`,\n\t\t)\n\t}\n\n\tprompts.outro(pico.green(`You're all set!`))\n}\n\nasync function useSpinner(\n\tstartMessage: string,\n\tfn: () => Promise<void>,\n\tfinishMessage: string,\n): Promise<void> {\n\ts.start(startMessage)\n\tawait fn()\n\ts.stop(pico.green(finishMessage))\n}\n\nasync function scaffold(to: string, opts: CreateAtomOptions): Promise<void> {\n\tawait fs.mkdir(to, { recursive: true })\n\n\tconst __dirname = dirname(fileURLToPath(import.meta.url))\n\tawait templateDir(\n\t\tresolve(__dirname, `../templates`, opts.templateName),\n\t\tto,\n\t\topts,\n\t)\n}\n\n/**\n * Recursive fs copy, swiped from `create-wmr`:\n * https://github.com/preactjs/wmr/blob/3c5672ecd2f958c8eaf372d33c084dc69228ae3f/packages/create-wmr/src/index.js#L108-L124\n */\nasync function templateDir(\n\tfrom: string,\n\tto: string,\n\topts: CreateAtomOptions,\n): Promise<void[]> {\n\tconst files = await fs.readdir(from)\n\tconst results = await Promise.all(\n\t\tfiles.map(async (f) => {\n\t\t\tif (f === `.` || f === `..`) return\n\t\t\tconst filename = resolve(from, f)\n\t\t\tif ((await fs.stat(filename)).isDirectory()) {\n\t\t\t\tawait fs.mkdir(resolve(to, f), { recursive: true })\n\t\t\t\treturn templateDir(filename, resolve(to, f), opts)\n\t\t\t}\n\t\t\tif (opts.packageManager !== `npm` && f === `README.md`) {\n\t\t\t\tawait fs.writeFile(\n\t\t\t\t\tresolve(to, f),\n\t\t\t\t\t(await fs.readFile(filename, `utf-8`)).replace(\n\t\t\t\t\t\t/npm run/g,\n\t\t\t\t\t\topts.packageManager === `bun` ? `bun run` : opts.packageManager,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Publishing to npm renames the .gitignore to .npmignore\n\t\t\t// https://github.com/npm/npm/issues/7252#issuecomment-253339460\n\t\t\tif (f === `_gitignore`) f = `.gitignore`\n\t\t\tawait fs.copyFile(filename, resolve(to, f))\n\t\t}),\n\t)\n\treturn results.flat(99)\n}\n\nasync function installDeps(to: string, opts: CreateAtomOptions) {\n\tconst dependencies: string[] = []\n\tconst devDependencies: string[] = []\n\n\tconst installOpts = {\n\t\tpackageManager: opts.packageManager,\n\t\tto,\n\t}\n\n\tawait installPackages(dependencies, { ...installOpts })\n\tdevDependencies.length &&\n\t\t(await installPackages(devDependencies, { ...installOpts, dev: true }))\n}\n\ntype InstallOptions = {\n\tpackageManager: `bun` | `npm` | `pnpm` | `yarn`\n\tto: string\n\tdev?: boolean\n}\n\nfunction installPackages(pkgs: string[], opts: InstallOptions) {\n\treturn x(\n\t\topts.packageManager,\n\t\t[\n\t\t\t// `yarn add` will fail if nothing is provided\n\t\t\topts.packageManager === `yarn` ? (pkgs.length ? `add` : ``) : `install`,\n\t\t\topts.dev ? `-D` : ``,\n\t\t\t...pkgs,\n\t\t].filter(Boolean),\n\t\t{\n\t\t\tnodeOptions: {\n\t\t\t\tstdio: `ignore`,\n\t\t\t\tcwd: opts.to,\n\t\t\t},\n\t\t},\n\t)\n}\n\nfunction getPkgManager(): `bun` | `npm` | `pnpm` | `yarn` {\n\tconst userAgent = process.env[`npm_config_user_agent`] ?? ``\n\tif (userAgent.startsWith(`yarn`)) return `yarn`\n\tif (userAgent.startsWith(`pnpm`)) return `pnpm`\n\tif (userAgent.startsWith(`bun`)) return `bun`\n\treturn `npm`\n}\n"],"mappings":";;;;;;;;AASA,MAAaA,OAAe,WAAW,aAAa,KAAK;AAEzD,MAAM,IAAI,QAAQ,S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SAAS,gBAAgB,MAAgB,MAAsB;AAC9D,QAAO,EACN,KAAK,gBACL;EAEC,KAAK,mBAAmB,SAAU,KAAK,SAAS,QAAQ,KAAM;EAC9D,KAAK,MAAM,OAAO;EAClB,GAAG;EACH,CAAC,OAAO,QAAQ,EACjB,EACC,aAAa;EACZ,OAAO;EACP,KAAK,KAAK;EACV,EACD,CACD;;AAGF,SAAS,gBAAiD;CACzD,MAAM,YAAY,QAAQ,IAAI,4BAA4B;AAC1D,KAAI,UAAU,WAAW,OAAO,CAAE,QAAO;AACzC,KAAI,UAAU,WAAW,OAAO,CAAE,QAAO;AACzC,KAAI,UAAU,WAAW,MAAM,CAAE,QAAO;AACxC,QAAO"}
|
package/dist/create-atom.d.ts
CHANGED
|
@@ -2,13 +2,16 @@ import { Colors } from "picocolors/types";
|
|
|
2
2
|
|
|
3
3
|
//#region src/create-atom.d.ts
|
|
4
4
|
declare const pico: Colors;
|
|
5
|
+
type PackageManager = `bun` | `npm` | `pnpm` | `yarn`;
|
|
6
|
+
type TemplateName = `preact-svg-editor` | `react-node-backend`;
|
|
5
7
|
type CreateAtomOptions = {
|
|
6
|
-
packageManager:
|
|
8
|
+
packageManager: PackageManager;
|
|
9
|
+
templateName: TemplateName;
|
|
7
10
|
};
|
|
8
11
|
type CreateAtomOptionsPreloaded = { [K in keyof CreateAtomOptions]?: CreateAtomOptions[K] | undefined } & {
|
|
9
12
|
skipHints?: boolean | undefined;
|
|
10
13
|
};
|
|
11
14
|
declare function createAtom(argDir: string | undefined, options: CreateAtomOptionsPreloaded): Promise<void>;
|
|
12
15
|
//#endregion
|
|
13
|
-
export { CreateAtomOptions, CreateAtomOptionsPreloaded, createAtom, pico };
|
|
16
|
+
export { CreateAtomOptions, CreateAtomOptionsPreloaded, PackageManager, TemplateName, createAtom, pico };
|
|
14
17
|
//# sourceMappingURL=create-atom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-atom.d.ts","names":["pico: Colors"],"sources":["../src/create-atom.ts"],"sourcesContent":[],"mappings":";;;cASaA,MAAM;KAIP,
|
|
1
|
+
{"version":3,"file":"create-atom.d.ts","names":["pico: Colors"],"sources":["../src/create-atom.ts"],"sourcesContent":[],"mappings":";;;cASaA,MAAM;KAIP,cAAA;AAJCA,KAKD,YAAA,GALO,mBAAA,GAAA,oBAAA;AAIP,KAGA,iBAAA,GAHA;EACZ,cAAY,EAGK,cAHL;EAEZ,YAAY,EAEG,YAFH;AAKZ,CAAA;AACa,KADD,0BAAA,GACC,QAAA,MAAA,iBAAA,IAAqB,iBAArB,CAAuC,CAAvC,CAAA,GAAA,SAAA,EAAA,GAAA;EAAqB,SAAA,CAAA,EAAA,OAAA,GAAA,SAAA;CAAkB;AAAA,iBAG9B,UAAA,CAH8B,MAAA,EAAA,MAAA,GAAA,SAAA,EAAA,OAAA,EAK1C,0BAL0C,CAAA,EAMjD,OANiD,CAAA,IAAA,CAAA"}
|
package/dist/create-atom.js
CHANGED
package/dist/create-atom.x.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as createAtom } from "./create-atom-
|
|
2
|
+
import { t as createAtom } from "./create-atom-DOkiQlT8.js";
|
|
3
3
|
import { type } from "arktype";
|
|
4
4
|
import { cli, optional, options, parseBooleanOption } from "comline";
|
|
5
5
|
|
|
6
6
|
//#region src/create-atom.x.ts
|
|
7
7
|
const CREATE_ATOM_OPTS = options(`Create a new project with atom.io.`, type({
|
|
8
8
|
"packageManager?": `"bun" | "npm" | "pnpm" | "yarn"`,
|
|
9
|
+
"templateName?": `"preact-svg-editor" | "react-node-backend"`,
|
|
9
10
|
"skipHints?": `boolean`
|
|
10
11
|
}), {
|
|
11
12
|
packageManager: {
|
|
@@ -14,6 +15,12 @@ const CREATE_ATOM_OPTS = options(`Create a new project with atom.io.`, type({
|
|
|
14
15
|
description: `The package manager to use.`,
|
|
15
16
|
example: `--packageManager="npm"`
|
|
16
17
|
},
|
|
18
|
+
templateName: {
|
|
19
|
+
flag: `t`,
|
|
20
|
+
required: false,
|
|
21
|
+
description: `The template to use.`,
|
|
22
|
+
example: `--templateName="preact-svg-editor"`
|
|
23
|
+
},
|
|
17
24
|
skipHints: {
|
|
18
25
|
flag: `k`,
|
|
19
26
|
required: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-atom.x.js","names":[],"sources":["../src/create-atom.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { type } from \"arktype\"\nimport type { OptionsGroup } from \"comline\"\nimport { cli, optional, options, parseBooleanOption } from \"comline\"\n\nimport type { CreateAtomOptionsPreloaded } from \"./create-atom.ts\"\nimport { createAtom } from \"./create-atom.ts\"\n\nconst CREATE_ATOM_OPTS = options(\n\t`Create a new project with atom.io.`,\n\ttype({\n\t\t\"packageManager?\": `\"bun\" | \"npm\" | \"pnpm\" | \"yarn\"`,\n\t\t\"skipHints?\": `boolean`,\n\t}),\n\t{\n\t\tpackageManager: {\n\t\t\tflag: `m`,\n\t\t\trequired: false,\n\t\t\tdescription: `The package manager to use.`,\n\t\t\texample: `--packageManager=\"npm\"`,\n\t\t},\n\t\tskipHints: {\n\t\t\tflag: `k`,\n\t\t\trequired: false,\n\t\t\tdescription: `Silences the 'Getting Started' info, mainly for use in other initializers that may wrap this one but provide their own scripts/instructions.`,\n\t\t\texample: `--skipHints`,\n\t\t\tparse: parseBooleanOption,\n\t\t},\n\t},\n) satisfies OptionsGroup<CreateAtomOptionsPreloaded>\n\nconst parse = cli(\n\t{\n\t\tcliName: `create-atom`,\n\t\troutes: optional({ $projectName: null }),\n\t\trouteOptions: {\n\t\t\t\"\": CREATE_ATOM_OPTS,\n\t\t\t$projectName: CREATE_ATOM_OPTS,\n\t\t},\n\t},\n\t{\n\t\terror: console.error.bind(console),\n\t\tinfo: () => {},\n\t},\n)\nconst { inputs } = parse(process.argv)\n\nawait createAtom(inputs.path[0], inputs.opts)\n"],"mappings":";;;;;;AASA,MAAM,mBAAmB,QACxB,sCACA,KAAK;CACJ,mBAAmB;CACnB,cAAc;CACd,CAAC,EACF;CACC,gBAAgB;EACf,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS;EACT;CACD,WAAW;EACV,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS;EACT,OAAO;EACP;CACD,CACD;AAgBD,MAAM,EAAE,WAdM,IACb;CACC,SAAS;CACT,QAAQ,SAAS,EAAE,cAAc,MAAM,CAAC;CACxC,cAAc;EACb,IAAI;EACJ,cAAc;EACd;CACD,EACD;CACC,OAAO,QAAQ,MAAM,KAAK,QAAQ;CAClC,YAAY;CACZ,CACD,CACwB,QAAQ,KAAK;AAEtC,MAAM,WAAW,OAAO,KAAK,IAAI,OAAO,KAAK"}
|
|
1
|
+
{"version":3,"file":"create-atom.x.js","names":[],"sources":["../src/create-atom.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { type } from \"arktype\"\nimport type { OptionsGroup } from \"comline\"\nimport { cli, optional, options, parseBooleanOption } from \"comline\"\n\nimport type { CreateAtomOptionsPreloaded } from \"./create-atom.ts\"\nimport { createAtom } from \"./create-atom.ts\"\n\nconst CREATE_ATOM_OPTS = options(\n\t`Create a new project with atom.io.`,\n\ttype({\n\t\t\"packageManager?\": `\"bun\" | \"npm\" | \"pnpm\" | \"yarn\"`,\n\t\t\"templateName?\": `\"preact-svg-editor\" | \"react-node-backend\"`,\n\t\t\"skipHints?\": `boolean`,\n\t}),\n\t{\n\t\tpackageManager: {\n\t\t\tflag: `m`,\n\t\t\trequired: false,\n\t\t\tdescription: `The package manager to use.`,\n\t\t\texample: `--packageManager=\"npm\"`,\n\t\t},\n\t\ttemplateName: {\n\t\t\tflag: `t`,\n\t\t\trequired: false,\n\t\t\tdescription: `The template to use.`,\n\t\t\texample: `--templateName=\"preact-svg-editor\"`,\n\t\t},\n\t\tskipHints: {\n\t\t\tflag: `k`,\n\t\t\trequired: false,\n\t\t\tdescription: `Silences the 'Getting Started' info, mainly for use in other initializers that may wrap this one but provide their own scripts/instructions.`,\n\t\t\texample: `--skipHints`,\n\t\t\tparse: parseBooleanOption,\n\t\t},\n\t},\n) satisfies OptionsGroup<CreateAtomOptionsPreloaded>\n\nconst parse = cli(\n\t{\n\t\tcliName: `create-atom`,\n\t\troutes: optional({ $projectName: null }),\n\t\trouteOptions: {\n\t\t\t\"\": CREATE_ATOM_OPTS,\n\t\t\t$projectName: CREATE_ATOM_OPTS,\n\t\t},\n\t},\n\t{\n\t\terror: console.error.bind(console),\n\t\tinfo: () => {},\n\t},\n)\nconst { inputs } = parse(process.argv)\n\nawait createAtom(inputs.path[0], inputs.opts)\n"],"mappings":";;;;;;AASA,MAAM,mBAAmB,QACxB,sCACA,KAAK;CACJ,mBAAmB;CACnB,iBAAiB;CACjB,cAAc;CACd,CAAC,EACF;CACC,gBAAgB;EACf,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS;EACT;CACD,cAAc;EACb,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS;EACT;CACD,WAAW;EACV,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS;EACT,OAAO;EACP;CACD,CACD;AAgBD,MAAM,EAAE,WAdM,IACb;CACC,SAAS;CACT,QAAQ,SAAS,EAAE,cAAc,MAAM,CAAC;CACxC,cAAc;EACb,IAAI;EACJ,cAAc;EACd;CACD,EACD;CACC,OAAO,QAAQ,MAAM,KAAK,QAAQ;CAClC,YAAY;CACZ,CACD,CACwB,QAAQ,KAAK;AAEtC,MAAM,WAAW,OAAO,KAAK,IAAI,OAAO,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-atom.io",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jeremy Banka",
|
|
@@ -49,8 +49,6 @@
|
|
|
49
49
|
"lint:types": "tsgo --noEmit",
|
|
50
50
|
"watch:types": "tsgo --watch --noEmit",
|
|
51
51
|
"lint": "concurrently \"bun:lint:*\"",
|
|
52
|
-
"test": "bun test --watch -- **/*.test.ts",
|
|
53
|
-
"test:once": "bun test -- **/*.test.ts",
|
|
54
52
|
"postversion": "biome format --write package.json"
|
|
55
53
|
}
|
|
56
54
|
}
|
package/src/create-atom.ts
CHANGED
|
@@ -11,8 +11,12 @@ export const pico: Colors = picocolors.createColors(true)
|
|
|
11
11
|
|
|
12
12
|
const s = prompts.spinner()
|
|
13
13
|
|
|
14
|
+
export type PackageManager = `bun` | `npm` | `pnpm` | `yarn`
|
|
15
|
+
export type TemplateName = `preact-svg-editor` | `react-node-backend`
|
|
16
|
+
|
|
14
17
|
export type CreateAtomOptions = {
|
|
15
|
-
packageManager:
|
|
18
|
+
packageManager: PackageManager
|
|
19
|
+
templateName: TemplateName
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export type CreateAtomOptionsPreloaded = {
|
|
@@ -28,14 +32,29 @@ export async function createAtom(
|
|
|
28
32
|
|
|
29
33
|
prompts.intro(pico.greenBright(`atom.io - Data Components for TypeScript`))
|
|
30
34
|
|
|
31
|
-
const { dir } = await prompts.group(
|
|
35
|
+
const { dir, templateName } = await prompts.group(
|
|
32
36
|
{
|
|
37
|
+
templateName: () =>
|
|
38
|
+
prompts.select<TemplateName>({
|
|
39
|
+
message: `Template:`,
|
|
40
|
+
initialValue: `preact-svg-editor`,
|
|
41
|
+
options: [
|
|
42
|
+
{
|
|
43
|
+
label: `Preact SVG Editor`,
|
|
44
|
+
value: `preact-svg-editor`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: `React Node Backend`,
|
|
48
|
+
value: `react-node-backend`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
33
52
|
dir: () =>
|
|
34
53
|
argDir
|
|
35
54
|
? Promise.resolve(argDir)
|
|
36
55
|
: prompts.text({
|
|
37
56
|
message: `Project directory:`,
|
|
38
|
-
placeholder: `my-
|
|
57
|
+
placeholder: `my-app`,
|
|
39
58
|
validate(value) {
|
|
40
59
|
if (value.length === 0) {
|
|
41
60
|
return `Directory name is required!`
|
|
@@ -54,7 +73,7 @@ export async function createAtom(
|
|
|
54
73
|
},
|
|
55
74
|
)
|
|
56
75
|
const targetDir = resolve(process.cwd(), dir)
|
|
57
|
-
const opts: CreateAtomOptions = { packageManager }
|
|
76
|
+
const opts: CreateAtomOptions = { packageManager, templateName }
|
|
58
77
|
|
|
59
78
|
await useSpinner(
|
|
60
79
|
`Setting up your project directory...`,
|
|
@@ -104,7 +123,11 @@ async function scaffold(to: string, opts: CreateAtomOptions): Promise<void> {
|
|
|
104
123
|
await fs.mkdir(to, { recursive: true })
|
|
105
124
|
|
|
106
125
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
107
|
-
await templateDir(
|
|
126
|
+
await templateDir(
|
|
127
|
+
resolve(__dirname, `../templates`, opts.templateName),
|
|
128
|
+
to,
|
|
129
|
+
opts,
|
|
130
|
+
)
|
|
108
131
|
}
|
|
109
132
|
|
|
110
133
|
/**
|
package/src/create-atom.x.ts
CHANGED
|
@@ -11,6 +11,7 @@ const CREATE_ATOM_OPTS = options(
|
|
|
11
11
|
`Create a new project with atom.io.`,
|
|
12
12
|
type({
|
|
13
13
|
"packageManager?": `"bun" | "npm" | "pnpm" | "yarn"`,
|
|
14
|
+
"templateName?": `"preact-svg-editor" | "react-node-backend"`,
|
|
14
15
|
"skipHints?": `boolean`,
|
|
15
16
|
}),
|
|
16
17
|
{
|
|
@@ -20,6 +21,12 @@ const CREATE_ATOM_OPTS = options(
|
|
|
20
21
|
description: `The package manager to use.`,
|
|
21
22
|
example: `--packageManager="npm"`,
|
|
22
23
|
},
|
|
24
|
+
templateName: {
|
|
25
|
+
flag: `t`,
|
|
26
|
+
required: false,
|
|
27
|
+
description: `The template to use.`,
|
|
28
|
+
example: `--templateName="preact-svg-editor"`,
|
|
29
|
+
},
|
|
23
30
|
skipHints: {
|
|
24
31
|
flag: `k`,
|
|
25
32
|
required: false,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { default as TypeScriptPlugin } from "@typescript-eslint/eslint-plugin"
|
|
2
2
|
import * as parser from "@typescript-eslint/parser"
|
|
3
|
+
import AtomIOPlugin from "atom.io/eslint-plugin"
|
|
3
4
|
import type { ESLint, Linter } from "eslint"
|
|
5
|
+
import PreactConfig from "eslint-config-preact"
|
|
4
6
|
import * as ImportPlugin from "eslint-plugin-import-x"
|
|
5
7
|
import { default as SimpleImportSortPlugin } from "eslint-plugin-simple-import-sort"
|
|
6
|
-
import AtomIOPlugin from "atom.io/eslint-plugin"
|
|
7
|
-
import PreactConfig from "eslint-config-preact"
|
|
8
8
|
|
|
9
9
|
const ERROR = 2
|
|
10
10
|
|
|
@@ -154,11 +154,12 @@ const commonRules = {
|
|
|
154
154
|
"simple-import-sort/exports": ERROR,
|
|
155
155
|
|
|
156
156
|
"no-mixed-spaces-and-tabs": 0,
|
|
157
|
+
"no-duplicate-imports": 0,
|
|
157
158
|
quotes: [ERROR, `backtick`],
|
|
158
159
|
} satisfies Linter.Config[`rules`]
|
|
159
160
|
|
|
160
161
|
const configs: Linter.Config[] = [
|
|
161
|
-
PreactConfig,
|
|
162
|
+
...PreactConfig,
|
|
162
163
|
{
|
|
163
164
|
ignores: [`**/dist/**`, `**/gen/**`, `**/node_modules/**`],
|
|
164
165
|
},
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// eslint-disable-next-line quotes
|
|
2
|
+
declare module "eslint-plugin-import-x" {
|
|
3
|
+
import type { ESLint } from "eslint"
|
|
4
|
+
|
|
5
|
+
const plugin: ESLint.Plugin
|
|
6
|
+
export = plugin
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line quotes
|
|
10
|
+
declare module "eslint-plugin-simple-import-sort" {
|
|
11
|
+
import type { ESLint } from "eslint"
|
|
12
|
+
|
|
13
|
+
const plugin: ESLint.Plugin
|
|
14
|
+
export = plugin
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line quotes
|
|
18
|
+
declare module "@typescript-eslint/eslint-plugin" {
|
|
19
|
+
import type { ESLint } from "eslint"
|
|
20
|
+
|
|
21
|
+
const plugin: ESLint.Plugin
|
|
22
|
+
export = plugin
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line quotes
|
|
26
|
+
declare module "eslint-config-preact" {
|
|
27
|
+
import type { Linter } from "eslint"
|
|
28
|
+
|
|
29
|
+
const configs: Linter.Config[]
|
|
30
|
+
export = configs
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules/vite/bin/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules/vite/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules/vite/bin/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules/vite/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/vite@7.1.12_@types+node@24.9.2_jiti@2.6.1_lightningcss@1.30.2_sass-embedded@1.93.3_sass@1.93.3_terser@5.44.0_yaml@2.8.1/node_modules:/home/runner/work/wayforge/wayforge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../vite/bin/vite.js" "$@"
|
|
21
|
+
fi
|