Skip to content

Commit

Permalink
Merge pull request #1 from SchematicHQ/commonjs
Browse files Browse the repository at this point in the history
CommonJS support
  • Loading branch information
bpapillon authored Dec 8, 2023
2 parents e5b8fb2 + d69fc91 commit 5e5cdcd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
- name: Deploy browser build
run: |
aws s3 cp --acl=public-read dist/browser.js s3://$S3_BUCKET/js/schematic.js
aws s3 cp --acl=public-read dist/browser.js s3://$S3_BUCKET/js/schematic.${{ steps.package.outputs.version }}.js
aws s3 cp --acl=public-read dist/schematic.browser.js s3://$S3_BUCKET/js/schematic.js
aws s3 cp --acl=public-read dist/schematic.browser.js s3://$S3_BUCKET/js/schematic.${{ steps.package.outputs.version }}.js
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id ${{ env.CDN_DISTRIBUTION_ID }} --paths "/js/schematic.js" "/js/schematic.${{ steps.package.outputs.version }}.js"
Expand All @@ -68,10 +68,18 @@ jobs:
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Build
- name: Build CJS
uses: borales/actions-yarn@v4
with:
cmd: build:npm
cmd: build:cjs
- name: Build ESM
uses: borales/actions-yarn@v4
with:
cmd: build:esm
- name: Build types
uses: borales/actions-yarn@v4
with:
cmd: build:types
- name: Set up .npmrc
run: touch .npmrc && echo "//npm.pkg.github.com/:_authToken=$AUTH_TOKEN" > .npmrc
env:
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/merge_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ jobs:
with:
cmd: install

- name: Browser Build
- name: Build browser bundle
uses: borales/actions-yarn@v4
with:
cmd: build:browser

- name: NPM Build
- name: Build ESM
uses: borales/actions-yarn@v4
with:
cmd: build:npm
cmd: build:esm

- name: Build CJS
uses: borales/actions-yarn@v4
with:
cmd: build:cjs

- name: Build types
uses: borales/actions-yarn@v4
with:
cmd: build:types
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"name": "@schematichq/schematic-js",
"main": "dist/schematic.cjs.js",
"module": "dist/schematic.esm.js",
"browser": "dist/schematic.browser.js",
"author": "Ben Papillon <ben@schematichq.com>",
"dependencies": {
"@types/uuid": "^9.0.2",
Expand All @@ -10,22 +14,23 @@
"typescript": "^5.0.2"
},
"files": [
"dist/schematic.js",
"dist/schematic.cjs.js",
"dist/schematic.esm.js",
"dist/schematic.browser.js",
"dist/schematic.d.ts"
],
"license": "MIT",
"main": "dist/schematic.js",
"modules": false,
"name": "@schematichq/schematic-js",
"publishConfig": {
"@schematichq:registry": "https://npm.pkg.github.com"
},
"repository": "git@github.com:SchematicHQ/schematic-js.git",
"scripts": {
"build:npm": "npx esbuild src/index.ts --bundle --outfile=dist/schematic.js --platform=neutral && npx tsc && npx api-extractor run",
"build:browser": "npx esbuild src/browser.ts --bundle --minify --outfile=dist/browser.js --platform=browser",
"build:browser": "npx esbuild src/browser.ts --bundle --minify --outfile=dist/schematic.browser.js --platform=browser",
"build:cjs": "npx esbuild src/index.ts --bundle --format=cjs --outfile=dist/schematic.cjs.js --platform=neutral",
"build:esm": "npx esbuild src/index.ts --bundle --format=esm --outfile=dist/schematic.esm.js --platform=neutral",
"build:types": "npx tsc && npx api-extractor run",
"clean": "rm -rf dist"
},
"types": "dist/schematic.d.ts",
"version": "0.0.4"
"version": "0.0.5"
}

0 comments on commit 5e5cdcd

Please sign in to comment.