Skip to content

Commit

Permalink
BREAKING: Refactor into a new **multi-package** project
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorVelarde committed Mar 8, 2021
1 parent 7b4110e commit 9d16d34
Show file tree
Hide file tree
Showing 179 changed files with 85,288 additions and 15,530 deletions.
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

5 changes: 0 additions & 5 deletions .firebaserc

This file was deleted.

17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

name: CI

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
build:
Expand All @@ -19,16 +23,13 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install -g yarn
- run: yarn
- run: yarn lint
- run: yarn build
- run: yarn test:coverage

- run: npm install
- run: npm run build
- run: npm run test:coverage

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
CI: true

17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
/node_modules
/dist
/storybook-static
.DS_Store
/coverage
/reports
/.nyc_output

/packages/*/node_modules
/packages/*/coverage
/packages/*/dist

/packages/react-ui/storybook-static

.DS_Store

# Firebase
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/
.firebase/


1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Change main dependencies mode to peer, reducing library bundle size [#85](https://github.com/CartoDB/carto-react-lib/pull/85)
- Fix viewportFeatures with empty tiles [#100](https://github.com/CartoDB/carto-react-lib/pull/100)
- Fix viewportFeatures mode in PieWidget when using viewportFilter [#102](https://github.com/CartoDB/carto-react-lib/pull/102)
- BREAKING: Refactor into a new **multi-package** project

## 1.0.0-beta14 (2021-02-08)

Expand Down
19 changes: 19 additions & 0 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Developers

This is a monorepo, made with lerna

Clone and execute

```
npm install
```
The postinstall will execute lerna bootstrap, with hoisting option, and the project will be ready to work with.


From now on, use one of the root level commands, that lerna will execute for all internal packages, like for example:
```
npm run build
npm run test
```

If you have issues, you can always run `npm run test:clean`. It will perform a clean and then ensure that full install, build and test work fine
43 changes: 15 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CARTO React Library

TODO: adapt to multipackage

<p>
<a href="https://npmjs.org/package/@carto/react">
<img src="https://img.shields.io/npm/v/@carto/react.svg?style=flat-square" alt="version" />
Expand All @@ -16,41 +18,26 @@
</p>
<br/>

This is the official CARTO library for working with React. It is used by the [CARTO for React](https://github.com/CartoDB/cra-template-carto) templates, made with CRA (Create React App).
This is the official "CARTO library for React". It is organized as a set of **npm packages** (`@carto/react-*`), that work together providing widgets and utilities to build Location Intelligence applications with React, Redux & Material-UI.

These packages are used by the [CARTO for React](https://github.com/CartoDB/cra-template-carto) templates, made with CRA (Create React App).

There is a Storybook guide with the main UI components and how to use them at [CARTO for React - UI Components](https://storybook-react.carto.com/)

### How to install the library

If you are using the CARTO CRA templates, everything is already setup, so no further configuration is needed.
If you are using the CARTO CRA templates, everything is already setup, so no further configuration is needed!

In case you want to use this library in a different context, then you need to install it with:
In case you want to use this set of packages in a different context, then you would need to install the as usual, with something like:

```
yarn add @carto/react
yarn add @carto/react-api
yarn add @carto/react-auth
yarn add @carto/react-basemaps
yarn add @carto/react-core
yarn add @carto/react-redux
yarn add @carto/react-ui
yarn add @carto/react-widgets
```

Notice that to avoid issues within host projects, most of the relevant libraries are declared as **peer dependencies**. That means that you would need to add them if you are still not using them (keep an eye on the console warnings on peer dependencies).

This is the full list, in case you need it:

```
yarn add \
@deck.gl/core@^8.4.0 \
@deck.gl/extensions@^8.4.0 \
@deck.gl/google-maps@^8.4.0 \
@material-ui/core \
@material-ui/icons \
@material-ui/lab \
@reduxjs/toolkit \
@turf/bbox-polygon \
@turf/boolean-contains \
@turf/boolean-intersects \
echarts@^4.9.0 \
echarts-for-react@^2.0.16 \
prop-types \
react@^17.0.1 \
react-dom@^17.0.1 \
react-is@^17.0.1 \
react-redux@^7.2.2
```
Notice that to avoid issues within host projects, most of the base libraries are declared as **peer dependencies**. That means that you would need to add them explicitly to your project, if you are still not using them (keep an eye on the console warnings on peer dependencies).
13 changes: 13 additions & 0 deletions babel.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
presets: [
['@babel/preset-env', {
targets: { node: 'current' },
forceAllTransforms: true, // es5
}],
'@babel/preset-react'
],
plugins: [
"@babel/plugin-proposal-nullish-coalescing-operator",
'@babel/plugin-transform-runtime'
]
};
12 changes: 0 additions & 12 deletions firebase.json

This file was deleted.

32 changes: 18 additions & 14 deletions jest.config.js → jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
// bail: 0,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/89/9kkc43_s2yl5vjkrq8lnqtm40000gp/T/jest_dy",
// cacheDirectory: "/private/var/folders/c9/qzf7p4w15gxcxxpsm701xtnh0000gp/T/jest_dy",

// Automatically clear mock calls and instances between every test
// clearMocks: false,
Expand All @@ -23,7 +23,7 @@ module.exports = {
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
coverageDirectory: "coverage",

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
Expand All @@ -40,6 +40,9 @@ module.exports = {
// "lcov",
// "clover"
// ],
coverageReporters: [
"json"
],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
Expand All @@ -66,9 +69,9 @@ module.exports = {
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
moduleDirectories: [
"node_modules"
],

// An array of file extensions your modules use
// moduleFileExtensions: [
Expand All @@ -81,12 +84,10 @@ module.exports = {
// ],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
'src/(.*)': '<rootDir>/src/$1'
},
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
modulePathIgnorePatterns: ['dist'],
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,
Expand Down Expand Up @@ -130,7 +131,8 @@ module.exports = {
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['<rootDir>/src/tests/jest.setup.js'],
// setupFilesAfterEnv: [],
setupFilesAfterEnv: ['../../jest.setup.js'],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand All @@ -139,7 +141,7 @@ module.exports = {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: 'jest-environment-jsdom'
// testEnvironment: "jest-environment-jsdom",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
Expand All @@ -152,6 +154,10 @@ module.exports = {
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],
testMatch: [
"**/?(*.)+(spec|test).js"
],


// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
Expand All @@ -174,9 +180,7 @@ module.exports = {
// timers: "real",

// A map from regular expressions to paths to transformers
// transform: {
// "^.+\\.[t|j]sx?$": "babel-jest"
// }
// transform: undefined,

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": [
"packages/*"
],
"version": "0.0.1-rc.4"
}

0 comments on commit 9d16d34

Please sign in to comment.