create-jolly-roger 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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ import * as p from '@clack/prompts';
3
+ import { bgCyan, black, green, red } from 'kolorist';
4
+ import { downloadTemplate } from 'giget';
5
+ import pkg from '../package.json' with { type: 'json' };
6
+ async function main() {
7
+ p.intro(`${bgCyan(black(pkg.name))}`);
8
+ // 1. Get Project Name (from args or prompt)
9
+ let projectName = process.argv[2];
10
+ if (!projectName) {
11
+ projectName = (await p.text({
12
+ message: 'Where should we create your project?',
13
+ placeholder: './my-dapp',
14
+ validate: (value) => {
15
+ if (!value)
16
+ return 'Please enter a path';
17
+ },
18
+ }));
19
+ }
20
+ if (p.isCancel(projectName)) {
21
+ p.cancel('Operation cancelled.');
22
+ process.exit(0);
23
+ }
24
+ const templates = [
25
+ {
26
+ value: 'gh:wighawag/jolly-roger',
27
+ label: 'Build a fully decentralised app with zero backend',
28
+ hint: 'recommended',
29
+ },
30
+ // {
31
+ // value: 'gh:wighawag/jolly-roger-extended',
32
+ // label:
33
+ // 'Build a fully decentralised app with extra optional services for an even better user experience',
34
+ // },
35
+ ];
36
+ let template;
37
+ if (templates.length > 1) {
38
+ // 2. Select Template
39
+ template = await p.select({
40
+ message: 'Pick a starter template',
41
+ options: templates,
42
+ });
43
+ if (p.isCancel(template)) {
44
+ p.cancel('Operation cancelled.');
45
+ process.exit(0);
46
+ }
47
+ }
48
+ else {
49
+ template = templates[0].value;
50
+ }
51
+ // 3. Download using Giget
52
+ const s = p.spinner();
53
+ s.start(`Downloading template to ${projectName}...`);
54
+ try {
55
+ const { dir } = await downloadTemplate(template, {
56
+ dir: projectName,
57
+ force: true,
58
+ // install: true, // Optional: auto-runs npm/pnpm install via nypm
59
+ });
60
+ s.stop(`Template downloaded to ${green(dir)}`);
61
+ }
62
+ catch (err) {
63
+ s.stop('Download failed');
64
+ p.log.error(red(err.message));
65
+ process.exit(1);
66
+ }
67
+ // 4. Final Instructions
68
+ const nextSteps = `cd ${projectName}\npnpm install\npnpm run dev`;
69
+ p.note(nextSteps, 'Next steps:');
70
+ p.outro(`Done! Happy coding.`);
71
+ }
72
+ main().catch((err) => {
73
+ p.log.error(err.message);
74
+ process.exit(1);
75
+ });
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAC;AACvC,OAAO,GAAG,MAAM,iBAAiB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAEtD,KAAK,UAAU,IAAI;IAClB,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAEtC,4CAA4C;IAC5C,IAAI,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAElC,IAAI,CAAC,WAAW,EAAE,CAAC;QAClB,WAAW,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,sCAAsC;YAC/C,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBACnB,IAAI,CAAC,KAAK;oBAAE,OAAO,qBAAqB,CAAC;YAC1C,CAAC;SACD,CAAC,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,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC1B,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,wBAAwB;IACxB,MAAM,SAAS,GAAG,MAAM,WAAW,8BAA8B,CAAC;IAClE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACjC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAChC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACpB,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,27 +1,41 @@
1
1
  {
2
2
  "name": "create-jolly-roger",
3
- "description": "Create a barebone decentralised app. Zero reliance on any server. Using any EVM blockchain as backend.",
4
- "version": "0.0.1",
5
- "author": "wighawag <wighawag@gmail.com>",
6
- "scripts": {
7
- "build": "tsup src/cli.ts --minify",
8
- "clean": "shx rm -rf lib",
9
- "dev": "tsup src/cli.ts --watch",
10
- "prepublishOnly": "npm run clean && npm run build"
3
+ "version": "0.0.2",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
11
13
  },
12
- "bin": "dist/cli.js",
13
14
  "files": [
14
15
  "dist",
15
- "templates"
16
+ "src"
16
17
  ],
18
+ "dependencies": {
19
+ "@clack/prompts": "^1.1.0",
20
+ "giget": "^3.1.2",
21
+ "kolorist": "^1.8.0"
22
+ },
17
23
  "devDependencies": {
18
- "@types/node": "^17.0.29",
19
- "shx": "^0.3.4",
20
- "tsup": "^5.12.1",
21
- "typescript": "^4.6.3"
24
+ "@types/node": "^25.2.0",
25
+ "as-soon": "^0.1.5",
26
+ "cross-env": "^10.1.0",
27
+ "prettier": "^3.8.0",
28
+ "tsx": "^4.21.0",
29
+ "typescript": "^5.3.3",
30
+ "vitest": "^4.0.18"
22
31
  },
23
- "license": "MIT",
24
- "dependencies": {
25
- "create-create-app": "^7.3.0"
32
+ "scripts": {
33
+ "format": "prettier --write .",
34
+ "format:check": "prettier --check .",
35
+ "build": "tsc",
36
+ "dev": "as-soon -w src pnpm build",
37
+ "demo": "tsx src/index.ts",
38
+ "test": "vitest run",
39
+ "test:watch": "vitest"
26
40
  }
27
- }
41
+ }
package/src/index.ts ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ import * as p from '@clack/prompts';
3
+ import {bgCyan, black, green, red} from 'kolorist';
4
+ import {downloadTemplate} from 'giget';
5
+ import pkg from '../package.json' with {type: 'json'};
6
+
7
+ async function main() {
8
+ p.intro(`${bgCyan(black(pkg.name))}`);
9
+
10
+ // 1. Get Project Name (from args or prompt)
11
+ let projectName = process.argv[2];
12
+
13
+ if (!projectName) {
14
+ projectName = (await p.text({
15
+ message: 'Where should we create your project?',
16
+ placeholder: './my-dapp',
17
+ validate: (value) => {
18
+ if (!value) return 'Please enter a path';
19
+ },
20
+ })) as string;
21
+ }
22
+
23
+ if (p.isCancel(projectName)) {
24
+ p.cancel('Operation cancelled.');
25
+ process.exit(0);
26
+ }
27
+
28
+ const templates = [
29
+ {
30
+ value: 'gh:wighawag/jolly-roger',
31
+ label: 'Build a fully decentralised app with zero backend',
32
+ hint: 'recommended',
33
+ },
34
+ // {
35
+ // value: 'gh:wighawag/jolly-roger-extended',
36
+ // label:
37
+ // 'Build a fully decentralised app with extra optional services for an even better user experience',
38
+ // },
39
+ ];
40
+
41
+ let template: string | Symbol;
42
+ if (templates.length > 1) {
43
+ // 2. Select Template
44
+ template = await p.select({
45
+ message: 'Pick a starter template',
46
+ options: templates,
47
+ });
48
+
49
+ if (p.isCancel(template)) {
50
+ p.cancel('Operation cancelled.');
51
+ process.exit(0);
52
+ }
53
+ } else {
54
+ template = templates[0].value;
55
+ }
56
+
57
+ // 3. Download using Giget
58
+ const s = p.spinner();
59
+ s.start(`Downloading template to ${projectName}...`);
60
+
61
+ try {
62
+ const {dir} = await downloadTemplate(template as string, {
63
+ dir: projectName,
64
+ force: true,
65
+ // install: true, // Optional: auto-runs npm/pnpm install via nypm
66
+ });
67
+
68
+ s.stop(`Template downloaded to ${green(dir)}`);
69
+ } catch (err: any) {
70
+ s.stop('Download failed');
71
+ p.log.error(red(err.message));
72
+ process.exit(1);
73
+ }
74
+
75
+ // 4. Final Instructions
76
+ const nextSteps = `cd ${projectName}\npnpm install\npnpm run dev`;
77
+ p.note(nextSteps, 'Next steps:');
78
+ p.outro(`Done! Happy coding.`);
79
+ }
80
+
81
+ main().catch((err) => {
82
+ p.log.error(err.message);
83
+ process.exit(1);
84
+ });
package/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2023 wighawag <wighawag@gmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19
- OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Create Jolly Roger
2
-
3
- Create a barebone decentralised app. Zero reliance on any server. Using any EVM blockchain as backend.
4
-
5
- > created by [create-create-app](https://github.com/uetchy/create-create-app).
6
-
7
- ## Usage
8
-
9
- ```bash
10
- npx create-jolly-roger <name>
11
- ```
12
-
13
- ## Template string reference
14
-
15
- > Don't forget to remove this before publishing your package!
16
-
17
- - {{name}} => create-jolly-roger
18
- - {{upper name}} => CREATE-JOLLY-ROGER
19
- - {{lower name}} => create-jolly-roger
20
- - {{capital name}} => CreateJollyRoger
21
- - {{capital name space=true}} => Create Jolly Roger
22
- - {{camel name}} => createJollyRoger
23
- - {{snake name}} => create_jolly_roger
24
- - {{kebab name}} => create-jolly-roger
25
- - {{space name}} => create jolly roger
26
- - {{uuid}} => c747dc39-ef89-43da-ab76-b57a053a68d5
27
- - {{upper (uuid)}} => 01AD8D86-A9E5-4A28-8736-42BFDE0A506B
28
- - {{description}} => Create a barebone decentralised app. Zero reliance on any server. Using any EVM blockchain as backend.
29
- - {{author}} => wighawag
30
- - {{email}} => wighawag@gmail.com
31
- - {{contact}} => wighawag <wighawag@gmail.com>
32
- - {{license}} => MIT
33
- - {{year}} => 2023
34
- - {{custom}} => (undefined until it is defined in `extra` field in `create` function arguments)
35
-
36
- See https://github.com/uetchy/create-create-app#template for the further details.
package/dist/cli.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";var e=require("create-create-app"),o=require("path"),r=(0,o.resolve)(__dirname,"..","templates"),c=`
3
- This is a caveat!
4
- You can change this in \`src/cli.ts\`.
5
- `;(0,e.create)("create-jolly-roger",{templateRoot:r,extra:{architecture:{type:"list",describe:"choose your fave os",choices:["macOS","Windows","Linux"],prompt:"if-no-arg"}},after:({answers:t})=>console.log(`Ok you chose ${t.architecture}.`),caveat:c});
@@ -1,3 +0,0 @@
1
- # {{name}}
2
-
3
- {{description}}