innetjs 2.2.9 → 2.2.11

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
@@ -25,11 +25,11 @@ var path$1 = require('node:path');
25
25
  var prompt = require('prompts');
26
26
  var rollup = require('rollup');
27
27
  var filesize = require('rollup-plugin-filesize');
28
- var injectEnv = require('rollup-plugin-inject-process-env');
29
28
  var jsx = require('rollup-plugin-innet-jsx');
30
29
  var externals = require('rollup-plugin-node-externals');
31
30
  var polyfill = require('rollup-plugin-polyfill-node');
32
31
  var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
32
+ var env = require('rollup-plugin-process-env');
33
33
  var styles = require('rollup-plugin-styles');
34
34
  var rollupPluginTerser = require('rollup-plugin-terser');
35
35
  var typescript = require('rollup-plugin-typescript2');
@@ -59,26 +59,14 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
59
59
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
60
60
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
61
61
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
62
- var injectEnv__default = /*#__PURE__*/_interopDefaultLegacy(injectEnv);
63
62
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
64
63
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
65
64
  var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
65
+ var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
66
66
  var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
67
67
  var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
68
68
  var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
69
69
 
70
- (function() {
71
- const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.9"};
72
- try {
73
- if (process) {
74
- process.env = Object.assign({}, process.env);
75
- Object.assign(process.env, env);
76
- return;
77
- }
78
- } catch (e) {} // avoid ReferenceError: process is not defined
79
- globalThis.process = { env:env };
80
- })();
81
-
82
70
  const lintInclude = [
83
71
  '**/*.ts',
84
72
  '**/*.tsx',
@@ -201,21 +189,10 @@ const execAsync = node_util.promisify(exec);
201
189
  const copyFiles = node_util.promisify(fs__default["default"].copy);
202
190
  updateDotenv();
203
191
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
204
- function normalizeEnv(value) {
205
- if (value) {
206
- return value.replace(/\${([a-zA-Z0-9]+)}/g, (placeholder, placeholderId) => { var _a; return (_a = process.env[placeholderId]) !== null && _a !== void 0 ? _a : placeholder; });
207
- }
208
- }
209
- const innetEnv = Object.keys(process.env).reduce((result, key) => {
210
- if (key.startsWith('INNETJS_')) {
211
- result[key] = normalizeEnv(process.env[key]);
212
- }
213
- return result;
214
- }, {});
215
192
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
216
193
  const indexExt = scriptExtensions.join(',');
217
194
  class InnetJS {
218
- constructor({ projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
195
+ constructor({ envPrefix = process.env.INNETJS_ENV_PREFIX || 'INNETJS_', projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
219
196
  this.projectFolder = path__default["default"].resolve(projectFolder);
220
197
  this.publicFolder = path__default["default"].resolve(publicFolder);
221
198
  this.releaseFolder = path__default["default"].resolve(releaseFolder);
@@ -240,6 +217,7 @@ class InnetJS {
240
217
  this.proxy = proxy;
241
218
  this.api = api;
242
219
  this.baseUrl = baseUrl;
220
+ this.envPrefix = envPrefix;
243
221
  }
244
222
  // Methods
245
223
  init(appName, { template, force = false } = {}) {
@@ -305,11 +283,9 @@ class InnetJS {
305
283
  json__default["default"](),
306
284
  typescript__default["default"](),
307
285
  jsx__default["default"](),
308
- eslint__default["default"]({
309
- include: lintInclude,
310
- }),
311
286
  ],
312
287
  };
288
+ this.withLint(inputOptions);
313
289
  const outputOptions = {
314
290
  dir: this.buildFolder,
315
291
  sourcemap: this.sourcemap,
@@ -335,7 +311,7 @@ class InnetJS {
335
311
  }), string({
336
312
  include: '**/*.*',
337
313
  exclude: stringExcludeDom,
338
- }), injectEnv__default["default"](innetEnv));
314
+ }));
339
315
  outputOptions.format = 'es';
340
316
  outputOptions.plugins = [
341
317
  rollupPluginTerser.terser(),
@@ -344,6 +320,7 @@ class InnetJS {
344
320
  }),
345
321
  ];
346
322
  }
323
+ this.withEnv(inputOptions);
347
324
  yield logger__default["default"].start('Build production bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
348
325
  const bundle = yield rollup__default["default"].rollup(inputOptions);
349
326
  yield bundle.write(outputOptions);
@@ -397,11 +374,9 @@ class InnetJS {
397
374
  },
398
375
  }),
399
376
  jsx__default["default"](),
400
- eslint__default["default"]({
401
- include: lintInclude,
402
- }),
403
377
  ],
404
378
  };
379
+ this.withLint(options);
405
380
  if (node) {
406
381
  // @ts-expect-error
407
382
  options.output.format = 'cjs';
@@ -435,8 +410,9 @@ class InnetJS {
435
410
  }), string({
436
411
  include: '**/*.*',
437
412
  exclude: stringExcludeDom,
438
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv__default["default"](innetEnv));
413
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
439
414
  }
415
+ this.withEnv(options);
440
416
  const watcher = rollup__default["default"].watch(options);
441
417
  watcher.on('event', (e) => tslib.__awaiter(this, void 0, void 0, function* () {
442
418
  if (e.code === 'ERROR') {
@@ -519,74 +495,75 @@ class InnetJS {
519
495
  const { releaseFolder, cssModules } = this;
520
496
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
521
497
  const pkg = yield this.getPackage();
522
- function build(format) {
498
+ const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
523
499
  var _a, _b;
524
- return tslib.__awaiter(this, void 0, void 0, function* () {
525
- const ext = format === 'es'
526
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
527
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
528
- const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
529
- if (!input.length) {
530
- throw Error('index file is not detected');
531
- }
532
- const options = {
533
- input,
534
- preserveEntrySignatures: 'strict',
535
- output: {
536
- dir: releaseFolder,
537
- entryFileNames: `[name]${ext}`,
538
- format,
539
- preserveModules: true,
540
- },
541
- plugins: [
542
- json__default["default"](),
543
- typescript__default["default"]({
544
- rollupCommonJSResolveHack: false,
545
- clean: true,
546
- }),
547
- jsx__default["default"](),
548
- eslint__default["default"]({
549
- include: lintInclude,
550
- }),
551
- injectEnv__default["default"](innetEnv, {
552
- include: input,
553
- }),
554
- ],
555
- };
556
- if (node) {
557
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
558
- options.plugins = [
559
- ...options.plugins,
560
- externals__default["default"](),
561
- string({
562
- include: '**/*.*',
563
- exclude: stringExcludeNode,
564
- }),
565
- ];
566
- }
567
- else {
568
- options.plugins = [
569
- ...options.plugins,
570
- string({
571
- include: '**/*.*',
572
- exclude: stringExcludeDom,
573
- }),
574
- polyfill__default["default"](),
575
- image__default["default"](),
576
- styles__default["default"]({
577
- mode: 'inject',
578
- url: true,
579
- plugins: [autoprefixer__default["default"]()],
580
- modules: cssModules,
581
- minimize: true,
582
- }),
583
- ];
584
- }
585
- const bundle = yield rollup__default["default"].rollup(options);
586
- yield bundle.write(options.output);
587
- yield bundle.close();
588
- });
589
- }
500
+ const ext = format === 'es'
501
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
502
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
503
+ const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
504
+ if (!input.length) {
505
+ throw Error('index file is not detected');
506
+ }
507
+ const options = {
508
+ input,
509
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
510
+ preserveEntrySignatures: 'strict',
511
+ output: {
512
+ dir: releaseFolder,
513
+ entryFileNames: `[name]${ext}`,
514
+ format,
515
+ preserveModules: true,
516
+ exports: 'auto',
517
+ },
518
+ plugins: [
519
+ json__default["default"](),
520
+ typescript__default["default"]({
521
+ clean: true,
522
+ useTsconfigDeclarationDir: true,
523
+ tsconfigOverride: {
524
+ compilerOptions: {
525
+ declarationDir: releaseFolder,
526
+ sourceMap: false,
527
+ },
528
+ },
529
+ }),
530
+ jsx__default["default"](),
531
+ ],
532
+ };
533
+ this.withLint(options);
534
+ if (node) {
535
+ options.plugins = [
536
+ ...options.plugins,
537
+ externals__default["default"](),
538
+ string({
539
+ include: '**/*.*',
540
+ exclude: stringExcludeNode,
541
+ }),
542
+ ];
543
+ }
544
+ else {
545
+ options.plugins = [
546
+ ...options.plugins,
547
+ string({
548
+ include: '**/*.*',
549
+ exclude: stringExcludeDom,
550
+ }),
551
+ polyfill__default["default"](),
552
+ image__default["default"](),
553
+ styles__default["default"]({
554
+ mode: 'inject',
555
+ url: true,
556
+ plugins: [autoprefixer__default["default"]()],
557
+ modules: cssModules,
558
+ minimize: true,
559
+ }),
560
+ ];
561
+ }
562
+ this.withEnv(options);
563
+ const bundle = yield rollup__default["default"].rollup(options);
564
+ yield bundle.write(options.output);
565
+ yield bundle.close();
566
+ });
590
567
  yield logger__default["default"].start('Build cjs bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
591
568
  yield build('cjs');
592
569
  }));
@@ -604,7 +581,7 @@ class InnetJS {
604
581
  const { bin } = pkg;
605
582
  for (const name in bin) {
606
583
  const value = bin[name];
607
- const input = glob__default["default"].sync(`src/${value}.{${scriptExtensions.join(',')}}`);
584
+ const input = glob__default["default"].sync(`src/${value}.{${indexExt}}`);
608
585
  const file = path__default["default"].join(this.releaseFolder, value);
609
586
  const options = {
610
587
  input,
@@ -626,11 +603,10 @@ class InnetJS {
626
603
  }),
627
604
  externals__default["default"](),
628
605
  jsx__default["default"](),
629
- injectEnv__default["default"](innetEnv, {
630
- include: input,
631
- }),
632
606
  ],
633
607
  };
608
+ this.withLint(options);
609
+ this.withEnv(options);
634
610
  const bundle = yield rollup__default["default"].rollup(options);
635
611
  yield bundle.write(options.output);
636
612
  yield bundle.close();
@@ -660,6 +636,19 @@ class InnetJS {
660
636
  }
661
637
  });
662
638
  }
639
+ withLint(options) {
640
+ if (this._lintUsage === undefined) {
641
+ this._lintUsage = fs__default["default"].existsSync(path__default["default"].join(this.projectFolder, '.eslintrc'));
642
+ }
643
+ if (this._lintUsage) {
644
+ options.plugins.push(eslint__default["default"]({
645
+ include: lintInclude,
646
+ }));
647
+ }
648
+ }
649
+ withEnv(options) {
650
+ options.plugins.push(env__default["default"](this.envPrefix, { include: options.input }));
651
+ }
663
652
  increaseVersion(release) {
664
653
  return tslib.__awaiter(this, void 0, void 0, function* () {
665
654
  const pkg = yield this.getPackage();
@@ -768,6 +757,11 @@ class InnetJS {
768
757
  }
769
758
  }
770
759
 
760
+ if (typeof process === 'undefined') {
761
+ process = { env: {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"} };
762
+ } else {
763
+ Object.assign(process.env, {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"});
764
+ }
771
765
  updateDotenv();
772
766
  const innetJS = new InnetJS();
773
767
  const errorOption = new commander.Option('-e, --error', 'Show error details');
package/constants.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
-
7
5
  const lintInclude = [
8
6
  '**/*.ts',
9
7
  '**/*.tsx',
package/constants.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
-
3
1
  const lintInclude = [
4
2
  '**/*.ts',
5
3
  '**/*.tsx',
package/extract.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
5
  var unzipper = require('unzipper');
7
6
 
8
7
  const Writer = require('fstream').Writer;
package/extract.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
1
  import { Parse } from 'unzipper';
3
2
 
4
3
  const Writer = require('fstream').Writer;
package/helpers.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
5
  var tslib = require('tslib');
7
6
  var logger = require('@cantinc/logger');
8
7
  var chalk = require('chalk');
package/helpers.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
1
  import { __awaiter } from 'tslib';
3
2
  import logger from '@cantinc/logger';
4
3
  import chalk from 'chalk';
package/index.d.ts CHANGED
@@ -31,8 +31,10 @@ export declare class InnetJS {
31
31
  cssInJs: boolean;
32
32
  port: number;
33
33
  api: string;
34
+ envPrefix: string;
34
35
  private package;
35
- constructor({ projectFolder, baseUrl, publicFolder, releaseFolder, buildFolder, srcFolder, sourcemap, cssModules, cssInJs, sslKey, sslCrt, proxy, port, api, }?: {
36
+ constructor({ envPrefix, projectFolder, baseUrl, publicFolder, releaseFolder, buildFolder, srcFolder, sourcemap, cssModules, cssInJs, sslKey, sslCrt, proxy, port, api, }?: {
37
+ envPrefix?: string;
36
38
  projectFolder?: string;
37
39
  baseUrl?: string;
38
40
  publicFolder?: string;
@@ -60,6 +62,9 @@ export declare class InnetJS {
60
62
  }): Promise<void>;
61
63
  run(file: any): Promise<void>;
62
64
  release({ node, index, pub }?: ReleaseOptions): Promise<void>;
65
+ private _lintUsage;
66
+ withLint(options: rollup.RollupOptions): void;
67
+ withEnv(options: rollup.RollupOptions): void;
63
68
  increaseVersion(release: string): Promise<void>;
64
69
  getPackage(): Promise<Record<string, any>>;
65
70
  createClient(key: any, cert: any, pkg: any, index: string): rollup.Plugin;
package/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
5
  var tslib = require('tslib');
7
6
  var logger = require('@cantinc/logger');
8
7
  var commonjs = require('@rollup/plugin-commonjs');
@@ -26,11 +25,11 @@ var path = require('node:path');
26
25
  var prompt = require('prompts');
27
26
  var rollup = require('rollup');
28
27
  var filesize = require('rollup-plugin-filesize');
29
- var injectEnv = require('rollup-plugin-inject-process-env');
30
28
  var jsx = require('rollup-plugin-innet-jsx');
31
29
  var externals = require('rollup-plugin-node-externals');
32
30
  var polyfill = require('rollup-plugin-polyfill-node');
33
31
  var rollupPluginPreserveShebangs = require('rollup-plugin-preserve-shebangs');
32
+ var env = require('rollup-plugin-process-env');
34
33
  var styles = require('rollup-plugin-styles');
35
34
  var rollupPluginTerser = require('rollup-plugin-terser');
36
35
  var typescript = require('rollup-plugin-typescript2');
@@ -63,14 +62,19 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
63
62
  var prompt__default = /*#__PURE__*/_interopDefaultLegacy(prompt);
64
63
  var rollup__default = /*#__PURE__*/_interopDefaultLegacy(rollup);
65
64
  var filesize__default = /*#__PURE__*/_interopDefaultLegacy(filesize);
66
- var injectEnv__default = /*#__PURE__*/_interopDefaultLegacy(injectEnv);
67
65
  var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
68
66
  var externals__default = /*#__PURE__*/_interopDefaultLegacy(externals);
69
67
  var polyfill__default = /*#__PURE__*/_interopDefaultLegacy(polyfill);
68
+ var env__default = /*#__PURE__*/_interopDefaultLegacy(env);
70
69
  var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
71
70
  var typescript__default = /*#__PURE__*/_interopDefaultLegacy(typescript);
72
71
  var tmp__default = /*#__PURE__*/_interopDefaultLegacy(tmp);
73
72
 
73
+ if (typeof process === 'undefined') {
74
+ process = { env: {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"} };
75
+ } else {
76
+ Object.assign(process.env, {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"});
77
+ }
74
78
  const livereload = require('rollup-plugin-livereload');
75
79
  const { string } = require('rollup-plugin-string');
76
80
  const { exec, spawn } = require('child_process');
@@ -79,21 +83,10 @@ const execAsync = node_util.promisify(exec);
79
83
  const copyFiles = node_util.promisify(fs__default["default"].copy);
80
84
  updateDotenv.updateDotenv();
81
85
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
82
- function normalizeEnv(value) {
83
- if (value) {
84
- return value.replace(/\${([a-zA-Z0-9]+)}/g, (placeholder, placeholderId) => { var _a; return (_a = process.env[placeholderId]) !== null && _a !== void 0 ? _a : placeholder; });
85
- }
86
- }
87
- const innetEnv = Object.keys(process.env).reduce((result, key) => {
88
- if (key.startsWith('INNETJS_')) {
89
- result[key] = normalizeEnv(process.env[key]);
90
- }
91
- return result;
92
- }, {});
93
86
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
94
87
  const indexExt = scriptExtensions.join(',');
95
88
  class InnetJS {
96
- constructor({ projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
89
+ constructor({ envPrefix = process.env.INNETJS_ENV_PREFIX || 'INNETJS_', projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
97
90
  this.projectFolder = path__default["default"].resolve(projectFolder);
98
91
  this.publicFolder = path__default["default"].resolve(publicFolder);
99
92
  this.releaseFolder = path__default["default"].resolve(releaseFolder);
@@ -118,6 +111,7 @@ class InnetJS {
118
111
  this.proxy = proxy;
119
112
  this.api = api;
120
113
  this.baseUrl = baseUrl;
114
+ this.envPrefix = envPrefix;
121
115
  }
122
116
  // Methods
123
117
  init(appName, { template, force = false } = {}) {
@@ -183,11 +177,9 @@ class InnetJS {
183
177
  json__default["default"](),
184
178
  typescript__default["default"](),
185
179
  jsx__default["default"](),
186
- eslint__default["default"]({
187
- include: constants.lintInclude,
188
- }),
189
180
  ],
190
181
  };
182
+ this.withLint(inputOptions);
191
183
  const outputOptions = {
192
184
  dir: this.buildFolder,
193
185
  sourcemap: this.sourcemap,
@@ -213,7 +205,7 @@ class InnetJS {
213
205
  }), string({
214
206
  include: '**/*.*',
215
207
  exclude: constants.stringExcludeDom,
216
- }), injectEnv__default["default"](innetEnv));
208
+ }));
217
209
  outputOptions.format = 'es';
218
210
  outputOptions.plugins = [
219
211
  rollupPluginTerser.terser(),
@@ -222,6 +214,7 @@ class InnetJS {
222
214
  }),
223
215
  ];
224
216
  }
217
+ this.withEnv(inputOptions);
225
218
  yield logger__default["default"].start('Build production bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
226
219
  const bundle = yield rollup__default["default"].rollup(inputOptions);
227
220
  yield bundle.write(outputOptions);
@@ -275,11 +268,9 @@ class InnetJS {
275
268
  },
276
269
  }),
277
270
  jsx__default["default"](),
278
- eslint__default["default"]({
279
- include: constants.lintInclude,
280
- }),
281
271
  ],
282
272
  };
273
+ this.withLint(options);
283
274
  if (node) {
284
275
  // @ts-expect-error
285
276
  options.output.format = 'cjs';
@@ -313,8 +304,9 @@ class InnetJS {
313
304
  }), string({
314
305
  include: '**/*.*',
315
306
  exclude: constants.stringExcludeDom,
316
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv__default["default"](innetEnv));
307
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
317
308
  }
309
+ this.withEnv(options);
318
310
  const watcher = rollup__default["default"].watch(options);
319
311
  watcher.on('event', (e) => tslib.__awaiter(this, void 0, void 0, function* () {
320
312
  if (e.code === 'ERROR') {
@@ -397,74 +389,75 @@ class InnetJS {
397
389
  const { releaseFolder, cssModules } = this;
398
390
  yield logger__default["default"].start('Remove previous release', () => fs__default["default"].remove(releaseFolder));
399
391
  const pkg = yield this.getPackage();
400
- function build(format) {
392
+ const build = (format) => tslib.__awaiter(this, void 0, void 0, function* () {
401
393
  var _a, _b;
402
- return tslib.__awaiter(this, void 0, void 0, function* () {
403
- const ext = format === 'es'
404
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
405
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
406
- const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
407
- if (!input.length) {
408
- throw Error('index file is not detected');
409
- }
410
- const options = {
411
- input,
412
- preserveEntrySignatures: 'strict',
413
- output: {
414
- dir: releaseFolder,
415
- entryFileNames: `[name]${ext}`,
416
- format,
417
- preserveModules: true,
418
- },
419
- plugins: [
420
- json__default["default"](),
421
- typescript__default["default"]({
422
- rollupCommonJSResolveHack: false,
423
- clean: true,
424
- }),
425
- jsx__default["default"](),
426
- eslint__default["default"]({
427
- include: constants.lintInclude,
428
- }),
429
- injectEnv__default["default"](innetEnv, {
430
- include: input,
431
- }),
432
- ],
433
- };
434
- if (node) {
435
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
436
- options.plugins = [
437
- ...options.plugins,
438
- externals__default["default"](),
439
- string({
440
- include: '**/*.*',
441
- exclude: constants.stringExcludeNode,
442
- }),
443
- ];
444
- }
445
- else {
446
- options.plugins = [
447
- ...options.plugins,
448
- string({
449
- include: '**/*.*',
450
- exclude: constants.stringExcludeDom,
451
- }),
452
- polyfill__default["default"](),
453
- image__default["default"](),
454
- styles__default["default"]({
455
- mode: 'inject',
456
- url: true,
457
- plugins: [autoprefixer__default["default"]()],
458
- modules: cssModules,
459
- minimize: true,
460
- }),
461
- ];
462
- }
463
- const bundle = yield rollup__default["default"].rollup(options);
464
- yield bundle.write(options.output);
465
- yield bundle.close();
466
- });
467
- }
394
+ const ext = format === 'es'
395
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
396
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
397
+ const input = glob__default["default"].sync(`src/${index}.{${indexExt}}`);
398
+ if (!input.length) {
399
+ throw Error('index file is not detected');
400
+ }
401
+ const options = {
402
+ input,
403
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
404
+ preserveEntrySignatures: 'strict',
405
+ output: {
406
+ dir: releaseFolder,
407
+ entryFileNames: `[name]${ext}`,
408
+ format,
409
+ preserveModules: true,
410
+ exports: 'auto',
411
+ },
412
+ plugins: [
413
+ json__default["default"](),
414
+ typescript__default["default"]({
415
+ clean: true,
416
+ useTsconfigDeclarationDir: true,
417
+ tsconfigOverride: {
418
+ compilerOptions: {
419
+ declarationDir: releaseFolder,
420
+ sourceMap: false,
421
+ },
422
+ },
423
+ }),
424
+ jsx__default["default"](),
425
+ ],
426
+ };
427
+ this.withLint(options);
428
+ if (node) {
429
+ options.plugins = [
430
+ ...options.plugins,
431
+ externals__default["default"](),
432
+ string({
433
+ include: '**/*.*',
434
+ exclude: constants.stringExcludeNode,
435
+ }),
436
+ ];
437
+ }
438
+ else {
439
+ options.plugins = [
440
+ ...options.plugins,
441
+ string({
442
+ include: '**/*.*',
443
+ exclude: constants.stringExcludeDom,
444
+ }),
445
+ polyfill__default["default"](),
446
+ image__default["default"](),
447
+ styles__default["default"]({
448
+ mode: 'inject',
449
+ url: true,
450
+ plugins: [autoprefixer__default["default"]()],
451
+ modules: cssModules,
452
+ minimize: true,
453
+ }),
454
+ ];
455
+ }
456
+ this.withEnv(options);
457
+ const bundle = yield rollup__default["default"].rollup(options);
458
+ yield bundle.write(options.output);
459
+ yield bundle.close();
460
+ });
468
461
  yield logger__default["default"].start('Build cjs bundle', () => tslib.__awaiter(this, void 0, void 0, function* () {
469
462
  yield build('cjs');
470
463
  }));
@@ -482,7 +475,7 @@ class InnetJS {
482
475
  const { bin } = pkg;
483
476
  for (const name in bin) {
484
477
  const value = bin[name];
485
- const input = glob__default["default"].sync(`src/${value}.{${scriptExtensions.join(',')}}`);
478
+ const input = glob__default["default"].sync(`src/${value}.{${indexExt}}`);
486
479
  const file = path__default["default"].join(this.releaseFolder, value);
487
480
  const options = {
488
481
  input,
@@ -504,11 +497,10 @@ class InnetJS {
504
497
  }),
505
498
  externals__default["default"](),
506
499
  jsx__default["default"](),
507
- injectEnv__default["default"](innetEnv, {
508
- include: input,
509
- }),
510
500
  ],
511
501
  };
502
+ this.withLint(options);
503
+ this.withEnv(options);
512
504
  const bundle = yield rollup__default["default"].rollup(options);
513
505
  yield bundle.write(options.output);
514
506
  yield bundle.close();
@@ -538,6 +530,19 @@ class InnetJS {
538
530
  }
539
531
  });
540
532
  }
533
+ withLint(options) {
534
+ if (this._lintUsage === undefined) {
535
+ this._lintUsage = fs__default["default"].existsSync(path__default["default"].join(this.projectFolder, '.eslintrc'));
536
+ }
537
+ if (this._lintUsage) {
538
+ options.plugins.push(eslint__default["default"]({
539
+ include: constants.lintInclude,
540
+ }));
541
+ }
542
+ }
543
+ withEnv(options) {
544
+ options.plugins.push(env__default["default"](this.envPrefix, { include: options.input }));
545
+ }
541
546
  increaseVersion(release) {
542
547
  return tslib.__awaiter(this, void 0, void 0, function* () {
543
548
  const pkg = yield this.getPackage();
package/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
1
  import { __awaiter } from 'tslib';
3
2
  import logger from '@cantinc/logger';
4
3
  import commonjs from '@rollup/plugin-commonjs';
@@ -22,21 +21,26 @@ import path from 'node:path';
22
21
  import prompt from 'prompts';
23
22
  import rollup from 'rollup';
24
23
  import filesize from 'rollup-plugin-filesize';
25
- import injectEnv from 'rollup-plugin-inject-process-env';
26
24
  import jsx from 'rollup-plugin-innet-jsx';
27
25
  import externals from 'rollup-plugin-node-externals';
28
26
  import polyfill from 'rollup-plugin-polyfill-node';
29
27
  import { preserveShebangs } from 'rollup-plugin-preserve-shebangs';
28
+ import env from 'rollup-plugin-process-env';
30
29
  import styles from 'rollup-plugin-styles';
31
30
  import { terser } from 'rollup-plugin-terser';
32
31
  import typescript from 'rollup-plugin-typescript2';
33
32
  import tmp from 'tmp';
34
33
  import { promisify } from 'node:util';
35
- import { lintInclude, stringExcludeNode, stringExcludeDom } from './constants.mjs';
34
+ import { stringExcludeNode, stringExcludeDom, lintInclude } from './constants.mjs';
36
35
  import { Extract } from './extract.mjs';
37
36
  import { reporter, convertIndexFile, getFile } from './helpers.mjs';
38
37
  import { updateDotenv } from './updateDotenv.mjs';
39
38
 
39
+ if (typeof process === 'undefined') {
40
+ process = { env: {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"} };
41
+ } else {
42
+ Object.assign(process.env, {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.11"});
43
+ }
40
44
  const livereload = require('rollup-plugin-livereload');
41
45
  const { string } = require('rollup-plugin-string');
42
46
  const { exec, spawn } = require('child_process');
@@ -45,21 +49,10 @@ const execAsync = promisify(exec);
45
49
  const copyFiles = promisify(fs.copy);
46
50
  updateDotenv();
47
51
  const REG_CLEAR_TEXT = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
48
- function normalizeEnv(value) {
49
- if (value) {
50
- return value.replace(/\${([a-zA-Z0-9]+)}/g, (placeholder, placeholderId) => { var _a; return (_a = process.env[placeholderId]) !== null && _a !== void 0 ? _a : placeholder; });
51
- }
52
- }
53
- const innetEnv = Object.keys(process.env).reduce((result, key) => {
54
- if (key.startsWith('INNETJS_')) {
55
- result[key] = normalizeEnv(process.env[key]);
56
- }
57
- return result;
58
- }, {});
59
52
  const scriptExtensions = ['ts', 'js', 'tsx', 'jsx'];
60
53
  const indexExt = scriptExtensions.join(',');
61
54
  class InnetJS {
62
- constructor({ projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
55
+ constructor({ envPrefix = process.env.INNETJS_ENV_PREFIX || 'INNETJS_', projectFolder = process.env.PROJECT_FOLDER || '', baseUrl = process.env.BASE_URL || '/', publicFolder = process.env.PUBLIC_FOLDER || 'public', releaseFolder = process.env.RELEASE_FOLDER || 'release', 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 || '/api/?*', } = {}) {
63
56
  this.projectFolder = path.resolve(projectFolder);
64
57
  this.publicFolder = path.resolve(publicFolder);
65
58
  this.releaseFolder = path.resolve(releaseFolder);
@@ -84,6 +77,7 @@ class InnetJS {
84
77
  this.proxy = proxy;
85
78
  this.api = api;
86
79
  this.baseUrl = baseUrl;
80
+ this.envPrefix = envPrefix;
87
81
  }
88
82
  // Methods
89
83
  init(appName, { template, force = false } = {}) {
@@ -149,11 +143,9 @@ class InnetJS {
149
143
  json(),
150
144
  typescript(),
151
145
  jsx(),
152
- eslint({
153
- include: lintInclude,
154
- }),
155
146
  ],
156
147
  };
148
+ this.withLint(inputOptions);
157
149
  const outputOptions = {
158
150
  dir: this.buildFolder,
159
151
  sourcemap: this.sourcemap,
@@ -179,7 +171,7 @@ class InnetJS {
179
171
  }), string({
180
172
  include: '**/*.*',
181
173
  exclude: stringExcludeDom,
182
- }), injectEnv(innetEnv));
174
+ }));
183
175
  outputOptions.format = 'es';
184
176
  outputOptions.plugins = [
185
177
  terser(),
@@ -188,6 +180,7 @@ class InnetJS {
188
180
  }),
189
181
  ];
190
182
  }
183
+ this.withEnv(inputOptions);
191
184
  yield logger.start('Build production bundle', () => __awaiter(this, void 0, void 0, function* () {
192
185
  const bundle = yield rollup.rollup(inputOptions);
193
186
  yield bundle.write(outputOptions);
@@ -241,11 +234,9 @@ class InnetJS {
241
234
  },
242
235
  }),
243
236
  jsx(),
244
- eslint({
245
- include: lintInclude,
246
- }),
247
237
  ],
248
238
  };
239
+ this.withLint(options);
249
240
  if (node) {
250
241
  // @ts-expect-error
251
242
  options.output.format = 'cjs';
@@ -279,8 +270,9 @@ class InnetJS {
279
270
  }), string({
280
271
  include: '**/*.*',
281
272
  exclude: stringExcludeDom,
282
- }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))), injectEnv(innetEnv));
273
+ }), this.createClient(key, cert, pkg, index), livereload(Object.assign({ exts: ['html', 'css', 'js', 'png', 'svg', 'webp', 'gif', 'jpg', 'json'], watch: [this.devBuildFolder, this.publicFolder], verbose: false }, (key && cert ? { https: { key, cert } } : {}))));
283
274
  }
275
+ this.withEnv(options);
284
276
  const watcher = rollup.watch(options);
285
277
  watcher.on('event', (e) => __awaiter(this, void 0, void 0, function* () {
286
278
  if (e.code === 'ERROR') {
@@ -363,74 +355,75 @@ class InnetJS {
363
355
  const { releaseFolder, cssModules } = this;
364
356
  yield logger.start('Remove previous release', () => fs.remove(releaseFolder));
365
357
  const pkg = yield this.getPackage();
366
- function build(format) {
358
+ const build = (format) => __awaiter(this, void 0, void 0, function* () {
367
359
  var _a, _b;
368
- return __awaiter(this, void 0, void 0, function* () {
369
- const ext = format === 'es'
370
- ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
371
- : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
372
- const input = glob.sync(`src/${index}.{${indexExt}}`);
373
- if (!input.length) {
374
- throw Error('index file is not detected');
375
- }
376
- const options = {
377
- input,
378
- preserveEntrySignatures: 'strict',
379
- output: {
380
- dir: releaseFolder,
381
- entryFileNames: `[name]${ext}`,
382
- format,
383
- preserveModules: true,
384
- },
385
- plugins: [
386
- json(),
387
- typescript({
388
- rollupCommonJSResolveHack: false,
389
- clean: true,
390
- }),
391
- jsx(),
392
- eslint({
393
- include: lintInclude,
394
- }),
395
- injectEnv(innetEnv, {
396
- include: input,
397
- }),
398
- ],
399
- };
400
- if (node) {
401
- options.external = [...Object.keys(pkg.dependencies), 'tslib'];
402
- options.plugins = [
403
- ...options.plugins,
404
- externals(),
405
- string({
406
- include: '**/*.*',
407
- exclude: stringExcludeNode,
408
- }),
409
- ];
410
- }
411
- else {
412
- options.plugins = [
413
- ...options.plugins,
414
- string({
415
- include: '**/*.*',
416
- exclude: stringExcludeDom,
417
- }),
418
- polyfill(),
419
- image(),
420
- styles({
421
- mode: 'inject',
422
- url: true,
423
- plugins: [autoprefixer()],
424
- modules: cssModules,
425
- minimize: true,
426
- }),
427
- ];
428
- }
429
- const bundle = yield rollup.rollup(options);
430
- yield bundle.write(options.output);
431
- yield bundle.close();
432
- });
433
- }
360
+ const ext = format === 'es'
361
+ ? ((_a = (pkg.module || pkg.esnext || pkg['jsnext:main'])) === null || _a === void 0 ? void 0 : _a.replace('index', '')) || '.mjs'
362
+ : ((_b = pkg.main) === null || _b === void 0 ? void 0 : _b.replace('index', '')) || '.js';
363
+ const input = glob.sync(`src/${index}.{${indexExt}}`);
364
+ if (!input.length) {
365
+ throw Error('index file is not detected');
366
+ }
367
+ const options = {
368
+ input,
369
+ external: [...Object.keys(pkg.dependencies), 'tslib'],
370
+ preserveEntrySignatures: 'strict',
371
+ output: {
372
+ dir: releaseFolder,
373
+ entryFileNames: `[name]${ext}`,
374
+ format,
375
+ preserveModules: true,
376
+ exports: 'auto',
377
+ },
378
+ plugins: [
379
+ json(),
380
+ typescript({
381
+ clean: true,
382
+ useTsconfigDeclarationDir: true,
383
+ tsconfigOverride: {
384
+ compilerOptions: {
385
+ declarationDir: releaseFolder,
386
+ sourceMap: false,
387
+ },
388
+ },
389
+ }),
390
+ jsx(),
391
+ ],
392
+ };
393
+ this.withLint(options);
394
+ if (node) {
395
+ options.plugins = [
396
+ ...options.plugins,
397
+ externals(),
398
+ string({
399
+ include: '**/*.*',
400
+ exclude: stringExcludeNode,
401
+ }),
402
+ ];
403
+ }
404
+ else {
405
+ options.plugins = [
406
+ ...options.plugins,
407
+ string({
408
+ include: '**/*.*',
409
+ exclude: stringExcludeDom,
410
+ }),
411
+ polyfill(),
412
+ image(),
413
+ styles({
414
+ mode: 'inject',
415
+ url: true,
416
+ plugins: [autoprefixer()],
417
+ modules: cssModules,
418
+ minimize: true,
419
+ }),
420
+ ];
421
+ }
422
+ this.withEnv(options);
423
+ const bundle = yield rollup.rollup(options);
424
+ yield bundle.write(options.output);
425
+ yield bundle.close();
426
+ });
434
427
  yield logger.start('Build cjs bundle', () => __awaiter(this, void 0, void 0, function* () {
435
428
  yield build('cjs');
436
429
  }));
@@ -448,7 +441,7 @@ class InnetJS {
448
441
  const { bin } = pkg;
449
442
  for (const name in bin) {
450
443
  const value = bin[name];
451
- const input = glob.sync(`src/${value}.{${scriptExtensions.join(',')}}`);
444
+ const input = glob.sync(`src/${value}.{${indexExt}}`);
452
445
  const file = path.join(this.releaseFolder, value);
453
446
  const options = {
454
447
  input,
@@ -470,11 +463,10 @@ class InnetJS {
470
463
  }),
471
464
  externals(),
472
465
  jsx(),
473
- injectEnv(innetEnv, {
474
- include: input,
475
- }),
476
466
  ],
477
467
  };
468
+ this.withLint(options);
469
+ this.withEnv(options);
478
470
  const bundle = yield rollup.rollup(options);
479
471
  yield bundle.write(options.output);
480
472
  yield bundle.close();
@@ -504,6 +496,19 @@ class InnetJS {
504
496
  }
505
497
  });
506
498
  }
499
+ withLint(options) {
500
+ if (this._lintUsage === undefined) {
501
+ this._lintUsage = fs.existsSync(path.join(this.projectFolder, '.eslintrc'));
502
+ }
503
+ if (this._lintUsage) {
504
+ options.plugins.push(eslint({
505
+ include: lintInclude,
506
+ }));
507
+ }
508
+ }
509
+ withEnv(options) {
510
+ options.plugins.push(env(this.envPrefix, { include: options.input }));
511
+ }
507
512
  increaseVersion(release) {
508
513
  return __awaiter(this, void 0, void 0, function* () {
509
514
  const pkg = yield this.getPackage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innetjs",
3
- "version": "2.2.9",
3
+ "version": "2.2.11",
4
4
  "description": "CLI for innet boilerplate",
5
5
  "homepage": "https://github.com/d8corp/innetjs",
6
6
  "author": "Mikhail Lysikov <d8corp@mail.ru>",
@@ -72,7 +72,7 @@
72
72
  "prompts": "^2.4.2",
73
73
  "rollup": "^2.79.1",
74
74
  "rollup-plugin-filesize": "^9.1.2",
75
- "rollup-plugin-inject-process-env": "^1.3.1",
75
+ "rollup-plugin-process-env": "^1.0.0",
76
76
  "rollup-plugin-innet-jsx": "^1.3.2",
77
77
  "rollup-plugin-livereload": "^2.0.5",
78
78
  "rollup-plugin-node-externals": "^5.0.2",
package/updateDotenv.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('./_virtual/_rollup-plugin-inject-process-env.js');
6
-
7
5
  function updateDotenv() {
8
6
  const { INNETJS_INNETJS_PACKAGE_VERSION } = process.env;
9
7
  delete process.env.INNETJS_INNETJS_PACKAGE_VERSION;
package/updateDotenv.mjs CHANGED
@@ -1,5 +1,3 @@
1
- import './_virtual/_rollup-plugin-inject-process-env.mjs';
2
-
3
1
  function updateDotenv() {
4
2
  const { INNETJS_INNETJS_PACKAGE_VERSION } = process.env;
5
3
  delete process.env.INNETJS_INNETJS_PACKAGE_VERSION;
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- (function() {
4
- const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.9"};
5
- try {
6
- if (process) {
7
- process.env = Object.assign({}, process.env);
8
- Object.assign(process.env, env);
9
- return;
10
- }
11
- } catch (e) {} // avoid ReferenceError: process is not defined
12
- globalThis.process = { env:env };
13
- })();
@@ -1,11 +0,0 @@
1
- (function() {
2
- const env = {"INNETJS_INNETJS_PACKAGE_VERSION":"2.2.9"};
3
- try {
4
- if (process) {
5
- process.env = Object.assign({}, process.env);
6
- Object.assign(process.env, env);
7
- return;
8
- }
9
- } catch (e) {} // avoid ReferenceError: process is not defined
10
- globalThis.process = { env:env };
11
- })();