Skip to content

Commit

Permalink
fix: lazy load AceEditor to allow server side rendering the input
Browse files Browse the repository at this point in the history
Also, ci: add semantic-release workflow
  • Loading branch information
snorrees authored Aug 16, 2022
1 parent 9878741 commit d1d173b
Show file tree
Hide file tree
Showing 15 changed files with 31,354 additions and 15,453 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
env: {
browser: true,
node: false,
jest: true
},
extends: [
'sanity/react', // must come before sanity/typescript
Expand Down
72 changes: 57 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,69 @@
name: CI
name: CI & Release
on:
push:
workflow_dispatch:
inputs:
release:
description: 'Release new version'
required: true
default: false
type: boolean
skipTests:
description: 'Skip tests'
required: true
default: false
type: boolean

jobs:
test:
runs-on: ${{ matrix.platform }}
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
node-version:
- 16
build:
name: 'Lint & Build'
runs-on: ubuntu-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'npm'
- run: npm ci
- run: npm run lint --if-present
- run: npm run build

test:
name: 'Test'
needs: build
strategy:
matrix:
node-version: [ 16.x, 18.x ]
platform: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.platform }}
if: inputs.skipTests != true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run lint
- run: npm run build
#- run: npm test
- run: npm test

release:
name: 'Semantic release'
needs: test
runs-on: ubuntu-latest
if: inputs.release == true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'npm'
- run: npm install
# Branches that will release new versions is defined in .releaserc.json
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
9 changes: 9 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "@parcel/config-default",
"transformers": {
"*.{js,mjs,jsx,cjs,ts,tsx}": [
"@parcel/transformer-js",
"@parcel/transformer-react-refresh-wrap"
]
}
}
23 changes: 23 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"branches": [
{"name": "main", "channel": "studio-v3", "prerelease": "v3-studio"},
{"name": "main-post-ga"}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"tarballDir": "release"
}
],
[
"@semantic-release/github",
{
"assets": "release/*.tgz"
}
]
],
"preset": "angular"
}
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// used only by jest, .parcelrc configured to ignore this file
module.exports = {
presets: [
'@babel/preset-env',
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
],
}
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
const crypto = require('crypto')
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['.yalc', 'node_modules', '.idea', 'lib', '.parcel-cache'],
globals: {
'ts-jest': {
babelConfig: true,
},
crypto: {
getRandomValues: (arr) => crypto.randomBytes(arr.length),
},
},
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(mjs|js|jsx)$': 'babel-jest',
},
transformIgnorePatterns: ['node_modules/(?!(nanoid|uuid|get-random-values-esm))'],
}
Loading

0 comments on commit d1d173b

Please sign in to comment.