Skip to content

Commit

Permalink
More stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklafrance committed Nov 29, 2024
1 parent 183c978 commit d769c38
Show file tree
Hide file tree
Showing 17 changed files with 1,345 additions and 539 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ jobs:
- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Cache turborepo
uses: actions/cache@v4
- name: Restore Turborepo cache
id: cache-turborepo-restore
uses: actions/cache/restore@v4
with:
path: node_modules/.cache/turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
key: ${{ runner.os }}-turborepo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
save-always: true
${{ runner.os }}-turborepo-
path: .turbo

- name: Build packages
run: pnpm ci-build

- name: Save Turborepo cache
id: cache-turborepo-save
if: always() && steps.cache-turborepo-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-turborepo-restore.outputs.cache-primary-key }}
path: .turbo

- name: Create release Pull Request or publish to NPM
uses: changesets/action@v1
with:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,60 @@ jobs:
key: ${{ runner.os }}-jest-${{ hashFiles('packages/**/node_modules/.cache/jest') }}
save-always: true





name: CI

# PNPM setup based on https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
CI: true

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "22.8.0"
cache: pnpm
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Restore Turborepo cache
id: cache-turborepo-restore
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-turborepo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turborepo-
path: .turbo

- name: Build packages
run: pnpm ci-build

Expand All @@ -87,3 +141,11 @@ jobs:

- name: Test packages
run: pnpm test

- name: Save Turborepo cache
id: cache-turborepo-save
if: always() && steps.cache-turborepo-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-turborepo-restore.outputs.cache-primary-key }}
path: .turbo
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dist
.pnpm-debug.log*
.netlify
.turbo
.rslib
.retype

# Mac
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lint:types": "pnpm -r --parallel --include-workspace-root exec tsc",
"changeset": "changeset",
"publish-pkg": "changeset publish",
"clean": "pnpm -r --parallel --include-workspace-root exec pnpm dlx rimraf dist .turbo .netlify node_modules/.cache",
"clean": "pnpm -r --parallel --include-workspace-root exec pnpm dlx rimraf dist .turbo .rslib .netlify node_modules/.cache",
"reset": "pnpm clean && pnpm reset:modules",
"reset:modules": "pnpm -r --parallel --include-workspace-root exec pnpm dlx rimraf node_modules pnpm-lock.yaml",
"dev-basic": "turbo run dev --filter=./samples/basic/*",
Expand Down
38 changes: 20 additions & 18 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,51 @@
"url": "git+https://github.com/gsoft-inc/wl-squide.git",
"directory": "packages/core"
},
"type": "module",
"publishConfig": {
"access": "public",
"provenance": true
},
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
"provenance": true,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
}
},
"exports": "./src/index.ts",
"files": [
"/dist",
"CHANGELOG.md",
"README.md"
],
"scripts": {
"dev": "tsup --config ./tsup.dev.ts",
"build": "tsup --config ./tsup.build.ts"
"dev": "rslib build --watch --config ./rslib.dev.ts",
"build": "rslib build --config ./rslib.build.ts",
"foo": "pnpm publish --dry-run"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
"react": "*"
},
"dependencies": {
"@types/react": "18.3.12",
"eventemitter3": "5.0.1"
},
"devDependencies": {
"@microsoft/api-extractor": "7.48.0",
"@rsbuild/plugin-react": "1.0.7",
"@rslib/core": "0.1.0",
"@swc/core": "1.8.0",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/react": "18.3.12",
"@workleap/eslint-plugin": "3.2.3",
"@workleap/swc-configs": "2.2.3",
"@workleap/tsup-configs": "3.0.6",
"@workleap/typescript-configs": "3.0.2",
"eslint": "8.57.0",
"jest": "29.7.0",
"react": "18.3.1",
"tsup": "8.3.5",
"typescript": "5.5.4"
},
"dependencies": {
"eventemitter3": "5.0.1"
},
"sideEffects": false,
"engines": {
"node": ">=21.1.0"
Expand Down
27 changes: 27 additions & 0 deletions packages/core/rslib.build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
lib: [{
format: "esm",
syntax: "esnext",
bundle: true,
dts: {
bundle: true
}
}],
source: {
entry: {
index: "./src/index.ts"
}
},
output: {
target: "web",
distPath: {
root: "./dist"
},
cleanDistPath: true,
minify: false
},
plugins: [pluginReact()]
});
27 changes: 27 additions & 0 deletions packages/core/rslib.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
lib: [{
format: "esm",
syntax: "esnext",
bundle: true,
dts: false
}],
source: {
entry: {
index: "./src/index.ts"
}
},
output: {
target: "web",
distPath: {
root: "./dist"
},
cleanDistPath: true,
sourceMap: {
js: "cheap-module-source-map"
}
},
plugins: [pluginReact()]
});
3 changes: 0 additions & 3 deletions packages/core/tsup.build.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/core/tsup.dev.ts

This file was deleted.

14 changes: 7 additions & 7 deletions packages/env-vars/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Config } from "jest";
import { pathsToModuleNameMapper } from "ts-jest";
// import { pathsToModuleNameMapper } from "ts-jest";
import { swcConfig } from "./swc.jest.ts";
import { compilerOptions } from "./tsconfig.json";
// import { compilerOptions } from "./tsconfig.json";

const config: Config = {
testEnvironment: "jsdom",
Expand All @@ -11,11 +11,11 @@ const config: Config = {
transform: {
"^.+\\.(js|ts|tsx)$": ["@swc/jest", swcConfig as Record<string, unknown>]
},
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: "<rootDir>"
})
},
// moduleNameMapper: {
// ...pathsToModuleNameMapper(compilerOptions.paths, {
// prefix: "<rootDir>"
// })
// },
cacheDirectory: "./node_modules/.cache/jest"
};

Expand Down
24 changes: 14 additions & 10 deletions packages/env-vars/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,34 @@
"README.md"
],
"scripts": {
"dev": "tsup --config ./tsup.dev.ts",
"build": "tsup --config ./tsup.build.ts"
"dev": "rslib build --watch --config ./rslib.dev.ts",
"build": "rslib build --config ./rslib.build.ts"
},
"peerDependencies": {
"react": "*"
},
"dependencies": {
"@squide/core": "workspace:*",
"@types/react": "18.3.12",
"memoize": "10.0.0"
},
"devDependencies": {
"@microsoft/api-extractor": "7.48.0",
"@rsbuild/plugin-react": "1.0.7",
"@rslib/core": "0.1.0",
"@swc/core": "1.8.0",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@workleap/eslint-plugin": "3.2.3",
"@workleap/swc-configs": "2.2.3",
"@workleap/tsup-configs": "3.0.6",
"@workleap/typescript-configs": "3.0.2",
"eslint": "8.57.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"react": "18.3.1",
"ts-jest": "29.2.5",
"tsup": "8.3.5",
"typescript": "5.5.4"
},
"dependencies": {
"@squide/core": "workspace:*",
"memoize": "10.0.0"
},
"sideEffects": false,
"engines": {
"node": ">=21.1.0"
Expand Down
27 changes: 27 additions & 0 deletions packages/env-vars/rslib.build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
lib: [{
format: "esm",
syntax: "esnext",
bundle: true,
dts: {
bundle: true
}
}],
source: {
entry: {
index: "./src/index.ts"
}
},
output: {
target: "web",
distPath: {
root: "./dist"
},
cleanDistPath: true,
minify: false
},
plugins: [pluginReact()]
});
27 changes: 27 additions & 0 deletions packages/env-vars/rslib.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { pluginReact } from "@rsbuild/plugin-react";
import { defineConfig } from "@rslib/core";

export default defineConfig({
lib: [{
format: "esm",
syntax: "esnext",
bundle: true,
dts: false
}],
source: {
entry: {
index: "./src/index.ts"
}
},
output: {
target: "web",
distPath: {
root: "./dist"
},
cleanDistPath: true,
sourceMap: {
js: "cheap-module-source-map"
}
},
plugins: [pluginReact()]
});
10 changes: 5 additions & 5 deletions packages/env-vars/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "@workleap/typescript-configs/library.json",
"compilerOptions": {
"paths": {
"@squide/core": ["../core/src/index.ts"]
}
},
// "compilerOptions": {
// "paths": {
// "@squide/core": ["../core/src/index.ts"]
// }
// },
"exclude": ["dist", "node_modules"]
}
Loading

0 comments on commit d769c38

Please sign in to comment.