create-feli 0.1.10

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/README.md ADDED
@@ -0,0 +1,48 @@
1
+ create-vag
2
+ ==========
3
+
4
+
5
+ Presentation
6
+ ------------
7
+
8
+ *create-vag* is the *initializer* used by *npm* for creating a new [vag](https://github.com/charlyoleg2/vag) repository. It contains the *command line interface* application called by `npm create vag@latest`.
9
+
10
+
11
+ Links
12
+ -----
13
+
14
+ - [sources](https://github.com/charlyoleg2/create-vag)
15
+ - [pkg](https://www.npmjs.com/package/create-vag)
16
+
17
+
18
+ Requirements
19
+ ------------
20
+
21
+ - [node](https://nodejs.org) > 20.10.0
22
+ - [npm](https://docs.npmjs.com/cli) > 10.5.0
23
+
24
+
25
+ Usage
26
+ -----
27
+
28
+ *create-vag* is not intended to be installed directly but rather used via one of the following commands:
29
+
30
+ ```bash
31
+ npm create vag@latest
32
+ npm create vag@latest projAbc
33
+ npm init vag@latest projAbc
34
+ npm exec create-vag@latest projAbc
35
+ npx create-vag@latest projAbc
36
+ ```
37
+
38
+ Dev
39
+ ---
40
+
41
+ ```bash
42
+ git clone https://github.com/charlyoleg2/create-vag
43
+ cd create-vag
44
+ npm install
45
+ npm run ci
46
+ npm run run
47
+ ```
48
+
@@ -0,0 +1,281 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/create-feli-cli.ts
4
+ import * as prom from "@clack/prompts";
5
+ import chalk from "chalk";
6
+
7
+ // package.json
8
+ var package_default = {
9
+ name: "create-feli",
10
+ version: "0.1.10",
11
+ description: "The npm-initializer for creating a new feli package",
12
+ private: false,
13
+ repository: {
14
+ type: "git",
15
+ url: "git+https://github.com/charlyoleg2/feli_mono.git"
16
+ },
17
+ homepage: "https://www.npmjs.com/package/create-feli",
18
+ author: "charlyoleg",
19
+ license: "ISC",
20
+ keywords: [
21
+ "front-end only",
22
+ "locally installed",
23
+ "web-UI deployment",
24
+ "feli"
25
+ ],
26
+ type: "module",
27
+ exports: {
28
+ ".": {
29
+ types: "./dist/create-feli-api.d.ts",
30
+ default: "./dist/create-feli-api.js"
31
+ }
32
+ },
33
+ bin: {
34
+ "create-feli": "dist/create-feli-cli.js"
35
+ },
36
+ files: [
37
+ "dist/create-feli-cli.js",
38
+ "dist/template/",
39
+ "!dist/**/*.map",
40
+ "!dist/**/*.spec.*"
41
+ ],
42
+ tsup: {
43
+ entry: [
44
+ "src/create-feli-api.ts",
45
+ "src/create-feli-ref.ts",
46
+ "src/create-feli-cli.ts"
47
+ ],
48
+ format: "esm",
49
+ splitting: false,
50
+ dts: false,
51
+ sourcemap: false,
52
+ clean: true
53
+ },
54
+ prettier: {
55
+ useTabs: true,
56
+ singleQuote: true,
57
+ trailingComma: "none",
58
+ printWidth: 100,
59
+ plugins: [],
60
+ overrides: []
61
+ },
62
+ scripts: {
63
+ dev: "tsup --watch",
64
+ build: "tsup",
65
+ check: "tsc --noEmit",
66
+ pretty: "prettier --check .",
67
+ format: "prettier --write .",
68
+ lint: "eslint .",
69
+ "test:unit": "vitest",
70
+ "test:unit:once": "vitest --run",
71
+ copy_template: "shx cp -r template dist/",
72
+ cleanCopy_template: "run-s clean:template copy_template",
73
+ ci: "run-s check build pretty lint test:unit:once cleanCopy_template",
74
+ run: "dist/create-feli-cli.js",
75
+ "run:ref": "dist/create-feli-ref.js tmp2",
76
+ "run:diff": "diff -rq tmp tmp2",
77
+ "run:check": "run-s run:ref run:diff",
78
+ cycle: "run-s clean ci run",
79
+ "clean:template": "shx rm -fr dist/template",
80
+ "clean:build": "shx rm -fr dist node_modules",
81
+ "clean:output": "shx rm -fr tmp tmp2",
82
+ clean: "run-s clean:build clean:output"
83
+ },
84
+ dependencies: {
85
+ "@clack/prompts": "^0.11.0",
86
+ chalk: "^5.3.0",
87
+ handlebars: "^4.7.8"
88
+ },
89
+ devDependencies: {
90
+ "@eslint/js": "^9.28.0",
91
+ "@types/eslint__js": "^8.42.3",
92
+ "@types/node": "^24.0.7",
93
+ eslint: "^9.28.0",
94
+ "eslint-config-prettier": "^10.1.5",
95
+ "npm-run-all": "^4.1.5",
96
+ prettier: "^3.5.3",
97
+ shx: "^0.4.0",
98
+ tsup: "^8.5.0",
99
+ typescript: "^5.8.3",
100
+ "typescript-eslint": "^8.33.1",
101
+ vitest: "^3.2.2"
102
+ }
103
+ };
104
+
105
+ // src/create-feli-cli.ts
106
+ import { setTimeout as sleep2 } from "timers/promises";
107
+
108
+ // src/create-feli-api.ts
109
+ import { setTimeout as sleep } from "timers/promises";
110
+ import { readFile, writeFile, access, mkdir } from "fs/promises";
111
+ import { dirname, extname } from "path";
112
+ import Handlebars from "handlebars";
113
+
114
+ // src/create-feli-common.ts
115
+ function firstLetterCapital(str) {
116
+ const rStr = str.charAt(0).toUpperCase() + str.slice(1);
117
+ return rStr;
118
+ }
119
+ function underline(str) {
120
+ const strLen = str.length;
121
+ const rStr = "=".repeat(strLen);
122
+ return rStr;
123
+ }
124
+ function prefixOutputPath() {
125
+ let rPreDir = ".";
126
+ const scriptDir = new URL("", import.meta.url).toString();
127
+ const regex = new RegExp("/node_modules/");
128
+ if (!regex.test(scriptDir)) {
129
+ rPreDir = "./tmp";
130
+ }
131
+ return rPreDir;
132
+ }
133
+
134
+ // src/create-feli-list.ts
135
+ var template_file_list = [
136
+ ".editorconfig",
137
+ ".gitignore",
138
+ "package.json",
139
+ "README.md",
140
+ "{{projName}}_repos.yml"
141
+ ];
142
+
143
+ // src/create-feli-api.ts
144
+ async function createMissingDir(outPath) {
145
+ const outDir = dirname(outPath);
146
+ try {
147
+ await access(outDir);
148
+ } catch (err) {
149
+ if (err) {
150
+ await mkdir(outDir, { recursive: true });
151
+ }
152
+ }
153
+ }
154
+ function isFileBinary(fpath) {
155
+ const binaryExts = /* @__PURE__ */ new Set([".png"]);
156
+ const infileExt = extname(fpath.toString());
157
+ const rBool = binaryExts.has(infileExt);
158
+ return rBool;
159
+ }
160
+ async function oneFile(onePath, cfg2, preDir2) {
161
+ try {
162
+ const onePathIn = Handlebars.compile(onePath)({
163
+ projName: "projAbc",
164
+ repoName: "projAbc-uis"
165
+ });
166
+ const onePathOut = Handlebars.compile(onePath)(cfg2);
167
+ const fileIn1 = new URL(`./template/${onePathIn}.handlebars`, import.meta.url);
168
+ const fileIn2 = new URL(`./template/${onePathIn}`, import.meta.url);
169
+ let fileBin = false;
170
+ let fileStr2 = "";
171
+ const outPath = `${preDir2}/${cfg2.repoName}/${onePathOut}`;
172
+ try {
173
+ await access(fileIn1);
174
+ try {
175
+ const fileStr1 = await readFile(fileIn1, { encoding: "utf8" });
176
+ const templateStr = Handlebars.compile(fileStr1);
177
+ fileStr2 = templateStr(cfg2);
178
+ } catch (err) {
179
+ console.log(`err392: error while processing ${fileIn1.toString()}`);
180
+ console.log(err);
181
+ }
182
+ } catch (err) {
183
+ if (err) {
184
+ if (isFileBinary(fileIn2)) {
185
+ fileBin = true;
186
+ const fileBuffer2 = await readFile(fileIn2);
187
+ await createMissingDir(outPath);
188
+ await writeFile(outPath, fileBuffer2);
189
+ } else {
190
+ fileStr2 = await readFile(fileIn2, { encoding: "utf8" });
191
+ }
192
+ }
193
+ }
194
+ if (!fileBin) {
195
+ await createMissingDir(outPath);
196
+ await writeFile(outPath, fileStr2);
197
+ }
198
+ } catch (err) {
199
+ console.log(`err213: error while generating file ${onePath}`);
200
+ console.error(err);
201
+ throw `err214: error with path ${onePath}`;
202
+ }
203
+ }
204
+ async function generate_boirlerplate(cfg12, preDir2) {
205
+ console.log(`Boilerplate with:
206
+ project name : ${cfg12.projName}
207
+ repository name : ${cfg12.repoName}`);
208
+ const cfg2 = {
209
+ projName: cfg12.projName,
210
+ ProjName: firstLetterCapital(cfg12.projName),
211
+ ProjNameUnderline: underline(cfg12.projName),
212
+ repoName: cfg12.repoName,
213
+ RepoName: firstLetterCapital(cfg12.repoName),
214
+ RepoNameUnderline: underline(cfg12.repoName)
215
+ };
216
+ for (const fpath of template_file_list) {
217
+ await oneFile(fpath, cfg2, preDir2);
218
+ }
219
+ console.log(`generate ${template_file_list.length} files in ${preDir2}/${cfg12.repoName}/`);
220
+ await sleep(100);
221
+ const rResp = {
222
+ vim: `vim ${cfg12.projName}_repos.yml`
223
+ };
224
+ return rResp;
225
+ }
226
+
227
+ // src/create-feli-cli.ts
228
+ var firstMsg = `Create a new ${chalk.italic("feli-top-repo")} with ${chalk.italic(package_default.name)} version ${chalk.italic(package_default.version)}`;
229
+ console.log(firstMsg);
230
+ var projName = process.argv[2] || "blabla";
231
+ var argN = process.argv.length - 2;
232
+ if (argN > 1) {
233
+ console.log(`warn376: ${argN} arguments provided but only one supported!`);
234
+ }
235
+ prom.intro(chalk.inverse(" Your new feli-top-repo "));
236
+ var pCfg = await prom.group(
237
+ {
238
+ projName: () => prom.text({
239
+ message: "Name of the project?",
240
+ initialValue: `${projName}`
241
+ //placeholder: `${projName}`
242
+ }),
243
+ repoName: () => prom.text({
244
+ message: "Name of the top-repository?",
245
+ initialValue: `${projName}_uis`
246
+ //placeholder: `${projName}_uis`
247
+ })
248
+ },
249
+ {
250
+ onCancel: () => {
251
+ prom.cancel("Operation aborted!");
252
+ process.exit(0);
253
+ }
254
+ }
255
+ );
256
+ prom.outro("Your new feli-top-repository will be boilerplated!");
257
+ var cfg1 = {
258
+ projName: pCfg.projName,
259
+ repoName: pCfg.repoName
260
+ };
261
+ var preDir = prefixOutputPath();
262
+ var resp = await generate_boirlerplate(cfg1, preDir);
263
+ await sleep2(100);
264
+ function styl(str) {
265
+ const rStr = chalk.bold.cyan(str);
266
+ return rStr;
267
+ }
268
+ var lastMsg = `
269
+ Next steps:
270
+ 1: ${styl(`cd ${pCfg.repoName}`)}
271
+ 2: ${styl(`npm install`)}
272
+ 3: ${styl('git init && git add -A && git commit -m "Initial commit"')} (optional)
273
+ 4: ${styl(`${resp.vim}`)} (optional)
274
+ 5: ${styl(`npm run`)}
275
+ 6: ${styl(`npm run vag-list`)}
276
+ 7: ${styl(`npm run vag-clone`)}
277
+ 8: ${styl(`npm run vag-pull`)}
278
+ 9: ${styl(`npm run vag-status`)}
279
+ 10: ${styl(`npm run vag-diff`)}
280
+ `;
281
+ console.log(lastMsg);
@@ -0,0 +1,23 @@
1
+ # .editorconfig of vag-root
2
+ # EditorConfig is awesome: https://EditorConfig.org
3
+ # don't forget the vim-plugin for it
4
+
5
+ # top-most EditorConfig file
6
+ root = true
7
+
8
+ # Unix-style newlines with a newline ending every file
9
+ [*]
10
+ indent_style = tab
11
+ indent_size = 4
12
+ end_of_line = lf
13
+ charset = utf-8
14
+ trim_trailing_whitespace = true
15
+ insert_final_newline = true
16
+
17
+ # Tab indentation (no size specified)
18
+ [Makefile]
19
+ indent_style = tab
20
+
21
+ # yaml indentation with spaces
22
+ [*.{yml,yaml}]
23
+ indent_style = space
@@ -0,0 +1,6 @@
1
+ # .gitignore of vag-root
2
+ node_modules
3
+ build
4
+ dist
5
+ tmp
6
+ /repos/
@@ -0,0 +1,30 @@
1
+ {{ProjName}}\_vag
2
+ {{{ProjNameUnderline}}}=====
3
+
4
+
5
+ Presentation
6
+ ------------
7
+
8
+ *{{projName}}\_vag* is the top-repo of the *{{ProjName}}* ecosystem. It just points to other repositories.
9
+
10
+ Using [vag\_tools](https://www.npmjs.com/package/vag_tools), it clones the following repositories:
11
+
12
+ - {{projName}}
13
+ - create-{{projName}}
14
+ - {{projName}}\_vag
15
+
16
+
17
+ Getting started
18
+ ---------------
19
+
20
+ ```bash
21
+ git clone https://github.com/MYNAME/{{projName}}_vag
22
+ cd {{projName}}_vag
23
+ npm i
24
+ npm run
25
+ npm run vag-clone
26
+ npm run vag-pull
27
+ ls -la repos
28
+ npx vag --help
29
+ ```
30
+
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "{{projName}}_vag",
3
+ "version": "0.0.1",
4
+ "description": "top-repo that points to the other {{projName}} repositories",
5
+ "private": true,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/MYNAME/{{projName}}_vag.git"
9
+ },
10
+ "homepage": "https://github.com/MYNAME/{{projName}}_vag#readme",
11
+ "author": "MYNAME",
12
+ "license": "ISC",
13
+ "keywords": [
14
+ "{{projName}}",
15
+ "vag"
16
+ ],
17
+ "type": "module",
18
+ "main": "index.js",
19
+ "scripts": {
20
+ "vag-list": "vag --importYaml={{projName}}_repos.yml list",
21
+ "vag-clone": "vag --importYaml={{projName}}_repos.yml clone",
22
+ "vag-status": "vag --importYaml={{projName}}_repos.yml --only_configured status",
23
+ "vag-diff": "vag --importYaml={{projName}}_repos.yml --only_configured diff",
24
+ "vag-branch": "vag branch",
25
+ "vag-remote": "vag remote",
26
+ "vag-pull": "vag pull",
27
+ "vag-push": "vag push",
28
+ "vag-verify": "vag verify --importYaml={{projName}}_repos.yml",
29
+ "vag-versions": "vag versions",
30
+ "test": "echo \"Error: no test specified\" && exit 1"
31
+ },
32
+ "devDependencies": {
33
+ "vag_tools": "^0.1.0"
34
+ }
35
+ }
@@ -0,0 +1,13 @@
1
+ # {{projName}}_repos.yml
2
+
3
+ repositories:
4
+ repos/{{projName}}:
5
+ type: git
6
+ url: git@github.com:MYNAME/{{projName}}.git
7
+ version: main
8
+ repos/create-{{projName}}:
9
+ url: git@github.com:MYNAME/create-{{projName}}.git
10
+ version: main
11
+ repos/{{projName}}_vag:
12
+ url: git@github.com:MYNAME/{{projName}}_vag.git
13
+ version: main
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "create-feli",
3
+ "version": "0.1.10",
4
+ "description": "The npm-initializer for creating a new feli package",
5
+ "private": false,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/charlyoleg2/feli_mono.git"
9
+ },
10
+ "homepage": "https://www.npmjs.com/package/create-feli",
11
+ "author": "charlyoleg",
12
+ "license": "ISC",
13
+ "keywords": [
14
+ "front-end only",
15
+ "locally installed",
16
+ "web-UI deployment",
17
+ "feli"
18
+ ],
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/create-feli-api.d.ts",
23
+ "default": "./dist/create-feli-api.js"
24
+ }
25
+ },
26
+ "bin": {
27
+ "create-feli": "dist/create-feli-cli.js"
28
+ },
29
+ "files": [
30
+ "dist/create-feli-cli.js",
31
+ "dist/template/",
32
+ "!dist/**/*.map",
33
+ "!dist/**/*.spec.*"
34
+ ],
35
+ "tsup": {
36
+ "entry": [
37
+ "src/create-feli-api.ts",
38
+ "src/create-feli-ref.ts",
39
+ "src/create-feli-cli.ts"
40
+ ],
41
+ "format": "esm",
42
+ "splitting": false,
43
+ "dts": false,
44
+ "sourcemap": false,
45
+ "clean": true
46
+ },
47
+ "prettier": {
48
+ "useTabs": true,
49
+ "singleQuote": true,
50
+ "trailingComma": "none",
51
+ "printWidth": 100,
52
+ "plugins": [],
53
+ "overrides": []
54
+ },
55
+ "scripts": {
56
+ "dev": "tsup --watch",
57
+ "build": "tsup",
58
+ "check": "tsc --noEmit",
59
+ "pretty": "prettier --check .",
60
+ "format": "prettier --write .",
61
+ "lint": "eslint .",
62
+ "test:unit": "vitest",
63
+ "test:unit:once": "vitest --run",
64
+ "copy_template": "shx cp -r template dist/",
65
+ "cleanCopy_template": "run-s clean:template copy_template",
66
+ "ci": "run-s check build pretty lint test:unit:once cleanCopy_template",
67
+ "run": "dist/create-feli-cli.js",
68
+ "run:ref": "dist/create-feli-ref.js tmp2",
69
+ "run:diff": "diff -rq tmp tmp2",
70
+ "run:check": "run-s run:ref run:diff",
71
+ "cycle": "run-s clean ci run",
72
+ "clean:template": "shx rm -fr dist/template",
73
+ "clean:build": "shx rm -fr dist node_modules",
74
+ "clean:output": "shx rm -fr tmp tmp2",
75
+ "clean": "run-s clean:build clean:output"
76
+ },
77
+ "dependencies": {
78
+ "@clack/prompts": "^0.11.0",
79
+ "chalk": "^5.3.0",
80
+ "handlebars": "^4.7.8"
81
+ },
82
+ "devDependencies": {
83
+ "@eslint/js": "^9.28.0",
84
+ "@types/eslint__js": "^8.42.3",
85
+ "@types/node": "^24.0.7",
86
+ "eslint": "^9.28.0",
87
+ "eslint-config-prettier": "^10.1.5",
88
+ "npm-run-all": "^4.1.5",
89
+ "prettier": "^3.5.3",
90
+ "shx": "^0.4.0",
91
+ "tsup": "^8.5.0",
92
+ "typescript": "^5.8.3",
93
+ "typescript-eslint": "^8.33.1",
94
+ "vitest": "^3.2.2"
95
+ }
96
+ }