Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lskjs/env

Package Overview
Dependencies
Maintainers
11
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lskjs/env

LSK.js – env – Scripts for environment detecton

  • 3.0.0-alpha.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
120
decreased by-64.29%
Maintainers
11
Weekly downloads
 
Created
Source

LSK.js – env

@lskjs/env – LSK.js – env – Scripts for environment detecton

LSK logo NPM version NPM downloads NPM Dependency count Have TypeScript types Have tree shaking NPM Package size Package size Ask us in Telegram


Table of contents

⌨️ Install

# yarn
yarn i @lskjs/env 

# npm
npm i @lskjs/env 

First principles

  • Асинхронность все везде
  • Ленивость всех операций
  • Декларативный подход для конечного программиста

Манифест

Стандарт бы и 5 лет назад, но авангардисты JS создали coffescript, babel и ts, потому что JS окостенел и не двигался. Так же как и ВКшники написали свой KPHP. 

В этом пути нет ничего постыдного, то что еще вчера считалось ебанистикой, завтра может захватить умы своим удобством.

У меня нет априорной аппеляции к авторитетам из ECMA. 

Я делаю среду комфортную для конечного программиста, который делает продукт для клиента. 
Если стандарт позволяет написать удобное решение — то придумаем как.
Если для этого придется переписать стандарт — значит перепишем. 
Благо babel максимальным образом позволяет писать собственные диалекты.

Не задача должна прогибаться под решением, а решение под задачу.

Вопросы на которые стоит ответить создателю:

  • Пример Api на бэке handler
  • Пример функции и как ее переопределить
  • Модели монго как подключить
  • Как достать, когда пишешь Api
  • Роутер добавление роута и страницы
  • CrudApi основные методы
  • Как оборачивать ответ сервера, чтобы вернулся объект
  • Как сделать свой стор
  • Как достать стор на странице

Как запускать любой lsk-образный проект

  1. git clone repo
  2. npm install
  3. npm run bootstrap
  • copy .env.js if needed
  • npm run dev or
  • cd packages/package && npm run dev

Packages included in this repo

PackageDescriptionActivityVersionBundlePackage Size
apiqueryhttp/s + websockets api client for Web, Node.js and React Native throw fetch or axiosNPM BadgeNPM BadgeNPM Badgeinstall size
apmLSK.js – apm – module Node.js agent for Elastic APMNPM BadgeNPM BadgeNPM Badgeinstall size
authLSK.js – auth – module for authorization by login and password and singup through social networksNPM BadgeNPM BadgeNPM Badgeinstall size
autobindLSK ux subrepo: autobindNPM BadgeNPM BadgeNPM Badgeinstall size
billingLSK.js module for adding billing in cabinetNPM BadgeNPM BadgeNPM Badgeinstall size
botsLSK.js module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-baseLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-pluginLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-plugin-debugLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-plugin-menuLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-plugin-notifyLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-plugin-polundraLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-plugin-portalLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-providerLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-clubhouseLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-discordLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-instagramLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-slackLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-telegramLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-twitterLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-vkLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-provider-whatsappLSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
bots-routerLSK.js router for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creationNPM BadgeNPM BadgeNPM Badgeinstall size
build-localesCLI for build i18 locales from Google spreadsheetNPM BadgeNPM BadgeNPM Badgeinstall size
bunyanLight weight bunyan logger for a JSON logging library for node.js services without dtraceNPM BadgeNPM BadgeNPM Badgeinstall size
configLSK config.NPM BadgeNPM BadgeNPM Badgeinstall size
dbLSK.js module for working with mongodb databaseNPM BadgeNPM BadgeNPM Badgeinstall size
elasticLSK.js module for elastic searchNPM BadgeNPM BadgeNPM Badgeinstall size
eventLSK module for event.NPM BadgeNPM BadgeNPM Badgeinstall size
getspreadsheetLSK getspreadsheet.NPM BadgeNPM BadgeNPM Badgeinstall size
grantLSK module for grant.NPM BadgeNPM BadgeNPM Badgeinstall size
i18LSK module for internationalization with i18next.NPM BadgeNPM BadgeNPM Badgeinstall size
kafkaLSK module for kafka.NPM BadgeNPM BadgeNPM Badgeinstall size
launcherLSK Launcher.NPM BadgeNPM BadgeNPM Badgeinstall size
linkallLSK link all.NPM BadgeNPM BadgeNPM Badgeinstall size
logLSK log.NPM BadgeNPM BadgeNPM Badgeinstall size
logЛоггер совмещающий лучшие черты morgan, winston, bunyan, logrus. debug. Базируется на debug-level.NPM BadgeNPM BadgeNPM Badgeinstall size
mailerLSK module for send and receive emails.NPM BadgeNPM BadgeNPM Badgeinstall size
mobxLSK module for mobx.NPM BadgeNPM BadgeNPM Badgeinstall size
moduleModule system with dependency injection, event emitter, logger and submodules treeNPM BadgeNPM BadgeNPM Badgeinstall size
permitLSK module for one time codes and permits.NPM BadgeNPM BadgeNPM Badgeinstall size
proxyLSK module for proxy.NPM BadgeNPM BadgeNPM Badgeinstall size
rabbitLSK module for rabbit.NPM BadgeNPM BadgeNPM Badgeinstall size
reactappLSK ux subrepo: reactappNPM BadgeNPM BadgeNPM Badgeinstall size
rlogLSK module for remote logger.NPM BadgeNPM BadgeNPM Badgeinstall size
scyllaLSK module for scylla.NPM BadgeNPM BadgeNPM Badgeinstall size
sequelizeLSK module for sequelize.NPM BadgeNPM BadgeNPM Badgeinstall size
serverLSK server.NPM BadgeNPM BadgeNPM Badgeinstall size
server-apiLSK server-api.NPM BadgeNPM BadgeNPM Badgeinstall size
shLSK ux subrepo: shNPM BadgeNPM BadgeNPM Badgeinstall size
smsLSK module for sms.NPM BadgeNPM BadgeNPM Badgeinstall size
tbotLSK module.NPM BadgeNPM BadgeNPM Badgeinstall size
uappLSK universal react app wrapperNPM BadgeNPM BadgeNPM Badgeinstall size
uploadLSK module for uploading files.NPM BadgeNPM BadgeNPM Badgeinstall size
utilsLSK.js – utils – helpers and functionsNPM BadgeNPM BadgeNPM Badgeinstall size
workerLSK module for worker.NPM BadgeNPM BadgeNPM Badgeinstall size
add-to-calendarLSK ux subrepo: extraNPM BadgeNPM BadgeNPM Badgeinstall size
articleLSK ux subrepo: articleNPM BadgeNPM BadgeNPM Badgeinstall size
avatarLSK ux subrepo: avatarNPM BadgeNPM BadgeNPM Badgeinstall size
buttonLSK ux subrepo: buttonNPM BadgeNPM BadgeNPM Badgeinstall size
button2LSK ux subrepo: buttonNPM BadgeNPM BadgeNPM Badgeinstall size
chatLSK ux subrepo: chatNPM BadgeNPM BadgeNPM Badgeinstall size
cookie-consentLSK ux subrepo: cookie-consentNPM BadgeNPM BadgeNPM Badgeinstall size
cssLSK ux subrepo: cssNPM BadgeNPM BadgeNPM Badgeinstall size
dashLSK.js – Dash – React components for your own dashboardNPM BadgeNPM BadgeNPM Badgeinstall size
dashboardLSK ux subrepo: dashboardNPM BadgeNPM BadgeNPM Badgeinstall size
devLSK ux subrepo: ui-devNPM BadgeNPM BadgeNPM Badgeinstall size
docslskjs docsNPM BadgeNPM BadgeNPM Badgeinstall size
downloadsLSK ux subrepo: downloadNPM BadgeNPM BadgeNPM Badgeinstall size
extraLSK ux subrepo: extraNPM BadgeNPM BadgeNPM Badgeinstall size
flagLSK ux subrepo: flagNPM BadgeNPM BadgeNPM Badgeinstall size
formLSK ux subrepo: formNPM BadgeNPM BadgeNPM Badgeinstall size
gridLSK ux subrepo: gridNPM BadgeNPM BadgeNPM Badgeinstall size
gridtableLSK ux subrepo: gridtableNPM BadgeNPM BadgeNPM Badgeinstall size
imageLSK ux subrepo: imageNPM BadgeNPM BadgeNPM Badgeinstall size
landingLSK ux subrepo: landingNPM BadgeNPM BadgeNPM Badgeinstall size
linkLSK ux subrepo: linkNPM BadgeNPM BadgeNPM Badgeinstall size
listLSK ux subrepo: listNPM BadgeNPM BadgeNPM Badgeinstall size
modalLSK ux subrepo: modalNPM BadgeNPM BadgeNPM Badgeinstall size
navbarLSK ux subrepo: navbarNPM BadgeNPM BadgeNPM Badgeinstall size
notificationLSK ux subrepo: notificationNPM BadgeNPM BadgeNPM Badgeinstall size
pageLSK ux subrepo: pageNPM BadgeNPM BadgeNPM Badgeinstall size
progressLSK ux subrepo: progressNPM BadgeNPM BadgeNPM Badgeinstall size
scrollLSK ux subrepo: scrollNPM BadgeNPM BadgeNPM Badgeinstall size
slideLSK ux subrepo: slideNPM BadgeNPM BadgeNPM Badgeinstall size
tLSK ux subrepo: tNPM BadgeNPM BadgeNPM Badgeinstall size
tagLSK ux subrepo: tagNPM BadgeNPM BadgeNPM Badgeinstall size
themeLSK ux subrepo: themeNPM BadgeNPM BadgeNPM Badgeinstall size
typoLSK ux subrepo: typoNPM BadgeNPM BadgeNPM Badgeinstall size
uiLSK ux subrepo: uiNPM BadgeNPM BadgeNPM Badgeinstall size
ui2LSK ux subrepo: ui2NPM BadgeNPM BadgeNPM Badgeinstall size

Вдохновлен:

this.useMiddlewares()
this.useRoutes()
this.useDefaultRoute()

А также:

  • Express async router
  • Json Web Token
  • Bunyan logger with updated view

Auth

Токен можно прикладывать следующими методами

  • в Header Authorization: Bearer %USER_TOKEN%
  • в Header X-Access-Token: %USER_TOKEN%
  • в Cookie: token=%USER_TOKEN%
  • в GET параметр: ?token=%USER_TOKEN%

Bunyan log levels

LSKit принимает стоковый Bunyan логгер

log.trace('Starting method');

if (!req.user) {
  log.fatal('Cannot get User');
  throw new Error('Cannot get User')
}

log.info('Method success');

Log levels

  • fatal
  • error
  • warn
  • info
  • debug
  • trace

Что еще нужно дописать

  • Что из себя представляет модуль
  • Что такое мидлвара?
  • Что такое ресурс? Resource ENDPOINT
  • Универсальная модель?
  • Документация со swagger

Getting Started

Requirements

  • Mac OS X, Windows, or Linux
  • Node.js v6.5 or newer
  • npm v3.10 or newer (new to npm?)
  • node-gyp prerequisites mentioned here
  • Text editor or IDE pre-configured with React/JSX/Flow/ESlint (learn more)

Структура проекта

Before you start, take a moment to see how the project structure looks like:

.
├── /build/                     # Директория в которую билдится проект
├── /node_modules/              # Сторонние библиотеки и утилиты
├── /src/                       # Исходный код приложения
│   ├── /CoreApp/               # Базовое приложение
│   │   ├── /api/               # Интерфейс клиент-серверного взаимодействия
│   │   ├── /middlewares/       # Среднии слои express
│   │   ├── /models/            # Модели базы данных
│   │   ├── /resourses/         # Ресурсы
│   │   ├── CoreApp.js          # Класс-реализация базового приложения
│   │   ├── requests.js         # Реквесты приложения
│   │   └── responses.js        # Респонсы приложения
│   ├── /ReactApp/              # Базовое приложение
│   │   ├── /compoents/         # React компоненты
│   │   ├── /Html/              # Класс-реализа
│   │   ├── /Html/              # Класс-реализа
│   │   ├── /Html/              # Класс-реализа
│   │   ├── /routes/            # Роутер с страницами\экранами, которые являются React компонентами
│   │   ├── /models/            # Модели базы данных
│   │   ├── /resourses/         # Ресурсы
│   │   ├── /routes/            # Роутер с страницами\экранами, которые являются React компонентами
│   │   ├── /stores/            # Сторы React приложения
│   │   ├   └── /AppStore.js    # Главный стор React приложения
│   │   ├── ReactApp.client.js  # Класс-реализация базового приложения на клиенте
│   │   ├── ReactApp.server.js  # Класс-реализация базового приложения на сервере
│   │   ├── requests.js         # Реквесты приложения
│   │   └── responses.js        # Респонсы приложения
│   ├── /client.js              # Точка входа Клиентского приложения
│   ├── /config                 # Общие настройки проекта
│   └── /server.js              # Точка входа Серверного приложения
├── /test/                      # Модульные и интеграционные тесты
├── /tools/                     # Скрипты и утилиты для автоматизации сборки проекта
│   ├── /config.js              # Конфигурация сборки проекта
│   ├── /run.js                 # Система запуска сборки
│   └── /webpack.config.js      # Конфигурация Вебпака для клинстких и серверных бандлов
└── package.json                # Список сторонних библиотек и утилит

Note: The current version of RSK does not contain a Flux implementation. It can be easily integrated with any Flux library of your choice. The most commonly used Flux libraries are Flux, Redux, and Relay.

Quick Start

1. Get the latest version

You can start by cloning the latest version of React Starter Kit (RSK) on your local machine by running:

$ git clone -o lego-starter-kit -b master --single-branch \
      https://github.com/isuvorov/lego-starter-kit.git MyApp
$ cd MyApp

Alternatively, you can start a new project based on RSK right from WebStorm IDE, or by using Yeoman generator.

2. Run npm install

This will install both run-time project dependencies and developer tools listed in package.json file.

3. Run npm start

This command will build the app from the source files (/src) into the output /build folder. As soon as the initial build completes, it will start the Node.js server (node build/server.js) and Browsersync with HMR on top of it.

http://localhost:3000/ — Node.js server (build/server.js)
http://localhost:3000/graphql — GraphQL server and IDE
http://localhost:3001/ — BrowserSync proxy with HMR, React Hot Transform
http://localhost:3002/ — BrowserSync control panel (UI)

Now you can open your web app in a browser, on mobile devices and start hacking. Whenever you modify any of the source files inside the /src folder, the module bundler (Webpack) will recompile the app on the fly and refresh all the connected browsers.

browsersync

Note that the npm start command launches the app in development mode, the compiled output files are not optimized and minimized in this case. You can use --release command line argument to check how your app works in release (production) mode:

$ npm start -- --release

NOTE: double dashes are required

How to Build, Test, Deploy

If you need just to build the app (without running a dev server), simply run:

$ npm run build

or, for a production build:

$ npm run build -- --release

or, for a production docker build:

$ npm run build -- --release --docker

NOTE: double dashes are required

After running this command, the /build folder will contain the compiled version of the app. For example, you can launch Node.js server normally by running node build/server.js.

To check the source code for syntax errors and potential issues run:

$ npm run lint

To launch unit tests:

$ npm test              # Run unit tests with Mocha
$ npm run test:watch    # Launch unit test runner and start watching for changes

By default, Mocha test runner is looking for test files matching the src/**/*.test.js pattern. Take a look at src/components/Layout/Layout.test.js as an example.

To deploy the app, run:

$ npm run deploy

The deployment script tools/deploy.js is configured to push the contents of the /build folder to a remote server via Git. You can easily deploy your app to Azure Web Apps, or Heroku this way. Both will execute npm install --production upon receiving new files from you. Note, you should only deploy the contents of the /build folder to a remote server.

How to Update

If you need to keep your project up to date with the recent changes made to RSK, you can always fetch and merge them from this repo back into your own project by running:

$ git checkout master
$ git fetch lego-starter-kit
$ git merge lego-starter-kit/master
$ npm install

📖 License

This project is licensed under the MIT License - see the LICENSE file for details

👥 Contributors


Igor Suvorov

💻 🎨 🤔

👏 Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b features/fooBar)
  3. Commit your changes (git commit -am 'feat(image): Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

📮 Any questions? Always welcome :)

Keywords

FAQs

Package last updated on 16 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc