0.4.13 • Published 6 years ago

@vtex/vtex-scripts v0.4.13

Weekly downloads
9
License
ISC
Repository
github
Last release
6 years ago

VTEX Scripts

This package contains the scripts and build configuration for the VTEX modules.

Usage

  1. Inside the NPM Store Components repo

Just run the bellow in the terminal

$ lerna add @vtex/vtex-scripts --scope=your-component
$ lerna bootstrap

And add the following lines to your package.json

{
  "scripts": {
    "build": "vtex-scripts build",
    "test": "vtex-scripts test"
  }
}
  1. In a vtex init'ed module

Add the @vtex/vtex-scripts to your devDependencies

$ yarn add @vtex/vtex-scripts --dev

Also, if you want testing you need to install some required packages

$ yarn add enzyme enzyme-adapter-react-16 jsdom --dev

And add the following to a setupTests.js in the root of your source directory

import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { JSDOM } from 'jsdom'

const jsdom = new JSDOM('<!doctype html><html><body></body></html>')

global.window = jsdom.window
global.document = window.document

Enzyme.configure({ adapter: new Adapter() })

Then, just add the scripts to your package.json

{
  "scripts": {
    "test": "vtex-scripts test"
  }
}

Configurations

You can also customize some default configurations that comes with vtex-scripts

The following properties can be supplied in a vtexScriptsOverride property inside your package.json

NameTypeDescription
srcPathStringThe relative path of your sources directory (e.g. ./src)
distPathStringThe relative path of your compiled files directory (e.g. ./dist)
setupTestsFilenameStringThe filename of the tests setup file (e.g. setupTests.js)