Skip to content

Commit

Permalink
Merge pull request #2 from piperubio/feature-data-update
Browse files Browse the repository at this point in the history
Feature data v1
  • Loading branch information
piperubio authored Jan 19, 2025
2 parents 24f22bd + 41bb77e commit 751b34a
Show file tree
Hide file tree
Showing 26 changed files with 3,225 additions and 683 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
16 changes: 9 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
"features": {
"ghcr.io/shyim/devcontainers-features/bun:0": {},
"ghcr.io/devcontainers-community/features/deno:1": {},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
},
"ghcr.io/devcontainers-contrib/features/ruff:1": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
},
"ghcr.io/devcontainers-contrib/features/ruff:1": {
"version": "latest"
},
"ghcr.io/va-h/devcontainers-features/uv:1": {
"version": "latest"
}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pnpm install",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "echo alias pn='pnpm' >> ~/.bashrc && pn install",
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -32,7 +32,9 @@
"ms-python.debugpy",
"ms-toolsai.jupyter",
"mechatroner.rainbow-csv",
"charliermarsh.ruff"
"charliermarsh.ruff",
"pflannery.vscode-versionlens",
"YoavBls.pretty-ts-errors"
]
}
}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
coverage
dist
.changeset
.DS_Store
.pnpm-store
21 changes: 12 additions & 9 deletions clregionsjs.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
{
"path": "."
},
{
"path": "packages/data"
},
{
"path": "packages/core"
}
],
"settings": {}
}
{
"path": "packages/tsconfig"
},
{
"path": "packages/data"
},
{
"path": "packages/core"
}
],
"settings": {}
}
52 changes: 30 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
{
"name": "clregions",
"version": "0.1.0",
"description": "Chilean (CL) regions, provinces and communes",
"repository": "github:piperubio/clregions",
"keywords": [
"cl",
"chile",
"regions",
"provinces",
"communes",
"regiones",
"provincias",
"comunas"
],
"license": "MIT",
"engines": {
"node": ">=18"
},
"devDependencies": {
"@biomejs/biome": "1.9.4"
}
}
"name": "clregions",
"version": "0.1.0",
"description": "Chilean (CL) regions, provinces and communes",
"repository": "github:piperubio/clregions",
"keywords": [
"cl",
"chile",
"regions",
"provinces",
"communes",
"regiones",
"provincias",
"comunas"
],
"license": "MIT",
"engines": {
"node": ">=18"
},
"scripts": {
"changeset": "changeset",
"version": "changeset version",
"publish": "changeset publish"
},
"devDependencies": {
"@biomejs/biome": "1.9.4"
},
"dependencies": {
"@changesets/cli": "^2.26.0"
}
}
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.26.0",
"@clregions/data": "workspace:*",
"@clregions/tsconfig": "workspace:*",
"@types/node": "^18.13.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
Expand Down
28 changes: 0 additions & 28 deletions packages/core/src/base-types.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/data/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
Expand Down
30 changes: 30 additions & 0 deletions packages/data/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# @clregions/data

## 1.0.0

### Major Changes

- 3e093af: Fix territorial data for Chile's regions, provinces and communes. Major changes include:

- Add data in multiple formats:

- CSV files (regions, provinces, communes)
- SQL files with tables and data
- JSON files (as object and array)
- TypeScript/JavaScript library

- Add TypeScript types for both object and array data structures
- CLCountryObject & CLCountryArray
- CLRegionObject & CLRegionArray
- CLProvinceObject & CLProvinceArray
- CLCommune

The package is now available on npm as @clregions/data

## 0.1.0

### Minor Changes

- ed92ca4: Add data for Chile's regions, provinces and communes. Minor changes include:

- JSON file as object
21 changes: 21 additions & 0 deletions packages/data/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Felipe Rubio Galaz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 26 additions & 3 deletions packages/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,42 @@ Datos en formato csv, json y sql.

🛡️ Si encuentras alguna discordancia en los datos, no dudes enviarnos un pull request.

## Requisitos
## Uso JS/TS

### Instalación

```bash
npm install @clregions/data
```

### Uso

* `dataObject` contiene los datos en formato de objeto.

```javascript
import { dataObject } from '@clregions/data';
```
* `dataArray` contiene los datos en formato de array.

```javascript
import { dataArray } from '@clregions/data';
```

## Desarrollo

### Requisitos

- Python 3.12 o superior
- [uv package manager](https://docs.astral.sh/uv/)

## Instalación de dependencias
### Instalación de dependencias

```bash
uv venv
uv sync
```

### Fuentes de Datos
## Fuentes de Datos

[BCN Ley 21.074 2018](https://www.bcn.cl/leychile/navegar?idNorma=1115064)
[BCN Decreto 1115 del Ministerio del Interior y Seguridad Pública 2018](https://www.bcn.cl/leychile/navegar?idNorma=1123248)
Expand Down
61 changes: 58 additions & 3 deletions packages/data/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
import data from "./json/data.json" with { type: "json" };

export default data;
import array from "./json/array.json" with { type: "json" };
import object from "./json/object.json" with { type: "json" };

export type CLCountryObject = {
country: string;
countryCode: string;
regions: {
[key: string]: CLRegionObject;
};
};

export type CLCountryArray = {
country: string;
countryCode: string;
regions: CLRegionArray[];
};

export type CLRegionObject = {
id: string;
name: string;
shortName: string;
abbreviation: string;
isoCode: string;
provinces: {
[key: string]: CLProvinceObject;
};
};

export type CLRegionArray = {
id: string;
name: string;
shortName: string;
abbreviation: string;
isoCode: string;
provinces: CLProvinceArray[];
};

export type CLProvinceObject = {
id: string;
name: string;
communes: {
[key: string]: CLCommune;
};
};

export type CLProvinceArray = {
id: string;
name: string;
communes: CLCommune[];
};

export type CLCommune = {
id: string;
name: string;
};

export const dataObject: CLCountryObject = object;
export const dataArray: CLCountryArray = array;
Loading

0 comments on commit 751b34a

Please sign in to comment.