innetjs 1.12.1 → 2.0.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.
Files changed (36) hide show
  1. package/bin/innet +114 -34
  2. package/extract.d.ts +1 -0
  3. package/index.d.ts +6 -2
  4. package/index.es6.js +136 -57
  5. package/index.js +113 -33
  6. package/package.json +17 -14
  7. package/templates/be/.env +0 -1
  8. package/templates/be/README.md +0 -15
  9. package/templates/be/package.json +0 -13
  10. package/templates/be/src/controller/index.tsx +0 -7
  11. package/templates/be/src/declaration.d.ts +0 -4
  12. package/templates/be/src/index.tsx +0 -6
  13. package/templates/be/src/view/App/App.css +0 -12
  14. package/templates/be/src/view/App/App.tsx +0 -15
  15. package/templates/be/src/view/App/index.ts +0 -1
  16. package/templates/be/src/view/Page/Page.css +0 -7
  17. package/templates/be/src/view/Page/Page.tsx +0 -24
  18. package/templates/be/src/view/Page/index.ts +0 -1
  19. package/templates/be/src/view/index.ts +0 -2
  20. package/templates/be/tsconfig.json +0 -31
  21. package/templates/fe/.env +0 -1
  22. package/templates/fe/README.md +0 -84
  23. package/templates/fe/package.json +0 -16
  24. package/templates/fe/public/favicon.ico +0 -0
  25. package/templates/fe/public/index.html +0 -14
  26. package/templates/fe/src/App.scss +0 -48
  27. package/templates/fe/src/App.tsx +0 -36
  28. package/templates/fe/src/componenst/Page/Page.scss +0 -22
  29. package/templates/fe/src/componenst/Page/Page.tsx +0 -18
  30. package/templates/fe/src/componenst/Page/index.ts +0 -1
  31. package/templates/fe/src/declaration.d.ts +0 -9
  32. package/templates/fe/src/index.tsx +0 -6
  33. package/templates/fe/src/pages/HomePage/HomePage.scss +0 -25
  34. package/templates/fe/src/pages/HomePage/HomePage.tsx +0 -24
  35. package/templates/fe/src/pages/HomePage/index.ts +0 -1
  36. package/templates/fe/tsconfig.json +0 -30
package/index.js CHANGED
@@ -1,18 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var path = require('path');
3
+ var path$1 = require('path');
4
4
  var fs = require('fs-extra');
5
5
  var http = require('http');
6
6
  var https = require('https');
7
+ var util = require('util');
8
+ var axios = require('axios');
7
9
  var logger = require('@cantinc/logger');
8
10
  var chalk = require('chalk');
9
- var util = require('util');
10
11
  var rollup = require('rollup');
11
12
  var commonjs = require('@rollup/plugin-commonjs');
12
13
  var pluginNodeResolve = require('@rollup/plugin-node-resolve');
13
14
  var rollupPluginTerser = require('rollup-plugin-terser');
14
15
  var typescript = require('rollup-plugin-typescript2');
15
- var postcss = require('rollup-plugin-postcss');
16
+ var styles = require('rollup-plugin-styles');
16
17
  var autoprefixer = require('autoprefixer');
17
18
  var express = require('express');
18
19
  var json = require('@rollup/plugin-json');
@@ -21,19 +22,21 @@ var proxy = require('express-http-proxy');
21
22
  var selector = require('cli-select');
22
23
  var jsx = require('rollup-plugin-innet-jsx');
23
24
  var filesize = require('rollup-plugin-filesize');
25
+ var unzipper = require('unzipper');
24
26
 
25
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
28
 
27
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
29
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
28
30
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
29
31
  var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
30
32
  var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
33
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
31
34
  var logger__default = /*#__PURE__*/_interopDefaultLegacy(logger);
32
35
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
33
36
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
34
37
  var commonjs__default = /*#__PURE__*/_interopDefaultLegacy(commonjs);
35
38
  var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
36
- var postcss__default = /*#__PURE__*/_interopDefaultLegacy(postcss);
39
+ var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
37
40
  var autoprefixer__default = /*#__PURE__*/_interopDefaultLegacy(autoprefixer);
38
41
  var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
39
42
  var json__default = /*#__PURE__*/_interopDefaultLegacy(json);
@@ -43,7 +46,7 @@ var selector__default = /*#__PURE__*/_interopDefaultLegacy(selector);
43
46
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
44
47
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
45
48
 
46
- /*! *****************************************************************************
49
+ /******************************************************************************
47
50
  Copyright (c) Microsoft Corporation.
48
51
 
49
52
  Permission to use, copy, modify, and/or distribute this software for any
@@ -68,11 +71,54 @@ function __awaiter(thisArg, _arguments, P, generator) {
68
71
  });
69
72
  }
70
73
 
74
+ const Writer = require('fstream').Writer;
75
+ const path = require('path');
76
+ const stream = require('stream');
77
+ const duplexer2 = require('duplexer2');
78
+ const Promise$1 = require('bluebird');
79
+ function Extract(opts, template) {
80
+ const reduceCount = 19 + template.length;
81
+ // make sure path is normalized before using it
82
+ opts.path = path.resolve(path.normalize(opts.path));
83
+ // @ts-ignore
84
+ const parser = new unzipper.Parse(opts);
85
+ const outStream = new stream.Writable({ objectMode: true });
86
+ outStream._write = function (entry, encoding, cb) {
87
+ if (entry.type === 'Directory')
88
+ return cb();
89
+ const extractPath = path.join(opts.path, entry.path.slice(reduceCount));
90
+ if (extractPath.indexOf(opts.path) !== 0) {
91
+ return cb();
92
+ }
93
+ const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
94
+ entry.pipe(writer)
95
+ .on('error', cb)
96
+ .on('close', cb);
97
+ };
98
+ const extract = duplexer2(parser, outStream);
99
+ parser.once('crx-header', function (crxHeader) {
100
+ extract.crxHeader = crxHeader;
101
+ });
102
+ parser
103
+ .pipe(outStream)
104
+ .on('finish', function () {
105
+ extract.emit('close');
106
+ });
107
+ extract.promise = function () {
108
+ return new Promise$1(function (resolve, reject) {
109
+ extract.on('close', resolve);
110
+ extract.on('error', reject);
111
+ });
112
+ };
113
+ return extract;
114
+ }
115
+
71
116
  const livereload = require('rollup-plugin-livereload');
72
117
  const { string } = require('rollup-plugin-string');
73
118
  const { exec, spawn } = require('child_process');
74
119
  const readline = require('readline');
75
120
  const execAsync = util.promisify(exec);
121
+ const copyFiles = util.promisify(fs__default["default"].copy);
76
122
  require('dotenv').config();
77
123
  function getFile(file) {
78
124
  file = path__default["default"].resolve(file);
@@ -96,16 +142,27 @@ function getFile(file) {
96
142
  }
97
143
  return file;
98
144
  }
145
+ function convertIndexFile(data, version) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ return data
148
+ .toString()
149
+ .replace('</head>', `<script type="module" defer src="index.js${version ? `?v=${version}` : ''}"></script></head>`);
150
+ });
151
+ }
99
152
  const reporter = (options, outputOptions, info) => {
100
153
  logger__default["default"].log(`${chalk__default["default"].yellow(info.fileName)} ${chalk__default["default"].green(info.bundleSize)} [ gzip: ${chalk__default["default"].green(info.gzipSize)} ]`);
101
154
  return '';
102
155
  };
103
156
  class InnetJS {
104
- constructor({ projectFolder = process.env.PROJECT_FOLDER || '', publicFolder = process.env.PUBLIC_FOLDER || 'public', buildFolder = process.env.BUILD_FOLDER || path__default["default"].join('public', 'build'), srcFolder = process.env.SRC_FOLDER || 'src', sourcemap = process.env.SOURCEMAP ? process.env.SOURCEMAP === 'true' : false, cssModules = process.env.CSS_MODULES ? process.env.CSS_MODULES === 'true' : false, cssInJs = process.env.CSS_IN_JS ? process.env.CSS_IN_JS === 'true' : false, sslKey = process.env.SSL_KEY || 'localhost.key', sslCrt = process.env.SSL_CRT || 'localhost.crt', proxy = process.env.PROXY || '', port = process.env.PORT ? +process.env.PORT : 3000, api = process.env.API || '*', } = {}) {
157
+ constructor({ projectFolder = process.env.PROJECT_FOLDER || '', publicFolder = process.env.PUBLIC_FOLDER || 'public', buildFolder = process.env.BUILD_FOLDER || 'build', srcFolder = process.env.SRC_FOLDER || 'src', sourcemap = process.env.SOURCEMAP ? process.env.SOURCEMAP === 'true' : false, cssModules = process.env.CSS_MODULES ? process.env.CSS_MODULES === 'true' : true, cssInJs = process.env.CSS_IN_JS ? process.env.CSS_IN_JS === 'true' : true, sslKey = process.env.SSL_KEY || 'localhost.key', sslCrt = process.env.SSL_CRT || 'localhost.crt', proxy = process.env.PROXY || '', port = process.env.PORT ? +process.env.PORT : 3000, api = process.env.API || '*', } = {}) {
105
158
  this.projectFolder = path__default["default"].resolve(projectFolder);
106
159
  this.publicFolder = path__default["default"].resolve(publicFolder);
107
160
  this.buildFolder = path__default["default"].resolve(buildFolder);
108
161
  this.srcFolder = path__default["default"].resolve(srcFolder);
162
+ this.publicIndexFile = path__default["default"].join(publicFolder, 'index.html');
163
+ this.buildIndexFile = path__default["default"].join(buildFolder, 'index.html');
164
+ this.devBuildFolder = path__default["default"].resolve(projectFolder, 'node_modules', '.cache', 'innetjs', 'build');
165
+ this.devBuildIndexFile = path__default["default"].join(this.devBuildFolder, 'index.html');
109
166
  this.sourcemap = sourcemap;
110
167
  this.cssModules = cssModules;
111
168
  this.cssInJs = cssInJs;
@@ -119,14 +176,18 @@ class InnetJS {
119
176
  init(appName, { template, force = false } = {}) {
120
177
  return __awaiter(this, void 0, void 0, function* () {
121
178
  const appPath = path__default["default"].resolve(appName);
122
- if (!template) {
179
+ const { data } = yield logger__default["default"].start('Get templates list', () => __awaiter(this, void 0, void 0, function* () { return yield axios__default["default"].get('https://api.github.com/repos/d8corp/innetjs-templates/branches'); }));
180
+ const templates = data.map(({ name }) => name).filter(name => name !== 'main');
181
+ if (!template || !templates.includes(template)) {
123
182
  logger__default["default"].log(chalk__default["default"].green(`Select one of those templates`));
124
183
  const { value } = yield selector__default["default"]({
125
- values: ['fe', 'be']
184
+ values: templates
126
185
  });
127
186
  template = value;
128
187
  readline.moveCursor(process.stdout, 0, -1);
129
- logger__default["default"].log(`Selected ${value} template`);
188
+ const text = `Selected template: ${chalk__default["default"].white(value)}`;
189
+ logger__default["default"].start(text);
190
+ logger__default["default"].end(text);
130
191
  }
131
192
  if (!force) {
132
193
  yield logger__default["default"].start('Check if app folder is available', () => __awaiter(this, void 0, void 0, function* () {
@@ -146,14 +207,16 @@ class InnetJS {
146
207
  }
147
208
  }));
148
209
  }
149
- const libPath = path__default["default"].resolve(__dirname, '..');
150
- const templatePath = path__default["default"].resolve(libPath, 'templates', template);
151
- yield logger__default["default"].start('Check if the template exists', () => __awaiter(this, void 0, void 0, function* () {
152
- if (!fs__default["default"].existsSync(templatePath)) {
153
- throw Error(`The template '${template}' is not exist`);
154
- }
210
+ yield logger__default["default"].start('Download template', () => __awaiter(this, void 0, void 0, function* () {
211
+ const { data } = yield axios__default["default"].get(`https://github.com/d8corp/innetjs-templates/archive/refs/heads/${template}.zip`, {
212
+ responseType: 'stream'
213
+ });
214
+ yield new Promise((resolve, reject) => {
215
+ data.pipe(Extract({
216
+ path: appPath,
217
+ }, template)).on('finish', resolve).on('error', reject);
218
+ });
155
219
  }));
156
- yield logger__default["default"].start('Copy files', () => fs__default["default"].copy(templatePath, appPath));
157
220
  yield logger__default["default"].start('Install packages', () => execAsync(`cd ${appPath} && npm i`));
158
221
  });
159
222
  }
@@ -164,6 +227,7 @@ class InnetJS {
164
227
  const pkg = node && (yield this.getPackage());
165
228
  const inputOptions = {
166
229
  input: path__default["default"].resolve(this.srcFolder, `index.${indexExtension}`),
230
+ preserveEntrySignatures: 'strict',
167
231
  plugins: [
168
232
  commonjs__default["default"](),
169
233
  json__default["default"](),
@@ -203,12 +267,13 @@ class InnetJS {
203
267
  '**/*.css',
204
268
  '**/*.scss',
205
269
  ]
206
- }), postcss__default["default"]({
270
+ }), styles__default["default"]({
271
+ mode: this.cssInJs ? 'inject' : 'extract',
272
+ url: true,
207
273
  plugins: [autoprefixer__default["default"]()],
208
- extract: !this.cssInJs,
209
274
  modules: this.cssModules,
210
275
  sourceMap: this.sourcemap,
211
- minimize: true
276
+ minimize: true,
212
277
  }));
213
278
  outputOptions.format = 'es';
214
279
  outputOptions.plugins = [
@@ -222,6 +287,12 @@ class InnetJS {
222
287
  const bundle = yield rollup__default["default"].rollup(inputOptions);
223
288
  yield bundle.write(outputOptions);
224
289
  yield bundle.close();
290
+ if (!node) {
291
+ yield copyFiles(this.publicFolder, this.buildFolder);
292
+ const data = yield fs.promises.readFile(this.publicIndexFile);
293
+ const pkg = yield this.getPackage();
294
+ yield fs.promises.writeFile(this.buildIndexFile, yield convertIndexFile(data, pkg.version));
295
+ }
225
296
  }));
226
297
  if (pkg) {
227
298
  yield logger__default["default"].start('Copy package.json', () => __awaiter(this, void 0, void 0, function* () {
@@ -242,12 +313,13 @@ class InnetJS {
242
313
  start({ node = false, error = false } = {}) {
243
314
  return __awaiter(this, void 0, void 0, function* () {
244
315
  const indexExtension = yield this.getProjectExtension();
245
- const pkg = node && (yield this.getPackage());
246
- yield logger__default["default"].start('Remove build', () => fs__default["default"].remove(this.buildFolder));
316
+ const pkg = yield this.getPackage();
317
+ yield logger__default["default"].start('Remove build', () => fs__default["default"].remove(this.devBuildFolder));
247
318
  const options = {
248
319
  input: path__default["default"].resolve(this.srcFolder, `index.${indexExtension}`),
320
+ preserveEntrySignatures: 'strict',
249
321
  output: {
250
- dir: this.buildFolder,
322
+ dir: this.devBuildFolder,
251
323
  sourcemap: true
252
324
  },
253
325
  plugins: [
@@ -302,15 +374,16 @@ class InnetJS {
302
374
  '**/*.css',
303
375
  '**/*.scss',
304
376
  ]
305
- }), postcss__default["default"]({
377
+ }), styles__default["default"]({
378
+ mode: this.cssInJs ? 'inject' : 'extract',
379
+ url: true,
306
380
  plugins: [autoprefixer__default["default"]()],
307
381
  modules: this.cssModules,
308
382
  sourceMap: true,
309
- extract: !this.cssInJs,
310
- }), this.createClient(key, cert), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
383
+ }), this.createClient(key, cert, pkg), livereload(Object.assign({ watch: this.publicFolder, verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
311
384
  }
312
385
  const watcher = rollup__default["default"].watch(options);
313
- watcher.on('event', e => {
386
+ watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
314
387
  if (e.code == 'ERROR') {
315
388
  logger__default["default"].end('Bundling', error ? e.error.stack : e.error.message);
316
389
  }
@@ -320,7 +393,7 @@ class InnetJS {
320
393
  else if (e.code === 'BUNDLE_END') {
321
394
  logger__default["default"].end('Bundling');
322
395
  }
323
- });
396
+ }));
324
397
  });
325
398
  }
326
399
  run(file) {
@@ -412,14 +485,21 @@ class InnetJS {
412
485
  return this.package;
413
486
  });
414
487
  }
415
- createClient(key, cert) {
488
+ createClient(key, cert, pkg) {
416
489
  let app;
417
490
  return {
418
- writeBundle: () => {
491
+ writeBundle: () => __awaiter(this, void 0, void 0, function* () {
419
492
  var _a;
420
493
  if (!app) {
421
- const httpsUsing = !!(cert && key);
422
494
  app = express__default["default"]();
495
+ const update = () => __awaiter(this, void 0, void 0, function* () {
496
+ const data = yield fs.promises.readFile(this.publicIndexFile);
497
+ yield fs.promises.writeFile(this.devBuildIndexFile, yield convertIndexFile(data, pkg.version));
498
+ });
499
+ fs__default["default"].watch(this.publicIndexFile, update);
500
+ yield update();
501
+ const httpsUsing = !!(cert && key);
502
+ app.use(express__default["default"].static(this.devBuildFolder));
423
503
  app.use(express__default["default"].static(this.publicFolder));
424
504
  if ((_a = this.proxy) === null || _a === void 0 ? void 0 : _a.startsWith('http')) {
425
505
  app.use(this.api, proxy__default["default"](this.proxy, {
@@ -428,14 +508,14 @@ class InnetJS {
428
508
  }));
429
509
  }
430
510
  app.use(/^[^.]+$/, (req, res) => {
431
- res.sendFile(this.publicFolder + '/index.html');
511
+ res.sendFile(this.devBuildFolder + '/index.html');
432
512
  });
433
513
  const server = httpsUsing ? https__default["default"].createServer({ key, cert }, app) : http__default["default"].createServer(app);
434
514
  server.listen(this.port, () => {
435
515
  console.log(`${chalk__default["default"].green('➤')} Server started on http${httpsUsing ? 's' : ''}://localhost:${this.port}`);
436
516
  });
437
517
  }
438
- }
518
+ })
439
519
  };
440
520
  }
441
521
  createServer(external) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "1.12.1",
3
+ "version": "2.0.0",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -32,28 +32,31 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@cantinc/logger": "^1.1.0",
35
- "@rollup/plugin-commonjs": "^21.0.2",
35
+ "@rollup/plugin-commonjs": "^22.0.2",
36
36
  "@rollup/plugin-json": "^4.1.0",
37
- "@rollup/plugin-node-resolve": "^13.1.3",
38
- "autoprefixer": "^10.4.4",
37
+ "@rollup/plugin-node-resolve": "^13.3.0",
38
+ "autoprefixer": "^10.4.8",
39
+ "axios": "^0.27.2",
39
40
  "chalk": "^4.1.2",
40
41
  "cli-select": "^1.1.2",
41
- "commander": "^9.1.0",
42
- "dotenv": "^16.0.0",
43
- "express": "^4.17.3",
42
+ "commander": "^9.4.0",
43
+ "dotenv": "^16.0.1",
44
+ "express": "^4.18.1",
44
45
  "express-http-proxy": "^1.6.3",
45
- "fs-extra": "^10.0.1",
46
+ "fs-extra": "^10.1.0",
46
47
  "node-sass": "^7.0.1",
47
- "postcss": "^8.4.12",
48
- "rollup": "^2.70.1",
48
+ "postcss": "^8.4.16",
49
+ "rollup": "^2.77.2",
49
50
  "rollup-plugin-filesize": "^9.1.2",
50
- "rollup-plugin-innet-jsx": "^1.2.0",
51
+ "rollup-plugin-innet-jsx": "^1.3.0",
52
+ "rollup-plugin-lit-css": "^4.0.0",
51
53
  "rollup-plugin-livereload": "^2.0.5",
52
- "rollup-plugin-postcss": "^4.0.2",
53
54
  "rollup-plugin-string": "^3.0.0",
55
+ "rollup-plugin-styles": "^4.0.0",
54
56
  "rollup-plugin-terser": "^7.0.2",
55
- "rollup-plugin-typescript2": "^0.31.2",
57
+ "rollup-plugin-typescript2": "^0.32.1",
56
58
  "tmp": "^0.2.1",
57
- "typescript": "^4.6.2"
59
+ "typescript": "^4.7.4",
60
+ "unzipper": "^0.10.11"
58
61
  }
59
62
  }
package/templates/be/.env DELETED
@@ -1 +0,0 @@
1
- BUILD_FOLDER=build
@@ -1,15 +0,0 @@
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 application run:
11
- ```shell
12
- npm run build
13
- ```
14
-
15
-
@@ -1,13 +0,0 @@
1
- {
2
- "scripts": {
3
- "start": "innetjs start -n",
4
- "build": "innetjs build -n"
5
- },
6
- "dependencies": {
7
- "@innet/server": "^1.1.0",
8
- "innet": "^1.0.0"
9
- },
10
- "devDependencies": {
11
- "innetjs": "^1.12.1"
12
- }
13
- }
@@ -1,7 +0,0 @@
1
- import { App } from '/view'
2
-
3
- export default (
4
- <server onStart={url => console.log(`open: ${url}`)}>
5
- <App />
6
- </server>
7
- )
@@ -1,4 +0,0 @@
1
- declare module '*.css' {
2
- const content: Record<string, string>
3
- export default content
4
- }
@@ -1,6 +0,0 @@
1
- import innet from 'innet'
2
- import server from '@innet/server'
3
-
4
- import app from '/controller'
5
-
6
- innet(app, server)
@@ -1,12 +0,0 @@
1
- .root {
2
- position: absolute;
3
- top: 50%;
4
- left: 50%;
5
- transform: translate(-50%, -50%);
6
- }
7
-
8
- .header {
9
- text-align: center;
10
- font-family: sans-serif;
11
- font-size: 40px;
12
- }
@@ -1,15 +0,0 @@
1
- import { Page } from '../Page'
2
-
3
- import appStyles from './App.css'
4
-
5
- export function App () {
6
- return (
7
- <Page title='innetjs application' styles={appStyles}>
8
- <div class='root'>
9
- <h1 class='header'>
10
- Welcome to the innet application!
11
- </h1>
12
- </div>
13
- </Page>
14
- )
15
- }
@@ -1 +0,0 @@
1
- export * from './App'
@@ -1,7 +0,0 @@
1
- html, body {
2
- margin: 0;
3
- padding: 0;
4
- height: 100vh;
5
- background: #2B2B2B;
6
- color: #F7B756;
7
- }
@@ -1,24 +0,0 @@
1
- import pageStyles from './Page.css'
2
-
3
- export function Page ({ title, styles }, children) {
4
- return (
5
- <header name='content-type' value='text/html; charset=utf-8'>
6
- <html lang='ru'>
7
- <head>
8
- <meta charset="UTF-8"/>
9
- <meta
10
- name="viewport"
11
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
12
- />
13
- <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
14
- <style>{pageStyles}</style>
15
- <style>{styles}</style>
16
- <title>{title}</title>
17
- </head>
18
- <body>
19
- {children}
20
- </body>
21
- </html>
22
- </header>
23
- )
24
- }
@@ -1 +0,0 @@
1
- export * from './Page'
@@ -1,2 +0,0 @@
1
- export * from './App'
2
- export * from './Page'
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": ".",
4
- "paths": {
5
- "/": ["src"],
6
- "/*": ["src/*"],
7
- },
8
- "target": "ES6",
9
- "lib": [
10
- "esnext"
11
- ],
12
- "allowJs": true,
13
- "skipLibCheck": true,
14
- "esModuleInterop": true,
15
- "experimentalDecorators": true,
16
- "allowSyntheticDefaultImports": true,
17
- "strict": false,
18
- "forceConsistentCasingInFileNames": true,
19
- "module": "esnext",
20
- "moduleResolution": "node",
21
- "resolveJsonModule": true,
22
- "isolatedModules": false,
23
- "removeComments": true,
24
- "declaration": false,
25
- "noEmit": true,
26
- "jsx": "preserve"
27
- },
28
- "include": [
29
- "src"
30
- ]
31
- }
package/templates/fe/.env DELETED
@@ -1 +0,0 @@
1
- CSS_MODULES=true
@@ -1,84 +0,0 @@
1
- # innet get start
2
- To start developing run this
3
- ```bash
4
- npm start
5
- ```
6
- To build production run this
7
- ```bash
8
- npm run build
9
- ```
10
- *You can find the production bundle in `public` folder*
11
-
12
- ### TypeScript
13
- The main file is `index.js` (`index.ts`, `index.tsx`) from `src` folder.
14
- You can import `.js`, `.ts` or `.tsx` files into any script file.
15
- So you can use `TypeScript` or not or use somewhere.
16
- If you don't want to use `TypeScript`,
17
- you can remove `tsconfig.json` and `declaration.d.ts`.
18
-
19
- ### SCSS
20
- You can import `.css` or `.scss` into a script.
21
- So you can use `SCSS` or not.
22
- ```typescript jsx
23
- import './index.css'
24
- import './index.scss'
25
- ```
26
- ### JSON
27
- You can import `.json` file into a script.
28
- ```typescript jsx
29
- import settings from './settings.json'
30
- ```
31
- ### HTTPS
32
- Add `localhost.crt` and `localhost.key` to the root of the application to use HTTPS.
33
- ### base path of imports
34
- You can use `/` to get root of src.
35
- ```typescript
36
- import App from '/components/App'
37
- ```
38
- The same:
39
- ```typescript
40
- import App from 'src/components/App'
41
- ```
42
- The same for index file.
43
- ```typescript
44
- import App from './components/App'
45
- ```
46
- ### .env
47
- You can create and set up `.env` file to change some features.
48
- These options are used by default.
49
- ```dotenv
50
- # you can use remote API, for example PROXY=https://localhost:9000
51
- PROXY=false
52
-
53
- # you can set remote API URL beginning, for example API=/api/?*
54
- API=*
55
-
56
- # you can change the static server port
57
- PORT=3000
58
-
59
- # you can change directory and file name of ssl certificates
60
- SSL_CRT_FILE=localhost.crt
61
- SSL_KEY_FILE=localhost.key
62
-
63
- # add the next key if you get "Error: self signed certificate"
64
- # NODE_TLS_REJECT_UNAUTHORIZED=0
65
-
66
- # you can generate sourcemap for production build
67
- GENERATE_SOURCEMAP=false
68
-
69
- # by default index.js includes all styles,
70
- # but you can keep styles into index.css with CSS_EXTRACT=true
71
- CSS_IN_JS=false
72
-
73
- # import styles from './App.css'
74
- # you can use css modules with CSS_MODULES=true.
75
- # If CSS_MODULES equals false you still can use css modules,
76
- # just name the css or scss file like App.module.css
77
- CSS_MODULES=false
78
-
79
- # you can change the public folder
80
- PUBLIC_FOLDER=public
81
-
82
- # you can change the folder of scripts
83
- BUILD_FOLDER=public/build
84
- ```
@@ -1,16 +0,0 @@
1
- {
2
- "scripts": {
3
- "build": "npx innetjs build",
4
- "start": "npx innetjs start"
5
- },
6
- "dependencies": {
7
- "innet": "^1.0.0",
8
- "@innet/dom": "^0.4.3",
9
- "@innet/jsx": "^1.0.2",
10
- "html-classes": "^1.2.0",
11
- "watch-state": "^3.4.3"
12
- },
13
- "devDependencies": {
14
- "innetjs": "^1.12.1"
15
- }
16
- }
Binary file
@@ -1,14 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport"
6
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
8
- <link rel="stylesheet" href="/build/index.css">
9
- <script type="module" defer src="/build/index.js"></script>
10
- <title>Hello innet</title>
11
- </head>
12
- <body>
13
- </body>
14
- </html>