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

CommonJS support #1

Merged
merged 1 commit into from
Dec 8, 2023
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
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"
}