Skip to content

Commit 8622835

Browse files
authored
Merge pull request #194 from orgapp/esm
migrate to ESM
2 parents fe4fe17 + 9376c97 commit 8622835

File tree

470 files changed

+22321
-39903
lines changed

Some content is hidden

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

470 files changed

+22321
-39903
lines changed

.changeset/beige-glasses-hang.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
'gatsby-plugin-orga': major
3+
'@orgajs/rehype-estree': major
4+
'oast-to-hast': major
5+
'@orgajs/reorg-rehype': major
6+
'@orgajs/reorg-parse': major
7+
'@orgajs/estree-jsx': major
8+
'@orgajs/metadata': major
9+
'text-kit': major
10+
'@orgajs/loader': major
11+
'@orgajs/rollup': major
12+
'@orgajs/astro': major
13+
'@orgajs/react': major
14+
'@orgajs/reorg': major
15+
'@orgajs/next': major
16+
'orga': major
17+
'@orgajs/orgx': major
18+
---
19+
20+
# Migrate most of the ecosystem to ESM
21+
22+
We are excited to announce that we have migrated most of our ecosystem to ESM! This move was necessary as the unified ecosystem had already transitioned to ESM, leaving our orgajs system stuck on an older version if we wanted to stay on commonjs. We understand that this transition may come with some inevitable breaking changes, but we have done our best to make it as gentle as possible.
23+
24+
In the past, ESM support in popular frameworks like webpack, gatsby, and nextjs was problematic, but the JS world has steadily moved forward, and we are now in a much better state. We have put in a lot of effort to bring this project up to speed, and we are happy to say that it's in a pretty good state now.
25+
26+
We acknowledge that there are still some missing features that we will gradually add back over time. However, we feel that the changes are now in a great state to be released to the world. If you want to use the new versions, we recommend checking out the `examples` folder to get started.
27+
28+
We understand that this upgrade path may not be compatible with older versions, and we apologize for any inconvenience this may cause. However, we encourage you to consider starting fresh, as the most important part of your site should always be your content (org-mode files). Thank you for your understanding, and we hope you enjoy the new and improved ecosystem!

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ insert_final_newline = true
99
[vcbuild.bat]
1010
end_of_line = crlf
1111

12-
[*.{js,jsx,ts,tsx,css,json}]
12+
[*.{js,cjs,mjs,jsx,ts,tsx,css,json,astro}]
1313
indent_style = space
1414
indent_size = 2
1515

.eslintrc.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ module.exports = {
33
env: {
44
node: true,
55
browser: true,
6-
jest: true,
6+
es6: true,
77
},
8-
extends: ['eslint:recommended', 'plugin:react/recommended'],
8+
extends: [
9+
'eslint:recommended',
10+
'plugin:react/recommended',
11+
'plugin:import/recommended',
12+
'plugin:import/typescript',
13+
],
914
parserOptions: {
1015
ecmaVersion: 2020,
1116
sourceType: 'module',
@@ -19,12 +24,20 @@ module.exports = {
1924
extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
2025
paths: ['node_modules/', 'node_modules/@types/'],
2126
},
27+
typescript: {
28+
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
29+
project: 'packages/*/tsconfig.json',
30+
},
31+
},
32+
'import/parsers': {
33+
'@typescript-eslint/parser': ['.ts', '.tsx'],
2234
},
2335
},
2436
rules: {
2537
'import/no-extraneous-dependencies': ['warn'],
2638
semi: ['error', 'never'],
2739
'react/react-in-jsx-scope': 'off',
40+
'react/prop-types': 'off',
2841
},
2942
overrides: [
3043
{

.github/workflows/ci.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ jobs:
1616
test:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
- name: Use Node.js
21-
uses: actions/setup-node@v2
21+
uses: actions/setup-node@v3
2222
with:
23-
node-version: 14
23+
node-version: 18.x
24+
- uses: pnpm/action-setup@v2
25+
with:
26+
version: 8.0.0
2427
- name: run unit tests
2528
run: |
26-
yarn install --immutable
27-
yarn build
28-
yarn test
29+
pnpm install
30+
pnpm test

.github/workflows/release.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,43 @@ on:
55
branches:
66
- main
77

8+
env:
9+
CI: true
10+
PNPM_CACHE_FOLDER: .pnpm-store
11+
812
jobs:
913
release:
1014
name: Release
1115
runs-on: ubuntu-latest
1216
steps:
1317
- name: Checkout Repo
14-
uses: actions/checkout@master
18+
uses: actions/checkout@v3
1519
with:
1620
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1721
fetch-depth: 0
1822

19-
- name: Setup Node.js 14.x
20-
uses: actions/setup-node@master
23+
- name: Setup Node.js 18.x
24+
uses: actions/setup-node@v3
2125
with:
22-
node-version: 14.x
26+
node-version: 18.x
2327

24-
- name: Install Dependencies
25-
run: yarn install --immutable
28+
- name: install pnpm
29+
run: npm i pnpm@latest -g
30+
- name: Setup npmrc
31+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
32+
- name: setup pnpm config
33+
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
34+
- name: install dependencies
35+
run: pnpm install
36+
- name: create and publish versions
37+
uses: changesets/action@v1
38+
with:
39+
version: pnpm ci:version
40+
commit: 'chore: update versions'
41+
title: 'chore: update versions'
42+
publish: pnpm ci:publish
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
2645

2746
- name: Create Release Pull Request or Publish to npm
2847
id: changesets
@@ -32,6 +51,4 @@ jobs:
3251
version: yarn version-packages
3352
publish: yarn release
3453
env:
35-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3654
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
37-

.gitignore

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,15 @@ typings/
8989
# next.js build output
9090
.next
9191

92-
lib
93-
dist
9492
.npmrc
95-
*.tsbuildinfo
9693

9794
# private
9895
.archive
9996

100-
# yarn 2
101-
.yarn/*
102-
!.yarn/patches
103-
!.yarn/releases
104-
!.yarn/plugins
105-
!.yarn/sdks
106-
!.yarn/versions
107-
.pnp.*
97+
/.idea
98+
.vscode
99+
100+
# build artifacts
101+
dist
102+
*.tsbuildinfo
103+
packages/rollup/**/*.d.ts

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs lts-hydrogen

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

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

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

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

.yarn/releases/yarn-berry.cjs

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

0 commit comments

Comments
 (0)