Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.0 Release #1

Merged
merged 10 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintrc

This file was deleted.

44 changes: 44 additions & 0 deletions .github/composite/nodejs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Install Node.js with dependencies"
description: ""
inputs:
version:
description: "version of Node.js"
required: true

runs:
using: composite
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.version }}

# this workflow maybe broken - GET https://registry.npmjs.org/pnpm error (ERR_INVALID_THIS).
# - name: Install pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 8
# run_install: false

- name: Install pnpm
shell: bash
run: |
npm install -g pnpm@8

- name: Get pnpm cache directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('.node-version') }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ hashFiles('.node-version') }}

- name: Install dependencies
shell: bash
run: |
pnpm install
36 changes: 36 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Test Package"

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20]

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: ./.github/composite/nodejs
with:
version: ${{ matrix.node }}

- name: Build Package
shell: bash
run: |
pnpm build

- name: Test Package
shell: bash
run: |
pnpm run test
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.0
12 changes: 7 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.github/
bin/
src/
src/fixtures/

.eslintignore
.eslintrc
.gitignore
tsconfig.json
yarn.lock
.node-version
biome.json
tsconfig.*json
tsconfig.*tsbuildinfo
vite.config.ts
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
# @natsuneko-laboratory/unitypackage

Create UnityPackage from Node.js, written in TypeScript. No platform dependency.
Archive / Extract / Search UnityPackage from Node.js, written in TypeScript. No platform dependency.

## Requirements

- Node.js >= 16
- Node.js >= 18

## Install

```
```bash
$ npm add @natsuneko-laboratory/unitypackage
$ yarn add @natsuneko-laboratory/unitypackage
$ pnpm add @natsuneko-laboratory/unitypackage
```

## Usage

```typescript
import { archive } from "@natsuneko-laboratory/unitypackage";

// archive as UnityPackage
const meta = [
"/path/to/Assets/file1.meta",
"/path/to/Assets/file2.meta",
"/path/to/Assets/file3.meta",
];

await archive(meta, "/path/to", "./archive.unitypackage");
import { archive, extract } from "@natsuneko-laboratory/unitypackage";

// create a unitypackage
await archive({
files: [
// files to archive
"/path/to/assets/MonoBehaviour.cs",
"/path/to/assets/Prefab.prefab",
],
root: "/path/to", // unity project root
dest: "/path/to/archive.unitypackage", // destination path
transform: (path) => join("Assets", join), // transform path (optional)
});

// extract a unitypackage
await extract({
file: "/path/to/archive.unitypackage",
root: "/path/to", // unity project root
transform: (path) => join("Assets", join), // transform path (optional)
});
```

## Development

```bash
# prepare
$ yarn install
$ pnpm install

# publish
$ npm publish --access public
```

## License

MIT by [Natsune - @6jz](https://twitter.com/6jz)
MIT by [@6jz](https://twitter.com/6jz)
12 changes: 12 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
44 changes: 18 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
{
"name": "@natsuneko-laboratory/unitypackage",
"version": "0.2.0",
"description": "Operate UnityPackage from Node.js",
"version": "1.0.0",
"description": "Archive / Extract / Search UnityPackage from Node.js, written in TypeScript. No platform dependency.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"repository": "https://github.com/natsuneko-laboratory/unitypackage.git",
"author": "Natsune Mochizuki",
"license": "MIT",
"scripts": {
"prepublish": "npm run build",
"build": "tsc",
"prepare": "npm run build",
"lint:eslint": "eslint --ext 'src/**/*.{ts,js}'",
"lint:prettier": "prettier --check 'src/**/*.{ts,js}'",
"fix:eslint": "eslint --fix 'src/**/*.{ts,js}'",
"fix:prettier": "prettier --write 'src/**/*.{ts,js}'"
},
"devDependencies": {
"@types/adm-zip": "^0.4.34",
"@types/mkdirp": "^1.0.2",
"@types/node": "^17.0.14",
"@types/tar": "^6.1.1",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"prettier": "^2.5.1",
"typescript": "^4.5.5"
"build": "tsc && vite build",
"test": "vitest",
"prepare": "npm run build"
},
"dependencies": {
"adm-zip": "^0.5.9",
"mkdirp": "^1.0.4",
"tar": "^6.1.11"
"normalize-path": "^3.0.0",
"tar": "^6.2.0"
},
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@natsuneko-laboratory/kiana": "^1.0.2",
"@types/node": "^20.11.16",
"@types/normalize-path": "^3.0.2",
"@types/tar": "^6.1.11",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vitest": "^1.2.2"
}
}
Loading
Loading