Skip to content

Commit

Permalink
chore: configure build for windows (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
gizeasy authored May 19, 2023
1 parent ae9a88c commit 830af5e
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 27 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ yarn add @consta/charts

## Подключите зависимости

Чтобы начать работу, установите библиотеку [`@consta/uikit`](https://www.npmjs.com/package/@consta/uikit) и [настройте тему](http://portal.consta.design/libs/portal/theme-themeabout).
Чтобы начать работу, установите библиотеку [`@consta/uikit`](https://www.npmjs.com/package/@consta/uikit) и [настройте тему](http://consta.design/libs/portal/theme-themeabout).

### Можно использовать компоненты

Expand Down Expand Up @@ -79,11 +79,17 @@ const MyComponent = () => {
};
```

## Документация и стенд

На стенде можно посмотреть примеры графиков. Документация — во вкладке у каждого компонента.

[Вперёд, к стенду](http://consta.design/libs/charts)

## Разработка

### Подготовка окружения

Рабочее окружение должно содержать NodeJS и Yarn, необходимые версии можно узнать в файле [package.json](./package.json) в блоке **engines**.
Рабочее окружение должно содержать NodeJS и Yarn.

Чтобы установить зависимости, выполните команду:

Expand All @@ -94,27 +100,22 @@ $ yarn install
### Основные команды

```sh
# Сборка и старт
# Запуск локального сервера для разработки
$ yarn start
# Сборка для production
$ yarn build
# Линтинг всех файлов
$ yarn lint
# Форматирование всех файлов prettier
$ yarn unit
# Запуск юнит-тестов, тестирование TS, линтинг файлов
$ yarn test
```

## Документация и стенд
# Сборка пакета
$ yarn build

На стенде можно посмотреть примеры графиков. Документация — во вкладке у каждого компонента.
# Сборка стенда
$ yarn stand:build

[Вперёд, к стенду](http://charts.consta.design/)
# Запуск тестов
$ yarn test
```

## Контрибьюторам

Будем рады, если вы захотите принять участие в разработке дизайн-системы =) Но сначала прочитайте [инструкцию для контрибьюторов](http://portal.consta.design/libs/portal/custom-contribute).
Будем рады, если вы захотите принять участие в разработке дизайн-системы =) Но сначала прочитайте [инструкцию для контрибьюторов](https://consta.design/libs/portal/contributers-code).

## Лицензия

Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@
"format:svg": "prettier --write '**/*.svg' --parser html",
"pre-push": "yarn run tsc-dry-run",
"pre-commit": "yarn run lint-staged",
"pre-build": "node scripts/preBuild.js --config=scripts/generateReExportsConfig.js",
"test": "yarn tsc-dry-run",
"unit": "jest",
"unit:watch": "jest --watch",
"unit:clear": "jest --clearCache",
"build:css": "NODE_ENV=buildProduction postcss 'src/**/*.css' --base src --dir dist/__internal__/src/",
"build:js": "NODE_ENV=buildProduction BUILDING_JS=true babel --extensions '.ts,.tsx' --config-file ./babel.config.js --source-maps --out-dir dist/__internal__/src/ ./src",
"build:types": "NODE_ENV=buildProduction ttsc --declaration --outDir dist/__internal__/src/ --emitDeclarationOnly -p tsconfig.build.json",
"build:css": "cross-env NODE_ENV=buildProduction postcss src/**/*.css --base src --dir dist/__internal__/src/",
"build:js": "cross-env NODE_ENV=buildProduction BUILDING_JS=true babel --extensions .ts,.tsx --config-file ./babel.config.js --source-maps --out-dir dist/__internal__/src/ ./src",
"build:types": "cross-env NODE_ENV=buildProduction ttsc --declaration --outDir dist/__internal__/src/ --emitDeclarationOnly -p tsconfig.build.json",
"build:package.json": "node scripts/prepare-package-json.js",
"build:reexports": "node scripts/generateReExports.js --config=scripts/generateReExportsConfig.js",
"build:docs": "cp README.md dist/README.md",
"build": "rm -rf dist && yarn build:css && yarn build:js && yarn build:types && yarn build:reexports && yarn build:package.json && yarn build:docs",
"build:copy-assets": "node scripts/copyAssets.js",
"build": "yarn rm:dist && yarn build:css && yarn build:js && yarn build:types && yarn build:reexports && yarn build:package.json && yarn build:copy-assets",
"stand:generate": "node node_modules/@consta/stand/scripts/standGenerate.js --config=node_modules/@consta/stand/scripts/config.js",
"stand:build": "rm -rf ./build && yarn stand:generate && NODE_ENV=production webpack --mode production --config node_modules/@consta/stand/webpack.config.js",
"stand:start": "NODE_ENV=development webpack serve --open --progress --mode development --hot --progress --config node_modules/@consta/stand/webpack.config.js",
"stand:dev": "NODE_ENV=standDevelopment webpack serve --open --progress --mode development --hot --progress --config node_modules/@consta/stand/webpack.config.js",
"stand:build": "yarn rm:build && yarn stand:generate && NODE_ENV=production webpack --mode production --config node_modules/@consta/stand/webpack.config.js",
"stand:start": "cross-env NODE_ENV=development webpack serve --open --progress --mode development --hot --progress --config node_modules/@consta/stand/webpack.config.js",
"start": "yarn stand:generate && yarn stand:start",
"start:dev": "yarn stand:generate && yarn stand:dev"
"rm:dist": "node ./scripts/rm.js --path=./dist",
"rm:build": "node ./scripts/rm.js --path=./build"
},
"files": [
"*",
Expand Down Expand Up @@ -84,6 +83,7 @@
}
},
"devDependencies": {
"cross-env": "^7.0.3",
"@babel/cli": "^7.18.9",
"@babel/core": "^7.17.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
Expand Down
7 changes: 7 additions & 0 deletions scripts/copyAssets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { copy } = require('fs-extra');

const postBuildCopyFiles = async () => {
await copy('./README.md', './dist/README.md');
};

postBuildCopyFiles();
44 changes: 44 additions & 0 deletions scripts/rm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const { Command, flags } = require('@oclif/command');
const logSymbols = require('log-symbols');
const { remove } = require('fs-extra');

class GenerateCommand extends Command {
async safeInvokeHook(hook) {
if (hook !== undefined) {
if (typeof hook === 'function') {
this.log(`start executing ${hook.name}`);
await hook();
this.log(`finish executing ${hook.name}`);
} else {
this.error(`${hook.name} should be function!`);
}
}
}

async run() {
const hrstart = process.hrtime();
const { flags } = this.parse(GenerateCommand);

try {
await remove(flags.path);
} catch (err) {
this.error(err);
}

const hrend = process.hrtime(hrstart);

this.log(logSymbols.success, `${flags.path} is removed!🗑️`);
this.log(`Execution time: ${hrend[0]}s`);
}
}

GenerateCommand.flags = {
path: flags.string({
description: 'The path to a build config file.',
default: undefined,
}),
};

GenerateCommand.description = 'removing file...';

GenerateCommand.run();
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6193,6 +6193,13 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

cross-env@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
dependencies:
cross-spawn "^7.0.1"

cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand All @@ -6202,7 +6209,7 @@ cross-spawn@^5.0.1:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.2, cross-spawn@^7.0.3:
cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down

0 comments on commit 830af5e

Please sign in to comment.