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

Rewrite in TypeScript; update build process #6

Merged
merged 6 commits into from
Nov 14, 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
36 changes: 3 additions & 33 deletions .config/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

var configs = [];
const configs = [];
const banner = `/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */`;

const extensions = [
Expand Down Expand Up @@ -33,38 +33,9 @@ var terser_config = terser({
},
});


// esm
configs.push({
input: path.resolve(__dirname,'../lib/index.mjs'),
output:{
dir: path.resolve(__dirname,'../dist/esm'),
format: 'esm',
preserveModules: true,
sourcemap: true,
banner: banner,
entryFileNames: '[name].js',
},
plugins:[babel_config] // resolve_config
});

// cjs
configs.push({
input: path.resolve(__dirname,'../lib/index.mjs'),
output:{
dir: path.resolve(__dirname,'../dist/cjs'),
format: 'cjs',
preserveModules: false,
sourcemap: true,
banner: banner,
},
plugins:[babel_config] //resolve_config
});


// umd
configs.push({
input: path.resolve(__dirname,'../lib/index.mjs'),
input: path.resolve(__dirname,'../lib/index.ts'),
output: {
name: 'diacritics',
file: `dist/umd/index.js`,
Expand All @@ -80,7 +51,7 @@ configs.push({

// umd min
configs.push({
input: path.resolve(__dirname,'../lib/index.mjs'),
input: path.resolve(__dirname,'../lib/index.ts'),
output: {
name: 'diacritics',
file: `dist/umd/index.min.js`,
Expand All @@ -94,5 +65,4 @@ configs.push({
]
});


export default configs;
7 changes: 7 additions & 0 deletions .config/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "../dist/cjs",
}
}
7 changes: 7 additions & 0 deletions .config/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "../dist/esm",
}
}
12 changes: 6 additions & 6 deletions .config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"include": ["../lib/index.mjs"],
"include": ["../lib/index.ts"],
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"strict": true,
"checkJs": true,
"strict": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"noUncheckedIndexedAccess": true,

"declaration": true,
"declarationDir": "../dist/types",
"isolatedModules": true,
"moduleResolution": "node"
"sourceMap": true,
"rewriteRelativeImportExtensions": true,
},
}
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm run build:types
- run: npm run test
- run: npm run test:typescript
- run: npm run test:types
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.DS_store
.vscode
node_modules
benchmark/report*.json
coverage
build
x-*
dist
x-*
*.0x
2 changes: 1 addition & 1 deletion bench.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Usage:
* > npm run bench
*/
import * as D from './lib/index.mjs';
import * as D from './dist/esm/index.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now requires one to run npm run build first. I couldn't see a convenient way to have this file either be or directly import TypeScript.

import * as assert from 'assert';

const regExp = (needle) => {
Expand Down
11 changes: 0 additions & 11 deletions lib/index.d.ts

This file was deleted.

Loading