Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/add-i18n-go…
Browse files Browse the repository at this point in the history
…oglesheet
  • Loading branch information
guesung committed Sep 27, 2024
2 parents a9e03f4 + 11f41f6 commit 48c97c7
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 40 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"tslib": "^2.6.3",
"turbo": "^2.1.1",
"typescript": "5.5.3",
"vite": "5.3.6"
"vite": "5.3.3"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
29 changes: 20 additions & 9 deletions packages/shared/build.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
import * as esbuild from 'esbuild';
import dotenv from 'dotenv';
dotenv.config();
import * as esbuild from 'esbuild';
import { nodeExternalsPlugin } from 'esbuild-node-externals';
import { exec } from 'child_process';
import { promisify } from 'util';

dotenv.config();
const define = {};

for (const k in process.env) {
define[`process.env.${k}`] = JSON.stringify(process.env[k]);
}

/**
* @type { import("esbuild").BuildOptions }
*/
const buildOptions = {
entryPoints: ['./index.ts', './src/**/*.ts'],
const libBuildOptions = {
entryPoints: ['./src/**/*'],
outdir: 'dist',
tsconfig: './tsconfig.json',
bundle: false,
target: 'es6',
outdir: './dist',
sourcemap: true,
plugins: [nodeExternalsPlugin()],
define,
};

await esbuild.build(buildOptions);
const build = async () => {
await esbuild.build({ ...libBuildOptions, format: 'esm', outExtension: { '.js': '.js' }, sourcemap: true });

const execAsync = promisify(exec);
await execAsync('tsc --emitDeclarationOnly --outDir dist');
};

build().catch(error => {
console.log(error);
process.exit(1);
});
8 changes: 0 additions & 8 deletions packages/shared/index.ts

This file was deleted.

44 changes: 40 additions & 4 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,56 @@
"private": true,
"sideEffects": false,
"files": [
"dist/**"
"dist"
],
"types": "index.ts",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./utils/date.js": {
"types": "./dist/utils/date.d.ts",
"default": "./dist/utils/date.js"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"default": "./dist/utils/index.js"
},
"./utils/extension": {
"types": "./dist/utils/extension/index.d.ts",
"default": "./dist/utils/extension/index.js"
},
"./utils/web": {
"types": "./dist/utils/web/index.d.ts",
"default": "./dist/utils/web/index.js"
},
"./hooks": {
"types": "./dist/hooks/index.d.ts",
"default": "./dist/hooks/index.js"
},
"./constants": {
"types": "./dist/constants/index.d.ts",
"default": "./dist/constants/index.js"
},
"./types": {
"types": "./dist/types/index.d.ts",
"default": "./dist/types/index.js"
}
},
"scripts": {
"clean": "rimraf ./dist",
"ready": "node build.mjs",
"ready": "rm -rf dist && node build.mjs",
"lint": "eslint . --ext .ts,.tsx",
"lint:fix": "pnpm lint --fix",
"prettier": "prettier . --write --ignore-path ../../.prettierignore",
"type-check": "tsc --noEmit"
},
"devDependencies": {
"@extension/storage": "workspace:*",
"@extension/tsconfig": "workspace:*"
"@extension/tsconfig": "workspace:*",
"esbuild-node-externals": "^1.14.0"
}
}
8 changes: 8 additions & 0 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './hooks';
export * from './types';
export * from './utils';
export * from './utils/extension';
export * from './utils/extension/bridge';
export * from './utils/extension/module';
export * from './utils/web';
export * from './constants';
16 changes: 14 additions & 2 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
"compilerOptions": {
"outDir": "dist",
"jsx": "react-jsx",
"types": ["chrome"],
"emitDeclarationOnly": false,
"baseUrl": ".",
"types": ["chrome"]
"strictPropertyInitialization": false,
"declaration": true,
"target": "esnext",
"module": "NodeNext",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"rootDir": "src"
},
"include": ["src/**/*", "index.ts"]
"include": ["./src/**/*", "**/*.d.ts"],
"exclude": ["dist", "node_modules"]
}
46 changes: 30 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48c97c7

Please sign in to comment.