Skip to content

enable esm #93

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

Merged
merged 3 commits into from
Sep 11, 2021
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
File renamed without changes.
27 changes: 17 additions & 10 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ jobs:
name: Build
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [10, 14, 16]
os:
- ubuntu-latest
- macos-latest
- windows-latest
node:
- 14
- 16

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -17,7 +22,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: npm
cache-dependency-path: package.json

- name: Install Dependencies
Expand All @@ -35,37 +40,39 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'npm'
cache: npm
cache-dependency-path: package.json

- name: Install Dependencies
run: npm install

- name: Generate Version
run: ./scripts/generate-version.sh
- name: Generate Package JSON
run: ./scripts/generate-package-json.sh

- name: Pack Testing
run: ./scripts/npm-pack-testing.sh

publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v'))
name: Publish
needs: [build, pack]
needs:
- build
- pack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'npm'
cache: npm
cache-dependency-path: package.json

- name: Install Dependencies
run: npm install

- name: Generate Version
run: ./scripts/generate-version.sh
- name: Generate Package JSON
run: ./scripts/generate-package-json.sh

- name: Set Publish Config
run: ./scripts/package-publish-config-tag.sh
Expand Down
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

29 changes: 0 additions & 29 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion example/demo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
FlashStore,
} from '../src/mod'
} from '../src/mod.js'

async function main(): Promise<number> {
const flashStore = new FlashStore('flashstore.workdir')
Expand Down
5 changes: 0 additions & 5 deletions index.ts

This file was deleted.

48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
{
"name": "flash-store",
"version": "1.1.4",
"version": "1.1.5",
"description": "FlashStore is a Key-Value persistent storage with easy to use ES6 Map-like API(both Async and Sync support), powered by LevelDB and TypeScript.",
"main": "bundles/flash-store.umd.js",
"types": "dist/src/mod.d.ts",
"type": "module",
"exports": {
".": {
"import": "./dist/esm/src/mod.js",
"require": "./dist/cjs/src/mod.js"
}
},
"typings": "./dist/esm/src/mod.d.ts",
"engines": {
"node": ">=14"
},
"scripts": {
"build": "tsc --module esnext",
"clean": "shx rm -fr dist/*",
"dist": "npm-run-all clean build dist:commonjs",
"build": "tsc && tsc -p tsconfig.cjs.json",
"dist:commonjs": "jq -n \"{ type: \\\"commonjs\\\" }\" > dist/cjs/package.json",
"pack": "npm pack",
"clean": "shx rm -fr dist/* bundles/*",
"doc": "npm run dist && echo '# FlashStore v'$(jq -r .version package.json)' Documentation\n' > docs/index.md && jsdoc2md dist/flash-store.js>> docs/index.md",
"demo": "ts-node example/demo.ts",
"dist": "npm run clean && npm run build && npm run rollup && npm run dist:es6to5",
"dist:es6to5": "tsc --out ./bundles/flash-store.umd.js --target es5 --allowJs bundles/flash-store.es6.umd.js --lib es6,dom",
"lint": "npm run lint:es && npm run lint:ts && npm run lint:md",
"lint": "npm-run-all lint:es lint:ts lint:md",
"lint:md": "markdownlint README.md",
"lint:ts": "tsc --noEmit",
"lint:ts": "tsc --isolatedModules --noEmit",
"lint:es": "eslint --ignore-pattern fixtures/ \"src/**/*.ts\" \"tests/**/*.ts\"",
"rollup": "rollup -c",
"test": "npm run lint && npm run test:unit",
"test:pack": "bash -x scripts/npm-pack-testing.sh",
"test:unit": "tap --node-arg=--require=ts-node/register \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\""
"test:unit": "tap --node-arg=--loader=ts-node/esm --node-arg=--no-warnings \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\""
},
"repository": {
"type": "git",
Expand All @@ -46,33 +54,25 @@
"state-switch": "^0.6.18"
},
"devDependencies": {
"@chatie/eslint-config": "^0.12.4",
"@chatie/eslint-config": "^0.14.1",
"@chatie/git-scripts": "^0.6.2",
"@chatie/semver": "^0.4.7",
"@chatie/tsconfig": "^0.16.2",
"@chatie/tsconfig": "^0.20.2",
"@types/app-root-path": "^1.2.4",
"@types/level": "^6.0.0",
"@types/level-errors": "^3.0.0",
"@types/rimraf": "^3.0.1",
"jsdoc-to-markdown": "^7.0.1",
"rollup": "^2.56.2",
"rollup-plugin-json": "^4.0.0",
"npm-run-all": "^4.1.5",
"shx": "^0.3.3",
"source-map-support": "^0.5.19",
"tstest": "^0.5.16"
"tstest": "^0.5.16",
"typescript": "^4.4.3"
},
"files": [
"package.json",
"README.md",
"CHANGELOG.md",
"LICENSE",
"bundles/",
"src/",
"dist/"
],
"engines": {
"node": ">= 10"
},
"publishConfig": {
"access": "public",
"tag": "next"
Expand Down
22 changes: 0 additions & 22 deletions rollup.config.js

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/development-release.ts

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/generate-package-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e

SRC_PACKAGE_JSON_TS_FILE='src/package-json.ts'

[ -f ${SRC_PACKAGE_JSON_TS_FILE} ] || {
echo ${SRC_PACKAGE_JSON_TS_FILE}" not found"
exit 1
}

cat <<_SRC_ > ${SRC_PACKAGE_JSON_TS_FILE}
/**
* This file was auto generated from scripts/generate-version.sh
*/
import type { PackageJson } from 'type-fest'
export const packageJson: PackageJson = $(cat package.json) as any
_SRC_
18 changes: 0 additions & 18 deletions scripts/generate-version.sh

This file was deleted.

Loading