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

Scaffold react sdk package #1

Merged
merged 46 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
00a01b3
Add gitignore
niwsa May 10, 2023
e4e1f7f
Set up root package.json
niwsa May 10, 2023
3324dda
Set up Prettier, ESLInt, tsconfig
niwsa May 11, 2023
28a6288
Install dev dependencies
niwsa May 11, 2023
40eba26
Mitosis config
niwsa May 11, 2023
84aac1c
Scaffold sso/login component
niwsa May 11, 2023
7ba176b
Add type for css module
niwsa May 12, 2023
0c2c92b
Switch `useState` to `useStore`
niwsa May 12, 2023
ab122ab
Merge branch 'main' into mitosis
niwsa May 12, 2023
b9415bf
Sync lock file
niwsa May 12, 2023
8aeb83c
Use postcss for loading css files
niwsa May 12, 2023
059c6f0
Tweak `dest` and formatting change
niwsa May 12, 2023
352019f
Add postcss run to build
niwsa May 12, 2023
70ace0f
Update dev dependencies
niwsa May 16, 2023
8c15697
main export and other changes
niwsa May 16, 2023
c6fc0fd
Scaffold `react` package
niwsa May 16, 2023
4eaec2b
Add empty `src` folder
niwsa May 16, 2023
978663a
Cleanup
niwsa May 16, 2023
359d196
[react] Setup doc theme
niwsa May 16, 2023
acc1fe9
[react] Expose `sso` entry point
niwsa May 16, 2023
da14b88
[react] plugin to inject css
niwsa May 16, 2023
613c045
[react] scaffold docs
niwsa May 16, 2023
fb19591
Remove default entry point
niwsa May 18, 2023
85b399b
Support multiple entry points
niwsa May 18, 2023
3bd3365
Scope to subpath entry points
niwsa May 18, 2023
58c519c
Cleanup
niwsa May 18, 2023
b5e1fd0
Add script for react:docs
niwsa May 19, 2023
334bedb
Fix local state naming
niwsa May 19, 2023
f1af994
Use `sso` subpath for import
niwsa May 19, 2023
e1ae7da
Tweak css module typings
niwsa May 19, 2023
fdb3785
Support sso import in demos
niwsa May 19, 2023
269ee54
show component demos for prod build also
niwsa May 19, 2023
004d752
Minor tweaks
niwsa May 19, 2023
8cb1359
Point entry points to dist location
niwsa May 19, 2023
9edbaec
Fix sso entry point
niwsa May 21, 2023
20c85cc
Remove unused path
niwsa May 21, 2023
b278609
Fix path for lib import in docs
niwsa May 21, 2023
3d0aba8
Enable sourcemap out and other cleanups
niwsa May 21, 2023
98786cb
Fix entrypoints
niwsa May 21, 2023
5ece4a4
Publish library types
niwsa May 21, 2023
f609118
Make npm public
niwsa May 21, 2023
b058faa
Use root folder instead of `types/`
niwsa May 21, 2023
296749f
Update README.md
niwsa May 21, 2023
b3c4908
Set up gh workflow
niwsa May 21, 2023
8f297dc
Update `keywords`
niwsa May 22, 2023
d732a8c
Minor tweaks
niwsa May 22, 2023
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
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@builder.io/mitosis/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint", "@builder.io/mitosis"],
};
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: UI Component SDK build and publish
on:
workflow_dispatch:
inputs:
npmversion:
required: true
type: string
publishtag:
required: true
type: string
default: latest
jobs:
mitosis-generate:
runs-on: ubuntu-latest

defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
check-latest: true
- run: npm ci
- name: Run mitosis build
run: npm build
- name: Export framework code for react
uses: actions/upload-artifact@v3
with:
name: react-ui
path: ./react/src

build-publish-framework-lib:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./react

steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
check-latest: true
- uses: actions/download-artifact@v3
with:
name: react-ui
path: ./react/src
- run: npm ci
- name: Publish NPM
if: github.ref == 'refs/heads/release' || contains(github.ref, 'refs/tags/beta-v')
run: |
npm install -g json
PKG_VERSION=${{ inputs.npmversion }}
json -I -f package.json -e "this.version=\"${PKG_VERSION}\""

npm publish --tag ${{ inputs.publishtag }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78 changes: 78 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# mitosis build out
output

18 changes: 18 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
node_modules
.next
public
**/**/node_modules
**/**/.next
**/**/public
npm/migration/**

*.lock
*.log

.gitignore
.npmignore
.prettierignore
.DS_Store
.eslintignore

**/LICENSE
11 changes: 11 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: true,
jsxSingleQuote: true,
trailingComma: "es5",
semi: true,
printWidth: 110,
arrowParens: "always",
importOrderSeparation: true,
};
8 changes: 8 additions & 0 deletions mitosis.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('@builder.io/mitosis').MitosisConfig} */
module.exports = {
files: 'src/**',
dest: '.',
options: { react: { typescript: true } },
targets: ['react'],
exclude: ['src/css.d.ts'],
};
Loading