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

chore: rollup build for react packages #338

Merged
merged 11 commits into from
Dec 23, 2024
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
10 changes: 4 additions & 6 deletions .github/workflows/publish-canary-cdn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ concurrency:
cancel-in-progress: true

jobs:
web-components:
deploy-canary-cdn:
if: github.repository == 'carbon-design-system/carbon-labs'
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'packages/web-components'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- uses: fkirc/[email protected]
with:
github_token: ${{ github.token }}
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
Expand All @@ -34,6 +31,7 @@ jobs:
- name: Build dist folders in each package
run: yarn build:dist:canary
- name: Create one folder with dist contents from each package
working-directory: 'packages/web-components'
run: |
mkdir dist
cp -r src/components/**/dist/. dist/
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/publish-cdn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@ concurrency:
cancel-in-progress: true

jobs:
web-components:
deploy-cdn:
if: |
github.repository == 'carbon-design-system/carbon-labs'
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'packages/web-components'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- name: Use Node.js 18.x
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
Expand All @@ -34,6 +31,7 @@ jobs:
- name: Build dist folders in each package
run: yarn build:dist
- name: Create one folder with dist contents from each package
working-directory: 'packages/web-components'
run: |
mkdir dist
cp -r src/components/**/dist/. dist/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lerna-debug.log*
node_modules
dist
es
scss
dist-ssr
lib
*.local
Expand Down
3 changes: 2 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/storybook-static/**
**/storybook-static/**
scss
24 changes: 24 additions & 0 deletions examples/react/example-button/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
22 changes: 22 additions & 0 deletions examples/react/example-button/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
@license

Copyright IBM Corp. 2024

This source code is licensed under the Apache-2.0 license found in the
LICENSE file in the root directory of this source tree.
-->

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@carbon-labs/example-button stackblitz</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/react/example-button/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "carbon-labs-react-example-button",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@carbon/react": "^1.72.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@carbon-labs/react-example-button": "latest",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react": "^4.2.1",
"sass": "~1.83.0",
"typescript": "^5.2.2",
"vite": "^5.0.8"
}
}
16 changes: 16 additions & 0 deletions examples/react/example-button/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
*
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { ExampleButton } from '@carbon-labs/example-button/es/index';

function App() {
return <ExampleButton />;
}

export default App;
9 changes: 9 additions & 0 deletions examples/react/example-button/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

@use '@carbon/react';
@use '@carbon-labs/example-button/scss/example-button';
19 changes: 19 additions & 0 deletions examples/react/example-button/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
*
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.tsx';
import './index.scss';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
10 changes: 10 additions & 0 deletions examples/react/example-button/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @license
*
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

/// <reference types="vite/client" />
25 changes: 25 additions & 0 deletions examples/react/example-button/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
10 changes: 10 additions & 0 deletions examples/react/example-button/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
16 changes: 16 additions & 0 deletions examples/react/example-button/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @license
*
* Copyright IBM Corp. 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
2 changes: 0 additions & 2 deletions packages/react/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import './styles.scss';

import theme from './theme';

console.log('process.env.NODE_ENV', process.env.NODE_ENV);

const devTools = {
layoutSize: {
description: "Set the layout context's size",
Expand Down
1 change: 0 additions & 1 deletion packages/react/.storybook/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { create } from '@storybook/theming';
import PackageInfo from '../package.json';

/**
* @see https://storybook.js.org/docs/react/configure/theming
Expand Down
2 changes: 1 addition & 1 deletion packages/react/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* LICENSE file in the root directory of this source tree.
*/

module.exports = {
export default {
testEnvironment: 'jsdom',
preset: 'ts-jest',
moduleNameMapper: {
Expand Down
Loading
Loading