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

refactor: esm first #365

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion hebcal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ declare module '@hebcal/core' {
/**
* Gregorian date helper functions.
*/
export declare namespace greg {
export namespace greg {
/**
* Long names of the Gregorian months (1='January', 12='December')
* @readonly
Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"contributors": [
"Eyal Schachter (https://github.com/Scimonster)",
"Danny Sadinoff (https://github.com/dsadinoff)"
"Danny Sadinoff (https://github.com/dsadinoff)",
"Benny Powers (https://github.com/bennypowers)"
],
"keywords": [
"hebcal",
Expand All @@ -20,8 +21,13 @@
"zmanim"
],
"description": "A perpetual Jewish Calendar API",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"type": "module",
"exports": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"typings": "hebcal.d.ts",
"engines": {
"node": ">= 16.0.0"
Expand All @@ -42,7 +48,7 @@
"build:rollup": "rollup -c",
"build": "npm run po2json && npm run build:rollup",
"prepublish": "npm run build",
"po2json": "node ./po2json.js po/*.po",
"po2json": "node ./po2json.cjs po/*.po",
"readme": "npx -p jsdoc-to-markdown jsdoc2md dist/index.js",
"pretest": "npm run build",
"lint": "eslint src",
Expand Down
File renamed without changes.
21 changes: 11 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const {nodeResolve} = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const babel = require('@rollup/plugin-babel');
const json = require('@rollup/plugin-json');
const terser = require('@rollup/plugin-terser');
const pkg = require('./package.json');
import {nodeResolve} from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import babel from '@rollup/plugin-babel';
import json from '@rollup/plugin-json';
import terser from '@rollup/plugin-terser';
import MANIFEST from './package.json' assert { type: 'json' };
const {name, version, main, module} = MANIFEST;

const banner = '/*! ' + pkg.name + ' v' + pkg.version + ' */';
const banner = `/*! ${name} v${version} */`;

const TARGET_NODE_VER = '16.0.0';
const TARGETS_BROWSER = {
Expand All @@ -15,11 +16,11 @@ const TARGETS_BROWSER = {
safari: '15.6',
};

module.exports = [
export default [
{
input: 'src/index.js',
output: [
{file: pkg.main, format: 'cjs', name: pkg.name, banner,
{file: main, format: 'cjs', name, banner,
inlineDynamicImports: true,
globals: {
'temporal-polyfill': 'Temporal',
Expand Down Expand Up @@ -48,7 +49,7 @@ module.exports = [
{
input: 'src/index.js',
output: [
{file: pkg.module, format: 'es', name: pkg.name, banner,
{file: module, format: 'es', name, banner,
inlineDynamicImports: true,
globals: {
'temporal-polyfill': 'Temporal',
Expand Down
Loading