Skip to content

Commit bdcc6a8

Browse files
authored
Merge pull request #2 from JumpCutter/dk949/npmify
Npmify
2 parents 9444352 + 1a060cf commit bdcc6a8

10 files changed

Lines changed: 63 additions & 105 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,11 @@ on:
66
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
77

88
jobs:
9-
test:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v2
14-
15-
- name: Read .nvmrc
16-
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
17-
id: nvm
18-
19-
- name: Setup Node
20-
uses: actions/setup-node@v1
21-
with:
22-
node-version: '${{ steps.nvm.outputs.NVMRC }}'
23-
24-
- name: Install
25-
run: |
26-
yarn install
27-
28-
- name: Build
29-
run: yarn release
30-
31-
- name: Artifact
32-
uses: actions/upload-artifact@v2
33-
with:
34-
name: ubuntu-latest
35-
path: dist
36-
37-
389
build:
39-
needs: test
4010
strategy:
4111
fail-fast: true
42-
matrix:
43-
os: [macos-latest, windows-latest, ubuntu-latest]
4412
max-parallel: 3
45-
runs-on: ${{ matrix.os }}
13+
runs-on: ubuntu-latest
4614
steps:
4715
- name: Checkout
4816
uses: actions/checkout@v2
@@ -61,12 +29,10 @@ jobs:
6129
yarn install
6230
6331
- name: Build
64-
if: startsWith(matrix.os, 'macos')
6532
run: |
6633
yarn release
6734
6835
- name: Get Change
69-
if: startsWith(matrix.os, 'ubuntu')
7036
id: changes
7137
run: |
7238
echo "# ${{ github.ref }}" > changes.txt
@@ -86,7 +52,6 @@ jobs:
8652
echo ::set-output name=log::$(cat changes.txt)
8753
8854
- name: Upload change
89-
if: startsWith(matrix.os, 'ubuntu')
9055
uses: actions/upload-artifact@v2
9156
with:
9257
name: changes
@@ -95,8 +60,8 @@ jobs:
9560
- name: Artifact
9661
uses: actions/upload-artifact@v2
9762
with:
98-
name: ${{ matrix.os }}
99-
path: dist
63+
name: package
64+
path: package
10065

10166
release:
10267
needs: build
@@ -118,14 +83,11 @@ jobs:
11883
id: create_release
11984
uses: actions/create-release@v1
12085
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12287
with:
12388
tag_name: ${{ github.ref }}
12489
release_name: Release ${{ github.ref }}
125-
# body: ${{ steps.changes.outputs.log }}
12690
body_path: changes.txt
127-
# body: ${{ needs.build.outputs.log }}
128-
# echo ::set-env name=FOO::$(echo -n "hello world")
12991
draft: false
13092
prerelease: false
13193

@@ -137,58 +99,24 @@ jobs:
13799
upload:
138100
needs: release
139101
runs-on: ubuntu-latest
140-
strategy:
141-
fail-fast: true
142-
matrix:
143-
os: [ubuntu-latest, macos-latest, windows-latest]
144-
max-parallel: 3
145102
steps:
146103
- uses: actions/download-artifact@v2
147104
with:
148-
name: ${{ matrix.os }}
105+
name: package
149106
path: ProjectExportAPI
150107

151108
- name: list path
152-
if: startsWith(matrix.os, 'windows')
153-
run: dir ProjectExportAPI
154-
155-
- name: Compress folder
156-
if: startsWith(matrix.os, 'windows')
157-
run: cd ProjectExportAPI && 7za a ../ProjectExportAPI.zip
109+
run: ls -l ProjectExportAPI
158110

159111
- name: Compress folder
160-
if: startsWith(matrix.os, 'windows') != true
161-
run: zip -r ProjectExportAPI.zip ProjectExportAPI/*
162-
163-
- name: Upload Linux Asset
164-
if: startsWith(matrix.os, 'ubuntu')
165-
uses: actions/upload-release-asset@v1
166-
env:
167-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168-
with:
169-
upload_url: ${{ needs.release.outputs.upload_url }}
170-
asset_path: ProjectExportAPI.zip
171-
asset_name: ProjectExportAPI-linux.zip
172-
asset_content_type: application/zip
173-
174-
- name: Upload Mac Asset
175-
if: startsWith(matrix.os, 'macos')
176-
uses: actions/upload-release-asset@v1
177-
env:
178-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179-
with:
180-
upload_url: ${{ needs.release.outputs.upload_url }}
181-
asset_path: ProjectExportAPI.zip
182-
asset_name: ProjectExportAPI-mac.zip
183-
asset_content_type: application/zip
112+
run: tar -cvzf ProjectExportAPI.tar.gz ProjectExportAPI
184113

185-
- name: Upload Windows Asset
186-
if: startsWith(matrix.os, 'windows')
114+
- name: Upload Asset
187115
uses: actions/upload-release-asset@v1
188116
env:
189117
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190118
with:
191119
upload_url: ${{ needs.release.outputs.upload_url }}
192-
asset_path: ProjectExportAPI.zip
193-
asset_name: ProjectExportAPI-windows.zip
120+
asset_path: ProjectExportAPI.tar.gz
121+
asset_name: ProjectExportAPI.tar.gz
194122
asset_content_type: application/zip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
node_modules
33
yarn-error.log
44
test/test.*
5+
package

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## [0.0.3](https://github.com/JumpCutter/JC-ProjectExportAPI/compare/v0.0.2...v0.0.3) (2021-10-18)
4+
### Changes
5+
- __release__: Third time's the charm
6+
7+
## [0.0.2](https://github.com/JumpCutter/JC-ProjectExportAPI/compare/v0.0.1...v0.0.2) (2021-10-13)
8+
### Changes
9+
- __release__: CI!!!
10+
311
## [0.0.1](https://github.com/JumpCutter/JC-ProjectExportAPI/compare/v0.0.0...v0.0.1) (2021-10-04)
412
### Changes
513
- __release__: initial release, basic test

package.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,37 @@
22
"name": "JC-ProjectExportAPI",
33
"version": "0.0.1",
44
"description": "Project export API",
5-
"main": "dist/test.js",
5+
"main": "dist/index.js",
66
"author": "dk949",
77
"license": "MIT",
8-
"private": true,
8+
"private": false,
99
"scripts": {
1010
"cp": "node .github/cp.js",
1111
"mkdir": "node .github/mkdir.js",
12-
"build": "yarn run tsc",
13-
"release": "yarn build && yarn cp ./src/ProjectExport.d.ts dist",
12+
"build": "yarn tsc",
13+
"release": "yarn build && yarn cp ./src/project.d.ts package/dist && yarn cp ./src/index.d.ts package/dist && yarn cp ./package.json package/",
1414
"test": "mocha"
1515
},
16+
"repository": {
17+
"type": "git",
18+
"url": "git+https://github.com/JumpCutter/JC-ProjectExportAPI"
19+
},
20+
"keywords": [
21+
"JumpCutter",
22+
"Editor"
23+
],
24+
"bugs": {
25+
"url": "https://github.com/JumpCutter/JC-ProjectExportAPI/issues"
26+
},
27+
"homepage": "https://github.com/JumpCutter/JC-ProjectExportAPI#readme",
28+
"files": [
29+
"dist/**/*"
30+
],
1631
"dependencies": {
17-
"edl_composer": "^1.0.3",
18-
"typescript": "^4.4.3"
32+
"edl_composer": "^1.0.3"
1933
},
2034
"devDependencies": {
35+
"typescript": "^4.3.4",
2136
"@types/mocha": "^9.0.0",
2237
"@types/node": "^16.10.2",
2338
"mocha": "^9.1.2",

src/index.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import * as Project from "./project";
2+
export {Project};
3+
export abstract class Generator{
4+
constructor(project: Project.Project)
5+
generate(): string;
6+
}
7+
8+
export class ResolveEDL extends Generator{}
9+
export class VegasEDL extends Generator{}
10+
export class FCPXML extends Generator{}
11+
export class XML extends Generator{}
File renamed without changes.

src/project.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface Project {
22
outFile: string;
3-
resolution?: null;
3+
resolution: string | null;
44
frameRate: number;
55
layers?: Layers | null;
66
}

test/index.spec.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import {VegasEDL} from "../src/vegasEDL/genVegasEDL"
2-
import {ResolveEDL} from "../src/EDL/genEDL"
3-
import {FCPXML} from "../src/FCPXML/genFCPXML"
4-
import {XML} from "../src/XML/genXML"
5-
1+
import * as PEAPI from "../src/index";
62
import fs from "fs";
73
import path from "path";
84

95

10-
116
let generators = {};
127

138

@@ -18,7 +13,7 @@ project["layers"][0][0]["sourceFile"] = "../JC-examples/yoga.mp4"
1813
describe("generating vegasEDL for importing into Sony Vegas Pro", () => {
1914
it("should create a generator object that takes project as an argument", () => {
2015
let tmp = project;
21-
generators["VegasEDL"] = (new VegasEDL(tmp));
16+
generators["VegasEDL"] = (new PEAPI.VegasEDL(tmp));
2217
});
2318
it("generate a string representing a project in the EDL format Sony vegas supports", () => {
2419
fs.writeFileSync(path.join(__dirname, "./test.txt"), generators["VegasEDL"].generate());
@@ -28,7 +23,7 @@ describe("generating vegasEDL for importing into Sony Vegas Pro", () => {
2823
describe("generating EDL for importing into DaVinci Resolve", () => {
2924
it("should create a generator object that takes project as an argument", () => {
3025
let tmp = project;
31-
generators["ResolveEDL"] = (new ResolveEDL(tmp));
26+
generators["ResolveEDL"] = (new PEAPI.ResolveEDL(tmp));
3227
});
3328
it("generate a string representing a project in the EDL format", () => {
3429
fs.writeFileSync(path.join(__dirname, "./test.edl"), generators["ResolveEDL"].generate());
@@ -39,7 +34,7 @@ describe("generating EDL for importing into DaVinci Resolve", () => {
3934
describe("generating FCPXML for importing into FinalCut Pro", () => {
4035
it("should create a generator object that takes project as an argument", () => {
4136
let tmp = project;
42-
generators["FCPXML"] = (new FCPXML(tmp));
37+
generators["FCPXML"] = (new PEAPI.FCPXML(tmp));
4338
});
4439
it("generate a string representing a project in the FCPXML format", () => {
4540
fs.writeFileSync(path.join(__dirname, "./test.fcpxml"), generators["FCPXML"].generate());
@@ -51,7 +46,7 @@ describe("generating FCPXML for importing into FinalCut Pro", () => {
5146
describe("generating XML for importing into Premiere Pro", () => {
5247
it("should create a generator object that takes project as an argument", () => {
5348
let tmp = project;
54-
generators["XML"] = (new XML(tmp));
49+
generators["XML"] = (new PEAPI.XML(tmp));
5550
});
5651
it("generate a string representing a project in the EDL format Sony vegas supports", () => {
5752
fs.writeFileSync(path.join(__dirname, "./test.xml"), generators["XML"].generate());

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"allowJs": true,
1818
"jsx": "react",
1919
"sourceMap": true,
20-
"outDir": "./dist",
20+
"outDir": "./package/dist",
2121
"strict": true,
2222
"noImplicitAny": false,
2323
"esModuleInterop": true,
@@ -30,7 +30,7 @@
3030
"exclude": [
3131
"node_modules",
3232
"test",
33-
"dist"
33+
"package"
3434
],
3535
"ts-node": {
3636
"files": true

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
integrity sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==
4141

4242
"@types/node@^16.10.2":
43-
version "16.10.2"
44-
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.2.tgz#5764ca9aa94470adb4e1185fe2e9f19458992b2e"
45-
integrity sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==
43+
version "16.10.3"
44+
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.10.3.tgz#7a8f2838603ea314d1d22bb3171d899e15c57bd5"
45+
integrity sha512-ho3Ruq+fFnBrZhUYI46n/bV2GjwzSkwuT4dTf0GkuNFmnb8nq4ny2z9JEVemFi6bdEJanHLlYfy9c6FN9B9McQ==
4646

4747
"@ungap/promise-all-settled@1.1.2":
4848
version "1.1.2"
@@ -569,7 +569,7 @@ ts-node@^10.2.1:
569569
make-error "^1.1.1"
570570
yn "3.1.1"
571571

572-
typescript@^4.4.3:
572+
typescript@^4.3.4:
573573
version "4.4.3"
574574
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
575575
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==

0 commit comments

Comments
 (0)