Skip to content

Commit c2428f7

Browse files
authored
Merge pull request #2106 from docsifyjs/es-modules
conversion to ESM, and deletion of CommonJS
2 parents a69c22a + 376c92d commit c2428f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1152
-961
lines changed

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const prettierConfig = require('./.prettierrc');
1+
const prettierConfig = require('./.prettierrc.json');
22

33
module.exports = {
44
root: true,

.github/workflows/test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Build & Test
22

3-
on:
4-
push:
5-
branches: [master, develop]
6-
pull_request:
7-
branches: [master, develop]
3+
on: [push]
84

95
jobs:
106
lint:

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.eslintignore
2-
.eslintrc
2+
.eslintrc.cjs
33
.github
44
.gitignore
5-
.travis.yml

.prettierrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"arrowParens": "avoid",
3+
"singleQuote": true
4+
}

.vscode/launch.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
{
88
"type": "node",
99
"request": "launch",
10-
"name": "Run tests",
10+
"name": "Run unit tests",
1111
"runtimeExecutable": "npm",
12-
"runtimeArgs": ["run-script", "test"],
12+
"runtimeArgs": ["test"],
1313
"console": "integratedTerminal"
1414
},
1515
{
1616
"type": "node",
1717
"request": "launch",
1818
"name": "Run current test file",
19-
"runtimeExecutable": "npm",
20-
"runtimeArgs": ["run-script", "test"],
21-
"args": ["--", "-i", "${relativeFile}", "--testPathIgnorePatterns"],
19+
"runtimeExecutable": "npx",
20+
"runtimeArgs": ["jest"],
21+
"args": ["-i", "${relativeFile}", "--testPathIgnorePatterns"],
2222
"console": "integratedTerminal"
2323
},
2424
{
@@ -41,10 +41,9 @@
4141
"type": "node",
4242
"request": "launch",
4343
"name": "Update current test file snapshot(s)",
44-
"runtimeExecutable": "npm",
45-
"runtimeArgs": ["run-script", "test"],
44+
"runtimeExecutable": "npx",
45+
"runtimeArgs": ["jest"],
4646
"args": [
47-
"--",
4847
"-i",
4948
"${relativeFile}",
5049
"--updateSnapshot",
@@ -56,8 +55,8 @@
5655
"type": "node",
5756
"request": "launch",
5857
"name": "Update selected test name snapshot(s)",
59-
"runtimeExecutable": "npm",
60-
"runtimeArgs": ["run-script", "test"],
58+
"runtimeExecutable": "npx",
59+
"runtimeArgs": ["jest"],
6160
"args": [
6261
"--",
6362
"-i",

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
- [`develop` branch preview](https://docsify-preview.vercel.app/)
3333
- [Documentation](https://docsify.js.org)
3434
- [CLI](https://github.com/docsifyjs/docsify-cli)
35-
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
35+
- CDN:
36+
- [UNPKG](https://unpkg.com/docsify/)
37+
- [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/)
38+
- [cdnjs](https://cdnjs.com/libraries/docsify)
3639
- [Awesome docsify](https://github.com/docsifyjs/awesome-docsify)
3740
- [Community chat](https://discord.gg/3NwKFyR)
3841

babel.config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

babel.config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "current"
8+
}
9+
}
10+
]
11+
]
12+
}

build/build.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
const rollup = require('rollup')
2-
const buble = require('rollup-plugin-buble')
3-
const commonjs = require('rollup-plugin-commonjs')
4-
const nodeResolve = require('rollup-plugin-node-resolve')
5-
const { uglify } = require('rollup-plugin-uglify')
6-
const replace = require('rollup-plugin-replace')
7-
const isProd = process.env.NODE_ENV === 'production'
8-
const version = process.env.VERSION || require('../package.json').version
9-
const chokidar = require('chokidar')
10-
const path = require('path')
1+
import rollup from 'rollup';
2+
import buble from 'rollup-plugin-buble';
3+
import commonjs from 'rollup-plugin-commonjs';
4+
import nodeResolve from 'rollup-plugin-node-resolve';
5+
import { uglify } from 'rollup-plugin-uglify';
6+
import replace from 'rollup-plugin-replace';
7+
import chokidar from 'chokidar';
8+
import path from 'path';
9+
import { relative } from './util.js';
10+
import { promises as fs } from 'fs';
11+
12+
const pkgPath = relative(import.meta, '..', 'package.json');
13+
const pkgString = (await fs.readFile(pkgPath)).toString();
14+
const pkg = JSON.parse(pkgString);
15+
const isProd = process.env.NODE_ENV === 'production';
16+
const version = process.env.VERSION || pkg.version;
1117

1218
/**
1319
* @param {{

0 commit comments

Comments
 (0)