innetjs 1.7.4 → 1.8.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/bin/innet +20 -9
- package/index.d.ts +1 -4
- package/index.es6.js +16 -6
- package/index.js +16 -6
- package/package.json +2 -2
- package/templates/be/.env +1 -0
- package/templates/be/README.md +15 -0
- package/templates/be/package.json +13 -0
- package/templates/be/src/App.tsx +7 -0
- package/templates/be/src/index.tsx +6 -0
- package/templates/be/tsconfig.json +35 -0
- package/templates/fe/package.json +1 -1
package/bin/innet
CHANGED
|
@@ -112,17 +112,27 @@ class InnetJS {
|
|
|
112
112
|
this.api = api;
|
|
113
113
|
}
|
|
114
114
|
// Methods
|
|
115
|
-
init(appName, { template
|
|
115
|
+
init(appName, { template, force = false } = {}) {
|
|
116
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
const appPath = path__default['default'].resolve(appName);
|
|
118
|
+
if (!template) {
|
|
119
|
+
logger__default['default'].log(chalk__default['default'].green(`Select one of those templates`));
|
|
120
|
+
const { value } = yield selector__default['default']({
|
|
121
|
+
values: ['fe', 'be']
|
|
122
|
+
});
|
|
123
|
+
template = value;
|
|
124
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
125
|
+
logger__default['default'].log(`Selected ${value} template`);
|
|
126
|
+
}
|
|
118
127
|
if (!force) {
|
|
119
128
|
yield logger__default['default'].start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
|
|
120
129
|
if (fs__default['default'].existsSync(appPath)) {
|
|
121
|
-
|
|
122
|
-
const { id: result } = yield selector__default['default']({
|
|
130
|
+
logger__default['default'].log(chalk__default['default'].red(`'${appPath}' already exist, what do you want?`));
|
|
131
|
+
const { id: result, value } = yield selector__default['default']({
|
|
123
132
|
values: ['Stop the process', 'Remove the folder', 'Merge with template']
|
|
124
133
|
});
|
|
125
|
-
readline.moveCursor(process.stdout, 0, -
|
|
134
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
135
|
+
logger__default['default'].log(`Already exist, selected: ${value}`);
|
|
126
136
|
if (!result) {
|
|
127
137
|
throw Error(`'${appPath}' already exist`);
|
|
128
138
|
}
|
|
@@ -134,11 +144,11 @@ class InnetJS {
|
|
|
134
144
|
}
|
|
135
145
|
const libPath = path__default['default'].resolve(__dirname, '..');
|
|
136
146
|
const templatePath = path__default['default'].resolve(libPath, 'templates', template);
|
|
137
|
-
yield logger__default['default'].start('Check if the template exists', () => {
|
|
147
|
+
yield logger__default['default'].start('Check if the template exists', () => __awaiter(this, void 0, void 0, function* () {
|
|
138
148
|
if (!fs__default['default'].existsSync(templatePath)) {
|
|
139
149
|
throw Error(`The template '${template}' is not exist`);
|
|
140
150
|
}
|
|
141
|
-
});
|
|
151
|
+
}));
|
|
142
152
|
yield logger__default['default'].start('Copy files', () => fs__default['default'].copy(templatePath, appPath));
|
|
143
153
|
yield logger__default['default'].start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
144
154
|
});
|
|
@@ -425,7 +435,7 @@ class InnetJS {
|
|
|
425
435
|
}
|
|
426
436
|
}
|
|
427
437
|
|
|
428
|
-
var version = "1.
|
|
438
|
+
var version = "1.8.2";
|
|
429
439
|
|
|
430
440
|
require('dotenv').config();
|
|
431
441
|
const innetJS = new InnetJS();
|
|
@@ -435,8 +445,9 @@ commander.program
|
|
|
435
445
|
.command('init <app-name>')
|
|
436
446
|
.description('Create innet boilerplate')
|
|
437
447
|
.option('-e, --error', 'Show error details')
|
|
438
|
-
.
|
|
439
|
-
|
|
448
|
+
.option('-t, --template <template>', 'Select template fe or be')
|
|
449
|
+
.action((appName, { error, template }) => {
|
|
450
|
+
innetJS.init(appName, { template }).catch(e => {
|
|
440
451
|
if (error) {
|
|
441
452
|
console.error(e);
|
|
442
453
|
process.exit(1);
|
package/index.d.ts
CHANGED
|
@@ -28,10 +28,7 @@ export default class InnetJS {
|
|
|
28
28
|
port?: number;
|
|
29
29
|
api?: string;
|
|
30
30
|
});
|
|
31
|
-
init(appName: string, { template, force }?:
|
|
32
|
-
template?: string;
|
|
33
|
-
force?: boolean;
|
|
34
|
-
}): Promise<void>;
|
|
31
|
+
init(appName: string, { template, force }?: any): Promise<void>;
|
|
35
32
|
build({ node }?: {
|
|
36
33
|
node?: boolean;
|
|
37
34
|
}): Promise<void>;
|
package/index.es6.js
CHANGED
|
@@ -88,17 +88,27 @@ class InnetJS {
|
|
|
88
88
|
this.api = api;
|
|
89
89
|
}
|
|
90
90
|
// Methods
|
|
91
|
-
init(appName, { template
|
|
91
|
+
init(appName, { template, force = false } = {}) {
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
const appPath = path.resolve(appName);
|
|
94
|
+
if (!template) {
|
|
95
|
+
logger.log(chalk.green(`Select one of those templates`));
|
|
96
|
+
const { value } = yield selector({
|
|
97
|
+
values: ['fe', 'be']
|
|
98
|
+
});
|
|
99
|
+
template = value;
|
|
100
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
101
|
+
logger.log(`Selected ${value} template`);
|
|
102
|
+
}
|
|
94
103
|
if (!force) {
|
|
95
104
|
yield logger.start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
|
|
96
105
|
if (fs.existsSync(appPath)) {
|
|
97
|
-
|
|
98
|
-
const { id: result } = yield selector({
|
|
106
|
+
logger.log(chalk.red(`'${appPath}' already exist, what do you want?`));
|
|
107
|
+
const { id: result, value } = yield selector({
|
|
99
108
|
values: ['Stop the process', 'Remove the folder', 'Merge with template']
|
|
100
109
|
});
|
|
101
|
-
readline.moveCursor(process.stdout, 0, -
|
|
110
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
111
|
+
logger.log(`Already exist, selected: ${value}`);
|
|
102
112
|
if (!result) {
|
|
103
113
|
throw Error(`'${appPath}' already exist`);
|
|
104
114
|
}
|
|
@@ -110,11 +120,11 @@ class InnetJS {
|
|
|
110
120
|
}
|
|
111
121
|
const libPath = path.resolve(__dirname, '..');
|
|
112
122
|
const templatePath = path.resolve(libPath, 'templates', template);
|
|
113
|
-
yield logger.start('Check if the template exists', () => {
|
|
123
|
+
yield logger.start('Check if the template exists', () => __awaiter(this, void 0, void 0, function* () {
|
|
114
124
|
if (!fs.existsSync(templatePath)) {
|
|
115
125
|
throw Error(`The template '${template}' is not exist`);
|
|
116
126
|
}
|
|
117
|
-
});
|
|
127
|
+
}));
|
|
118
128
|
yield logger.start('Copy files', () => fs.copy(templatePath, appPath));
|
|
119
129
|
yield logger.start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
120
130
|
});
|
package/index.js
CHANGED
|
@@ -110,17 +110,27 @@ class InnetJS {
|
|
|
110
110
|
this.api = api;
|
|
111
111
|
}
|
|
112
112
|
// Methods
|
|
113
|
-
init(appName, { template
|
|
113
|
+
init(appName, { template, force = false } = {}) {
|
|
114
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
115
|
const appPath = path__default['default'].resolve(appName);
|
|
116
|
+
if (!template) {
|
|
117
|
+
logger__default['default'].log(chalk__default['default'].green(`Select one of those templates`));
|
|
118
|
+
const { value } = yield selector__default['default']({
|
|
119
|
+
values: ['fe', 'be']
|
|
120
|
+
});
|
|
121
|
+
template = value;
|
|
122
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
123
|
+
logger__default['default'].log(`Selected ${value} template`);
|
|
124
|
+
}
|
|
116
125
|
if (!force) {
|
|
117
126
|
yield logger__default['default'].start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
|
|
118
127
|
if (fs__default['default'].existsSync(appPath)) {
|
|
119
|
-
|
|
120
|
-
const { id: result } = yield selector__default['default']({
|
|
128
|
+
logger__default['default'].log(chalk__default['default'].red(`'${appPath}' already exist, what do you want?`));
|
|
129
|
+
const { id: result, value } = yield selector__default['default']({
|
|
121
130
|
values: ['Stop the process', 'Remove the folder', 'Merge with template']
|
|
122
131
|
});
|
|
123
|
-
readline.moveCursor(process.stdout, 0, -
|
|
132
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
133
|
+
logger__default['default'].log(`Already exist, selected: ${value}`);
|
|
124
134
|
if (!result) {
|
|
125
135
|
throw Error(`'${appPath}' already exist`);
|
|
126
136
|
}
|
|
@@ -132,11 +142,11 @@ class InnetJS {
|
|
|
132
142
|
}
|
|
133
143
|
const libPath = path__default['default'].resolve(__dirname, '..');
|
|
134
144
|
const templatePath = path__default['default'].resolve(libPath, 'templates', template);
|
|
135
|
-
yield logger__default['default'].start('Check if the template exists', () => {
|
|
145
|
+
yield logger__default['default'].start('Check if the template exists', () => __awaiter(this, void 0, void 0, function* () {
|
|
136
146
|
if (!fs__default['default'].existsSync(templatePath)) {
|
|
137
147
|
throw Error(`The template '${template}' is not exist`);
|
|
138
148
|
}
|
|
139
|
-
});
|
|
149
|
+
}));
|
|
140
150
|
yield logger__default['default'].start('Copy files', () => fs__default['default'].copy(templatePath, appPath));
|
|
141
151
|
yield logger__default['default'].start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
|
|
142
152
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "innetjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "CLI for innet boilerplate",
|
|
5
5
|
"homepage": "https://github.com/d8corp/innetjs",
|
|
6
6
|
"author": "Mikhail Lysikov <d8corp@mail.ru>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"innetjs": "
|
|
9
|
+
"innetjs": "bin/innet"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BUILD_FOLDER=build
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"/": ["src"],
|
|
6
|
+
"/*": ["src/*"],
|
|
7
|
+
"@cantinc/utils": ["src/@cantinc/utils"],
|
|
8
|
+
"@innet/*": ["src/@innet/*"],
|
|
9
|
+
"innet/*": ["src/@innet/innet/*"],
|
|
10
|
+
"innet": ["src/@innet/innet"],
|
|
11
|
+
},
|
|
12
|
+
"target": "ES6",
|
|
13
|
+
"lib": [
|
|
14
|
+
"esnext"
|
|
15
|
+
],
|
|
16
|
+
"allowJs": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"experimentalDecorators": true,
|
|
20
|
+
"allowSyntheticDefaultImports": true,
|
|
21
|
+
"strict": false,
|
|
22
|
+
"forceConsistentCasingInFileNames": true,
|
|
23
|
+
"module": "esnext",
|
|
24
|
+
"moduleResolution": "node",
|
|
25
|
+
"resolveJsonModule": true,
|
|
26
|
+
"isolatedModules": false,
|
|
27
|
+
"removeComments": true,
|
|
28
|
+
"declaration": false,
|
|
29
|
+
"noEmit": true,
|
|
30
|
+
"jsx": "preserve"
|
|
31
|
+
},
|
|
32
|
+
"include": [
|
|
33
|
+
"src"
|
|
34
|
+
]
|
|
35
|
+
}
|