Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from motiondeveloper/hub-to-gh
Browse files Browse the repository at this point in the history
Hub to gh
  • Loading branch information
timhaywood authored Sep 22, 2020
2 parents 46ab79d + a4fddfe commit 8e20949
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To use this template you need to have the following installed on your system:
- [Node](https://nodejs.org/en/)
- [Git](https://git-scm.com/)
- [VS Code](https://code.visualstudio.com/) (recommended)
- [Hub](https://github.com/github/hub) (recommended)
- [GitHub CLI](https://github.com/cli/cli) (recommended)

> This setup works well for our workflow and requirements, but is still in the early stages. It is most likely unnecessary for smaller projects or beginners
Expand Down Expand Up @@ -97,9 +97,11 @@ To use this template you need to have the following installed on your system:
npm run release
```

> This will open an editor to add the release title and description
This will use the GitHub CLI to create a new tag and release

The release version number is the `"version"` in `package.json`.
The release version number is the `"version"` in `package.json`, and it will attach the `"main"` file to the release.

> You can add this version to the output file by placing the string `_npmVersion` in your code, which will be replaced with the version number in `package.json` at build time.
## After Effects API

Expand Down Expand Up @@ -168,12 +170,12 @@ Which will run Jest in watch mode.

There a couple of files you may wish to change to reflect the content of your project:

- `README.md`
- `rollup.config.js`: The `output.file` name

_The release script in `package.json` needs to match the output file name._

- `package.json`: `name`, `description`, `repo`, `author` and `version`
- `package.json`:
- `version`: The current version of the library, which is used for releases and added to `dist` files.
- `main`: The build output file which will be attached to releases
- `rollup.config.js`:
- `input`: The source file to be built
- `typescript()`: Custom typescript compiler options

## How

Expand Down
3 changes: 2 additions & 1 deletion dist/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"welcome": function(name) {
return `Welcome ${name}!`;
},
"someValue": 2
"someValue": 2,
"version": '1.2.2'
}
2 changes: 1 addition & 1 deletion package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "expressions-library-template",
"version": "1.2.0",
"version": "1.2.2",
"description": "A template repo for creating After Effects expression libraries (.jsx files) using TypeScript and Rollup ",
"main": "index.js",
"main": "dist/index.jsx",
"scripts": {
"test": "jest --watch",
"tsc": "tsc",
"build": "rollup -c",
"watch": "rollup -cw",
"release": "hub release create -a 'dist/index.jsx' $npm_package_version"
"release": "npm run build && gh release create $npm_package_version $npm_package_main"
},
"repository": {
"type": "git",
Expand Down
7 changes: 6 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import afterEffectJsx from 'rollup-plugin-ae-jsx';
import pkg from './package.json';

export default {
input: 'src/index.ts',
output: {
file: 'dist/index.jsx',
file: pkg.main,
format: 'cjs',
},
plugins: [
replace({
_npmVersion: pkg.version,
}),
typescript({
module: 'esnext',
target: 'esnext',
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ function welcome(name: string): string {

const someValue: number = 2;

const version: string = '_npmVersion';

// Export values to appear in jsx files
export { getLayerDuration, remap, welcome, someValue };
export { getLayerDuration, remap, welcome, someValue, version };

0 comments on commit 8e20949

Please # to comment.