innetjs 1.7.4 → 1.8.0

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 CHANGED
@@ -112,9 +112,17 @@ class InnetJS {
112
112
  this.api = api;
113
113
  }
114
114
  // Methods
115
- init(appName, { template = 'fe', force = false } = {}) {
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
+ console.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, -2);
125
+ }
118
126
  if (!force) {
119
127
  yield logger__default['default'].start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
120
128
  if (fs__default['default'].existsSync(appPath)) {
@@ -425,7 +433,7 @@ class InnetJS {
425
433
  }
426
434
  }
427
435
 
428
- var version = "1.7.4";
436
+ var version = "1.8.0";
429
437
 
430
438
  require('dotenv').config();
431
439
  const innetJS = new InnetJS();
@@ -435,8 +443,9 @@ commander.program
435
443
  .command('init <app-name>')
436
444
  .description('Create innet boilerplate')
437
445
  .option('-e, --error', 'Show error details')
438
- .action((appName, { error }) => {
439
- innetJS.init(appName).catch(e => {
446
+ .option('-t, --template', 'Select template')
447
+ .action((appName, { error, template }) => {
448
+ innetJS.init(appName, { template }).catch(e => {
440
449
  if (error) {
441
450
  console.error(e);
442
451
  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,9 +88,17 @@ class InnetJS {
88
88
  this.api = api;
89
89
  }
90
90
  // Methods
91
- init(appName, { template = 'fe', force = false } = {}) {
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
+ console.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, -2);
101
+ }
94
102
  if (!force) {
95
103
  yield logger.start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
96
104
  if (fs.existsSync(appPath)) {
package/index.js CHANGED
@@ -110,9 +110,17 @@ class InnetJS {
110
110
  this.api = api;
111
111
  }
112
112
  // Methods
113
- init(appName, { template = 'fe', force = false } = {}) {
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
+ console.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, -2);
123
+ }
116
124
  if (!force) {
117
125
  yield logger__default['default'].start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
118
126
  if (fs__default['default'].existsSync(appPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "1.7.4",
3
+ "version": "1.8.0",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -0,0 +1 @@
1
+ BUILD_FOLDER=build
@@ -0,0 +1,15 @@
1
+ # be
2
+
3
+ This is the simplest template of innet.js using for server side.
4
+
5
+ To start development run:
6
+ ```shell
7
+ npm start
8
+ ```
9
+
10
+ To build the project run:
11
+ ```shell
12
+ npm run build
13
+ ```
14
+
15
+
@@ -0,0 +1,13 @@
1
+ {
2
+ "scripts": {
3
+ "start": "innetjs start -n",
4
+ "build": "innetjs build -n"
5
+ },
6
+ "dependencies": {
7
+ "@innet/server": "^1.0.2",
8
+ "innet": "^1.0.0"
9
+ },
10
+ "devDependencies": {
11
+ "innetjs": "^1.8.0"
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ export default function App () {
2
+ return (
3
+ <server onStart={url => console.log(`open: ${url}`)}>
4
+ Hello World!
5
+ </server>
6
+ )
7
+ }
@@ -0,0 +1,6 @@
1
+ import innet from 'innet'
2
+ import server from '@innet/server'
3
+
4
+ import App from './App'
5
+
6
+ innet(<App />, server)
@@ -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
+ }
@@ -9,6 +9,6 @@
9
9
  "watch-state": "^3.3.3"
10
10
  },
11
11
  "devDependencies": {
12
- "innetjs": "^1.7.4"
12
+ "innetjs": "^1.8.0"
13
13
  }
14
14
  }