Skip to content

Commit

Permalink
refactor(json-file): move to expo/expo (#25405)
Browse files Browse the repository at this point in the history
# Why

This package is used in various places [within this
monorepo](https://github.com/search?q=repo%3Aexpo%2Fexpo%20%40expo%2Fjson-file%20path%3A**%2Fpackage.json&type=code).

The clean-up PR is here: expo/expo-cli#4782

# How

- Moved `@expo/json-file` from `expo/expo-cli`.
- Added missing `devDependencies` relation to `expo-module-scripts`
- Updated `jest.config.js`, and `package.json`
- Building with TSC, not with babel, so dropped `babel.config.js`

# Test Plan

See if CI passes.

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
  • Loading branch information
byCedric committed Nov 23, 2023
1 parent 988823c commit 417ec6d
Show file tree
Hide file tree
Showing 25 changed files with 1,156 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -4,6 +4,7 @@
/packages/@expo/prebuild-config @EvanBacon
/packages/@expo/config-plugins @EvanBacon @brentvatne
/packages/@expo/config-types @EvanBacon @douglowder
/packages/@expo/json-file @EvanBacon @bycedric
/packages/@expo/metro-config @EvanBacon @bycedric @marklawlor
/packages/@expo/metro-runtime @EvanBacon @bycedric @marklawlor
/packages/@expo/package-manager @EvanBacon @bycedric
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cli.yml
Expand Up @@ -11,6 +11,7 @@ on:
- packages/@expo/config/src/**
- packages/@expo/config-plugins/src/**
- packages/@expo/env/src/**
- packages/@expo/json-file/src/**
- packages/@expo/package-manager/src/**
- packages/@expo/prebuild-config/src/**
- packages/@expo/server/src/**
Expand All @@ -26,6 +27,7 @@ on:
- packages/@expo/config/src/**
- packages/@expo/config-plugins/src/**
- packages/@expo/env/src/**
- packages/@expo/json-file/src/**
- packages/@expo/package-manager/src/**
- packages/@expo/prebuild-config/src/**
- packages/@expo/server/src/**
Expand Down
2 changes: 2 additions & 0 deletions packages/@expo/json-file/.eslintignore
@@ -0,0 +1,2 @@
build/

2 changes: 2 additions & 0 deletions packages/@expo/json-file/.eslintrc.js
@@ -0,0 +1,2 @@
// @generated by expo-module-scripts
module.exports = require('expo-module-scripts/eslintrc.base.js');
13 changes: 13 additions & 0 deletions packages/@expo/json-file/CHANGELOG.md
@@ -0,0 +1,13 @@
# Changelog

## Unpublished

### 🛠 Breaking changes

### 🎉 New features

### 🐛 Bug fixes

### 💡 Others

- Move package from `expo/expo-cli` to `expo/expo`. ([#25405](https://github.com/expo/expo/pull/25405) by [@byCedric](https://github.com/byCedric))
22 changes: 22 additions & 0 deletions packages/@expo/json-file/LICENSE
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)

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: 29 additions & 0 deletions packages/@expo/json-file/README.md
@@ -0,0 +1,29 @@
<!-- Title -->
<h1 align="center">
👋 Welcome to <br><code>@expo/json-file</code>
</h1>

<p align="center">A library for reading and writing JSON files.</p>

<!-- Body -->

## 🏁 Setup

Install `@expo/json-file` in your project.

```sh
yarn add @expo/json-file
```

## ⚽️ Usage

```ts
import JsonFile, { JSONObject } from '@expo/json-file';

// Create a file instance
const jsonFile = new JsonFile<JSONObject>(filePath);

// Interact with the file
await jsonFile.readAsync();
await jsonFile.writeAsync({ some: 'data' });
```
61 changes: 61 additions & 0 deletions packages/@expo/json-file/build/JsonFile.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 417ec6d

Please sign in to comment.