jetup 0.0.1
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/LICENSE +21 -0
- package/README.md +54 -0
- package/config/config.json +55 -0
- package/dist/app.d.ts +21 -0
- package/dist/app.js +116 -0
- package/dist/app.js.map +1 -0
- package/dist/framework/base/base.d.ts +16 -0
- package/dist/framework/base/base.js +72 -0
- package/dist/framework/base/base.js.map +1 -0
- package/dist/framework/base/index.d.ts +3 -0
- package/dist/framework/base/index.js +7 -0
- package/dist/framework/base/index.js.map +1 -0
- package/dist/framework/base/named.d.ts +6 -0
- package/dist/framework/base/named.js +16 -0
- package/dist/framework/base/named.js.map +1 -0
- package/dist/framework/base/registry.d.ts +12 -0
- package/dist/framework/base/registry.js +36 -0
- package/dist/framework/base/registry.js.map +1 -0
- package/dist/framework/config/config.d.ts +2 -0
- package/dist/framework/config/config.js +19 -0
- package/dist/framework/config/config.js.map +1 -0
- package/dist/framework/config/default.json +5 -0
- package/dist/framework/config/index.d.ts +8 -0
- package/dist/framework/config/index.js +29 -0
- package/dist/framework/config/index.js.map +1 -0
- package/dist/framework/index.d.ts +3 -0
- package/dist/framework/index.js +7 -0
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/logger/index.d.ts +27 -0
- package/dist/framework/logger/index.js +80 -0
- package/dist/framework/logger/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/eslint/index.d.ts +5 -0
- package/dist/modules/eslint/index.js +18 -0
- package/dist/modules/eslint/index.js.map +1 -0
- package/dist/modules/husky/index.d.ts +6 -0
- package/dist/modules/husky/index.js +27 -0
- package/dist/modules/husky/index.js.map +1 -0
- package/dist/modules/husky/pre-commit +1 -0
- package/dist/modules/index.d.ts +9 -0
- package/dist/modules/index.js +13 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/jest/_setup.js +5 -0
- package/dist/modules/jest/index.d.ts +6 -0
- package/dist/modules/jest/index.js +37 -0
- package/dist/modules/jest/index.js.map +1 -0
- package/dist/modules/jest/jest.config.js +40 -0
- package/dist/modules/lint-staged/.lintstagedrc.json +5 -0
- package/dist/modules/lint-staged/index.d.ts +6 -0
- package/dist/modules/lint-staged/index.js +23 -0
- package/dist/modules/lint-staged/index.js.map +1 -0
- package/dist/modules/package/index.d.ts +6 -0
- package/dist/modules/package/index.js +19 -0
- package/dist/modules/package/index.js.map +1 -0
- package/dist/modules/package/package.json +17 -0
- package/dist/modules/prettier/.prettierignore +37 -0
- package/dist/modules/prettier/.prettierrc +7 -0
- package/dist/modules/prettier/index.d.ts +6 -0
- package/dist/modules/prettier/index.js +30 -0
- package/dist/modules/prettier/index.js.map +1 -0
- package/dist/modules/project/index.d.ts +5 -0
- package/dist/modules/project/index.js +23 -0
- package/dist/modules/project/index.js.map +1 -0
- package/dist/modules/src/index.d.ts +6 -0
- package/dist/modules/src/index.js +23 -0
- package/dist/modules/src/index.js.map +1 -0
- package/dist/modules/typescript/index.d.ts +5 -0
- package/dist/modules/typescript/index.js +22 -0
- package/dist/modules/typescript/index.js.map +1 -0
- package/dist/modules/typescript/tsconfig.json +26 -0
- package/dist/presets/base.d.ts +5 -0
- package/dist/presets/base.js +14 -0
- package/dist/presets/base.js.map +1 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/index.js +5 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/ts.d.ts +5 -0
- package/dist/presets/ts.js +23 -0
- package/dist/presets/ts.js.map +1 -0
- package/dist/types/config.d.ts +4 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cmd.d.ts +3 -0
- package/dist/utils/cmd.js +110 -0
- package/dist/utils/cmd.js.map +1 -0
- package/dist/utils/cwd.d.ts +4 -0
- package/dist/utils/cwd.js +11 -0
- package/dist/utils/cwd.js.map +1 -0
- package/dist/utils/files.d.ts +9 -0
- package/dist/utils/files.js +83 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +43 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/package.d.ts +2 -0
- package/dist/utils/package.js +18 -0
- package/dist/utils/package.js.map +1 -0
- package/lib/clean.js +12 -0
- package/lib/post-build.js +59 -0
- package/package.json +86 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasePresets = void 0;
|
|
4
|
+
class BasePresets {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.modules = [];
|
|
7
|
+
}
|
|
8
|
+
get name() {
|
|
9
|
+
const name = this.constructor.name.replace('Presets', '');
|
|
10
|
+
return name.charAt(0).toLowerCase() + name.substring(1);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.BasePresets = BasePresets;
|
|
14
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/presets/base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,WAAW;IAAjC;QACQ,YAAO,GAAiB,EAAE,CAAC;IAMnC,CAAC;IAJA,IAAW,IAAI;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;CACD;AAPD,kCAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":";;;AAAA,+CAAqB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EsLintModule, HuskyModule, JestModule, LintStagedModule, PackageModule, PrettierModule, ProjectModule, SrcModule, TypescriptModule } from '../modules';
|
|
2
|
+
import { BasePresets } from './base';
|
|
3
|
+
export declare class TsPresets extends BasePresets {
|
|
4
|
+
modules: (EsLintModule | HuskyModule | JestModule | LintStagedModule | PackageModule | PrettierModule | ProjectModule | SrcModule | TypescriptModule)[];
|
|
5
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsPresets = void 0;
|
|
4
|
+
const modules_1 = require("../modules");
|
|
5
|
+
const base_1 = require("./base");
|
|
6
|
+
class TsPresets extends base_1.BasePresets {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.modules = [
|
|
10
|
+
new modules_1.ProjectModule(),
|
|
11
|
+
new modules_1.PackageModule(),
|
|
12
|
+
new modules_1.EsLintModule(),
|
|
13
|
+
new modules_1.HuskyModule(),
|
|
14
|
+
new modules_1.JestModule(),
|
|
15
|
+
new modules_1.LintStagedModule(),
|
|
16
|
+
new modules_1.PrettierModule(),
|
|
17
|
+
new modules_1.TypescriptModule(),
|
|
18
|
+
new modules_1.SrcModule(),
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.TsPresets = TsPresets;
|
|
23
|
+
//# sourceMappingURL=ts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts.js","sourceRoot":"","sources":["../../src/presets/ts.ts"],"names":[],"mappings":";;;AAAA,wCAUoB;AACpB,iCAAqC;AAErC,MAAa,SAAU,SAAQ,kBAAW;IAA1C;;QACQ,YAAO,GAAG;YAChB,IAAI,uBAAa,EAAE;YACnB,IAAI,uBAAa,EAAE;YACnB,IAAI,sBAAY,EAAE;YAClB,IAAI,qBAAW,EAAE;YACjB,IAAI,oBAAU,EAAE;YAChB,IAAI,0BAAgB,EAAE;YACtB,IAAI,wBAAc,EAAE;YACpB,IAAI,0BAAgB,EAAE;YACtB,IAAI,mBAAS,EAAE;SACf,CAAC;IACH,CAAC;CAAA;AAZD,8BAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCommand = runCommand;
|
|
4
|
+
exports.runCommandInSilent = runCommandInSilent;
|
|
5
|
+
exports.runCommandInAlternateScreen = runCommandInAlternateScreen;
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const cwd_1 = require("./cwd");
|
|
8
|
+
async function runCommand(command) {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const [cmd, ...args] = command.split(' ');
|
|
11
|
+
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
shell: true,
|
|
14
|
+
cwd: cwd_1.CWD.value,
|
|
15
|
+
});
|
|
16
|
+
child.on('error', err => {
|
|
17
|
+
console.error(`Failed to start command: ${command}`);
|
|
18
|
+
reject(err);
|
|
19
|
+
});
|
|
20
|
+
child.on('close', code => {
|
|
21
|
+
if (code === 0) {
|
|
22
|
+
resolve();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
reject(new Error(`Command "${command}" exited with code ${code}`));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function runCommandInSilent(command) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const [cmd, ...args] = command.split(' ');
|
|
33
|
+
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
34
|
+
stdio: 'ignore',
|
|
35
|
+
cwd: cwd_1.CWD.value,
|
|
36
|
+
});
|
|
37
|
+
child.on('error', err => {
|
|
38
|
+
console.error(`Failed to start command: ${command}`);
|
|
39
|
+
reject(err);
|
|
40
|
+
});
|
|
41
|
+
child.on('close', code => {
|
|
42
|
+
if (code === 0) {
|
|
43
|
+
resolve();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
reject(new Error(`Command "${command}" exited with code ${code}`));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
async function runCommandInAlternateScreen(command) {
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
enterAlternateScreen({ header: `executing:\n${command}` });
|
|
54
|
+
const [cmd, ...args] = command.split(' ');
|
|
55
|
+
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
56
|
+
stdio: 'inherit',
|
|
57
|
+
shell: true,
|
|
58
|
+
cwd: cwd_1.CWD.value,
|
|
59
|
+
});
|
|
60
|
+
child.on('error', err => {
|
|
61
|
+
exitAlternateScreen();
|
|
62
|
+
console.error(`Failed to start command: ${command}`);
|
|
63
|
+
reject(err);
|
|
64
|
+
});
|
|
65
|
+
child.on('close', code => {
|
|
66
|
+
exitAlternateScreen();
|
|
67
|
+
if (code === 0) {
|
|
68
|
+
resolve();
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
reject(new Error(`Command "${command}" exited with code ${code}`));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function enterAlternateScreen(params) {
|
|
77
|
+
process.stdout.write('\x1b[?1049h');
|
|
78
|
+
if (params.title)
|
|
79
|
+
setTerminalTitle(params.title);
|
|
80
|
+
if (params.header)
|
|
81
|
+
drawBoxedTitle(params.header);
|
|
82
|
+
}
|
|
83
|
+
function exitAlternateScreen() {
|
|
84
|
+
process.stdout.write('\x1b[?1049l');
|
|
85
|
+
}
|
|
86
|
+
function setTerminalTitle(title) {
|
|
87
|
+
process.stdout.write(`\x1b]0;${title}\x07`);
|
|
88
|
+
}
|
|
89
|
+
function drawBoxedTitle(title, padding = {}) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const hPadding = (_a = padding.horizontal) !== null && _a !== void 0 ? _a : 5;
|
|
92
|
+
const vPadding = (_b = padding.vertical) !== null && _b !== void 0 ? _b : 1;
|
|
93
|
+
const rawLines = title.split('\n');
|
|
94
|
+
const contentWidth = Math.max(...rawLines.map(line => line.length)) + hPadding * 2;
|
|
95
|
+
const border = '─'.repeat(contentWidth);
|
|
96
|
+
const emptyLine = ' '.repeat(contentWidth);
|
|
97
|
+
const paddedLines = rawLines.map(line => {
|
|
98
|
+
const padded = ' '.repeat(hPadding) + line + ' '.repeat(hPadding);
|
|
99
|
+
return padded.padEnd(contentWidth);
|
|
100
|
+
});
|
|
101
|
+
const allLines = [
|
|
102
|
+
...Array(vPadding).fill(emptyLine),
|
|
103
|
+
...paddedLines,
|
|
104
|
+
...Array(vPadding).fill(emptyLine),
|
|
105
|
+
];
|
|
106
|
+
const boxed = [`╭${border}╮`, ...allLines.map(line => `│${line}│`), `╰${border}╯`];
|
|
107
|
+
console.log(boxed.join('\n'));
|
|
108
|
+
console.log();
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../../src/utils/cmd.ts"],"names":[],"mappings":";;AAUA,gCAuBC;AASD,gDAsBC;AASD,kEA0BC;AAnGD,iDAAsC;AACtC,+BAA4B;AASrB,K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AAC,CAAC;IAE3C,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACvC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG;QAChB,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QAClC,GAAG,WAAW;QACd,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;KAClC,CAAC;IAEF,MAAM,KAAK,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,MAAM,GAAG,CAAC,CAAC;IAEnF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,EAAE,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd.js","sourceRoot":"","sources":["../../src/utils/cwd.ts"],"names":[],"mappings":";;;AAAA,MAAa,GAAG;IAGR,MAAM,CAAC,QAAQ,CAAC,KAAa;QACnC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IACnB,CAAC;;AALF,kBAMC;AALc,SAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Mode } from 'fs';
|
|
2
|
+
export declare function createFolderAndFiles(dirPath: string, files: Record<string, string>): Promise<void>;
|
|
3
|
+
export declare function mergeFolderAndFiles(dirPath: string, files: Record<string, string>): Promise<void>;
|
|
4
|
+
export declare function createOrReplaceFile(filePath: string, content: string): Promise<void>;
|
|
5
|
+
export declare function isFileExists(pattern: string): boolean;
|
|
6
|
+
export declare function isFolderExists(pattern: string): boolean;
|
|
7
|
+
export declare function readFile(...filePath: string[]): string;
|
|
8
|
+
export declare function changeFilePermission(filePath: string, permission: Mode): void;
|
|
9
|
+
export declare function cwd(...segments: string[]): string;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFolderAndFiles = createFolderAndFiles;
|
|
4
|
+
exports.mergeFolderAndFiles = mergeFolderAndFiles;
|
|
5
|
+
exports.createOrReplaceFile = createOrReplaceFile;
|
|
6
|
+
exports.isFileExists = isFileExists;
|
|
7
|
+
exports.isFolderExists = isFolderExists;
|
|
8
|
+
exports.readFile = readFile;
|
|
9
|
+
exports.changeFilePermission = changeFilePermission;
|
|
10
|
+
exports.cwd = cwd;
|
|
11
|
+
const promises_1 = require("fs/promises");
|
|
12
|
+
const fs_1 = require("fs");
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
|
+
const path_1 = require("path");
|
|
15
|
+
const cwd_1 = require("./cwd");
|
|
16
|
+
async function createFolderAndFiles(dirPath, files) {
|
|
17
|
+
if ((0, fs_1.existsSync)(dirPath)) {
|
|
18
|
+
await (0, promises_1.rm)(dirPath, { recursive: true, force: true });
|
|
19
|
+
}
|
|
20
|
+
await (0, promises_1.mkdir)(dirPath, { recursive: true });
|
|
21
|
+
for (const [fileName, content] of Object.entries(files)) {
|
|
22
|
+
const fullPath = (0, path_1.join)(dirPath, fileName);
|
|
23
|
+
await (0, promises_1.writeFile)(fullPath, content);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function mergeFolderAndFiles(dirPath, files) {
|
|
27
|
+
await (0, promises_1.mkdir)(dirPath, { recursive: true });
|
|
28
|
+
for (const [relativeName, content] of Object.entries(files)) {
|
|
29
|
+
const fullPath = (0, path_1.join)(dirPath, relativeName);
|
|
30
|
+
const parentDir = (0, path_1.dirname)(fullPath);
|
|
31
|
+
await (0, promises_1.mkdir)(parentDir, { recursive: true });
|
|
32
|
+
await (0, promises_1.writeFile)(fullPath, content);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async function createOrReplaceFile(filePath, content) {
|
|
36
|
+
const dir = (0, path_1.dirname)(filePath);
|
|
37
|
+
if (!(0, fs_1.existsSync)(dir)) {
|
|
38
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
await (0, promises_1.writeFile)(filePath, content);
|
|
41
|
+
}
|
|
42
|
+
function isFileExists(pattern) {
|
|
43
|
+
const cleanPattern = pattern.replace(/\s+/g, '');
|
|
44
|
+
if (cleanPattern.includes('*')) {
|
|
45
|
+
const matches = (0, glob_1.sync)(cleanPattern, { nodir: true });
|
|
46
|
+
return matches.length > 0;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return (0, fs_1.existsSync)(cleanPattern);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function isFolderExists(pattern) {
|
|
53
|
+
const cleanPattern = pattern.replace(/\s+/g, '');
|
|
54
|
+
if (cleanPattern.includes('*')) {
|
|
55
|
+
const matches = (0, glob_1.sync)(cleanPattern, { nodir: false });
|
|
56
|
+
return matches.some(p => {
|
|
57
|
+
try {
|
|
58
|
+
return (0, fs_1.statSync)(p).isDirectory();
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
try {
|
|
67
|
+
return (0, fs_1.existsSync)(cleanPattern) && (0, fs_1.statSync)(cleanPattern).isDirectory();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function readFile(...filePath) {
|
|
75
|
+
return (0, fs_1.readFileSync)((0, path_1.resolve)(...filePath), { encoding: 'utf-8' });
|
|
76
|
+
}
|
|
77
|
+
function changeFilePermission(filePath, permission) {
|
|
78
|
+
return (0, fs_1.chmodSync)(filePath, permission);
|
|
79
|
+
}
|
|
80
|
+
function cwd(...segments) {
|
|
81
|
+
return (0, path_1.resolve)(cwd_1.CWD.value, ...segments);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/utils/files.ts"],"names":[],"mappings":";;AAqBA,oDAaC;AAiBD,kDAiBC;AAcD,kDAMC;AAiBD,oCAYC;AAmBD,wCAuBC;AAYD,4BAEC;AAYD,oDAEC;AAeD,kBAEC;AA5MD,0CAAmD;AACnD,2BAAyE;AACzE,+BAAwC;AACxC,+BAA8C;AAC9C,+BAA4B;AAiBrB,KAAK,UAAU,oBAAoB,CACzC,OAAe,EACf,KAA6B;IAE7B,IAAI,IAAA,eAAU,EAAC,OAAO,CAAC,EAAE,CAAC;QACzB,MAAM,IAAA,aAAE,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,IAAA,gBAAK,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzC,MAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;AACF,CAAC;AAiBM,KAAK,UAAU,mBAAmB,CACxC,OAAe,EACf,KAA6B;IAG7B,MAAM,IAAA,gBAAK,EAAC,OAAO,EA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: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./cmd"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./files"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./json"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./package"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,kDAAwB;AACxB,iDAAuB;AACvB,oDAA0B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateJson = updateJson;
|
|
4
|
+
exports.hasJsonProperty = hasJsonProperty;
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const promises_1 = require("fs/promises");
|
|
7
|
+
async function updateJson(filePath, updates) {
|
|
8
|
+
try {
|
|
9
|
+
const content = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
10
|
+
const json = JSON.parse(content);
|
|
11
|
+
const updated = { ...json, ...updates };
|
|
12
|
+
await (0, promises_1.writeFile)(filePath, JSON.stringify(updated, null, 2) + '\n');
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(`Failed to update JSON at ${filePath}:`, error);
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function hasJsonProperty(filePath, propertyPath) {
|
|
20
|
+
if (!(0, fs_1.existsSync)(filePath))
|
|
21
|
+
return false;
|
|
22
|
+
const raw = (0, fs_1.readFileSync)(filePath, { encoding: 'utf-8' });
|
|
23
|
+
let obj;
|
|
24
|
+
try {
|
|
25
|
+
obj = JSON.parse(raw);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const keys = propertyPath.split('.');
|
|
31
|
+
let current = obj;
|
|
32
|
+
for (const key of keys) {
|
|
33
|
+
if (current === null ||
|
|
34
|
+
current === undefined ||
|
|
35
|
+
typeof current !== 'object' ||
|
|
36
|
+
!(key in current)) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
current = current[key];
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/utils/json.ts"],"names":[],"mappings":";;AAiBA,gCAaC;AAgBD,0CA2BC;AAzED,2BAA8C;AAC9C,0CAAkD;AAgB3C,KAAK,UAAU,UAAU,CAC/B,QAAgB,EAChB,OAAmB;IAEnB,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;QACtC,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;QACxC,MAAM,IAAA,oBAAS,EAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,4BAA4B,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC;AAgBD,SAAgB,eAAe,CAAC,QAAgB,EAAE,YAAoB;IACrE,IAAI,CAAC,IAAA,eAAU,EAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC1D,IAAI,GAA4B,CAAC;IACjC,IAAI,CAAC;QACJ,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,OAAO,GAA4B,GAAG,CAAC;IAE3C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,IACC,OAAO,KAAK,IAAI;YAChB,OAAO,KAAK,SAAS;YACrB,OAAO,OAAO,KAAK,QAAQ;YAC3B,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,EAChB,CAAC;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,GAAG,CAA4B,CAAC;IACnD,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageInstallDev = packageInstallDev;
|
|
4
|
+
exports.getPackageName = getPackageName;
|
|
5
|
+
const cmd_1 = require("./cmd");
|
|
6
|
+
async function packageInstallDev(packages) {
|
|
7
|
+
await (0, cmd_1.runCommandInSilent)(`npm install --save-dev ${packages}`);
|
|
8
|
+
}
|
|
9
|
+
function getPackageName(pkg) {
|
|
10
|
+
if (pkg.startsWith('@')) {
|
|
11
|
+
const match = pkg.match(/^(@[^/]+\/[^@]+)(?:@.+)?$/);
|
|
12
|
+
return match ? match[1] : pkg;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return pkg.split('@')[0];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/utils/package.ts"],"names":[],"mappings":";;AAYA,8CAEC;AAkBD,wCASC;AAzCD,+BAA2C;AAYpC,KAAK,UAAU,iBAAiB,CAAC,QAAgB;IACvD,MAAM,IAAA,wBAAkB,EAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;AAChE,CAAC;AAkBD,SAAgB,cAAc,CAAC,GAAW;IACzC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAEzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/B,CAAC;SAAM,CAAC;QAEP,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC"}
|
package/lib/clean.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2
|
+
|
|
3
|
+
const shell = require('shelljs');
|
|
4
|
+
|
|
5
|
+
if (shell.test('-f', 'junit.xml')) shell.rm('junit.xml');
|
|
6
|
+
if (shell.test('-d', 'dist')) shell.rm('-r', 'dist');
|
|
7
|
+
if (shell.test('-d', 'typedoc')) shell.rm('-r', 'typedoc');
|
|
8
|
+
if (shell.test('-d', 'coverage')) shell.rm('-r', 'coverage');
|
|
9
|
+
|
|
10
|
+
shell.rm('-rf', 'node_modules');
|
|
11
|
+
shell.rm('-f', 'tsconfig.tsbuildinfo');
|
|
12
|
+
shell.rm('-f', 'npm-shrinkwrap.json');
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2
|
+
|
|
3
|
+
const fs = require('fs').promises;
|
|
4
|
+
const { existsSync } = require('fs');
|
|
5
|
+
const { join, dirname, extname, resolve } = require('path');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Recursively copies everything from `srcDir` into `outDir`,
|
|
9
|
+
* excluding files with extensions `.ts` or `.tsx`. Directories
|
|
10
|
+
* are always created and traversed.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} srcDir - Path to the source directory.
|
|
13
|
+
* @param {string} outDir - Path to the destination directory.
|
|
14
|
+
*/
|
|
15
|
+
async function copyNonTsFiles(srcDir, outDir) {
|
|
16
|
+
// ensure outDir exists
|
|
17
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
18
|
+
|
|
19
|
+
const entries = await fs.readdir(srcDir, { withFileTypes: true });
|
|
20
|
+
for (const dirent of entries) {
|
|
21
|
+
const srcPath = join(srcDir, dirent.name);
|
|
22
|
+
const destPath = join(outDir, dirent.name);
|
|
23
|
+
|
|
24
|
+
if (dirent.isDirectory()) {
|
|
25
|
+
// recurse into subdirectories
|
|
26
|
+
await copyNonTsFiles(srcPath, destPath);
|
|
27
|
+
} else {
|
|
28
|
+
// skip .ts and .tsx files
|
|
29
|
+
const ext = extname(dirent.name).toLowerCase();
|
|
30
|
+
if (ext !== '.ts' && ext !== '.tsx') {
|
|
31
|
+
// ensure the destination directory exists
|
|
32
|
+
await fs.mkdir(dirname(destPath), { recursive: true });
|
|
33
|
+
await fs.copyFile(srcPath, destPath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Entry point: copies non-TS assets from ./src to ./dist
|
|
41
|
+
*/
|
|
42
|
+
(async () => {
|
|
43
|
+
try {
|
|
44
|
+
const projectRoot = process.cwd();
|
|
45
|
+
const srcDir = resolve(projectRoot, 'src');
|
|
46
|
+
const outDir = resolve(projectRoot, 'dist');
|
|
47
|
+
|
|
48
|
+
// only run if src exists
|
|
49
|
+
if (!existsSync(srcDir)) {
|
|
50
|
+
console.error(`Source directory not found: ${srcDir}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await copyNonTsFiles(srcDir, outDir);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error('❌ Error copying non-TS files:', err);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jetup",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Jetup: JavaScript Project Setup! Jetting-up your next JS project in seconds with one command, using fully modular, customizable presets, instantly ready to code!.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"jetup": "dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"config",
|
|
10
|
+
"dist",
|
|
11
|
+
"lib",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"package.json",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"preferGlobal": true,
|
|
17
|
+
"scripts": {
|
|
18
|
+
"clean": "node ./lib/clean.js",
|
|
19
|
+
"lint": "eslint --ext .ts .",
|
|
20
|
+
"lint:fix": "eslint --fix --ext .js,.ts .",
|
|
21
|
+
"format": "prettier --write '**/*'",
|
|
22
|
+
"build": "tsc && node ./lib/post-build.js",
|
|
23
|
+
"test": "jest --passWithNoTests",
|
|
24
|
+
"test:coverage": "jest --passWithNoTests --coverage=true --coverage-reporters=text",
|
|
25
|
+
"test:ci": "jest --config ./jest.config.js --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
|
|
26
|
+
"prepare": "husky",
|
|
27
|
+
"prepublishOnly": "npm ci && npm run lint && npm run build"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/aldhosutra/jetup.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"boilerplate",
|
|
35
|
+
"bootstrap",
|
|
36
|
+
"cli",
|
|
37
|
+
"code-generator",
|
|
38
|
+
"developer-tooling",
|
|
39
|
+
"init",
|
|
40
|
+
"javascript",
|
|
41
|
+
"modular",
|
|
42
|
+
"npx",
|
|
43
|
+
"preset",
|
|
44
|
+
"project-generator",
|
|
45
|
+
"project-setup",
|
|
46
|
+
"scaffold",
|
|
47
|
+
"setup",
|
|
48
|
+
"setup-tool",
|
|
49
|
+
"starter-kit",
|
|
50
|
+
"template"
|
|
51
|
+
],
|
|
52
|
+
"author": "aldhosutra",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/aldhosutra/jetup/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://jetup.js.org",
|
|
58
|
+
"overrides": {
|
|
59
|
+
"glob": "10.4.5"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@eslint/js": "^9.27.0",
|
|
63
|
+
"@types/jest": "^29.5.14",
|
|
64
|
+
"eslint": "^9.27.0",
|
|
65
|
+
"globals": "^16.1.0",
|
|
66
|
+
"husky": "^9.1.7",
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"jest-extended": "^5.0.2",
|
|
69
|
+
"jest-junit": "^16.0.0",
|
|
70
|
+
"lint-staged": "^15.5.2",
|
|
71
|
+
"prettier": "3.5.3",
|
|
72
|
+
"shelljs": "^0.10.0",
|
|
73
|
+
"ts-jest": "^29.3.4",
|
|
74
|
+
"tslib": "^2.8.1",
|
|
75
|
+
"typescript": "^5.8.3",
|
|
76
|
+
"typescript-eslint": "^8.32.1"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"commander": "^13.1.0",
|
|
80
|
+
"dotenv": "^16.5.0",
|
|
81
|
+
"figlet": "^1.8.1",
|
|
82
|
+
"lodash.merge": "^4.6.2",
|
|
83
|
+
"nanospinner": "^1.2.2",
|
|
84
|
+
"winston": "^3.17.0"
|
|
85
|
+
}
|
|
86
|
+
}
|