Skip to content

Commit

Permalink
Merge pull request #10 from ashblue/feature/move-to-typescript
Browse files Browse the repository at this point in the history
feat: package now overwrites target files instead of creating a copy
  • Loading branch information
ashblue authored Apr 2, 2021
2 parents b5c930c + 5e81432 commit 8286027
Show file tree
Hide file tree
Showing 24 changed files with 32,404 additions and 3,709 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
45 changes: 45 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es2021: true,
jest: true,
},
extends: [
'airbnb-base',
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12,
project: './tsconfig.json',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
plugins: [
'@typescript-eslint',
],
rules: {
'import/extensions': 'off',
'no-console': 'off',
'no-underscore-dangle': 'off',
'no-useless-constructor': 'off',
},
overrides: [
{
files: ['src/**/*.test.ts'],
rules: {
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
}
}
]
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ typings/
# Project specific
tmp
.idea
dist/
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run test:coverage
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.16.0
10 changes: 10 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
]
}
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
install:
- npm install
script:
- commitlint-travis
- npm run lint
- npm run test:coverage
- npm run build
- npm run semantic-release
57 changes: 43 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
# UPM Package Populator

A helper library to cross populate nested Unity packages in a project with NPM data.
A helper library to cross populate nested Unity package details such as README.md, CHANGELOG.md, package.json, and more.

Installation
## Getting Started

```bash
npm i -D upm-package-populator
npm install upm-package-populator
```

Example usage

```javascript
const createDist = require('upm-package-populator');

createDist(
// Nested Unity package location
'Assets/FluidBehaviorTree',

// Root folder
'.',

// Where the files will be output. Dumps a zip with the folder name
'dist');
const { populatePackage } = require('upm-package-populator');

populatePackage(
// The folder to copy files from
'./src',

// Where to overwrite files
'./target',
);
```

## Development

### Making Commits

To make a commit you must use Commitizen. To do so use the following to trigger the commit wizard.

```
npm run commit
```

### Testing The Package Locally

In this package's root run the following to link the package locally to NPM's node module directory.

```bash
npm link
```

Navigate to the root of the project you want to test the package in. Then run this. It will build a link to the local project on your mahcine.

```bash
npm link upm-package-populator
```

It's a good idea to unlink a package when you're done. **Navigate back to this project's root folder** and run the following to unlink. This should clean out any local reference data, which prevents any conflicts with packages.

```bash
npm unlink upm-package-populator
```
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
62 changes: 0 additions & 62 deletions create-dist.js

This file was deleted.

73 changes: 0 additions & 73 deletions create-dist.test.js

This file was deleted.

26 changes: 26 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
clearMocks: true,
collectCoverageFrom: [
'src/**/*',
],
coverageDirectory: "coverage",
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
}
},
moduleFileExtensions: [
"js",
"ts",
],
testEnvironment: "node",
testMatch: [
"**/*.test.ts",
],
transform: {
'\\.ts$': 'ts-jest',
},
};
Loading

0 comments on commit 8286027

Please sign in to comment.