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

chore: change the type to module #45

Merged
merged 1 commit into from
Nov 27, 2023
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
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "components-helper",
"version": "2.1.5",
"description": "Based on the docs to provide code prompt files for vue component library",
"main": "lib/index.js",
"module": "lib/index.es.js",
"type": "module",
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"exports": {
".": {
"import": "./lib/index.es.js",
"require": "./lib/index.js"
"import": "./lib/index.js",
"require": "./lib/index.cjs"
}
},
"scripts": {
Expand Down Expand Up @@ -44,10 +45,10 @@
},
"homepage": "https://github.com/tolking/components-helper#readme",
"engines": {
"node": ">15.0.0"
"node": ">=16.0.0"
},
"dependencies": {
"fast-glob": "^3.2.11"
"fast-glob": "^3.3.2"
},
"devDependencies": {
"@types/node": "^18.0.6",
Expand Down
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ts from 'rollup-plugin-typescript2'

const commonConf = {
input: './src/index.ts',
external: ['fast-glob', 'fs', 'path'],
external: ['fast-glob'],
plugins: [
ts({
extensions: ['.ts'],
Expand All @@ -13,13 +13,13 @@ const commonConf = {

const list = [
{
file: 'lib/index.es.js',
file: 'lib/index.js',
format: 'es',
exports: 'named',
compact: true,
},
{
file: 'lib/index.js',
file: 'lib/index.cjs',
format: 'cjs',
exports: 'named',
compact: true,
Expand Down
2 changes: 1 addition & 1 deletion src/read.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync } from 'fs'
import { readFileSync } from 'node:fs'

export function read(path: string): string {
return readFileSync(path, 'utf-8')
Expand Down
4 changes: 2 additions & 2 deletions src/write.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'path'
import { mkdir, writeFileSync } from 'fs'
import { resolve } from 'node:path'
import { mkdir, writeFileSync } from 'node:fs'
import type { Options, Tags, Props, WebTypes } from './type'

export function write(
Expand Down
3 changes: 1 addition & 2 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const helper = require('../lib/index').default
import helper from '../lib/index.js'

helper({
name: 'test',
Expand Down